From b684b8c597e803d5ad9929eab1d33085a65526c1 Mon Sep 17 00:00:00 2001 From: Bolton Bailey Date: Sun, 26 Jul 2026 20:21:19 -0700 Subject: [PATCH 1/3] agent-driven modulize --- CLAUDE.md | 54 +++- Complexitylib.lean | 22 +- Complexitylib/Asymptotics.lean | 22 +- .../Asymptotics/PolynomialComposition.lean | 6 +- Complexitylib/BooleanAnalysis.lean | 6 +- .../BooleanAnalysis/FourierExpansion.lean | 8 +- .../FourierExpansion/Defs.lean | 20 +- .../FourierExpansion/Internal.lean | 8 +- Complexitylib/Circuits.lean | 110 +++---- Complexitylib/Circuits/AC0.lean | 24 +- Complexitylib/Circuits/AC0/Defs.lean | 6 +- Complexitylib/Circuits/AC0/Iteration.lean | 8 +- .../Circuits/AC0/Iteration/Defs.lean | 16 +- .../Circuits/AC0/Iteration/Internal.lean | 16 +- Complexitylib/Circuits/AC0/NormalForm.lean | 8 +- .../Circuits/AC0/NormalForm/Defs.lean | 8 +- .../Circuits/AC0/NormalForm/Internal.lean | 6 +- Complexitylib/Circuits/AC0/Normalization.lean | 10 +- .../Circuits/AC0/Normalization/Defs.lean | 6 +- .../Circuits/AC0/Normalization/Internal.lean | 10 +- Complexitylib/Circuits/AC0/Parity.lean | 10 +- .../Circuits/AC0/Parity/Internal.lean | 8 +- Complexitylib/Circuits/AC0/Restriction.lean | 8 +- Complexitylib/Circuits/AC0/Switching.lean | 8 +- .../Circuits/AC0/Switching/Collection.lean | 10 +- .../AC0/Switching/Collection/Defs.lean | 6 +- .../AC0/Switching/Collection/Internal.lean | 14 +- .../Circuits/AC0/Switching/Defs.lean | 12 +- .../Circuits/AC0/Switching/Internal.lean | 14 +- .../Circuits/AC0/Switching/Parity.lean | 12 +- .../AC0/Switching/Parity/Internal.lean | 10 +- Complexitylib/Circuits/AndOrNot.lean | 10 +- Complexitylib/Circuits/AndOrNot/Defs.lean | 6 +- Complexitylib/Circuits/Barrington.lean | 10 +- Complexitylib/Circuits/BarringtonBridge.lean | 10 +- .../Circuits/BarringtonCodeGenerator.lean | 8 +- .../BarringtonCodeGenerator/Defs.lean | 10 +- .../BarringtonCodeGenerator/Internal.lean | 12 +- .../Circuits/BarringtonCompiler.lean | 8 +- .../Circuits/BarringtonCompiler/Defs.lean | 10 +- .../Circuits/BarringtonCompiler/Internal.lean | 8 +- .../Circuits/BarringtonConverse.lean | 6 +- .../Circuits/BarringtonConverse/Defs.lean | 8 +- .../Circuits/BarringtonConverse/Internal.lean | 6 +- Complexitylib/Circuits/BarringtonFamily.lean | 8 +- Complexitylib/Circuits/BarringtonLength.lean | 12 +- Complexitylib/Circuits/BarringtonRepr.lean | 16 +- Complexitylib/Circuits/BarringtonS5.lean | 16 +- Complexitylib/Circuits/BarringtonTyped.lean | 8 +- .../Circuits/BarringtonTyped/Defs.lean | 8 +- .../Circuits/BarringtonTyped/Internal.lean | 10 +- Complexitylib/Circuits/Basic.lean | 11 +- Complexitylib/Circuits/BasisHom.lean | 8 +- Complexitylib/Circuits/BasisHom/Defs.lean | 6 +- Complexitylib/Circuits/BasisHom/Internal.lean | 6 +- Complexitylib/Circuits/BitString.lean | 8 +- Complexitylib/Circuits/BranchingProgram.lean | 10 +- .../Circuits/BranchingProgramEncoding.lean | 8 +- .../BranchingProgramEncoding/Defs.lean | 10 +- .../BranchingProgramEncoding/Internal.lean | 10 +- Complexitylib/Circuits/CircuitFormula.lean | 8 +- .../Circuits/CircuitFormula/Defs.lean | 8 +- .../Circuits/CircuitFormula/Family.lean | 10 +- .../Circuits/CircuitFormula/Family/Defs.lean | 10 +- .../CircuitFormula/Family/Internal.lean | 10 +- .../Circuits/CircuitFormula/Internal.lean | 36 ++- Complexitylib/Circuits/Composition.lean | 8 +- Complexitylib/Circuits/Composition/Defs.lean | 6 +- .../Circuits/Composition/Internal.lean | 6 +- Complexitylib/Circuits/DecisionTree.lean | 16 +- .../Circuits/DecisionTree/Block.lean | 8 +- .../Circuits/DecisionTree/Block/Defs.lean | 8 +- .../Circuits/DecisionTree/Block/Internal.lean | 6 +- .../Circuits/DecisionTree/Finite.lean | 8 +- .../Circuits/DecisionTree/Finite/Defs.lean | 10 +- .../DecisionTree/Finite/Internal.lean | 6 +- .../Circuits/DecisionTree/NormalForm.lean | 10 +- .../DecisionTree/NormalForm/Defs.lean | 10 +- .../DecisionTree/NormalForm/Internal.lean | 10 +- Complexitylib/Circuits/DecisionTree/Path.lean | 8 +- .../Circuits/DecisionTree/Path/Defs.lean | 6 +- .../Circuits/DecisionTree/Path/Internal.lean | 8 +- .../Circuits/DecisionTree/Restriction.lean | 8 +- Complexitylib/Circuits/Dependency.lean | 8 +- Complexitylib/Circuits/Dependency/Defs.lean | 10 +- .../Circuits/Dependency/Internal.lean | 6 +- Complexitylib/Circuits/DepthClasses.lean | 8 +- Complexitylib/Circuits/DepthClasses/Defs.lean | 12 +- .../Circuits/DepthClasses/Internal.lean | 12 +- Complexitylib/Circuits/Encoding.lean | 20 +- Complexitylib/Circuits/Encoding/Defs.lean | 6 +- Complexitylib/Circuits/Encoding/Family.lean | 10 +- Complexitylib/Circuits/Encoding/Formula.lean | 6 +- .../Circuits/Encoding/Formula/Batch.lean | 6 +- .../Circuits/Encoding/Formula/Batch/Defs.lean | 6 +- .../Encoding/Formula/Batch/Internal.lean | 8 +- .../Circuits/Encoding/Formula/Defs.lean | 8 +- .../Circuits/Encoding/Formula/Internal.lean | 8 +- .../Circuits/Encoding/Formula/Stream.lean | 8 +- .../Encoding/Formula/Stream/Defs.lean | 6 +- .../Encoding/Formula/Stream/Internal.lean | 8 +- Complexitylib/Circuits/Encoding/Fragment.lean | 6 +- .../Circuits/Encoding/Fragment/Defs.lean | 6 +- Complexitylib/Circuits/Encoding/Internal.lean | 12 +- .../Circuits/Encoding/Internal/Codec.lean | 6 +- .../Circuits/Encoding/Internal/Fragment.lean | 8 +- .../Circuits/Encoding/Internal/Semantics.lean | 10 +- .../Circuits/Encoding/Internal/ToCircuit.lean | 8 +- Complexitylib/Circuits/Encoding/Machine.lean | 16 +- .../Circuits/Encoding/Machine/Core.lean | 10 +- .../Circuits/Encoding/Machine/Core/Defs.lean | 6 +- .../Encoding/Machine/Core/Internal.lean | 36 ++- .../Machine/Core/Internal/Action.lean | 6 +- .../Machine/Core/Internal/Evaluator.lean | 12 +- .../Machine/Core/Internal/Execution.lean | 10 +- .../Core/Internal/Execution/EmptyReject.lean | 8 +- .../Core/Internal/Execution/Family.lean | 10 +- .../Machine/Core/Internal/Execution/Gate.lean | 6 +- .../Core/Internal/Execution/Gate/Attempt.lean | 8 +- .../Core/Internal/Execution/Gate/Loop.lean | 6 +- .../Internal/Execution/Gate/LoopReject.lean | 8 +- .../Core/Internal/Execution/Gate/Reject.lean | 8 +- .../Execution/PositiveLoopReject.lean | 6 +- .../Internal/Execution/PositiveReject.lean | 8 +- .../Encoding/Machine/Core/Internal/Hoare.lean | 8 +- .../Encoding/Machine/Core/Internal/Pure.lean | 6 +- .../Encoding/Machine/Core/Internal/Stage.lean | 8 +- .../Encoding/Machine/Core/Internal/Tape.lean | 6 +- .../Circuits/Encoding/Machine/Defs.lean | 16 +- .../Circuits/Encoding/Machine/GateStream.lean | 8 +- .../Encoding/Machine/GateStream/Defs.lean | 8 +- .../Encoding/Machine/GateStream/Internal.lean | 12 +- .../Encoding/Machine/Internal/FrontEnd.lean | 14 +- .../Circuits/Encoding/Machine/NatCode.lean | 8 +- .../Encoding/Machine/NatCode/Defs.lean | 10 +- .../Encoding/Machine/NatCode/Internal.lean | 20 +- .../Circuits/Encoding/Machine/RawGate.lean | 8 +- .../Encoding/Machine/RawGate/Defs.lean | 6 +- .../Encoding/Machine/RawGate/Internal.lean | 10 +- .../Circuits/Encoding/Threshold.lean | 6 +- .../Circuits/Encoding/Threshold/Defs.lean | 6 +- .../Circuits/Encoding/Threshold/Internal.lean | 8 +- .../Circuits/Encoding/ToCircuit.lean | 6 +- .../Circuits/Encoding/ToCircuit/Defs.lean | 6 +- .../Circuits/Encoding/Validation.lean | 10 +- Complexitylib/Circuits/EssentialInput.lean | 8 +- Complexitylib/Circuits/Family.lean | 8 +- Complexitylib/Circuits/Family/Defs.lean | 8 +- Complexitylib/Circuits/Formula.lean | 12 +- Complexitylib/Circuits/FormulaEncoding.lean | 8 +- .../Circuits/FormulaEncoding/Defs.lean | 8 +- .../Circuits/FormulaEncoding/Internal.lean | 8 +- Complexitylib/Circuits/Hardwiring.lean | 6 +- Complexitylib/Circuits/Internal/AndOrNot.lean | 60 ++-- Complexitylib/Circuits/Internal/Bridge.lean | 8 +- .../Circuits/Internal/CircuitDescriptor.lean | 10 +- .../Internal/CircuitToDescriptor.lean | 8 +- .../Circuits/Internal/LowerBound.lean | 12 +- .../Circuits/Internal/Nondeterminism.lean | 28 +- .../Circuits/Internal/NormalForm.lean | 10 +- Complexitylib/Circuits/Internal/Schnorr.lean | 10 +- .../Circuits/Internal/SchnorrBridge.lean | 8 +- .../Circuits/Internal/ShannonBridge.lean | 6 +- .../Circuits/Internal/ShannonUpper.lean | 129 ++++---- .../Circuits/Internal/Simulation.lean | 66 ++-- Complexitylib/Circuits/Internal/Spira.lean | 10 +- Complexitylib/Circuits/Internal/Valiant.lean | 24 +- Complexitylib/Circuits/KarchmerWigderson.lean | 8 +- .../Circuits/KarchmerWigderson/Defs.lean | 8 +- .../Circuits/KarchmerWigderson/Internal.lean | 6 +- Complexitylib/Circuits/LowerBound.lean | 8 +- Complexitylib/Circuits/Monotone.lean | 8 +- Complexitylib/Circuits/Monotone/Defs.lean | 8 +- Complexitylib/Circuits/Monotone/Internal.lean | 8 +- .../Circuits/MultilinearExtension.lean | 8 +- Complexitylib/Circuits/Nondeterminism.lean | 10 +- .../Circuits/Nondeterminism/Defs.lean | 10 +- Complexitylib/Circuits/NormalForm.lean | 10 +- Complexitylib/Circuits/NormalForm/Defs.lean | 6 +- .../Circuits/NormalForm/Operations.lean | 8 +- .../Circuits/NormalForm/Operations/Defs.lean | 6 +- .../NormalForm/Operations/Internal.lean | 6 +- .../Circuits/NormalForm/Restriction.lean | 8 +- Complexitylib/Circuits/RandomRestriction.lean | 8 +- .../Circuits/RandomRestriction/Defs.lean | 14 +- .../Circuits/RandomRestriction/Internal.lean | 10 +- Complexitylib/Circuits/Restriction.lean | 8 +- Complexitylib/Circuits/Schnorr.lean | 8 +- Complexitylib/Circuits/Shannon.lean | 8 +- Complexitylib/Circuits/Spira.lean | 8 +- Complexitylib/Circuits/Threshold.lean | 8 +- Complexitylib/Circuits/Threshold/Defs.lean | 10 +- .../Circuits/Threshold/Internal.lean | 8 +- Complexitylib/Circuits/Unrolling.lean | 20 +- .../Circuits/Unrolling/Acceptance.lean | 12 +- .../Circuits/Unrolling/Acceptance/Defs.lean | 8 +- .../Unrolling/Acceptance/Hardwiring.lean | 8 +- .../Acceptance/Internal/Evaluation.lean | 10 +- .../Acceptance/Internal/Structure.lean | 14 +- .../Circuits/Unrolling/Amplification.lean | 14 +- .../Unrolling/Amplification/Defs.lean | 12 +- .../Amplification/Internal/Evaluation.lean | 10 +- .../Amplification/Internal/Structure.lean | 12 +- .../Amplification/Internal/Topology.lean | 6 +- Complexitylib/Circuits/Unrolling/Defs.lean | 32 +- .../Unrolling/Internal/Initialization.lean | 10 +- Complexitylib/Circuits/Unrolling/Trace.lean | 14 +- .../Circuits/Unrolling/Trace/Defs.lean | 8 +- .../Unrolling/Trace/Internal/Evaluation.lean | 10 +- .../Unrolling/Trace/Internal/HeadBounds.lean | 8 +- .../Unrolling/Trace/Internal/Structure.lean | 10 +- .../Unrolling/Trace/Internal/Topology.lean | 10 +- .../Circuits/Unrolling/Transition.lean | 10 +- .../Circuits/Unrolling/Transition/Defs.lean | 12 +- .../Unrolling/Transition/Fragment.lean | 16 +- .../Unrolling/Transition/Fragment/Defs.lean | 8 +- .../Fragment/Internal/ArrayEvaluation.lean | 6 +- .../Fragment/Internal/Evaluation.lean | 14 +- .../Transition/Fragment/Internal/Size.lean | 28 +- .../Fragment/Internal/Structure.lean | 10 +- .../Fragment/Internal/Topology.lean | 10 +- .../Transition/Internal/Semantics.lean | 10 +- .../Transition/Internal/Support.lean | 8 +- Complexitylib/Circuits/Valiant.lean | 6 +- Complexitylib/Circuits/XOR.lean | 6 +- Complexitylib/Circuits/XOR/Restriction.lean | 8 +- .../Circuits/XOR/Restriction/Defs.lean | 6 +- .../Circuits/XOR/Restriction/Internal.lean | 8 +- Complexitylib/Classes.lean | 128 ++++---- Complexitylib/Classes/Containments.lean | 18 +- Complexitylib/Classes/DTISP.lean | 12 +- Complexitylib/Classes/EventProb.lean | 26 +- Complexitylib/Classes/Exponential.lean | 6 +- Complexitylib/Classes/FNP.lean | 8 +- Complexitylib/Classes/FNP/Defs.lean | 8 +- Complexitylib/Classes/FNP/Internal.lean | 10 +- Complexitylib/Classes/FiniteCounting.lean | 37 ++- Complexitylib/Classes/Hierarchy.lean | 12 +- Complexitylib/Classes/L.lean | 14 +- Complexitylib/Classes/L/PolynomialTime.lean | 6 +- .../Classes/L/PolynomialTime/Internal.lean | 10 +- Complexitylib/Classes/NP.lean | 8 +- .../Classes/NP/Internal/PairBuildTM.lean | 15 +- .../Classes/NP/Internal/PairSplitTM.lean | 6 +- Complexitylib/Classes/NP/Reduction.lean | 8 +- Complexitylib/Classes/NP/Witness.lean | 8 +- Complexitylib/Classes/Negligible.lean | 6 +- Complexitylib/Classes/P.lean | 22 +- Complexitylib/Classes/P/Composition.lean | 6 +- Complexitylib/Classes/P/Defs.lean | 8 +- Complexitylib/Classes/P/FinsetDomain.lean | 6 +- .../Classes/P/FinsetDomain/Internal.lean | 20 +- Complexitylib/Classes/P/Internal.lean | 12 +- .../Classes/P/Internal/Composition.lean | 10 +- .../Classes/P/Internal/NormalForm.lean | 6 +- .../Classes/P/Internal/Preimage.lean | 8 +- Complexitylib/Classes/P/NormalForm.lean | 6 +- Complexitylib/Classes/P/PairWithInput.lean | 6 +- .../Classes/P/PairWithInput/Internal.lean | 8 +- Complexitylib/Classes/P/Preimage.lean | 6 +- Complexitylib/Classes/P/UnaryLength.lean | 6 +- .../Classes/P/UnaryLength/Internal.lean | 8 +- Complexitylib/Classes/PPoly.lean | 8 +- Complexitylib/Classes/PPoly/Advice.lean | 10 +- Complexitylib/Classes/PPoly/Advice/Defs.lean | 12 +- .../Classes/PPoly/Advice/Internal.lean | 10 +- .../Classes/PPoly/Advice/Reverse.lean | 8 +- .../Classes/PPoly/Advice/Reverse/Defs.lean | 8 +- .../PPoly/Advice/Reverse/Internal.lean | 10 +- Complexitylib/Classes/PPoly/Defs.lean | 10 +- Complexitylib/Classes/PPoly/Uniform.lean | 10 +- .../Classes/PPoly/Uniform/Containment.lean | 6 +- .../PPoly/Uniform/Containment/Internal.lean | 14 +- .../Classes/PPoly/Uniform/Preprocessing.lean | 8 +- .../PPoly/Uniform/Preprocessing/Defs.lean | 6 +- .../PPoly/Uniform/Preprocessing/Internal.lean | 14 +- .../Classes/PPoly/Uniform/Unrolling.lean | 8 +- .../PPoly/Uniform/Unrolling/Containment.lean | 6 +- .../Unrolling/Containment/Internal.lean | 14 +- .../Classes/PPoly/Uniform/Unrolling/Defs.lean | 8 +- .../Unrolling/Generator/Finalization.lean | 8 +- .../Generator/Finalization/Defs.lean | 8 +- .../Generator/Finalization/Internal.lean | 14 +- .../Unrolling/Generator/Initialization.lean | 8 +- .../Generator/Initialization/Defs.lean | 8 +- .../Generator/Initialization/Internal.lean | 23 +- .../Uniform/Unrolling/Generator/Offset.lean | 8 +- .../Unrolling/Generator/Offset/Defs.lean | 6 +- .../Unrolling/Generator/Offset/Internal.lean | 12 +- .../Unrolling/Generator/PolynomialOffset.lean | 8 +- .../Generator/PolynomialOffset/Defs.lean | 8 +- .../Generator/PolynomialOffset/Internal.lean | 8 +- .../Unrolling/Generator/Primitive.lean | 8 +- .../Unrolling/Generator/Primitive/Defs.lean | 8 +- .../Generator/Primitive/Internal.lean | 12 +- .../Uniform/Unrolling/Generator/Program.lean | 8 +- .../Unrolling/Generator/Program/Defs.lean | 12 +- .../Unrolling/Generator/Program/Internal.lean | 16 +- .../Uniform/Unrolling/Generator/Tableau.lean | 8 +- .../Unrolling/Generator/Tableau/Defs.lean | 12 +- .../Unrolling/Generator/Tableau/Internal.lean | 72 +++-- .../Unrolling/Generator/Transition/Case.lean | 8 +- .../Generator/Transition/Case/Defs.lean | 12 +- .../Generator/Transition/Case/Internal.lean | 21 +- .../Generator/Transition/Effect.lean | 8 +- .../Generator/Transition/Effect/Defs.lean | 8 +- .../Generator/Transition/Effect/Internal.lean | 78 ++--- .../Generator/Transition/MovedHead.lean | 8 +- .../Generator/Transition/MovedHead/Defs.lean | 12 +- .../Transition/MovedHead/Internal.lean | 54 ++-- .../Unrolling/Generator/Transition/Next.lean | 8 +- .../Generator/Transition/Next/Defs.lean | 10 +- .../Generator/Transition/Next/Internal.lean | 67 ++-- .../Generator/Transition/PackedCopy.lean | 8 +- .../Generator/Transition/PackedCopy/Defs.lean | 6 +- .../Transition/PackedCopy/Internal.lean | 8 +- .../Generator/Transition/Predecessor.lean | 8 +- .../Transition/Predecessor/Defs.lean | 12 +- .../Transition/Predecessor/Internal.lean | 20 +- .../Unrolling/Generator/Transition/Read.lean | 8 +- .../Generator/Transition/Read/Defs.lean | 8 +- .../Generator/Transition/Read/Internal.lean | 18 +- .../Unrolling/Generator/Transition/Step.lean | 8 +- .../Generator/Transition/Step/Defs.lean | 10 +- .../Generator/Transition/Step/Internal.lean | 30 +- .../Transition/Step/Internal/Effect.lean | 16 +- .../Transition/Step/Internal/Emitted.lean | 85 ++--- .../Step/Internal/FormulaSpace.lean | 6 +- .../Transition/Step/Internal/Packed.lean | 6 +- .../Transition/Step/Internal/Requires.lean | 14 +- .../Transition/Step/Internal/Sound.lean | 16 +- .../Transition/Step/Internal/Space.lean | 8 +- .../Step/Internal/Space/Common.lean | 8 +- .../Step/Internal/Space/Packed.lean | 8 +- .../Transition/Step/Internal/Top.lean | 6 +- .../Generator/Transition/WrittenCell.lean | 8 +- .../Transition/WrittenCell/Defs.lean | 8 +- .../Transition/WrittenCell/Internal.lean | 22 +- .../PPoly/Uniform/Unrolling/Internal.lean | 10 +- .../PPoly/Uniform/Unrolling/Padded.lean | 8 +- .../PPoly/Uniform/Unrolling/Padded/Defs.lean | 6 +- .../Uniform/Unrolling/Padded/Internal.lean | 8 +- .../PPoly/Uniform/Unrolling/Serializer.lean | 8 +- .../Uniform/Unrolling/Serializer/Bounds.lean | 8 +- .../Unrolling/Serializer/Bounds/Defs.lean | 8 +- .../Unrolling/Serializer/Bounds/Internal.lean | 6 +- .../Uniform/Unrolling/Serializer/Defs.lean | 6 +- .../Unrolling/Serializer/Finalization.lean | 8 +- .../Serializer/Finalization/Defs.lean | 10 +- .../Serializer/Finalization/Internal.lean | 12 +- .../Unrolling/Serializer/Initialization.lean | 8 +- .../Serializer/Initialization/Defs.lean | 8 +- .../Serializer/Initialization/Internal.lean | 10 +- .../Unrolling/Serializer/Internal.lean | 8 +- .../Unrolling/Serializer/Transition.lean | 8 +- .../Serializer/Transition/Atomic.lean | 8 +- .../Serializer/Transition/Atomic/Defs.lean | 6 +- .../Transition/Atomic/Internal.lean | 10 +- .../Unrolling/Serializer/Transition/Case.lean | 8 +- .../Serializer/Transition/Case/Defs.lean | 6 +- .../Serializer/Transition/Case/Internal.lean | 10 +- .../Unrolling/Serializer/Transition/Defs.lean | 6 +- .../Serializer/Transition/Effect.lean | 8 +- .../Serializer/Transition/Effect/Defs.lean | 6 +- .../Transition/Effect/Internal.lean | 10 +- .../Serializer/Transition/Internal.lean | 12 +- .../Serializer/Transition/MovedHead.lean | 8 +- .../Serializer/Transition/MovedHead/Defs.lean | 6 +- .../Transition/MovedHead/Internal.lean | 10 +- .../Unrolling/Serializer/Transition/Next.lean | 8 +- .../Serializer/Transition/Next/Defs.lean | 12 +- .../Serializer/Transition/Next/Internal.lean | 16 +- .../Serializer/Transition/Polynomial.lean | 8 +- .../Transition/Polynomial/Defs.lean | 8 +- .../Transition/Polynomial/Internal.lean | 8 +- .../Unrolling/Serializer/Transition/Step.lean | 8 +- .../Serializer/Transition/Step/Defs.lean | 6 +- .../Serializer/Transition/Step/Internal.lean | 12 +- .../Serializer/Transition/WrittenCell.lean | 8 +- .../Transition/WrittenCell/Defs.lean | 8 +- .../Transition/WrittenCell/Internal.lean | 14 +- .../PPoly/Uniform/Unrolling/Stream.lean | 8 +- .../PPoly/Uniform/Unrolling/Stream/Defs.lean | 6 +- .../Uniform/Unrolling/Stream/Internal.lean | 8 +- Complexitylib/Classes/PPoly/Unrolling.lean | 8 +- .../Classes/PPoly/Unrolling/Defs.lean | 8 +- .../Classes/PPoly/Unrolling/Internal.lean | 12 +- Complexitylib/Classes/Pairing.lean | 10 +- Complexitylib/Classes/PropertyDensity.lean | 14 +- Complexitylib/Classes/Randomized.lean | 10 +- .../Randomized/CircuitAmplification.lean | 10 +- .../Classes/Randomized/GoodSeed.lean | 10 +- Complexitylib/Classes/Randomized/PPoly.lean | 10 +- .../Classes/Randomized/PPoly/Defs.lean | 10 +- .../Classes/Randomized/PPoly/Internal.lean | 8 +- Complexitylib/Classes/SharpP.lean | 10 +- Complexitylib/Classes/Space.lean | 8 +- Complexitylib/Classes/Time.lean | 8 +- Complexitylib/DescriptiveComplexity.lean | 30 +- .../DescriptiveComplexity/Definable.lean | 12 +- .../DescriptiveComplexity/Encoding.lean | 16 +- Complexitylib/DescriptiveComplexity/Env.lean | 6 +- .../DescriptiveComplexity/Examples.lean | 10 +- .../DescriptiveComplexity/FirstOrder.lean | 12 +- .../FirstOrder/Isomorphism.lean | 8 +- .../FirstOrder/Semantics.lean | 10 +- .../FirstOrder/Substitution.lean | 6 +- .../FirstOrder/Syntax.lean | 6 +- .../DescriptiveComplexity/Isomorphism.lean | 6 +- .../DescriptiveComplexity/Language.lean | 10 +- .../DescriptiveComplexity/ModelChecking.lean | 12 +- .../DescriptiveComplexity/Query.lean | 6 +- .../DescriptiveComplexity/Reduction.lean | 8 +- .../DescriptiveComplexity/SecondOrder.lean | 10 +- .../SecondOrder/Isomorphism.lean | 8 +- .../SecondOrder/Semantics.lean | 12 +- .../SecondOrder/Syntax.lean | 6 +- .../DescriptiveComplexity/Structure.lean | 6 +- .../DescriptiveComplexity/Vocabulary.lean | 3 +- Complexitylib/Encoding/Pairing.lean | 10 +- Complexitylib/Languages.lean | 26 +- Complexitylib/Languages/AllSymbol.lean | 12 +- Complexitylib/Languages/AnBn.lean | 10 +- Complexitylib/Languages/Balanced.lean | 10 +- Complexitylib/Languages/Contains.lean | 10 +- Complexitylib/Languages/FirstCell.lean | 10 +- Complexitylib/Languages/LastBit.lean | 10 +- Complexitylib/Languages/LengthDivBy.lean | 12 +- Complexitylib/Languages/LengthParity.lean | 10 +- Complexitylib/Languages/Palindromes.lean | 10 +- Complexitylib/Languages/Trivial.lean | 10 +- Complexitylib/Languages/ZeroPrefix.lean | 10 +- Complexitylib/Mathlib/Digraph.lean | 10 +- Complexitylib/Mathlib/FinsetPrefixes.lean | 8 +- Complexitylib/Mathlib/NatBits.lean | 12 +- Complexitylib/Models.lean | 134 ++++---- Complexitylib/Models/RandomAccessMachine.lean | 114 +++---- .../Models/RandomAccessMachine/Classes.lean | 6 +- .../RandomAccessMachine/Classes/Defs.lean | 8 +- .../Models/RandomAccessMachine/Defs.lean | 10 +- .../Models/RandomAccessMachine/Internal.lean | 7 +- .../Simulation/RegisterStore.lean | 8 +- .../Simulation/RegisterStore/Containment.lean | 8 +- .../RegisterStore/Containment/Defs.lean | 10 +- .../RegisterStore/Containment/Internal.lean | 18 +- .../Simulation/RegisterStore/Defs.lean | 10 +- .../RegisterStore/DenseOverlay.lean | 6 +- .../RegisterStore/DenseOverlay/Defs.lean | 6 +- .../RegisterStore/DenseOverlay/Internal.lean | 8 +- .../Simulation/RegisterStore/Internal.lean | 8 +- .../RegisterStore/Machine/AddressEq.lean | 10 +- .../RegisterStore/Machine/AddressEq/Defs.lean | 6 +- .../Machine/AddressEq/Internal.lean | 14 +- .../Machine/DenseInputLookup.lean | 6 +- .../Machine/DenseInputLookup/Defs.lean | 16 +- .../Machine/DenseInputLookup/Internal.lean | 24 +- .../RegisterStore/Machine/EntryAppend.lean | 10 +- .../Machine/EntryAppend/Defs.lean | 6 +- .../Machine/EntryAppend/Internal.lean | 12 +- .../RegisterStore/Machine/EntryCleanup.lean | 10 +- .../Machine/EntryCleanup/Defs.lean | 10 +- .../Machine/EntryCleanup/Internal.lean | 12 +- .../RegisterStore/Machine/EntryDecode.lean | 10 +- .../Machine/EntryDecode/Defs.lean | 8 +- .../Machine/EntryDecode/Internal.lean | 12 +- .../Machine/EntryDecode/LinearInternal.lean | 12 +- .../RegisterStore/Machine/EntryEncode.lean | 12 +- .../Machine/EntryEncode/Defs.lean | 6 +- .../Machine/EntryEncode/Internal.lean | 10 +- .../RegisterStore/Machine/EntryLookup.lean | 10 +- .../Machine/EntryLookup/Defs.lean | 6 +- .../Machine/EntryLookup/Internal.lean | 10 +- .../Machine/EntryLookupRestore.lean | 10 +- .../RegisterStore/Machine/EntryMatch.lean | 10 +- .../Machine/EntryMatch/Defs.lean | 10 +- .../Machine/EntryMatch/Internal.lean | 14 +- .../RegisterStore/Machine/EntryMissCopy.lean | 10 +- .../Machine/EntryMissCopy/Defs.lean | 8 +- .../Machine/EntryMissCopy/Internal.lean | 10 +- .../RegisterStore/Machine/EntryReplace.lean | 10 +- .../Machine/EntryReplace/Defs.lean | 10 +- .../Machine/EntryReplace/Internal.lean | 12 +- .../RegisterStore/Machine/EntryScan.lean | 12 +- .../RegisterStore/Machine/EntryScan/Defs.lean | 8 +- .../Machine/EntryScan/Internal/Bounds.lean | 14 +- .../Machine/EntryScan/Internal/Ctrl.lean | 8 +- .../Machine/EntryScan/Internal/Inv.lean | 12 +- .../Machine/EntryScan/Internal/Sem.lean | 12 +- .../RegisterStore/Machine/EntryScanStep.lean | 10 +- .../Machine/EntryScanStep/Defs.lean | 8 +- .../Machine/EntryScanStep/Internal.lean | 10 +- .../RegisterStore/Machine/EntryUpdate.lean | 18 +- .../Machine/EntryUpdate/BoundsInternal.lean | 14 +- .../Machine/EntryUpdate/Defs.lean | 12 +- .../Machine/EntryUpdate/Internal/Ctrl.lean | 8 +- .../Machine/EntryUpdate/Internal/End.lean | 12 +- .../Machine/EntryUpdate/Internal/Hit.lean | 22 +- .../Machine/EntryUpdate/Internal/Inv.lean | 12 +- .../Machine/EntryUpdate/Internal/Loop.lean | 8 +- .../Machine/EntryUpdate/Internal/Miss.lean | 20 +- .../Machine/EntryUpdate/Internal/Out.lean | 16 +- .../Machine/EntryUpdate/Internal/Sem.lean | 8 +- .../Machine/EntryUpdate/Internal/Step.lean | 8 +- .../Machine/EntryUpdate/Internal/Time.lean | 16 +- .../Machine/EntryUpdate/Progress.lean | 6 +- .../Machine/EntryUpdate/Source.lean | 12 +- .../Machine/EntryUpdate/Tagged.lean | 6 +- .../Machine/EntryUpdate/TaggedDefs.lean | 10 +- .../Machine/EntryUpdate/TaggedProof.lean | 10 +- .../RegisterStore/Machine/Instruction.lean | 20 +- .../Machine/Instruction/Control.lean | 16 +- .../Machine/Instruction/Defs.lean | 30 +- .../Machine/Instruction/Dense.lean | 14 +- .../Machine/Instruction/DenseControl.lean | 8 +- .../Machine/Instruction/DenseCtrlSim.lean | 10 +- .../Machine/Instruction/DenseDefs.lean | 8 +- .../Machine/Instruction/DenseDirect.lean | 10 +- .../Machine/Instruction/DenseDispatch.lean | 18 +- .../Machine/Instruction/DenseImm.lean | 10 +- .../Machine/Instruction/DenseLoad.lean | 10 +- .../Machine/Instruction/DenseSim.lean | 8 +- .../Machine/Instruction/DenseSimData.lean | 12 +- .../Machine/Instruction/DenseSimDefs.lean | 8 +- .../Machine/Instruction/DenseStore.lean | 8 +- .../Machine/Instruction/Direct.lean | 10 +- .../Machine/Instruction/Dispatch.lean | 22 +- .../Machine/Instruction/Immediate.lean | 8 +- .../Machine/Instruction/Internal.lean | 14 +- .../Machine/Instruction/Load.lean | 10 +- .../Machine/Instruction/Sim/Control.lean | 10 +- .../Machine/Instruction/Sim/Data.lean | 12 +- .../Machine/Instruction/Sim/Defs.lean | 18 +- .../Machine/Instruction/Sim/Internal.lean | 22 +- .../Machine/Instruction/Store.lean | 8 +- .../RegisterStore/Machine/Lookup/Defs.lean | 20 +- .../Machine/Lookup/DenseInternal.lean | 10 +- .../Machine/Lookup/Internal/Assemble.lean | 8 +- .../Machine/Lookup/Internal/Bounds.lean | 6 +- .../Machine/Lookup/Internal/Prepare.lean | 8 +- .../Machine/Lookup/Internal/Reset.lean | 10 +- .../Machine/Lookup/Internal/Restore.lean | 8 +- .../Machine/Lookup/Internal/Scan.lean | 8 +- .../Machine/Lookup/Internal/Static.lean | 10 +- .../Machine/Lookup/Internal/Value.lean | 8 +- .../RegisterStore/Machine/Program.lean | 8 +- .../RegisterStore/Machine/Program/Bounds.lean | 8 +- .../Machine/Program/Bounds/Defs.lean | 6 +- .../Machine/Program/Bounds/Internal.lean | 12 +- .../Machine/Program/Decision.lean | 8 +- .../Machine/Program/Decision/Defs.lean | 6 +- .../Machine/Program/DecisionInternal.lean | 8 +- .../RegisterStore/Machine/Program/Defs.lean | 14 +- .../RegisterStore/Machine/Program/Dense.lean | 8 +- .../Machine/Program/DenseBounds.lean | 8 +- .../Machine/Program/DenseBoundsDefs.lean | 8 +- .../Machine/Program/DenseBoundsProof.lean | 18 +- .../Machine/Program/DenseDecision.lean | 8 +- .../Machine/Program/DenseDecisionDefs.lean | 8 +- .../Machine/Program/DenseDecisionProof.lean | 10 +- .../Machine/Program/DenseDefs.lean | 8 +- .../Machine/Program/DenseInit.lean | 8 +- .../Machine/Program/DenseInitDefs.lean | 8 +- .../Machine/Program/DenseInitProof.lean | 10 +- .../Machine/Program/DenseInternal.lean | 8 +- .../Machine/Program/Init/Defs.lean | 20 +- .../Machine/Program/Init/Internal.lean | 30 +- .../Machine/Program/Initialization.lean | 8 +- .../Machine/Program/Internal.lean | 16 +- .../RegisterStore/Machine/WordDecode.lean | 14 +- .../Machine/WordDecode/Defs.lean | 10 +- .../Machine/WordDecode/Internal.lean | 16 +- .../Machine/WordDecode/LinearInternal.lean | 10 +- .../RegisterStore/Machine/WordEncode.lean | 10 +- .../Machine/WordEncode/Defs.lean | 14 +- .../Machine/WordEncode/Internal.lean | 12 +- .../Simulation/TMConfig.lean | 8 +- .../Simulation/TMConfig/Defs.lean | 10 +- .../Simulation/TMConfig/Internal.lean | 6 +- .../Simulation/TMConfig/Sparse.lean | 8 +- .../Simulation/TMConfig/Sparse/ABI.lean | 8 +- .../Simulation/TMConfig/Sparse/ABI/Defs.lean | 6 +- .../TMConfig/Sparse/ABI/Internal/Capture.lean | 8 +- .../Sparse/ABI/Internal/Decision.lean | 10 +- .../TMConfig/Sparse/ABI/Internal/Loop.lean | 8 +- .../TMConfig/Sparse/ABI/Internal/Marshal.lean | 8 +- .../Sparse/ABI/Internal/Resources.lean | 8 +- .../TMConfig/Sparse/Containment.lean | 6 +- .../TMConfig/Sparse/Containment/Internal.lean | 14 +- .../Simulation/TMConfig/Sparse/Defs.lean | 8 +- .../Simulation/TMConfig/Sparse/Internal.lean | 8 +- .../Simulation/TMConfig/Sparse/Step.lean | 12 +- .../Simulation/TMConfig/Sparse/Step/Defs.lean | 8 +- .../TMConfig/Sparse/Step/Internal.lean | 16 +- .../TMConfig/Sparse/Step/Internal/Action.lean | 18 +- .../Sparse/Step/Internal/Dispatch.lean | 24 +- .../Sparse/Step/Internal/Iteration.lean | 6 +- .../TMConfig/Sparse/Step/Internal/Layout.lean | 8 +- .../TMConfig/Sparse/Step/Internal/Load.lean | 6 +- .../Sparse/Step/Internal/Resources.lean | 8 +- .../Simulation/TMConfig/Step.lean | 10 +- .../Simulation/TMConfig/Step/Defs.lean | 8 +- .../Simulation/TMConfig/Step/Internal.lean | 14 +- .../TMConfig/Step/Internal/Action.lean | 16 +- .../TMConfig/Step/Internal/Dispatch.lean | 8 +- .../TMConfig/Step/Internal/Layout.lean | 8 +- .../TMConfig/Step/Internal/Load.lean | 8 +- .../TMConfig/Step/Internal/Resources.lean | 21 +- .../Models/RandomAccessMachine/Soundness.lean | 6 +- .../RandomAccessMachine/Structured.lean | 10 +- .../RandomAccessMachine/Structured/Defs.lean | 6 +- .../Structured/GateEval.lean | 10 +- .../Structured/GateEval/Defs.lean | 8 +- .../Structured/GateEval/Internal.lean | 174 ++++++----- .../Structured/GateStep.lean | 8 +- .../Structured/GateStep/Defs.lean | 8 +- .../Structured/GateStep/Internal.lean | 14 +- .../Structured/GateStreamStep.lean | 8 +- .../Structured/GateStreamStep/Defs.lean | 8 +- .../Structured/GateStreamStep/Internal.lean | 105 ++++--- .../Structured/Hamming.lean | 10 +- .../Structured/Hamming/Defs.lean | 6 +- .../Structured/Hamming/Internal.lean | 10 +- .../Structured/Internal.lean | 8 +- .../Structured/Internal/Resources.lean | 8 +- .../Structured/LastBit.lean | 10 +- .../Structured/LastBit/Defs.lean | 8 +- .../Structured/PairValidate.lean | 12 +- .../Structured/PairValidate/Defs.lean | 8 +- .../Structured/PairValidate/Internal.lean | 8 +- .../Structured/Scanner.lean | 10 +- .../Structured/Scanner/Defs.lean | 8 +- .../Structured/Scanner/Internal.lean | 10 +- .../Structured/Switch.lean | 8 +- .../Structured/Switch/Compiled.lean | 6 +- .../Structured/Switch/Defs.lean | 6 +- .../Structured/Switch/Internal.lean | 8 +- .../Structured/ThreeSATSyntax.lean | 8 +- .../Structured/ThreeSATSyntax/Defs.lean | 8 +- .../Structured/UnaryDecode.lean | 10 +- .../Structured/UnaryDecode/Defs.lean | 8 +- .../Structured/UnaryDecode/Internal.lean | 10 +- Complexitylib/Models/TuringMachine.lean | 10 +- .../Models/TuringMachine/Combinators.lean | 8 +- .../Combinators/ForBinaryWork.lean | 8 +- .../Combinators/ForBinaryWork/Defs.lean | 6 +- .../Combinators/ForBinaryWork/Internal.lean | 12 +- .../TuringMachine/Combinators/ForInput.lean | 8 +- .../Combinators/ForInput/Defs.lean | 6 +- .../Combinators/ForInput/Internal.lean | 12 +- .../Combinators/ForWorkOnes.lean | 8 +- .../Combinators/ForWorkOnes/Defs.lean | 6 +- .../Combinators/ForWorkOnes/Internal.lean | 10 +- .../TuringMachine/Combinators/Internal.lean | 20 +- .../Combinators/Internal/Complement.lean | 10 +- .../Combinators/Internal/Generic.lean | 6 +- .../Combinators/Internal/If.lean | 8 +- .../Combinators/Internal/Loop.lean | 8 +- .../Combinators/Internal/Retarget.lean | 16 +- .../Combinators/Internal/Scanner.lean | 8 +- .../Combinators/Internal/Seq.lean | 8 +- .../Combinators/Internal/Union.lean | 10 +- .../Combinators/RetargetCompute.lean | 8 +- .../Combinators/RetargetCompute/Defs.lean | 6 +- .../Combinators/RetargetCompute/Internal.lean | 12 +- .../TuringMachine/Combinators/WorkBranch.lean | 8 +- .../Combinators/WorkBranch/Defs.lean | 6 +- .../Combinators/WorkBranch/Internal.lean | 16 +- .../Combinators/WorkSymbolBranch.lean | 10 +- .../Combinators/WorkSymbolBranch/Defs.lean | 6 +- .../WorkSymbolBranch/Internal.lean | 8 +- .../Models/TuringMachine/Composition.lean | 8 +- .../TuringMachine/Composition/Defs.lean | 12 +- .../TuringMachine/Composition/Internal.lean | 10 +- .../Composition/Internal/FirstPhase.lean | 10 +- .../Composition/Internal/Tail.lean | 16 +- .../Composition/PairWithInput.lean | 8 +- .../Composition/PairWithInput/Defs.lean | 8 +- .../Composition/PairWithInput/Internal.lean | 18 +- .../Models/TuringMachine/Deterministic.lean | 8 +- .../Experimental/BinaryRoutine.lean | 8 +- .../BinaryRoutine/Arithmetic.lean | 8 +- .../BinaryRoutine/Arithmetic/Defs.lean | 20 +- .../BinaryRoutine/Arithmetic/Internal.lean | 22 +- .../Experimental/BinaryRoutine/Control.lean | 8 +- .../BinaryRoutine/Control/Defs.lean | 10 +- .../BinaryRoutine/Control/Internal.lean | 18 +- .../Experimental/BinaryRoutine/Defs.lean | 16 +- .../BinaryRoutine/InputLength.lean | 8 +- .../BinaryRoutine/InputLength/Defs.lean | 8 +- .../BinaryRoutine/InputLength/Internal.lean | 12 +- .../Experimental/BinaryRoutine/Internal.lean | 16 +- .../Experimental/BinaryRoutine/List.lean | 8 +- .../Experimental/BinaryRoutine/List/Defs.lean | 6 +- .../BinaryRoutine/List/Internal.lean | 8 +- .../BinaryRoutine/SpaceBounds.lean | 8 +- .../BinaryRoutine/SpaceBounds/Defs.lean | 10 +- .../BinaryRoutine/SpaceBounds/Internal.lean | 12 +- .../TuringMachine/Experimental/EmitSpec.lean | 6 +- .../TuringMachine/Experimental/Routine.lean | 8 +- .../Experimental/Routine/Defs.lean | 6 +- .../Experimental/Routine/Internal.lean | 10 +- Complexitylib/Models/TuringMachine/Hoare.lean | 14 +- .../Models/TuringMachine/Hoare/Defs.lean | 8 +- .../TuringMachine/Hoare/RetargetOutput.lean | 8 +- .../Models/TuringMachine/Hoare/Space.lean | 8 +- .../TuringMachine/Hoare/Space/Defs.lean | 6 +- .../TuringMachine/Hoare/Space/Internal.lean | 10 +- .../Models/TuringMachine/Internal.lean | 8 +- .../TuringMachine/Internal/OutputBounds.lean | 6 +- Complexitylib/Models/TuringMachine/Lift.lean | 6 +- .../Models/TuringMachine/OutputBounds.lean | 6 +- .../Models/TuringMachine/Placement.lean | 8 +- .../Models/TuringMachine/Placement/Defs.lean | 6 +- .../TuringMachine/Placement/Internal.lean | 8 +- .../Models/TuringMachine/Registers.lean | 6 +- .../Models/TuringMachine/Registers/Arith.lean | 6 +- .../TuringMachine/Registers/DecReg.lean | 6 +- .../Models/TuringMachine/Registers/Emit.lean | 10 +- .../TuringMachine/Registers/EmitSeq.lean | 6 +- .../TuringMachine/Registers/ForReg.lean | 6 +- .../TuringMachine/Registers/Horner.lean | 10 +- .../TuringMachine/Registers/InputLen.lean | 6 +- .../TuringMachine/Registers/MixedRadix.lean | 6 +- .../Models/TuringMachine/Registers/Probe.lean | 51 +-- .../TuringMachine/Registers/RegisterOps.lean | 6 +- .../Models/TuringMachine/Repetition.lean | 6 +- .../TuringMachine/Repetition/Correctness.lean | 8 +- .../Models/TuringMachine/Repetition/Defs.lean | 10 +- .../TuringMachine/Repetition/Internal.lean | 10 +- .../Repetition/Internal/Boundary.lean | 6 +- .../Repetition/Internal/Correctness.lean | 8 +- .../Repetition/Internal/Finish.lean | 6 +- .../Repetition/Internal/Frame.lean | 6 +- .../Repetition/Internal/Parked.lean | 8 +- .../Repetition/Internal/Rewind.lean | 6 +- .../Repetition/Internal/Schedule.lean | 12 +- .../Internal/ScheduleArithmetic.lean | 6 +- .../Repetition/Internal/Setup.lean | 8 +- .../Repetition/Internal/Trial.lean | 6 +- .../Repetition/Internal/VoteStep.lean | 10 +- .../Repetition/Internal/Votes.lean | 6 +- .../TuringMachine/Repetition/Validation.lean | 6 +- .../Models/TuringMachine/SingleTape.lean | 18 +- .../TuringMachine/SingleTape/Internal.lean | 6 +- .../SingleTape/Internal/Correctness.lean | 10 +- .../SingleTape/Internal/Delta.lean | 8 +- .../SingleTape/Internal/Pad.lean | 6 +- .../SingleTape/Internal/Sim.lean | 14 +- .../TuringMachine/SingleTape/Validation.lean | 7 +- .../Models/TuringMachine/SpaceTime.lean | 8 +- .../Models/TuringMachine/SpaceTime/Defs.lean | 8 +- .../SpaceTime/Internal/Observation.lean | 6 +- .../SpaceTime/Internal/OutputFrontier.lean | 6 +- .../SpaceTime/Internal/Reachability.lean | 6 +- .../SpaceTime/Internal/RunBound.lean | 8 +- .../SpaceTime/Internal/Snapshot.lean | 10 +- .../Models/TuringMachine/Subroutines.lean | 6 +- .../TuringMachine/Subroutines/BinaryAdd.lean | 8 +- .../Subroutines/BinaryAdd/Defs.lean | 8 +- .../Subroutines/BinaryAdd/Internal.lean | 25 +- .../Subroutines/BinaryAddConst.lean | 8 +- .../Subroutines/BinaryAddConst/Defs.lean | 8 +- .../Subroutines/BinaryAddConst/Internal.lean | 18 +- .../TuringMachine/Subroutines/BinaryCopy.lean | 8 +- .../Subroutines/BinaryCopy/Defs.lean | 8 +- .../Subroutines/BinaryCopy/Internal.lean | 34 +- .../TuringMachine/Subroutines/BinaryEq.lean | 10 +- .../Subroutines/BinaryEq/Defs.lean | 8 +- .../Subroutines/BinaryEq/Internal.lean | 8 +- .../TuringMachine/Subroutines/BinaryFor.lean | 8 +- .../Subroutines/BinaryFor/Defs.lean | 6 +- .../Subroutines/BinaryFor/Internal.lean | 8 +- .../BinaryFor/Internal/Comparison.lean | 8 +- .../BinaryFor/Internal/Control.lean | 8 +- .../Subroutines/BinaryFor/Internal/Loop.lean | 12 +- .../Subroutines/BinaryLength.lean | 10 +- .../Subroutines/BinaryLength/Defs.lean | 8 +- .../Subroutines/BinaryLength/Internal.lean | 33 +- .../Subroutines/BinaryMulAdd.lean | 8 +- .../Subroutines/BinaryMulAdd/Defs.lean | 6 +- .../Subroutines/BinaryMulAdd/Internal.lean | 126 ++++---- .../Subroutines/BinaryPolynomial.lean | 8 +- .../Subroutines/BinaryPolynomial/Defs.lean | 12 +- .../BinaryPolynomial/Internal.lean | 79 ++--- .../TuringMachine/Subroutines/BinaryPred.lean | 8 +- .../Subroutines/BinaryPred/Defs.lean | 10 +- .../Subroutines/BinaryPred/Internal.lean | 12 +- .../Subroutines/BinaryRippleAdd.lean | 8 +- .../Subroutines/BinaryRippleAdd/Defs.lean | 8 +- .../Subroutines/BinaryRippleAdd/Internal.lean | 16 +- .../BinaryRippleAdd/Internal/Bounds.lean | 6 +- .../BinaryRippleAdd/Internal/Out.lean | 8 +- .../BinaryRippleAdd/Internal/Pure.lean | 6 +- .../BinaryRippleAdd/Internal/Rewind.lean | 11 +- .../BinaryRippleAdd/Internal/Scan.lean | 12 +- .../BinaryRippleAdd/Internal/Sem.lean | 19 +- .../Subroutines/BinaryRippleSub.lean | 10 +- .../Subroutines/BinaryRippleSub/Defs.lean | 10 +- .../BinaryRippleSub/Internal/Backward.lean | 8 +- .../BinaryRippleSub/Internal/Out.lean | 8 +- .../BinaryRippleSub/Internal/Pure.lean | 11 +- .../BinaryRippleSub/Internal/Rewind.lean | 11 +- .../BinaryRippleSub/Internal/Scan.lean | 10 +- .../BinaryRippleSub/Internal/Sem.lean | 20 +- .../Subroutines/BinaryShiftMul.lean | 12 +- .../Subroutines/BinaryShiftMul/Defs.lean | 14 +- .../BinaryShiftMul/Internal/Out.lean | 16 +- .../BinaryShiftMul/Internal/Pure.lean | 6 +- .../BinaryShiftMul/Internal/Sem.lean | 160 ++++++---- .../TuringMachine/Subroutines/BinarySucc.lean | 8 +- .../Subroutines/BinarySucc/Defs.lean | 10 +- .../Subroutines/BinarySucc/Internal.lean | 10 +- .../TuringMachine/Subroutines/ClearWork.lean | 8 +- .../Subroutines/ClearWork/Defs.lean | 6 +- .../Subroutines/ClearWork/Internal.lean | 12 +- .../TuringMachine/Subroutines/CopyOutput.lean | 8 +- .../Subroutines/CopyWorkOutput.lean | 6 +- .../TuringMachine/Subroutines/Counter.lean | 23 +- .../Subroutines/GuessBounded.lean | 20 +- .../TuringMachine/Subroutines/Internal.lean | 14 +- .../Subroutines/Internal/CopyOutput.lean | 10 +- .../Subroutines/Internal/CopyWorkOutput.lean | 6 +- .../Subroutines/Internal/ScanRight.lean | 12 +- .../TuringMachine/Subroutines/PairEmit.lean | 8 +- .../Subroutines/PairEmit/Defs.lean | 6 +- .../Subroutines/PairEmit/Internal.lean | 14 +- .../TuringMachine/Subroutines/PairSplit.lean | 12 +- .../Subroutines/PairSplit/Defs.lean | 6 +- .../Subroutines/PairSplit/Internal.lean | 14 +- .../Subroutines/PairValidate.lean | 12 +- .../Subroutines/PairValidate/Defs.lean | 8 +- .../Subroutines/PairValidate/Internal.lean | 12 +- .../Subroutines/ResetBinary.lean | 12 +- .../Subroutines/ResetBinary/Defs.lean | 8 +- .../Subroutines/ResetBinary/Internal.lean | 12 +- .../Subroutines/ResetBinaryMany.lean | 10 +- .../Subroutines/ResetBinaryMany/Defs.lean | 8 +- .../Subroutines/ResetBinaryMany/Internal.lean | 8 +- .../TuringMachine/Subroutines/ScanRight.lean | 12 +- .../Subroutines/UnaryLength.lean | 8 +- .../Subroutines/UnaryLength/Defs.lean | 6 +- .../Subroutines/UnaryLength/Internal.lean | 10 +- .../Models/TuringMachine/Tape/Encoding.lean | 6 +- Complexitylib/Models/TuringMachine/Trace.lean | 8 +- .../Models/TuringMachine/Trace/Internal.lean | 6 +- .../Models/TuringMachine/UTM/Clock.lean | 12 +- .../TuringMachine/UTM/ClockConstructible.lean | 8 +- .../Models/TuringMachine/UTM/ClockedUtm.lean | 10 +- .../Models/TuringMachine/UTM/Diagonal.lean | 18 +- .../Models/TuringMachine/UTM/Encoding.lean | 8 +- .../TuringMachine/UTM/HierarchySupport.lean | 8 +- .../TuringMachine/UTM/Internal/Body.lean | 24 +- .../TuringMachine/UTM/Internal/BodyApply.lean | 8 +- .../UTM/Internal/BodyAssembly.lean | 12 +- .../UTM/Internal/BodyInternal.lean | 8 +- .../UTM/Internal/BodyIteration.lean | 8 +- .../UTM/Internal/BodyLookup.lean | 8 +- .../TuringMachine/UTM/Internal/BodyLoop.lean | 8 +- .../TuringMachine/UTM/Internal/BodyMatch.lean | 6 +- .../UTM/Internal/ClockFrontier.lean | 6 +- .../TuringMachine/UTM/Internal/Desc.lean | 8 +- .../UTM/Internal/DescLayout.lean | 10 +- .../TuringMachine/UTM/Internal/Extract.lean | 10 +- .../TuringMachine/UTM/Internal/HaltTest.lean | 12 +- .../TuringMachine/UTM/Internal/Init.lean | 16 +- .../TuringMachine/UTM/Internal/Interp.lean | 8 +- .../TuringMachine/UTM/Internal/NegOut.lean | 8 +- .../TuringMachine/UTM/Internal/PairSelf.lean | 8 +- .../UTM/Internal/SeekFrontier.lean | 6 +- .../TuringMachine/UTM/Internal/Sim.lean | 10 +- .../UTM/Internal/SimClocked.lean | 8 +- .../TuringMachine/UTM/Internal/SimLoop.lean | 12 +- .../TuringMachine/UTM/Internal/StepGlue.lean | 8 +- .../TuringMachine/UTM/Internal/TermCheck.lean | 8 +- .../UTM/Internal/Terminated.lean | 6 +- .../TuringMachine/UTM/Internal/VTape.lean | 6 +- .../TuringMachine/UTM/Internal/Verdict.lean | 10 +- .../Models/TuringMachine/UTM/Machine.lean | 14 +- .../Models/TuringMachine/UTM/Universal.lean | 10 +- .../Models/TuringMachine/WorkReadOnly.lean | 8 +- Complexitylib/SAT.lean | 38 ++- Complexitylib/SAT/CookLevin.lean | 12 +- Complexitylib/SAT/CookLevin/Assembly.lean | 6 +- .../SAT/CookLevin/Internal/Emitter.lean | 10 +- .../SAT/CookLevin/Internal/EmitterActive.lean | 6 +- .../CookLevin/Internal/EmitterFamilies.lean | 6 +- .../SAT/CookLevin/Internal/EmitterLoop.lean | 6 +- .../SAT/CookLevin/Internal/EmitterStart.lean | 8 +- Complexitylib/SAT/Encoding.lean | 10 +- Complexitylib/SAT/Headline.lean | 8 +- Complexitylib/SAT/Internal/GuessVerify.lean | 51 +-- .../SAT/Internal/LinearGuessVerify.lean | 6 +- Complexitylib/SAT/Language.lean | 14 +- Complexitylib/SAT/QBF.lean | 12 +- Complexitylib/SAT/Rename.lean | 6 +- Complexitylib/SAT/Resolution.lean | 6 +- Complexitylib/SAT/Semantics.lean | 10 +- Complexitylib/SAT/ThreeCNF.lean | 6 +- Complexitylib/SAT/ThreeSAT.lean | 8 +- Complexitylib/SAT/ThreeSAT/Completeness.lean | 12 +- Complexitylib/SAT/ThreeSAT/Headline.lean | 12 +- Complexitylib/SAT/ThreeSAT/Syntax.lean | 10 +- Complexitylib/SAT/ThreeSAT/Verifier.lean | 10 +- Complexitylib/SAT/Tseitin.lean | 12 +- Complexitylib/SAT/Tseitin/Defs.lean | 6 +- .../SAT/Tseitin/Internal/Correctness.lean | 8 +- .../SAT/Tseitin/Internal/EncodingBounds.lean | 8 +- .../Tseitin/Internal/FunctionSemantics.lean | 6 +- Complexitylib/SAT/Tseitin/Internal/Shape.lean | 6 +- Complexitylib/SAT/Tseitin/Internal/Size.lean | 8 +- .../SAT/Tseitin/Internal/StateBounds.lean | 6 +- .../SAT/Tseitin/Internal/Streaming.lean | 10 +- .../Tseitin/Internal/StreamingEndpoint.lean | 6 +- Complexitylib/SAT/Tseitin/Machine.lean | 10 +- .../SAT/Tseitin/Machine/Controller.lean | 8 +- Complexitylib/SAT/Tseitin/Machine/Defs.lean | 10 +- .../Tseitin/Machine/Internal/BranchFrame.lean | 6 +- .../Tseitin/Machine/Internal/BufferSpecs.lean | 10 +- .../Machine/Internal/ControllerCalls.lean | 8 +- .../Machine/Internal/ControllerInput.lean | 8 +- .../Machine/Internal/ControllerInvariant.lean | 10 +- .../Machine/Internal/ControllerLift.lean | 8 +- .../Machine/Internal/ControllerRead.lean | 6 +- .../Machine/Internal/ControllerRun.lean | 8 +- .../Machine/Internal/ControllerSemantics.lean | 8 +- .../Machine/Internal/ControllerToken.lean | 12 +- .../Tseitin/Machine/Internal/EmitterSpec.lean | 10 +- .../Tseitin/Machine/Internal/Execution.lean | 8 +- .../Machine/Internal/FrontEndSpec.lean | 8 +- .../Machine/Internal/InvalidBranchSpec.lean | 6 +- .../Machine/Internal/PolynomialTime.lean | 16 +- .../Machine/Internal/RuntimeBounds.lean | 10 +- .../SAT/Tseitin/Machine/Internal/Setup.lean | 8 +- .../Machine/Internal/ValidBranchAssembly.lean | 6 +- .../Tseitin/Machine/Internal/Validation.lean | 6 +- .../Machine/Internal/ValidationFramed.lean | 6 +- .../SAT/Tseitin/Machine/Validation.lean | 16 +- Complexitylib/SAT/Verifier.lean | 6 +- Complexitylib/SAT/VerifierTM.lean | 291 ++++++++++-------- Complexitylib/TimeConstructible.lean | 10 +- scripts/lint_style.py | 9 +- 941 files changed, 7636 insertions(+), 3669 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 2bd340e9..34bbbd39 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -44,7 +44,9 @@ Complexitylib/Models/TuringMachine.lean — Γ, Dir3, TM, NTM, Cfg, ste Complexitylib/Models/TuringMachine/Internal.lean — proof internals (e.g. toNTM_accepts_iff) ``` -Aggregation files (`Complexitylib.lean`, `Models.lean`) contain only `import` statements — no definitions. +Aggregation files (`Complexitylib.lean`, `Models.lean`) contain only `import` +statements — no definitions (a leading `module` header and `public import`s, but +nothing else). ### Three-Layer Architecture @@ -78,7 +80,53 @@ definitions in their theorem signatures rather than raw expressions. For simple modules where Internal proofs don't need to reference surface definitions, the two-layer pattern (surface + Internal) is fine — introduce `Defs.lean` when the need arises. For trivial proofs, `private` lemmas in the -same file are acceptable. +same file are acceptable — but only if no `@[expose] public` declaration +references them (see the Module System section); otherwise they must be public. + +### Module System + +Every `.lean` file uses Lean's module system. The layout is: + +```lean +/- copyright header -/ +module + +public import Mathlib.… +public import Complexitylib.… + +/-! module docstring -/ + +@[expose] public section + +namespace Complexity +… +end Complexity +``` + +Conventions (matching Mathlib): + +- **`module` header + `public import`**: every file (including aggregation + files) begins with `module`, and all imports are `public import` so the + public interface is re-exported transitively. A `module` file can only + import other `module` files. +- **`@[expose] public section`**: wraps the whole body so definitions stay + exposed (reducible/unfoldable) downstream, preserving pre-module defeq + behavior. This is the default the `Modulize` migration script emits. +- **No `private` under an exposed section**: an `@[expose] public` definition + cannot reference a `private` declaration — the exposed body must be + reconstructible by importers. Make such helpers public (drop `private`) + rather than private. `private` is only safe for helpers used exclusively by + other non-exposed / `private` declarations. +- **Meta imports for tactics**: tactic and macro (meta) code is *not* + re-exported transitively through a plain `public import` chain. A file that + uses a tactic (e.g. `ring`) reached only transitively must import the tactic + module directly (`public import Mathlib.Tactic.Ring`). The same applies to + `to_additive`-generated lemmas whose defining module isn't in the direct + import closure. +- To migrate a new un-modulized file, run the Lean `Modulize` script: + `lake env lean --run script/Modulize.lean path/to/File.lean` (from the + `leanprover/lean4` repo), then resolve any private-exposure and meta-import + fallout as above. ### Key Design Decisions @@ -109,7 +157,7 @@ Follow Mathlib style: ### Common Pitfalls -- **No `module` keyword** in aggregation files — they import files with definitions, and `module` files can only import other `module` files. +- **Module system**: every file (including aggregation files) starts with a `module` header and uses `public import`; see the Module System section above for the `private`/`@[expose]` and meta-import rules. - **`List.get?` removed**: Use `l[i]?` (GetElem? syntax) instead of `l.get? i` in Lean 4 v4.28.0+. - **Lambda expressions in conjunction chains** need explicit parens: `c'.work = (fun i => ...) ∧ ...` - **`open` scoping**: Prefer `open Foo in` or `section`/`end` blocks over module-level `open` to avoid namespace pollution. diff --git a/Complexitylib.lean b/Complexitylib.lean index 7126b70d..221856ca 100644 --- a/Complexitylib.lean +++ b/Complexitylib.lean @@ -3,15 +3,17 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models -import Complexitylib.Asymptotics -import Complexitylib.TimeConstructible -import Complexitylib.Classes -import Complexitylib.Languages -import Complexitylib.SAT -import Complexitylib.Circuits -import Complexitylib.BooleanAnalysis -import Complexitylib.DescriptiveComplexity +module + +public import Complexitylib.Models +public import Complexitylib.Asymptotics +public import Complexitylib.TimeConstructible +public import Complexitylib.Classes +public import Complexitylib.Languages +public import Complexitylib.SAT +public import Complexitylib.Circuits +public import Complexitylib.BooleanAnalysis +public import Complexitylib.DescriptiveComplexity /-! # Complexitylib @@ -65,3 +67,5 @@ hardwiring and its advice corollary live in logarithmic-depth Boolean formula families with polynomial-length width-`5` permutation branching-program families. -/ + +@[expose] public section diff --git a/Complexitylib/Asymptotics.lean b/Complexitylib/Asymptotics.lean index 0ff86c9b..aa8c7850 100644 --- a/Complexitylib/Asymptotics.lean +++ b/Complexitylib/Asymptotics.lean @@ -3,15 +3,17 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Mathlib.Analysis.Asymptotics.Defs -import Mathlib.Analysis.Asymptotics.SpecificAsymptotics -import Mathlib.Analysis.Asymptotics.Lemmas -import Mathlib.Algebra.Polynomial.Eval.Defs -import Mathlib.Algebra.Polynomial.Eval.Degree -import Mathlib.Data.Finset.Lattice.Fold -import Mathlib.Data.Nat.Log -import Mathlib.Data.Nat.Size -import Mathlib.Algebra.Order.Floor.Semiring +module + +public import Mathlib.Analysis.Asymptotics.Defs +public import Mathlib.Analysis.Asymptotics.SpecificAsymptotics +public import Mathlib.Analysis.Asymptotics.Lemmas +public import Mathlib.Algebra.Polynomial.Eval.Defs +public import Mathlib.Algebra.Polynomial.Eval.Degree +public import Mathlib.Data.Finset.Lattice.Fold +public import Mathlib.Data.Nat.Log +public import Mathlib.Data.Nat.Size +public import Mathlib.Algebra.Order.Floor.Semiring /-! # Asymptotic notation for natural number functions @@ -51,6 +53,8 @@ opened and read like standard complexity-theoretic asymptotic notation. - `LittleO.const_mul_left` — constant multiple preserves little-o -/ +@[expose] public section + open Asymptotics Filter namespace Complexity diff --git a/Complexitylib/Asymptotics/PolynomialComposition.lean b/Complexitylib/Asymptotics/PolynomialComposition.lean index 554da3b2..73d9171d 100644 --- a/Complexitylib/Asymptotics/PolynomialComposition.lean +++ b/Complexitylib/Asymptotics/PolynomialComposition.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Asymptotics +module + +public import Complexitylib.Asymptotics /-! # Polynomial composition bounds @@ -18,6 +20,8 @@ deterministic function computations are connected sequentially. - `BigO.polynomial_composition_time` — the coarse sequential runtime is polynomially bounded -/ +@[expose] public section + namespace Complexity /-- Composing evaluations of natural-coefficient polynomials gives a function diff --git a/Complexitylib/BooleanAnalysis.lean b/Complexitylib/BooleanAnalysis.lean index d8940c87..c98f8d9c 100644 --- a/Complexitylib/BooleanAnalysis.lean +++ b/Complexitylib/BooleanAnalysis.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.BooleanAnalysis.FourierExpansion +module + +public import Complexitylib.BooleanAnalysis.FourierExpansion /-! # Analysis of Boolean functions @@ -20,3 +22,5 @@ an orthonormal basis, Fourier coefficients and weights, Parseval/Plancherel, and the mean/variance/covariance and convolution API. All definitions and theorems live under the `Complexity.BooleanAnalysis` namespace. -/ + +@[expose] public section diff --git a/Complexitylib/BooleanAnalysis/FourierExpansion.lean b/Complexitylib/BooleanAnalysis/FourierExpansion.lean index a7986df4..5fb42df8 100644 --- a/Complexitylib/BooleanAnalysis/FourierExpansion.lean +++ b/Complexitylib/BooleanAnalysis/FourierExpansion.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.BooleanAnalysis.FourierExpansion.Internal -import Mathlib.Probability.ProbabilityMassFunction.Constructions +module + +public import Complexitylib.BooleanAnalysis.FourierExpansion.Internal +public import Mathlib.Probability.ProbabilityMassFunction.Constructions /-! # Chapter 1: Boolean functions and the Fourier expansion @@ -17,6 +19,8 @@ Functions" by Ryan O'Donnell. * Ryan O'Donnell, *Analysis of Boolean Functions*, Chapter 1. -/ +@[expose] public section + namespace Complexity namespace BooleanAnalysis diff --git a/Complexitylib/BooleanAnalysis/FourierExpansion/Defs.lean b/Complexitylib/BooleanAnalysis/FourierExpansion/Defs.lean index ede2ac47..c4c4c631 100644 --- a/Complexitylib/BooleanAnalysis/FourierExpansion/Defs.lean +++ b/Complexitylib/BooleanAnalysis/FourierExpansion/Defs.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Mathlib.Algebra.BigOperators.Expect -import Mathlib.Analysis.InnerProductSpace.Basic -import Mathlib.Data.ZMod.Basic +module + +public import Mathlib.Algebra.BigOperators.Expect +public import Mathlib.Analysis.InnerProductSpace.Basic +public import Mathlib.Data.ZMod.Basic /-! # Chapter 1: Boolean functions and the Fourier expansion — Definitions @@ -42,6 +44,8 @@ the book's conventions: * `Pr₂[P]` — joint uniform probability over pairs -/ +@[expose] public section + namespace Complexity namespace BooleanAnalysis @@ -117,26 +121,26 @@ noncomputable instance instInner : Inner ℝ (BooleanFunction n) where theorem inner_def (f g : BooleanFunction n) : @inner ℝ _ instInner f g = (1 / (2 : ℝ) ^ n) * ∑ x : Cube n, f x * g x := rfl -private theorem inner_comm (f g : BooleanFunction n) : +theorem inner_comm (f g : BooleanFunction n) : @inner ℝ _ instInner f g = @inner ℝ _ instInner g f := by simp only [inner_def]; congr 1; apply Finset.sum_congr rfl; intro x _; ring -private theorem inner_add_left (f g h : BooleanFunction n) : +theorem inner_add_left (f g h : BooleanFunction n) : @inner ℝ _ instInner (f + g) h = @inner ℝ _ instInner f h + @inner ℝ _ instInner g h := by simp only [inner_def, add_apply, add_mul, Finset.sum_add_distrib, mul_add] -private theorem inner_smul_left (r : ℝ) (f g : BooleanFunction n) : +theorem inner_smul_left (r : ℝ) (f g : BooleanFunction n) : @inner ℝ _ instInner (r • f) g = r * @inner ℝ _ instInner f g := by simp only [inner_def, smul_apply, Finset.mul_sum]; ring_nf -private theorem inner_self_nonneg' (f : BooleanFunction n) : +theorem inner_self_nonneg' (f : BooleanFunction n) : 0 ≤ @inner ℝ _ instInner f f := by simp only [inner_def] apply mul_nonneg · positivity · apply Finset.sum_nonneg; intro x _; exact mul_self_nonneg (f x) -private theorem inner_self_eq_zero {f : BooleanFunction n} +theorem inner_self_eq_zero {f : BooleanFunction n} (h : @inner ℝ _ instInner f f = 0) : f = 0 := by simp only [inner_def] at h have h2n : (0 : ℝ) < 1 / 2 ^ n := by positivity diff --git a/Complexitylib/BooleanAnalysis/FourierExpansion/Internal.lean b/Complexitylib/BooleanAnalysis/FourierExpansion/Internal.lean index 9c7bef9f..5d112aee 100644 --- a/Complexitylib/BooleanAnalysis/FourierExpansion/Internal.lean +++ b/Complexitylib/BooleanAnalysis/FourierExpansion/Internal.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.BooleanAnalysis.FourierExpansion.Defs -import Mathlib.Analysis.InnerProductSpace.PiL2 +module + +public import Complexitylib.BooleanAnalysis.FourierExpansion.Defs +public import Mathlib.Analysis.InnerProductSpace.PiL2 /-! # Chapter 1: Boolean functions and the Fourier expansion — Internal lemmas @@ -14,6 +16,8 @@ main results in `BooleanAnalysis.FourierExpansion` but are not intended for direct use by downstream code. -/ +@[expose] public section + namespace Complexity namespace BooleanAnalysis.Internal diff --git a/Complexitylib/Circuits.lean b/Complexitylib/Circuits.lean index 7d66c1d6..082ab260 100644 --- a/Complexitylib/Circuits.lean +++ b/Complexitylib/Circuits.lean @@ -3,59 +3,61 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Basic -import Complexitylib.Circuits.BitString -import Complexitylib.Circuits.Composition -import Complexitylib.Circuits.Dependency -import Complexitylib.Circuits.DecisionTree -import Complexitylib.Circuits.DecisionTree.Finite -import Complexitylib.Circuits.DecisionTree.NormalForm -import Complexitylib.Circuits.DecisionTree.Path -import Complexitylib.Circuits.DecisionTree.Restriction -import Complexitylib.Circuits.Formula -import Complexitylib.Circuits.Spira -import Complexitylib.Circuits.FormulaEncoding -import Complexitylib.Circuits.CircuitFormula -import Complexitylib.Circuits.Restriction -import Complexitylib.Circuits.RandomRestriction -import Complexitylib.Circuits.BranchingProgram -import Complexitylib.Circuits.Barrington -import Complexitylib.Circuits.BarringtonS5 -import Complexitylib.Circuits.BarringtonBridge -import Complexitylib.Circuits.BarringtonRepr -import Complexitylib.Circuits.BarringtonLength -import Complexitylib.Circuits.BarringtonCompiler -import Complexitylib.Circuits.BranchingProgramEncoding -import Complexitylib.Circuits.BarringtonCodeGenerator -import Complexitylib.Circuits.BarringtonFamily -import Complexitylib.Circuits.BarringtonConverse -import Complexitylib.Circuits.BarringtonTyped -import Complexitylib.Circuits.CircuitFormula.Family -import Complexitylib.Circuits.MultilinearExtension -import Complexitylib.Circuits.NormalForm -import Complexitylib.Circuits.NormalForm.Operations -import Complexitylib.Circuits.NormalForm.Restriction -import Complexitylib.Circuits.AndOrNot -import Complexitylib.Circuits.BasisHom -import Complexitylib.Circuits.Threshold -import Complexitylib.Circuits.Monotone -import Complexitylib.Circuits.KarchmerWigderson -import Complexitylib.Circuits.Encoding -import Complexitylib.Circuits.Family -import Complexitylib.Circuits.Encoding.Family -import Complexitylib.Circuits.Encoding.Machine -import Complexitylib.Circuits.XOR -import Complexitylib.Circuits.XOR.Restriction -import Complexitylib.Circuits.EssentialInput -import Complexitylib.Circuits.Shannon -import Complexitylib.Circuits.LowerBound -import Complexitylib.Circuits.Schnorr -import Complexitylib.Circuits.DepthClasses -import Complexitylib.Circuits.AC0 -import Complexitylib.Circuits.Nondeterminism -import Complexitylib.Circuits.Hardwiring -import Complexitylib.Circuits.Unrolling -import Complexitylib.Circuits.Valiant +module + +public import Complexitylib.Circuits.Basic +public import Complexitylib.Circuits.BitString +public import Complexitylib.Circuits.Composition +public import Complexitylib.Circuits.Dependency +public import Complexitylib.Circuits.DecisionTree +public import Complexitylib.Circuits.DecisionTree.Finite +public import Complexitylib.Circuits.DecisionTree.NormalForm +public import Complexitylib.Circuits.DecisionTree.Path +public import Complexitylib.Circuits.DecisionTree.Restriction +public import Complexitylib.Circuits.Formula +public import Complexitylib.Circuits.Spira +public import Complexitylib.Circuits.FormulaEncoding +public import Complexitylib.Circuits.CircuitFormula +public import Complexitylib.Circuits.Restriction +public import Complexitylib.Circuits.RandomRestriction +public import Complexitylib.Circuits.BranchingProgram +public import Complexitylib.Circuits.Barrington +public import Complexitylib.Circuits.BarringtonS5 +public import Complexitylib.Circuits.BarringtonBridge +public import Complexitylib.Circuits.BarringtonRepr +public import Complexitylib.Circuits.BarringtonLength +public import Complexitylib.Circuits.BarringtonCompiler +public import Complexitylib.Circuits.BranchingProgramEncoding +public import Complexitylib.Circuits.BarringtonCodeGenerator +public import Complexitylib.Circuits.BarringtonFamily +public import Complexitylib.Circuits.BarringtonConverse +public import Complexitylib.Circuits.BarringtonTyped +public import Complexitylib.Circuits.CircuitFormula.Family +public import Complexitylib.Circuits.MultilinearExtension +public import Complexitylib.Circuits.NormalForm +public import Complexitylib.Circuits.NormalForm.Operations +public import Complexitylib.Circuits.NormalForm.Restriction +public import Complexitylib.Circuits.AndOrNot +public import Complexitylib.Circuits.BasisHom +public import Complexitylib.Circuits.Threshold +public import Complexitylib.Circuits.Monotone +public import Complexitylib.Circuits.KarchmerWigderson +public import Complexitylib.Circuits.Encoding +public import Complexitylib.Circuits.Family +public import Complexitylib.Circuits.Encoding.Family +public import Complexitylib.Circuits.Encoding.Machine +public import Complexitylib.Circuits.XOR +public import Complexitylib.Circuits.XOR.Restriction +public import Complexitylib.Circuits.EssentialInput +public import Complexitylib.Circuits.Shannon +public import Complexitylib.Circuits.LowerBound +public import Complexitylib.Circuits.Schnorr +public import Complexitylib.Circuits.DepthClasses +public import Complexitylib.Circuits.AC0 +public import Complexitylib.Circuits.Nondeterminism +public import Complexitylib.Circuits.Hardwiring +public import Complexitylib.Circuits.Unrolling +public import Complexitylib.Circuits.Valiant /-! # Circuit Complexity Library @@ -236,3 +238,5 @@ Theorem modules (re-export definitions + main results): Internal modules contain proof machinery (CircDesc, DNF construction, restriction/elimination arguments) and are not intended for direct use. -/ + +@[expose] public section diff --git a/Complexitylib/Circuits/AC0.lean b/Complexitylib/Circuits/AC0.lean index 34ba765b..0f4a7ef7 100644 --- a/Complexitylib/Circuits/AC0.lean +++ b/Complexitylib/Circuits/AC0.lean @@ -3,16 +3,18 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.AC0.Defs -import Complexitylib.Circuits.AC0.NormalForm -import Complexitylib.Circuits.AC0.Normalization -import Complexitylib.Circuits.AC0.Restriction -import Complexitylib.Circuits.AC0.Switching -import Complexitylib.Circuits.AC0.Switching.Collection -import Complexitylib.Circuits.AC0.Switching.Parity -import Complexitylib.Circuits.AC0.Iteration -import Complexitylib.Circuits.AC0.Parity -import Complexitylib.Circuits.DepthClasses +module + +public import Complexitylib.Circuits.AC0.Defs +public import Complexitylib.Circuits.AC0.NormalForm +public import Complexitylib.Circuits.AC0.Normalization +public import Complexitylib.Circuits.AC0.Restriction +public import Complexitylib.Circuits.AC0.Switching +public import Complexitylib.Circuits.AC0.Switching.Collection +public import Complexitylib.Circuits.AC0.Switching.Parity +public import Complexitylib.Circuits.AC0.Iteration +public import Complexitylib.Circuits.AC0.Parity +public import Complexitylib.Circuits.DepthClasses /-! # The class AC⁰ @@ -41,3 +43,5 @@ obstruction for every finite formula computing parity. The remaining separation step is the family-level arithmetic specialization proving nonuniform parity is not in `AC0`. -/ + +@[expose] public section diff --git a/Complexitylib/Circuits/AC0/Defs.lean b/Complexitylib/Circuits/AC0/Defs.lean index 693ad72f..e7399dca 100644 --- a/Complexitylib/Circuits/AC0/Defs.lean +++ b/Complexitylib/Circuits/AC0/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.DepthClasses.Defs +module + +public import Complexitylib.Circuits.DepthClasses.Defs /-! # AC0 -- compatibility import @@ -12,3 +14,5 @@ import Complexitylib.Circuits.DepthClasses.Defs `Complexitylib.Circuits.DepthClasses.Defs`. This module preserves the original import path. -/ + +@[expose] public section diff --git a/Complexitylib/Circuits/AC0/Iteration.lean b/Complexitylib/Circuits/AC0/Iteration.lean index 71e32f53..e7d170af 100644 --- a/Complexitylib/Circuits/AC0/Iteration.lean +++ b/Complexitylib/Circuits/AC0/Iteration.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.AC0.Iteration.Defs -import Complexitylib.Circuits.AC0.Iteration.Internal +module + +public import Complexitylib.Circuits.AC0.Iteration.Defs +public import Complexitylib.Circuits.AC0.Iteration.Internal /-! # Iterated switching for finite AC0 formulas @@ -18,6 +20,8 @@ Everything here is a statement about one finite formula and a finite product of restrictions. No uniformity or circuit-generator assumption is present. -/ +@[expose] public section + namespace Complexity namespace RandomRestriction diff --git a/Complexitylib/Circuits/AC0/Iteration/Defs.lean b/Complexitylib/Circuits/AC0/Iteration/Defs.lean index 5471275e..47652d96 100644 --- a/Complexitylib/Circuits/AC0/Iteration/Defs.lean +++ b/Complexitylib/Circuits/AC0/Iteration/Defs.lean @@ -3,12 +3,14 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.AC0.Restriction -import Complexitylib.Circuits.AC0.Switching.Defs -import Complexitylib.Circuits.DecisionTree.NormalForm.Defs -import Complexitylib.Circuits.RandomRestriction.Defs -import Mathlib.Data.Fintype.BigOperators -import Mathlib.Data.Fintype.Card +module + +public import Complexitylib.Circuits.AC0.Restriction +public import Complexitylib.Circuits.AC0.Switching.Defs +public import Complexitylib.Circuits.DecisionTree.NormalForm.Defs +public import Complexitylib.Circuits.RandomRestriction.Defs +public import Mathlib.Data.Fintype.BigOperators +public import Mathlib.Data.Fintype.Card /-! # Iterated switching for AC0 formulas -- definitions @@ -21,6 +23,8 @@ This representation is finite and nonuniform. It contains restrictions and formula trees only; it does not contain or assume a circuit generator. -/ +@[expose] public section + namespace Complexity open scoped BigOperators diff --git a/Complexitylib/Circuits/AC0/Iteration/Internal.lean b/Complexitylib/Circuits/AC0/Iteration/Internal.lean index b1dd6436..8ed791db 100644 --- a/Complexitylib/Circuits/AC0/Iteration/Internal.lean +++ b/Complexitylib/Circuits/AC0/Iteration/Internal.lean @@ -3,17 +3,21 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.AC0.Iteration.Defs -import Complexitylib.Circuits.AC0.Switching.Internal -import Complexitylib.Circuits.DecisionTree.NormalForm.Internal -import Complexitylib.Circuits.RandomRestriction.Internal -import Mathlib.Algebra.BigOperators.Ring.Finset -import Mathlib.Algebra.Order.BigOperators.Group.Finset +module + +public import Complexitylib.Circuits.AC0.Iteration.Defs +public import Complexitylib.Circuits.AC0.Switching.Internal +public import Complexitylib.Circuits.DecisionTree.NormalForm.Internal +public import Complexitylib.Circuits.RandomRestriction.Internal +public import Mathlib.Algebra.BigOperators.Ring.Finset +public import Mathlib.Algebra.Order.BigOperators.Group.Finset /-! # Iterated switching for AC0 formulas -- proof internals -/ +@[expose] public section + namespace Complexity namespace Switching diff --git a/Complexitylib/Circuits/AC0/NormalForm.lean b/Complexitylib/Circuits/AC0/NormalForm.lean index 8f186b65..d5d1b2d7 100644 --- a/Complexitylib/Circuits/AC0/NormalForm.lean +++ b/Complexitylib/Circuits/AC0/NormalForm.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.AC0.NormalForm.Defs -import Complexitylib.Circuits.AC0.NormalForm.Internal +module + +public import Complexitylib.Circuits.AC0.NormalForm.Defs +public import Complexitylib.Circuits.AC0.NormalForm.Internal /-! # Negation-normal unbounded formulas for AC0 @@ -14,6 +16,8 @@ This public surface provides the semantic and quantitative De Morgan laws for restriction arguments. -/ +@[expose] public section + namespace Complexity namespace AC0Formula diff --git a/Complexitylib/Circuits/AC0/NormalForm/Defs.lean b/Complexitylib/Circuits/AC0/NormalForm/Defs.lean index 0c06593e..c396de48 100644 --- a/Complexitylib/Circuits/AC0/NormalForm/Defs.lean +++ b/Complexitylib/Circuits/AC0/NormalForm/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.AndOrNot.Defs -import Complexitylib.Circuits.NormalForm.Defs +module + +public import Complexitylib.Circuits.AndOrNot.Defs +public import Complexitylib.Circuits.NormalForm.Defs /-! # Negation-normal unbounded formulas for AC0 @@ -20,6 +22,8 @@ direct structural induction principle for unbounded formulas; `ofList` and denote `true` and `false`, respectively. -/ +@[expose] public section + namespace Complexity mutual diff --git a/Complexitylib/Circuits/AC0/NormalForm/Internal.lean b/Complexitylib/Circuits/AC0/NormalForm/Internal.lean index b22390a9..69c1693b 100644 --- a/Complexitylib/Circuits/AC0/NormalForm/Internal.lean +++ b/Complexitylib/Circuits/AC0/NormalForm/Internal.lean @@ -3,12 +3,16 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.AC0.NormalForm.Defs +module + +public import Complexitylib.Circuits.AC0.NormalForm.Defs /-! # Negation-normal unbounded formulas -- proof internals -/ +@[expose] public section + namespace Complexity namespace AC0Formula diff --git a/Complexitylib/Circuits/AC0/Normalization.lean b/Complexitylib/Circuits/AC0/Normalization.lean index 1fd49502..45d252d0 100644 --- a/Complexitylib/Circuits/AC0/Normalization.lean +++ b/Complexitylib/Circuits/AC0/Normalization.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.AC0.NormalForm -import Complexitylib.Circuits.AC0.Normalization.Defs -import Complexitylib.Circuits.AC0.Normalization.Internal +module + +public import Complexitylib.Circuits.AC0.NormalForm +public import Complexitylib.Circuits.AC0.Normalization.Defs +public import Complexitylib.Circuits.AC0.Normalization.Internal /-! # AC0 circuit normalization @@ -21,6 +23,8 @@ For constant-depth, polynomial-gate circuit families this bound is polynomial. No uniformity assumption is used. -/ +@[expose] public section + namespace Complexity /-- A gate has at most two distinct signed occurrences of each available diff --git a/Complexitylib/Circuits/AC0/Normalization/Defs.lean b/Complexitylib/Circuits/AC0/Normalization/Defs.lean index b2328d7d..c7318753 100644 --- a/Complexitylib/Circuits/AC0/Normalization/Defs.lean +++ b/Complexitylib/Circuits/AC0/Normalization/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.AC0.NormalForm.Defs +module + +public import Complexitylib.Circuits.AC0.NormalForm.Defs /-! # Normalizing unbounded AND/OR circuits to negation-normal formulas @@ -15,6 +17,8 @@ model counts gates rather than wire incidences, so duplicate inputs must not inflate the normalized formula. -/ +@[expose] public section + namespace Complexity /-- The distinct signed source wires read by a gate, after composing every diff --git a/Complexitylib/Circuits/AC0/Normalization/Internal.lean b/Complexitylib/Circuits/AC0/Normalization/Internal.lean index 30d83684..965a49c8 100644 --- a/Complexitylib/Circuits/AC0/Normalization/Internal.lean +++ b/Complexitylib/Circuits/AC0/Normalization/Internal.lean @@ -3,14 +3,18 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.AC0.NormalForm.Internal -import Complexitylib.Circuits.AC0.Normalization.Defs -import Mathlib.Tactic +module + +public import Complexitylib.Circuits.AC0.NormalForm.Internal +public import Complexitylib.Circuits.AC0.Normalization.Defs +public import Mathlib.Tactic /-! # AC0 circuit normalization -- proof internals -/ +@[expose] public section + namespace Complexity private theorem foldl_or_eq_true (n : ℕ) (values : Fin n → Bool) : diff --git a/Complexitylib/Circuits/AC0/Parity.lean b/Complexitylib/Circuits/AC0/Parity.lean index c7a3f17c..7076a42c 100644 --- a/Complexitylib/Circuits/AC0/Parity.lean +++ b/Complexitylib/Circuits/AC0/Parity.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.AC0.Iteration -import Complexitylib.Circuits.AC0.Parity.Internal -import Complexitylib.Circuits.XOR.Restriction +module + +public import Complexitylib.Circuits.AC0.Iteration +public import Complexitylib.Circuits.AC0.Parity.Internal +public import Complexitylib.Circuits.XOR.Restriction /-! # Parity versus finite AC0 formulas @@ -24,6 +26,8 @@ arithmetic: instantiate the parameters against a polynomial formula-size bound and a fixed depth. -/ +@[expose] public section + namespace Complexity namespace AC0Formula diff --git a/Complexitylib/Circuits/AC0/Parity/Internal.lean b/Complexitylib/Circuits/AC0/Parity/Internal.lean index 3af84c3a..b5be95d0 100644 --- a/Complexitylib/Circuits/AC0/Parity/Internal.lean +++ b/Complexitylib/Circuits/AC0/Parity/Internal.lean @@ -3,13 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.AC0.Iteration.Internal -import Complexitylib.Circuits.XOR.Restriction.Internal +module + +public import Complexitylib.Circuits.AC0.Iteration.Internal +public import Complexitylib.Circuits.XOR.Restriction.Internal /-! # Parity versus finite AC0 formulas -- proof internals -/ +@[expose] public section + namespace Complexity namespace AC0Formula diff --git a/Complexitylib/Circuits/AC0/Restriction.lean b/Complexitylib/Circuits/AC0/Restriction.lean index eb070f1b..ce2d9f43 100644 --- a/Complexitylib/Circuits/AC0/Restriction.lean +++ b/Complexitylib/Circuits/AC0/Restriction.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.AC0.NormalForm -import Complexitylib.Circuits.Restriction +module + +public import Complexitylib.Circuits.AC0.NormalForm +public import Complexitylib.Circuits.Restriction /-! # Restricting negation-normal AC0 formulas @@ -15,6 +17,8 @@ operation, tree size and depth are preserved exactly, and variable support is filtered to the free variables. -/ +@[expose] public section + namespace Complexity namespace AC0Formula diff --git a/Complexitylib/Circuits/AC0/Switching.lean b/Complexitylib/Circuits/AC0/Switching.lean index fb2f36aa..1459a1d5 100644 --- a/Complexitylib/Circuits/AC0/Switching.lean +++ b/Complexitylib/Circuits/AC0/Switching.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.AC0.Switching.Defs -import Complexitylib.Circuits.AC0.Switching.Internal +module + +public import Complexitylib.Circuits.AC0.Switching.Defs +public import Complexitylib.Circuits.AC0.Switching.Internal /-! # Switching-lemma substrate @@ -16,6 +18,8 @@ consistent DNFs. The latter replays the canonical complete-block path from bounded literal positions, branch bits, and phase markers. -/ +@[expose] public section + namespace Complexity namespace Switching diff --git a/Complexitylib/Circuits/AC0/Switching/Collection.lean b/Complexitylib/Circuits/AC0/Switching/Collection.lean index d728482f..4ef42298 100644 --- a/Complexitylib/Circuits/AC0/Switching/Collection.lean +++ b/Complexitylib/Circuits/AC0/Switching/Collection.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.AC0.Switching -import Complexitylib.Circuits.AC0.Switching.Collection.Defs -import Complexitylib.Circuits.AC0.Switching.Collection.Internal +module + +public import Complexitylib.Circuits.AC0.Switching +public import Complexitylib.Circuits.AC0.Switching.Collection.Defs +public import Complexitylib.Circuits.AC0.Switching.Collection.Internal /-! # Simultaneous switching for finite formula collections @@ -16,6 +18,8 @@ collections are finite nonuniform objects; no generator or uniformity assumption is involved. -/ +@[expose] public section + namespace Complexity namespace DNF diff --git a/Complexitylib/Circuits/AC0/Switching/Collection/Defs.lean b/Complexitylib/Circuits/AC0/Switching/Collection/Defs.lean index 7c8706d4..ed141cbb 100644 --- a/Complexitylib/Circuits/AC0/Switching/Collection/Defs.lean +++ b/Complexitylib/Circuits/AC0/Switching/Collection/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.AC0.Switching.Defs +module + +public import Complexitylib.Circuits.AC0.Switching.Defs /-! # Simultaneous switching for finite formula collections -- definitions @@ -12,6 +14,8 @@ These are finite, nonuniform collections indexed by `Fin formulaCount`; they are unrelated to uniform circuit-family generators. -/ +@[expose] public section + namespace Complexity namespace DNF diff --git a/Complexitylib/Circuits/AC0/Switching/Collection/Internal.lean b/Complexitylib/Circuits/AC0/Switching/Collection/Internal.lean index db0aaee8..11b41401 100644 --- a/Complexitylib/Circuits/AC0/Switching/Collection/Internal.lean +++ b/Complexitylib/Circuits/AC0/Switching/Collection/Internal.lean @@ -3,16 +3,20 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.AC0.Switching.Collection.Defs -import Complexitylib.Circuits.AC0.Switching.Internal -import Complexitylib.Circuits.RandomRestriction.Internal -import Mathlib.Algebra.BigOperators.Ring.Finset -import Mathlib.Algebra.Order.BigOperators.Group.Finset +module + +public import Complexitylib.Circuits.AC0.Switching.Collection.Defs +public import Complexitylib.Circuits.AC0.Switching.Internal +public import Complexitylib.Circuits.RandomRestriction.Internal +public import Mathlib.Algebra.BigOperators.Ring.Finset +public import Mathlib.Algebra.Order.BigOperators.Group.Finset /-! # Simultaneous switching for finite formula collections -- proof internals -/ +@[expose] public section + namespace Complexity namespace Switching diff --git a/Complexitylib/Circuits/AC0/Switching/Defs.lean b/Complexitylib/Circuits/AC0/Switching/Defs.lean index b6c1907f..a9286af1 100644 --- a/Complexitylib/Circuits/AC0/Switching/Defs.lean +++ b/Complexitylib/Circuits/AC0/Switching/Defs.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.DecisionTree.Block.Defs -import Complexitylib.Circuits.DecisionTree.Finite.Defs -import Complexitylib.Circuits.NormalForm.Restriction -import Complexitylib.Circuits.RandomRestriction.Defs +module + +public import Complexitylib.Circuits.DecisionTree.Block.Defs +public import Complexitylib.Circuits.DecisionTree.Finite.Defs +public import Complexitylib.Circuits.NormalForm.Restriction +public import Complexitylib.Circuits.RandomRestriction.Defs /-! # Switching-lemma substrate -- definitions @@ -22,6 +24,8 @@ with the number of variables in the DNF, and its correctness proof shows that each recursive query removes its variable from support. -/ +@[expose] public section + namespace Complexity namespace Switching diff --git a/Complexitylib/Circuits/AC0/Switching/Internal.lean b/Complexitylib/Circuits/AC0/Switching/Internal.lean index 5bdb45df..f9f38580 100644 --- a/Complexitylib/Circuits/AC0/Switching/Internal.lean +++ b/Complexitylib/Circuits/AC0/Switching/Internal.lean @@ -3,16 +3,20 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.AC0.Switching.Defs -import Complexitylib.Circuits.DecisionTree.Block -import Complexitylib.Circuits.DecisionTree.Finite -import Complexitylib.Circuits.DecisionTree.Path -import Complexitylib.Circuits.RandomRestriction.Internal +module + +public import Complexitylib.Circuits.AC0.Switching.Defs +public import Complexitylib.Circuits.DecisionTree.Block +public import Complexitylib.Circuits.DecisionTree.Finite +public import Complexitylib.Circuits.DecisionTree.Path +public import Complexitylib.Circuits.RandomRestriction.Internal /-! # Switching-lemma substrate -- proof internals -/ +@[expose] public section + namespace Complexity namespace Switching diff --git a/Complexitylib/Circuits/AC0/Switching/Parity.lean b/Complexitylib/Circuits/AC0/Switching/Parity.lean index 9f03fa33..acf08bce 100644 --- a/Complexitylib/Circuits/AC0/Switching/Parity.lean +++ b/Complexitylib/Circuits/AC0/Switching/Parity.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.AC0.Switching -import Complexitylib.Circuits.AC0.Switching.Parity.Internal -import Complexitylib.Circuits.RandomRestriction -import Complexitylib.Circuits.XOR.Restriction +module + +public import Complexitylib.Circuits.AC0.Switching +public import Complexitylib.Circuits.AC0.Switching.Parity.Internal +public import Complexitylib.Circuits.RandomRestriction +public import Complexitylib.Circuits.XOR.Restriction /-! # Switching lemmas against parity @@ -21,6 +23,8 @@ formulas: contradictory DNF terms and tautological CNF clauses are cleaned without changing semantics or increasing width. -/ +@[expose] public section + namespace Complexity namespace DNF diff --git a/Complexitylib/Circuits/AC0/Switching/Parity/Internal.lean b/Complexitylib/Circuits/AC0/Switching/Parity/Internal.lean index 1d44134e..39f7e297 100644 --- a/Complexitylib/Circuits/AC0/Switching/Parity/Internal.lean +++ b/Complexitylib/Circuits/AC0/Switching/Parity/Internal.lean @@ -3,14 +3,18 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.AC0.Switching.Internal -import Complexitylib.Circuits.RandomRestriction.Internal -import Complexitylib.Circuits.XOR.Restriction.Internal +module + +public import Complexitylib.Circuits.AC0.Switching.Internal +public import Complexitylib.Circuits.RandomRestriction.Internal +public import Complexitylib.Circuits.XOR.Restriction.Internal /-! # Switching lemmas against parity -- proof internals -/ +@[expose] public section + namespace Complexity namespace DNF diff --git a/Complexitylib/Circuits/AndOrNot.lean b/Complexitylib/Circuits/AndOrNot.lean index 18b96920..4b2fd15d 100644 --- a/Complexitylib/Circuits/AndOrNot.lean +++ b/Complexitylib/Circuits/AndOrNot.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.AndOrNot.Defs -import Complexitylib.Circuits.Internal.AndOrNot -import Complexitylib.Circuits.Internal.Simulation +module + +public import Complexitylib.Circuits.AndOrNot.Defs +public import Complexitylib.Circuits.Internal.AndOrNot +public import Complexitylib.Circuits.Internal.Simulation /-! # AND/OR/NOT Basis @@ -27,6 +29,8 @@ This module provides the AND/OR basis definitions and completeness results. * `CompileAndOr.compileFn_size_le` — its quantitative size overhead -/ +@[expose] public section + namespace Complexity namespace CompileAndOr diff --git a/Complexitylib/Circuits/AndOrNot/Defs.lean b/Complexitylib/Circuits/AndOrNot/Defs.lean index 5344d7bd..24caf695 100644 --- a/Complexitylib/Circuits/AndOrNot/Defs.lean +++ b/Complexitylib/Circuits/AndOrNot/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Basic +module + +public import Complexitylib.Circuits.Basic /-! # AND/OR/NOT Basis — Definitions @@ -20,6 +22,8 @@ used throughout the circuit complexity library. * `Basis.andOr2` — fan-in exactly 2 AND/OR basis (used in Shannon/Schnorr bounds) -/ +@[expose] public section + namespace Complexity /-- Operations in an AND/OR basis. Negation is handled by per-input flags diff --git a/Complexitylib/Circuits/Barrington.lean b/Complexitylib/Circuits/Barrington.lean index b3f4ee46..9e589bc8 100644 --- a/Complexitylib/Circuits/Barrington.lean +++ b/Complexitylib/Circuits/Barrington.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.BranchingProgram -import Mathlib.Algebra.Group.Commutator -import Mathlib.Data.List.ModifyLast +module + +public import Complexitylib.Circuits.BranchingProgram +public import Mathlib.Algebra.Group.Commutator +public import Mathlib.Data.List.ModifyLast /-! # Toward Barrington's theorem: the group-theoretic core @@ -44,6 +46,8 @@ proved here are the moves in Barrington's inductive construction: `BP.Computes_not_compact`, `BP.Computes_and`. -/ +@[expose] public section + open scoped commutatorElement namespace Complexity diff --git a/Complexitylib/Circuits/BarringtonBridge.lean b/Complexitylib/Circuits/BarringtonBridge.lean index d1b82e0f..5d56fa1b 100644 --- a/Complexitylib/Circuits/BarringtonBridge.lean +++ b/Complexitylib/Circuits/BarringtonBridge.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Barrington -import Complexitylib.Circuits.BarringtonS5 -import Mathlib.GroupTheory.Perm.Cycle.Type +module + +public import Complexitylib.Circuits.Barrington +public import Complexitylib.Circuits.BarringtonS5 +public import Mathlib.GroupTheory.Perm.Cycle.Type /-! # Barrington: bridging the abstract move-set to the `S₅` cycle algebra @@ -31,6 +33,8 @@ actually consumes — where the *target* representing cycle is an arbitrary the formula induction needs. -/ +@[expose] public section + open scoped commutatorElement open Equiv diff --git a/Complexitylib/Circuits/BarringtonCodeGenerator.lean b/Complexitylib/Circuits/BarringtonCodeGenerator.lean index 1883598b..c1196984 100644 --- a/Complexitylib/Circuits/BarringtonCodeGenerator.lean +++ b/Complexitylib/Circuits/BarringtonCodeGenerator.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.BarringtonCodeGenerator.Defs -import Complexitylib.Circuits.BarringtonCodeGenerator.Internal +module + +public import Complexitylib.Circuits.BarringtonCodeGenerator.Defs +public import Complexitylib.Circuits.BarringtonCodeGenerator.Internal /-! # Bitstring-level Barrington code generator @@ -27,6 +29,8 @@ evaluation matches the source formula, and its instruction count is at most - `barringtonCompileCode_spec` -- decoded semantics and Barrington length bound. -/ +@[expose] public section + namespace Complexity /-- Every variable referenced by a formula is at most its canonical code diff --git a/Complexitylib/Circuits/BarringtonCodeGenerator/Defs.lean b/Complexitylib/Circuits/BarringtonCodeGenerator/Defs.lean index af88cf5a..07aea0f5 100644 --- a/Complexitylib/Circuits/BarringtonCodeGenerator/Defs.lean +++ b/Complexitylib/Circuits/BarringtonCodeGenerator/Defs.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.BarringtonCompiler.Defs -import Complexitylib.Circuits.BranchingProgramEncoding.Defs -import Complexitylib.Circuits.FormulaEncoding.Defs +module + +public import Complexitylib.Circuits.BarringtonCompiler.Defs +public import Complexitylib.Circuits.BranchingProgramEncoding.Defs +public import Complexitylib.Circuits.FormulaEncoding.Defs /-! # Pure bitstring target for the uniform Barrington generator @@ -17,6 +19,8 @@ program. Malformed formula codes map to the empty string; valid program codes are always nonempty because they start with an instruction-count field. -/ +@[expose] public section + namespace Complexity /-- Decode a formula code and emit the canonical code of its compiled diff --git a/Complexitylib/Circuits/BarringtonCodeGenerator/Internal.lean b/Complexitylib/Circuits/BarringtonCodeGenerator/Internal.lean index cb6e6c2f..19b79b78 100644 --- a/Complexitylib/Circuits/BarringtonCodeGenerator/Internal.lean +++ b/Complexitylib/Circuits/BarringtonCodeGenerator/Internal.lean @@ -3,15 +3,19 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.BarringtonCodeGenerator.Defs -import Complexitylib.Circuits.BarringtonCompiler -import Complexitylib.Circuits.BranchingProgramEncoding -import Complexitylib.Circuits.FormulaEncoding +module + +public import Complexitylib.Circuits.BarringtonCodeGenerator.Defs +public import Complexitylib.Circuits.BarringtonCompiler +public import Complexitylib.Circuits.BranchingProgramEncoding +public import Complexitylib.Circuits.FormulaEncoding /-! # Pure Barrington code-generator internals -/ +@[expose] public section + namespace Complexity /-- Internal bound placing every referenced variable below the formula-code diff --git a/Complexitylib/Circuits/BarringtonCompiler.lean b/Complexitylib/Circuits/BarringtonCompiler.lean index cbff84d7..d55b432b 100644 --- a/Complexitylib/Circuits/BarringtonCompiler.lean +++ b/Complexitylib/Circuits/BarringtonCompiler.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.BarringtonCompiler.Defs -import Complexitylib.Circuits.BarringtonCompiler.Internal +module + +public import Complexitylib.Circuits.BarringtonCompiler.Defs +public import Complexitylib.Circuits.BarringtonCompiler.Internal /-! # An executable Barrington compiler @@ -33,6 +35,8 @@ proof, not extraction of program data from an existential theorem. Barrington theorem for the fixed canonical target cycle. -/ +@[expose] public section + open scoped commutatorElement open Equiv diff --git a/Complexitylib/Circuits/BarringtonCompiler/Defs.lean b/Complexitylib/Circuits/BarringtonCompiler/Defs.lean index b9ca411b..3fafe0db 100644 --- a/Complexitylib/Circuits/BarringtonCompiler/Defs.lean +++ b/Complexitylib/Circuits/BarringtonCompiler/Defs.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Barrington -import Complexitylib.Circuits.BarringtonS5 -import Complexitylib.Circuits.Formula +module + +public import Complexitylib.Circuits.Barrington +public import Complexitylib.Circuits.BarringtonS5 +public import Complexitylib.Circuits.Formula /-! # An executable Barrington compiler -- definitions @@ -15,6 +17,8 @@ The original existence proof chooses conjugators and commutator factors inside the target-cycle decomposition and the resulting formula compiler executable. -/ +@[expose] public section + open scoped commutatorElement open Equiv diff --git a/Complexitylib/Circuits/BarringtonCompiler/Internal.lean b/Complexitylib/Circuits/BarringtonCompiler/Internal.lean index f1219847..9ef73106 100644 --- a/Complexitylib/Circuits/BarringtonCompiler/Internal.lean +++ b/Complexitylib/Circuits/BarringtonCompiler/Internal.lean @@ -3,13 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.BarringtonCompiler.Defs -import Complexitylib.Circuits.BarringtonLength +module + +public import Complexitylib.Circuits.BarringtonCompiler.Defs +public import Complexitylib.Circuits.BarringtonLength /-! # An executable Barrington compiler -- proof internals -/ +@[expose] public section + open scoped commutatorElement open Equiv diff --git a/Complexitylib/Circuits/BarringtonConverse.lean b/Complexitylib/Circuits/BarringtonConverse.lean index 6836bb0b..e9aa7660 100644 --- a/Complexitylib/Circuits/BarringtonConverse.lean +++ b/Complexitylib/Circuits/BarringtonConverse.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.BarringtonConverse.Internal +module + +public import Complexitylib.Circuits.BarringtonConverse.Internal /-! # The converse direction of Barrington's theorem @@ -26,6 +28,8 @@ equivalence under the library's total-assignment family convention. total-assignment equivalence -/ +@[expose] public section + namespace Complexity /-- Taking a binary ceiling logarithm of a polynomial bound yields an affine diff --git a/Complexitylib/Circuits/BarringtonConverse/Defs.lean b/Complexitylib/Circuits/BarringtonConverse/Defs.lean index 5dd91303..a00f6cf9 100644 --- a/Complexitylib/Circuits/BarringtonConverse/Defs.lean +++ b/Complexitylib/Circuits/BarringtonConverse/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.BarringtonFamily -import Mathlib.Data.List.OfFn +module + +public import Complexitylib.Circuits.BarringtonFamily +public import Mathlib.Data.List.OfFn /-! # The converse direction of Barrington's theorem -- definitions @@ -20,6 +22,8 @@ programs are evaluated on total assignments `ℕ → Bool`, while the family ind records the input-length parameter controlling depth and program length. -/ +@[expose] public section + namespace Complexity namespace BoolFormula diff --git a/Complexitylib/Circuits/BarringtonConverse/Internal.lean b/Complexitylib/Circuits/BarringtonConverse/Internal.lean index 93b2eeb3..38e04903 100644 --- a/Complexitylib/Circuits/BarringtonConverse/Internal.lean +++ b/Complexitylib/Circuits/BarringtonConverse/Internal.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.BarringtonConverse.Defs +module + +public import Complexitylib.Circuits.BarringtonConverse.Defs /-! # The converse direction of Barrington's theorem -- proof internals @@ -12,6 +14,8 @@ This file proves correctness and logarithmic depth for balanced branching-progra evaluation, then lifts that construction to polynomial-length families. -/ +@[expose] public section + open Equiv namespace Complexity diff --git a/Complexitylib/Circuits/BarringtonFamily.lean b/Complexitylib/Circuits/BarringtonFamily.lean index 4073459e..93a81284 100644 --- a/Complexitylib/Circuits/BarringtonFamily.lean +++ b/Complexitylib/Circuits/BarringtonFamily.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.BarringtonLength -import Mathlib.Data.Nat.Log +module + +public import Complexitylib.Circuits.BarringtonLength +public import Mathlib.Data.Nat.Log /-! # Barrington at the family level: `NC¹ ⊆` polynomial-size width-`5` branching programs @@ -31,6 +33,8 @@ applying the per-formula bound pointwise, together with the arithmetic fact that - `FormulaFamily.logDepth_polyLength_bp` — the family-level containment. -/ +@[expose] public section + open Equiv namespace Complexity diff --git a/Complexitylib/Circuits/BarringtonLength.lean b/Complexitylib/Circuits/BarringtonLength.lean index 6dfd8df8..62dcb6d3 100644 --- a/Complexitylib/Circuits/BarringtonLength.lean +++ b/Complexitylib/Circuits/BarringtonLength.lean @@ -3,10 +3,12 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.BarringtonBridge -import Complexitylib.Circuits.Formula -import Mathlib.Tactic.Linarith -import Mathlib.Data.Nat.Log +module + +public import Complexitylib.Circuits.BarringtonBridge +public import Complexitylib.Circuits.Formula +public import Mathlib.Tactic.Linarith +public import Mathlib.Data.Nat.Log /-! # Barrington's theorem with a length bound @@ -37,6 +39,8 @@ the classical `4 ^ depth` bound. the textbook `4 ^ depth` length bound. -/ +@[expose] public section + open scoped commutatorElement open Equiv diff --git a/Complexitylib/Circuits/BarringtonRepr.lean b/Complexitylib/Circuits/BarringtonRepr.lean index 5b887f76..0e12bb25 100644 --- a/Complexitylib/Circuits/BarringtonRepr.lean +++ b/Complexitylib/Circuits/BarringtonRepr.lean @@ -3,12 +3,14 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Barrington -import Complexitylib.Circuits.BarringtonS5 -import Complexitylib.Circuits.BarringtonBridge -import Complexitylib.Circuits.Formula -import Mathlib.GroupTheory.Perm.Cycle.Type -import Mathlib.GroupTheory.Perm.Fin +module + +public import Complexitylib.Circuits.Barrington +public import Complexitylib.Circuits.BarringtonS5 +public import Complexitylib.Circuits.BarringtonBridge +public import Complexitylib.Circuits.Formula +public import Mathlib.GroupTheory.Perm.Cycle.Type +public import Mathlib.GroupTheory.Perm.Fin /-! # Barrington's theorem (representation form) @@ -43,6 +45,8 @@ converse live in `BarringtonFamily.lean` and `BarringtonConverse.lean`. and a query point `x` whose orbit under the program's value decides `φ`. -/ +@[expose] public section + open scoped commutatorElement open Equiv diff --git a/Complexitylib/Circuits/BarringtonS5.lean b/Complexitylib/Circuits/BarringtonS5.lean index 2d368a36..70ebe57a 100644 --- a/Complexitylib/Circuits/BarringtonS5.lean +++ b/Complexitylib/Circuits/BarringtonS5.lean @@ -3,12 +3,14 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Mathlib.GroupTheory.Perm.Fin -import Mathlib.GroupTheory.Perm.Cycle.Type -import Mathlib.GroupTheory.Perm.Cycle.Concrete -import Mathlib.Algebra.Group.Commutator -import Mathlib.Tactic.NormNum.Prime -import Mathlib.Tactic.Common +module + +public import Mathlib.GroupTheory.Perm.Fin +public import Mathlib.GroupTheory.Perm.Cycle.Type +public import Mathlib.GroupTheory.Perm.Cycle.Concrete +public import Mathlib.Algebra.Group.Commutator +public import Mathlib.Tactic.NormNum.Prime +public import Mathlib.Tactic.Common /-! # The `S₅` five-cycle commutator (Barrington's non-solvability input) @@ -44,6 +46,8 @@ output cycle. commutator of two `5`-cycles. -/ +@[expose] public section + open scoped commutatorElement open Equiv diff --git a/Complexitylib/Circuits/BarringtonTyped.lean b/Complexitylib/Circuits/BarringtonTyped.lean index 58607595..0a274b88 100644 --- a/Complexitylib/Circuits/BarringtonTyped.lean +++ b/Complexitylib/Circuits/BarringtonTyped.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.BarringtonTyped.Defs -import Complexitylib.Circuits.BarringtonTyped.Internal +module + +public import Complexitylib.Circuits.BarringtonTyped.Defs +public import Complexitylib.Circuits.BarringtonTyped.Internal /-! # Fixed-arity nonuniform Barrington theorem @@ -22,6 +24,8 @@ model stores the unique zero-input answer separately. * `barrington_equivalence` -- the typed nonuniform class equivalence. -/ +@[expose] public section + namespace Complexity /-- Every fixed-arity logarithmic-depth formula family has an equivalent diff --git a/Complexitylib/Circuits/BarringtonTyped/Defs.lean b/Complexitylib/Circuits/BarringtonTyped/Defs.lean index b8a61016..e6e04ace 100644 --- a/Complexitylib/Circuits/BarringtonTyped/Defs.lean +++ b/Complexitylib/Circuits/BarringtonTyped/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.BarringtonConverse.Defs -import Complexitylib.Circuits.BitString +module + +public import Complexitylib.Circuits.BarringtonConverse.Defs +public import Complexitylib.Circuits.BitString /-! # Fixed-arity nonuniform Barrington families -- definitions @@ -24,6 +26,8 @@ Both objects denote `BoolFunFamily`, so the eventual equivalence has the correct fixed-arity semantic domain. -/ +@[expose] public section + namespace Complexity /-- A nonuniform family of formulas with an explicit arity bound on every diff --git a/Complexitylib/Circuits/BarringtonTyped/Internal.lean b/Complexitylib/Circuits/BarringtonTyped/Internal.lean index 886d4740..2e25fdfc 100644 --- a/Complexitylib/Circuits/BarringtonTyped/Internal.lean +++ b/Complexitylib/Circuits/BarringtonTyped/Internal.lean @@ -3,14 +3,18 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.BarringtonCompiler -import Complexitylib.Circuits.BarringtonConverse -import Complexitylib.Circuits.BarringtonTyped.Defs +module + +public import Complexitylib.Circuits.BarringtonCompiler +public import Complexitylib.Circuits.BarringtonConverse +public import Complexitylib.Circuits.BarringtonTyped.Defs /-! # Fixed-arity nonuniform Barrington families -- proof internals -/ +@[expose] public section + namespace Complexity /-- Compile every positive-arity formula through the fixed Barrington target. diff --git a/Complexitylib/Circuits/Basic.lean b/Complexitylib/Circuits/Basic.lean index 47d371f0..f69f4d03 100644 --- a/Complexitylib/Circuits/Basic.lean +++ b/Complexitylib/Circuits/Basic.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Mathlib.Data.Nat.Lattice +module + +public import Mathlib.Data.Nat.Lattice /-! # Boolean Circuit Complexity @@ -29,6 +31,8 @@ establishes the circuit size complexity measure for Boolean functions. * `Circuit.sizeComplexity_pos` — for complete bases, size complexity is positive -/ +@[expose] public section + namespace Complexity /-- A BitString of length `n`. -/ @@ -239,7 +243,8 @@ over `B` computes it. -/ def Realizable (B : Basis) (f : BitString N → Bool) : Prop := ∃ G, ∃ c : Circuit B N 1 G, (fun x => (c.eval x) 0) = f -private def realizationSizes (B : Basis) (f : BitString N → Bool) : Set Nat := +@[nolint docBlame] +def realizationSizes (B : Basis) (f : BitString N → Bool) : Set Nat := {s | ∃ G, ∃ c : Circuit B N 1 G, c.size = s ∧ (fun x => (c.eval x) 0) = f} @@ -264,7 +269,7 @@ noncomputable def sizeComplexity (B : Basis) [CompleteBasis B] (f : BitString N → Bool) : Nat := sInf (realizationSizes B f) -private theorem realizationSizes_nonempty [CompleteBasis B] +theorem realizationSizes_nonempty [CompleteBasis B] (f : BitString N → Bool) : (realizationSizes B f).Nonempty := by obtain ⟨G, c, hc⟩ := CompleteBasis.complete (B := B) (fun x => (fun _ : Fin 1 => f x)) diff --git a/Complexitylib/Circuits/BasisHom.lean b/Complexitylib/Circuits/BasisHom.lean index 788bcc70..5c666302 100644 --- a/Complexitylib/Circuits/BasisHom.lean +++ b/Complexitylib/Circuits/BasisHom.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.BasisHom.Defs -import Complexitylib.Circuits.BasisHom.Internal +module + +public import Complexitylib.Circuits.BasisHom.Defs +public import Complexitylib.Circuits.BasisHom.Internal /-! # Semantics-preserving maps between circuit bases @@ -14,6 +16,8 @@ Boolean semantics. Circuit transport along a homomorphism preserves semantics, gate count, wiring, and depth exactly. -/ +@[expose] public section + namespace Complexity namespace Gate diff --git a/Complexitylib/Circuits/BasisHom/Defs.lean b/Complexitylib/Circuits/BasisHom/Defs.lean index 458d71dc..c99c3e9e 100644 --- a/Complexitylib/Circuits/BasisHom/Defs.lean +++ b/Complexitylib/Circuits/BasisHom/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Family.Defs +module + +public import Complexitylib.Circuits.Family.Defs /-! # Semantics-preserving maps between circuit bases -- definitions @@ -16,6 +18,8 @@ labels; fan-in, wiring, negation flags, gate count, and circuit topology are preserved exactly. -/ +@[expose] public section + namespace Complexity /-- A semantics-preserving operation map between Boolean bases. -/ diff --git a/Complexitylib/Circuits/BasisHom/Internal.lean b/Complexitylib/Circuits/BasisHom/Internal.lean index 1e681a68..9c220edb 100644 --- a/Complexitylib/Circuits/BasisHom/Internal.lean +++ b/Complexitylib/Circuits/BasisHom/Internal.lean @@ -3,12 +3,16 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.BasisHom.Defs +module + +public import Complexitylib.Circuits.BasisHom.Defs /-! # Semantics-preserving maps between circuit bases -- proof internals -/ +@[expose] public section + namespace Complexity namespace Gate diff --git a/Complexitylib/Circuits/BitString.lean b/Complexitylib/Circuits/BitString.lean index 04b11c00..7b08d9f4 100644 --- a/Complexitylib/Circuits/BitString.lean +++ b/Complexitylib/Circuits/BitString.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Basic -import Mathlib.Data.List.OfFn +module + +public import Complexitylib.Circuits.Basic +public import Mathlib.Data.List.OfFn /-! # Fixed-length bit strings and lists @@ -17,6 +19,8 @@ The variable-length equivalence is already available from Mathlib as `List.equivSigmaTuple : List Bool ≃ Σ n, BitString n`. -/ +@[expose] public section + namespace Complexity namespace BitString diff --git a/Complexitylib/Circuits/BranchingProgram.lean b/Complexitylib/Circuits/BranchingProgram.lean index 3230980f..284acecd 100644 --- a/Complexitylib/Circuits/BranchingProgram.lean +++ b/Complexitylib/Circuits/BranchingProgram.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Mathlib.GroupTheory.Perm.Basic -import Mathlib.Algebra.BigOperators.Group.List.Basic -import Mathlib.Data.Finset.Basic +module + +public import Mathlib.GroupTheory.Perm.Basic +public import Mathlib.Algebra.BigOperators.Group.List.Basic +public import Mathlib.Data.Finset.Basic /-! # Permutation branching programs @@ -24,6 +26,8 @@ theorem). Barrington's inductive construction rests on -/ +@[expose] public section + namespace Complexity /-- A single width-`w` branching-program instruction: read variable `var`, and diff --git a/Complexitylib/Circuits/BranchingProgramEncoding.lean b/Complexitylib/Circuits/BranchingProgramEncoding.lean index c657cf53..b30d0dcc 100644 --- a/Complexitylib/Circuits/BranchingProgramEncoding.lean +++ b/Complexitylib/Circuits/BranchingProgramEncoding.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.BranchingProgramEncoding.Defs -import Complexitylib.Circuits.BranchingProgramEncoding.Internal +module + +public import Complexitylib.Circuits.BranchingProgramEncoding.Defs +public import Complexitylib.Circuits.BranchingProgramEncoding.Internal /-! # Canonical encoding of width-five branching programs @@ -28,6 +30,8 @@ finite permutation proofs on the machine tape. - `BPCode.Program.length_encode` -- exact serialization length. -/ +@[expose] public section + namespace Complexity namespace BPCode diff --git a/Complexitylib/Circuits/BranchingProgramEncoding/Defs.lean b/Complexitylib/Circuits/BranchingProgramEncoding/Defs.lean index 65938e14..ef5435b8 100644 --- a/Complexitylib/Circuits/BranchingProgramEncoding/Defs.lean +++ b/Complexitylib/Circuits/BranchingProgramEncoding/Defs.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.BarringtonCompiler.Defs -import Complexitylib.Circuits.Encoding.Defs -import Complexitylib.Mathlib.NatBits +module + +public import Complexitylib.Circuits.BarringtonCompiler.Defs +public import Complexitylib.Circuits.Encoding.Defs +public import Complexitylib.Mathlib.NatBits /-! # Machine-facing encoding of width-five branching programs @@ -21,6 +23,8 @@ permutation fields. A program starts with its instruction count, so exact decoding rejects truncation and trailing garbage. -/ +@[expose] public section + namespace Complexity namespace BPCode diff --git a/Complexitylib/Circuits/BranchingProgramEncoding/Internal.lean b/Complexitylib/Circuits/BranchingProgramEncoding/Internal.lean index c00165f0..4bb71199 100644 --- a/Complexitylib/Circuits/BranchingProgramEncoding/Internal.lean +++ b/Complexitylib/Circuits/BranchingProgramEncoding/Internal.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.BarringtonCompiler -import Complexitylib.Circuits.BranchingProgramEncoding.Defs -import Complexitylib.Circuits.Encoding +module + +public import Complexitylib.Circuits.BarringtonCompiler +public import Complexitylib.Circuits.BranchingProgramEncoding.Defs +public import Complexitylib.Circuits.Encoding /-! # Width-five branching-program codec internals @@ -15,6 +17,8 @@ Public statements are re-exported by `Complexitylib.Circuits.BranchingProgramEncoding`. -/ +@[expose] public section + set_option maxRecDepth 100000 namespace Complexity diff --git a/Complexitylib/Circuits/CircuitFormula.lean b/Complexitylib/Circuits/CircuitFormula.lean index d0db89af..eea620ac 100644 --- a/Complexitylib/Circuits/CircuitFormula.lean +++ b/Complexitylib/Circuits/CircuitFormula.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.CircuitFormula.Defs -import Complexitylib.Circuits.CircuitFormula.Internal +module + +public import Complexitylib.Circuits.CircuitFormula.Defs +public import Complexitylib.Circuits.CircuitFormula.Internal /-! # Unfolding fan-in-two circuit outputs into Boolean formulas @@ -30,6 +32,8 @@ size claim. is at most twice the selected output depth. -/ +@[expose] public section + namespace Complexity namespace BoolFormula diff --git a/Complexitylib/Circuits/CircuitFormula/Defs.lean b/Complexitylib/Circuits/CircuitFormula/Defs.lean index 4515d77f..2d6a88de 100644 --- a/Complexitylib/Circuits/CircuitFormula/Defs.lean +++ b/Complexitylib/Circuits/CircuitFormula/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.AndOrNot.Defs -import Complexitylib.Circuits.Formula +module + +public import Complexitylib.Circuits.AndOrNot.Defs +public import Complexitylib.Circuits.Formula /-! # Unfolding fan-in-two circuit outputs into Boolean formulas -- definitions @@ -14,6 +16,8 @@ output gate. Shared subcircuits are intentionally duplicated in the resulting formula tree; no formula-size claim is implicit in this bridge. -/ +@[expose] public section + namespace Complexity namespace BoolFormula diff --git a/Complexitylib/Circuits/CircuitFormula/Family.lean b/Complexitylib/Circuits/CircuitFormula/Family.lean index 446dbc94..4b871819 100644 --- a/Complexitylib/Circuits/CircuitFormula/Family.lean +++ b/Complexitylib/Circuits/CircuitFormula/Family.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.BarringtonTyped -import Complexitylib.Circuits.CircuitFormula.Family.Defs -import Complexitylib.Circuits.CircuitFormula.Family.Internal +module + +public import Complexitylib.Circuits.BarringtonTyped +public import Complexitylib.Circuits.CircuitFormula.Family.Defs +public import Complexitylib.Circuits.CircuitFormula.Family.Internal /-! # Circuit-family outputs as formula families @@ -24,6 +26,8 @@ when unfolded. Barrington's construction depends on formula depth, which the translation controls directly. -/ +@[expose] public section + namespace Complexity namespace Circuit diff --git a/Complexitylib/Circuits/CircuitFormula/Family/Defs.lean b/Complexitylib/Circuits/CircuitFormula/Family/Defs.lean index 07f93415..0b3bd60a 100644 --- a/Complexitylib/Circuits/CircuitFormula/Family/Defs.lean +++ b/Complexitylib/Circuits/CircuitFormula/Family/Defs.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.BarringtonConverse.Defs -import Complexitylib.Circuits.CircuitFormula.Defs -import Complexitylib.Circuits.Family.Defs +module + +public import Complexitylib.Circuits.BarringtonConverse.Defs +public import Complexitylib.Circuits.CircuitFormula.Defs +public import Complexitylib.Circuits.Family.Defs /-! # Circuit-family outputs as formula families -- definitions @@ -14,6 +16,8 @@ These definitions connect typed, length-indexed `CircuitFamily` semantics to the total-assignment convention used by the Barrington development. -/ +@[expose] public section + namespace Complexity namespace BoolFunFamily diff --git a/Complexitylib/Circuits/CircuitFormula/Family/Internal.lean b/Complexitylib/Circuits/CircuitFormula/Family/Internal.lean index 96d6dca5..671c61d8 100644 --- a/Complexitylib/Circuits/CircuitFormula/Family/Internal.lean +++ b/Complexitylib/Circuits/CircuitFormula/Family/Internal.lean @@ -3,14 +3,18 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.CircuitFormula -import Complexitylib.Circuits.CircuitFormula.Family.Defs -import Complexitylib.Circuits.DepthClasses +module + +public import Complexitylib.Circuits.CircuitFormula +public import Complexitylib.Circuits.CircuitFormula.Family.Defs +public import Complexitylib.Circuits.DepthClasses /-! # Circuit-family outputs as formula families -- proof internals -/ +@[expose] public section + namespace Complexity namespace Circuit diff --git a/Complexitylib/Circuits/CircuitFormula/Internal.lean b/Complexitylib/Circuits/CircuitFormula/Internal.lean index 29e3d4a4..c0d1da31 100644 --- a/Complexitylib/Circuits/CircuitFormula/Internal.lean +++ b/Complexitylib/Circuits/CircuitFormula/Internal.lean @@ -3,12 +3,16 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.CircuitFormula.Defs +module + +public import Complexitylib.Circuits.CircuitFormula.Defs /-! # Unfolding fan-in-two circuit outputs into Boolean formulas -- proof internals -/ +@[expose] public section + namespace Complexity namespace BoolFormula @@ -41,7 +45,7 @@ theorem depth_andOr_negateIf_le_internal (op : AndOrOp) all_goals omega -private theorem vars_negateIf_internal +theorem vars_negateIf_internal (negated : Bool) (formula : BoolFormula) : (negateIf negated formula).vars = formula.vars := by cases negated <;> simp [negateIf, vars] @@ -81,7 +85,7 @@ theorem depth_toBoolFormula_le_internal {W : ℕ} (wireFormula (gate.inputs ⟨0, by rw [fanIn_andOr2 gate]; omega⟩)) (wireFormula (gate.inputs ⟨1, by rw [fanIn_andOr2 gate]; omega⟩)) -private theorem vars_toBoolFormula_lt_internal {W N : ℕ} +theorem vars_toBoolFormula_lt_internal {W N : ℕ} (gate : Gate Basis.andOr2 W) (wireFormula : Fin W → BoolFormula) (hvars : ∀ input : Fin gate.fanIn, ∀ index, index ∈ (wireFormula (gate.inputs input)).vars → index < N) : @@ -120,6 +124,20 @@ theorem wireFormula_of_not_lt_internal simp only [hinput, dite_false] rfl +/-- Auxiliary: for a fan-in-two gate `g`, the `Fin.foldl` over its inputs +collapses to the `max` of the two input wire depths. Stated with `g` +universally quantified so the structure `obtain` avoids the fragile +`generalize` over a gate that appears in dependent index proofs. -/ +private theorem foldl_fanIn_two_max + (circuit : Circuit Basis.andOr2 N M G) (g : Gate Basis.andOr2 (N + G)) : + Fin.foldl g.fanIn (fun acc k => max acc (circuit.wireDepth (g.inputs k))) 0 = + max (circuit.wireDepth (g.inputs ⟨0, by rw [fanIn_andOr2 g]; omega⟩)) + (circuit.wireDepth (g.inputs ⟨1, by rw [fanIn_andOr2 g]; omega⟩)) := by + obtain ⟨op, fanIn, arityOk, inputs, negated⟩ := g + change fanIn = 2 at arityOk + subst arityOk + simp [Fin.foldl_succ_last, Fin.foldl_zero] + theorem wireDepth_of_not_lt_two_internal (circuit : Circuit Basis.andOr2 N M G) (wire : Fin (N + G)) (hinput : ¬ wire.val < N) : @@ -133,11 +151,7 @@ theorem wireDepth_of_not_lt_two_internal (circuit.wireDepth (gate.inputs input₁)) := by rw [Circuit.wireDepth_of_not_lt circuit wire hinput] dsimp only - generalize circuit.gates ⟨wire.val - N, by omega⟩ = gate - obtain ⟨op, fanIn, arityOk, inputs, negated⟩ := gate - change fanIn = 2 at arityOk - subst arityOk - simp [Fin.foldl_succ_last, Fin.foldl_zero] + exact congrArg (1 + ·) (foldl_fanIn_two_max circuit (circuit.gates ⟨wire.val - N, by omega⟩)) theorem outputDepth_two_internal (circuit : Circuit Basis.andOr2 N M G) (output : Fin M) : @@ -151,11 +165,7 @@ theorem outputDepth_two_internal (circuit.wireDepth (gate.inputs input₁)) := by unfold Circuit.outputDepth dsimp only - generalize circuit.outputs output = gate - obtain ⟨op, fanIn, arityOk, inputs, negated⟩ := gate - change fanIn = 2 at arityOk - subst arityOk - simp [Fin.foldl_succ_last, Fin.foldl_zero] + exact congrArg (1 + ·) (foldl_fanIn_two_max circuit (circuit.outputs output)) theorem eval_wireFormula_internal (circuit : Circuit Basis.andOr2 N M G) (assignment : ℕ → Bool) diff --git a/Complexitylib/Circuits/Composition.lean b/Complexitylib/Circuits/Composition.lean index e2628963..8c366552 100644 --- a/Complexitylib/Circuits/Composition.lean +++ b/Complexitylib/Circuits/Composition.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Composition.Defs -import Complexitylib.Circuits.Composition.Internal +module + +public import Complexitylib.Circuits.Composition.Defs +public import Complexitylib.Circuits.Composition.Internal /-! # Resource-accounted circuit composition @@ -20,6 +22,8 @@ size, rather than duplicating the inner circuit once per outer use. * `Circuit.depth_compose_le` -- depth is at most the sum of source depths. -/ +@[expose] public section + namespace Complexity namespace Gate diff --git a/Complexitylib/Circuits/Composition/Defs.lean b/Complexitylib/Circuits/Composition/Defs.lean index 37864c8c..ca166816 100644 --- a/Complexitylib/Circuits/Composition/Defs.lean +++ b/Complexitylib/Circuits/Composition/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Basic +module + +public import Complexitylib.Circuits.Basic /-! # Circuit composition -- definitions @@ -15,6 +17,8 @@ internal gates, the composite has exactly `G₁ + K + G₂` internal gates. Consequently its library size is the sum of the two source sizes. -/ +@[expose] public section + namespace Complexity namespace Gate diff --git a/Complexitylib/Circuits/Composition/Internal.lean b/Complexitylib/Circuits/Composition/Internal.lean index 6ba928cc..48dccd3f 100644 --- a/Complexitylib/Circuits/Composition/Internal.lean +++ b/Complexitylib/Circuits/Composition/Internal.lean @@ -3,12 +3,16 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Composition.Defs +module + +public import Complexitylib.Circuits.Composition.Defs /-! # Circuit composition -- proof internals -/ +@[expose] public section + namespace Complexity namespace Gate diff --git a/Complexitylib/Circuits/DecisionTree.lean b/Complexitylib/Circuits/DecisionTree.lean index 8eecb53e..cdadf2de 100644 --- a/Complexitylib/Circuits/DecisionTree.lean +++ b/Complexitylib/Circuits/DecisionTree.lean @@ -3,12 +3,14 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Mathlib.Data.Nat.Basic -import Mathlib.Data.Bool.Basic -import Mathlib.Data.Finset.Basic -import Mathlib.Data.Finset.Union -import Mathlib.Data.Finset.Card -import Complexitylib.Circuits.Formula +module + +public import Mathlib.Data.Nat.Basic +public import Mathlib.Data.Bool.Basic +public import Mathlib.Data.Finset.Basic +public import Mathlib.Data.Finset.Union +public import Mathlib.Data.Finset.Card +public import Complexitylib.Circuits.Formula /-! # Boolean decision trees @@ -34,6 +36,8 @@ are distinct from the DAG-shaped `Circuit`. equivalent Boolean formula (the decision-tree ⟹ formula direction) -/ +@[expose] public section + namespace Complexity /-- A Boolean decision tree: a `leaf` carries an output bit; a `node i t₀ t₁` diff --git a/Complexitylib/Circuits/DecisionTree/Block.lean b/Complexitylib/Circuits/DecisionTree/Block.lean index 5a0a4881..5c7feb0f 100644 --- a/Complexitylib/Circuits/DecisionTree/Block.lean +++ b/Complexitylib/Circuits/DecisionTree/Block.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.DecisionTree.Block.Defs -import Complexitylib.Circuits.DecisionTree.Block.Internal +module + +public import Complexitylib.Circuits.DecisionTree.Block.Defs +public import Complexitylib.Circuits.DecisionTree.Block.Internal /-! # Complete query blocks in finite decision trees @@ -14,6 +16,8 @@ queried before control reaches a continuation indexed by the collected finite restriction. -/ +@[expose] public section + namespace Complexity namespace DecisionTree.On diff --git a/Complexitylib/Circuits/DecisionTree/Block/Defs.lean b/Complexitylib/Circuits/DecisionTree/Block/Defs.lean index 03889526..31417f3a 100644 --- a/Complexitylib/Circuits/DecisionTree/Block/Defs.lean +++ b/Complexitylib/Circuits/DecisionTree/Block/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.DecisionTree.Path.Defs -import Complexitylib.Circuits.Restriction +module + +public import Complexitylib.Circuits.DecisionTree.Path.Defs +public import Complexitylib.Circuits.Restriction /-! # Complete query blocks in finite decision trees -- definitions @@ -15,6 +17,8 @@ the resulting finite restriction. This is the block operation used by the canonical switching tree. -/ +@[expose] public section + namespace Complexity namespace DecisionTree.On diff --git a/Complexitylib/Circuits/DecisionTree/Block/Internal.lean b/Complexitylib/Circuits/DecisionTree/Block/Internal.lean index 2522a4f1..2757ffc3 100644 --- a/Complexitylib/Circuits/DecisionTree/Block/Internal.lean +++ b/Complexitylib/Circuits/DecisionTree/Block/Internal.lean @@ -3,12 +3,16 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.DecisionTree.Block.Defs +module + +public import Complexitylib.Circuits.DecisionTree.Block.Defs /-! # Complete query blocks in finite decision trees -- proof internals -/ +@[expose] public section + namespace Complexity namespace DecisionTree.On diff --git a/Complexitylib/Circuits/DecisionTree/Finite.lean b/Complexitylib/Circuits/DecisionTree/Finite.lean index 5a72647f..8a8bf28b 100644 --- a/Complexitylib/Circuits/DecisionTree/Finite.lean +++ b/Complexitylib/Circuits/DecisionTree/Finite.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.DecisionTree.Finite.Defs -import Complexitylib.Circuits.DecisionTree.Finite.Internal +module + +public import Complexitylib.Circuits.DecisionTree.Finite.Defs +public import Complexitylib.Circuits.DecisionTree.Finite.Internal /-! # Finite-arity decision trees @@ -14,6 +16,8 @@ decision-tree representation used by finite switching and restriction arguments; no query can silently fall outside the sampled variable set. -/ +@[expose] public section + namespace Complexity namespace DecisionTree.On diff --git a/Complexitylib/Circuits/DecisionTree/Finite/Defs.lean b/Complexitylib/Circuits/DecisionTree/Finite/Defs.lean index f675c17d..1528f4ab 100644 --- a/Complexitylib/Circuits/DecisionTree/Finite/Defs.lean +++ b/Complexitylib/Circuits/DecisionTree/Finite/Defs.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.BitString -import Complexitylib.Circuits.DecisionTree -import Complexitylib.Circuits.Restriction +module + +public import Complexitylib.Circuits.BitString +public import Complexitylib.Circuits.DecisionTree +public import Complexitylib.Circuits.Restriction /-! # Finite-arity decision trees -- definitions @@ -15,6 +17,8 @@ arguments, however, count restrictions on exactly `N` variables. `DecisionTree.O N` makes that arity part of the type and prevents out-of-range queries. -/ +@[expose] public section + namespace Complexity namespace DecisionTree diff --git a/Complexitylib/Circuits/DecisionTree/Finite/Internal.lean b/Complexitylib/Circuits/DecisionTree/Finite/Internal.lean index bf78f06e..8f3208fe 100644 --- a/Complexitylib/Circuits/DecisionTree/Finite/Internal.lean +++ b/Complexitylib/Circuits/DecisionTree/Finite/Internal.lean @@ -3,12 +3,16 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.DecisionTree.Finite.Defs +module + +public import Complexitylib.Circuits.DecisionTree.Finite.Defs /-! # Finite-arity decision trees -- proof internals -/ +@[expose] public section + namespace Complexity namespace DecisionTree.On diff --git a/Complexitylib/Circuits/DecisionTree/NormalForm.lean b/Complexitylib/Circuits/DecisionTree/NormalForm.lean index 60fd32a4..1e56854c 100644 --- a/Complexitylib/Circuits/DecisionTree/NormalForm.lean +++ b/Complexitylib/Circuits/DecisionTree/NormalForm.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.DecisionTree.Finite -import Complexitylib.Circuits.DecisionTree.NormalForm.Defs -import Complexitylib.Circuits.DecisionTree.NormalForm.Internal +module + +public import Complexitylib.Circuits.DecisionTree.Finite +public import Complexitylib.Circuits.DecisionTree.NormalForm.Defs +public import Complexitylib.Circuits.DecisionTree.NormalForm.Internal /-! # Compiling finite decision trees to CNF and DNF @@ -16,6 +18,8 @@ compute exactly the original tree, have at most one component per leaf, and therefore have at most `2 ^ d` terms or clauses. -/ +@[expose] public section + namespace Complexity namespace DecisionTree.On diff --git a/Complexitylib/Circuits/DecisionTree/NormalForm/Defs.lean b/Complexitylib/Circuits/DecisionTree/NormalForm/Defs.lean index 4dae3e3a..f97bf76a 100644 --- a/Complexitylib/Circuits/DecisionTree/NormalForm/Defs.lean +++ b/Complexitylib/Circuits/DecisionTree/NormalForm/Defs.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.DecisionTree.Finite.Defs -import Complexitylib.Circuits.NormalForm.Defs -import Complexitylib.Circuits.NormalForm.Operations.Defs +module + +public import Complexitylib.Circuits.DecisionTree.Finite.Defs +public import Complexitylib.Circuits.NormalForm.Defs +public import Complexitylib.Circuits.NormalForm.Operations.Defs /-! # Compiling finite decision trees to CNF and DNF -- definitions @@ -16,6 +18,8 @@ The dual CNF is obtained by compiling the leaf-complemented tree and applying De Morgan negation. -/ +@[expose] public section + namespace Complexity namespace DecisionTree.On diff --git a/Complexitylib/Circuits/DecisionTree/NormalForm/Internal.lean b/Complexitylib/Circuits/DecisionTree/NormalForm/Internal.lean index 47ff1a4e..bf837521 100644 --- a/Complexitylib/Circuits/DecisionTree/NormalForm/Internal.lean +++ b/Complexitylib/Circuits/DecisionTree/NormalForm/Internal.lean @@ -3,14 +3,18 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.DecisionTree.Finite.Internal -import Complexitylib.Circuits.DecisionTree.NormalForm.Defs -import Complexitylib.Circuits.NormalForm.Operations.Internal +module + +public import Complexitylib.Circuits.DecisionTree.Finite.Internal +public import Complexitylib.Circuits.DecisionTree.NormalForm.Defs +public import Complexitylib.Circuits.NormalForm.Operations.Internal /-! # Compiling finite decision trees to CNF and DNF -- proof internals -/ +@[expose] public section + namespace Complexity namespace DecisionTree.On diff --git a/Complexitylib/Circuits/DecisionTree/Path.lean b/Complexitylib/Circuits/DecisionTree/Path.lean index 675b8f37..f149803d 100644 --- a/Complexitylib/Circuits/DecisionTree/Path.lean +++ b/Complexitylib/Circuits/DecisionTree/Path.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.DecisionTree.Path.Defs -import Complexitylib.Circuits.DecisionTree.Path.Internal +module + +public import Complexitylib.Circuits.DecisionTree.Path.Defs +public import Complexitylib.Circuits.DecisionTree.Path.Internal /-! # Canonical deepest paths in finite decision trees @@ -14,6 +16,8 @@ length is exactly the tree depth. For path-read-once trees, every prefix of that path is an embedding into the input coordinates. -/ +@[expose] public section + namespace Complexity namespace DecisionTree.On diff --git a/Complexitylib/Circuits/DecisionTree/Path/Defs.lean b/Complexitylib/Circuits/DecisionTree/Path/Defs.lean index 9db36768..409e8611 100644 --- a/Complexitylib/Circuits/DecisionTree/Path/Defs.lean +++ b/Complexitylib/Circuits/DecisionTree/Path/Defs.lean @@ -3,12 +3,16 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.DecisionTree.Finite.Defs +module + +public import Complexitylib.Circuits.DecisionTree.Finite.Defs /-! # Canonical deepest paths in finite decision trees -- definitions -/ +@[expose] public section + namespace Complexity namespace DecisionTree.On diff --git a/Complexitylib/Circuits/DecisionTree/Path/Internal.lean b/Complexitylib/Circuits/DecisionTree/Path/Internal.lean index 721cb4ca..7ff7812c 100644 --- a/Complexitylib/Circuits/DecisionTree/Path/Internal.lean +++ b/Complexitylib/Circuits/DecisionTree/Path/Internal.lean @@ -3,13 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.DecisionTree.Path.Defs -import Complexitylib.Circuits.DecisionTree.Finite.Internal +module + +public import Complexitylib.Circuits.DecisionTree.Path.Defs +public import Complexitylib.Circuits.DecisionTree.Finite.Internal /-! # Canonical deepest paths in finite decision trees -- proof internals -/ +@[expose] public section + namespace Complexity namespace DecisionTree.On diff --git a/Complexitylib/Circuits/DecisionTree/Restriction.lean b/Complexitylib/Circuits/DecisionTree/Restriction.lean index 0923e9bc..98c6b6ea 100644 --- a/Complexitylib/Circuits/DecisionTree/Restriction.lean +++ b/Complexitylib/Circuits/DecisionTree/Restriction.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.DecisionTree -import Complexitylib.Circuits.Restriction +module + +public import Complexitylib.Circuits.DecisionTree +public import Complexitylib.Circuits.Restriction /-! # Restricting decision trees @@ -23,6 +25,8 @@ simplification used when switching-lemma arguments measure decision-tree depth. left-biased restriction composition. -/ +@[expose] public section + namespace Complexity namespace DecisionTree diff --git a/Complexitylib/Circuits/Dependency.lean b/Complexitylib/Circuits/Dependency.lean index 02a3ee25..7bf9e0ea 100644 --- a/Complexitylib/Circuits/Dependency.lean +++ b/Complexitylib/Circuits/Dependency.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Dependency.Defs -import Complexitylib.Circuits.Dependency.Internal +module + +public import Complexitylib.Circuits.Dependency.Defs +public import Complexitylib.Circuits.Dependency.Internal /-! # Circuit dependency graphs @@ -22,6 +24,8 @@ referenced wire to the gate that reads it. bounded by total fan-in. -/ +@[expose] public section + namespace Complexity namespace Circuit diff --git a/Complexitylib/Circuits/Dependency/Defs.lean b/Complexitylib/Circuits/Dependency/Defs.lean index e9586e2f..b00e2e5a 100644 --- a/Complexitylib/Circuits/Dependency/Defs.lean +++ b/Complexitylib/Circuits/Dependency/Defs.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Basic -import Complexitylib.Mathlib.Digraph -import Mathlib.Data.Fintype.BigOperators +module + +public import Complexitylib.Circuits.Basic +public import Complexitylib.Mathlib.Digraph +public import Mathlib.Data.Fintype.BigOperators /-! # Circuit dependency graphs -- definitions @@ -17,6 +19,8 @@ of the same wire at the same gate collapse in the graph's edge set, while `Circuit.totalFanIn` continues to count them with multiplicity. -/ +@[expose] public section + namespace Complexity namespace Circuit diff --git a/Complexitylib/Circuits/Dependency/Internal.lean b/Complexitylib/Circuits/Dependency/Internal.lean index 98666c10..1717fa9b 100644 --- a/Complexitylib/Circuits/Dependency/Internal.lean +++ b/Complexitylib/Circuits/Dependency/Internal.lean @@ -3,12 +3,16 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Dependency.Defs +module + +public import Complexitylib.Circuits.Dependency.Defs /-! # Circuit dependency graphs -- proof internals -/ +@[expose] public section + namespace Complexity namespace Circuit diff --git a/Complexitylib/Circuits/DepthClasses.lean b/Complexitylib/Circuits/DepthClasses.lean index f73afda4..ddd07599 100644 --- a/Complexitylib/Circuits/DepthClasses.lean +++ b/Complexitylib/Circuits/DepthClasses.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.DepthClasses.Defs -import Complexitylib.Circuits.DepthClasses.Internal +module + +public import Complexitylib.Circuits.DepthClasses.Defs +public import Complexitylib.Circuits.DepthClasses.Internal /-! # Circuit depth classes @@ -24,6 +26,8 @@ These definitions are explicitly nonuniform. Generator uniformity is an additional predicate and is not implicit in the names `NC`, `AC`, or `TC`. -/ +@[expose] public section + namespace Complexity /-- The exponent-zero polylogarithmic envelope is the constant `c`. -/ diff --git a/Complexitylib/Circuits/DepthClasses/Defs.lean b/Complexitylib/Circuits/DepthClasses/Defs.lean index 43284c90..c2b30f5a 100644 --- a/Complexitylib/Circuits/DepthClasses/Defs.lean +++ b/Complexitylib/Circuits/DepthClasses/Defs.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.AndOrNot.Defs -import Complexitylib.Circuits.Family.Defs -import Complexitylib.Circuits.Threshold.Defs -import Mathlib.Data.Nat.Log +module + +public import Complexitylib.Circuits.AndOrNot.Defs +public import Complexitylib.Circuits.Family.Defs +public import Complexitylib.Circuits.Threshold.Defs +public import Mathlib.Data.Nat.Log /-! # Circuit depth classes -- definitions @@ -20,6 +22,8 @@ AND/OR circuits. Both require polynomial size and depth `O((log n + 1)^i)` in an explicit pointwise form. -/ +@[expose] public section + namespace Complexity /-- A concrete `O((log₂ n + 1)^i)` depth envelope with multiplicative diff --git a/Complexitylib/Circuits/DepthClasses/Internal.lean b/Complexitylib/Circuits/DepthClasses/Internal.lean index 5806d185..abd483ff 100644 --- a/Complexitylib/Circuits/DepthClasses/Internal.lean +++ b/Complexitylib/Circuits/DepthClasses/Internal.lean @@ -3,15 +3,19 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.DepthClasses.Defs -import Complexitylib.Circuits.BasisHom -import Complexitylib.Circuits.Family -import Complexitylib.Circuits.Threshold +module + +public import Complexitylib.Circuits.DepthClasses.Defs +public import Complexitylib.Circuits.BasisHom +public import Complexitylib.Circuits.Family +public import Complexitylib.Circuits.Threshold /-! # Circuit depth classes -- proof internals -/ +@[expose] public section + namespace Complexity theorem polylogDepth_zero_internal (c n : ℕ) : diff --git a/Complexitylib/Circuits/Encoding.lean b/Complexitylib/Circuits/Encoding.lean index 7ce5ecfd..bcbb2e34 100644 --- a/Complexitylib/Circuits/Encoding.lean +++ b/Complexitylib/Circuits/Encoding.lean @@ -3,14 +3,16 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Defs -import Complexitylib.Circuits.Encoding.Fragment -import Complexitylib.Circuits.Encoding.Formula -import Complexitylib.Circuits.Encoding.Formula.Batch -import Complexitylib.Circuits.Encoding.Formula.Stream -import Complexitylib.Circuits.Encoding.Internal -import Complexitylib.Circuits.Encoding.Threshold -import Complexitylib.Circuits.Encoding.ToCircuit +module + +public import Complexitylib.Circuits.Encoding.Defs +public import Complexitylib.Circuits.Encoding.Fragment +public import Complexitylib.Circuits.Encoding.Formula +public import Complexitylib.Circuits.Encoding.Formula.Batch +public import Complexitylib.Circuits.Encoding.Formula.Stream +public import Complexitylib.Circuits.Encoding.Internal +public import Complexitylib.Circuits.Encoding.Threshold +public import Complexitylib.Circuits.Encoding.ToCircuit /-! # Encoded fan-in-two circuits @@ -52,6 +54,8 @@ This module exposes the machine-facing representation of - `Threshold.evalAux?_compileRaw`: exact threshold-fragment evaluation. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Defs.lean b/Complexitylib/Circuits/Encoding/Defs.lean index 4101fd1f..8e1133e7 100644 --- a/Complexitylib/Circuits/Encoding/Defs.lean +++ b/Complexitylib/Circuits/Encoding/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.AndOrNot.Defs +module + +public import Complexitylib.Circuits.AndOrNot.Defs /-! # Machine-facing encoding of fan-in-two AND/OR circuits @@ -26,6 +28,8 @@ format polynomially long in the input arity and number of gates; a binary format can be added later without changing the raw circuit semantics. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Family.lean b/Complexitylib/Circuits/Encoding/Family.lean index b4eb1ed7..fd33eee9 100644 --- a/Complexitylib/Circuits/Encoding/Family.lean +++ b/Complexitylib/Circuits/Encoding/Family.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding -import Complexitylib.Circuits.Family -import Complexitylib.Encoding.Pairing +module + +public import Complexitylib.Circuits.Encoding +public import Complexitylib.Circuits.Family +public import Complexitylib.Encoding.Pairing /-! # Encodings of whole circuit families @@ -15,6 +17,8 @@ codec. A leading tag distinguishes the explicit empty-input answer from an ordinary encoded circuit. -/ +@[expose] public section + namespace Complexity namespace CircuitFamily diff --git a/Complexitylib/Circuits/Encoding/Formula.lean b/Complexitylib/Circuits/Encoding/Formula.lean index a9128718..5f320f8a 100644 --- a/Complexitylib/Circuits/Encoding/Formula.lean +++ b/Complexitylib/Circuits/Encoding/Formula.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Formula.Internal +module + +public import Complexitylib.Circuits.Encoding.Formula.Internal /-! # Correctness of Boolean-formula raw compilation @@ -26,6 +28,8 @@ circuits; circuit families handle their zero-input member separately. correctness; `evalAux?_compileRaw` is the all-existing-wires corollary. -/ +@[expose] public section + namespace Complexity namespace BoolFormula diff --git a/Complexitylib/Circuits/Encoding/Formula/Batch.lean b/Complexitylib/Circuits/Encoding/Formula/Batch.lean index 84427cfd..e0c20f32 100644 --- a/Complexitylib/Circuits/Encoding/Formula/Batch.lean +++ b/Complexitylib/Circuits/Encoding/Formula/Batch.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Formula.Batch.Internal +module + +public import Complexitylib.Circuits.Encoding.Formula.Batch.Internal /-! # Batch compilation of Boolean formulas @@ -23,6 +25,8 @@ all results in one contiguous block starting at `rawBatchOutputBase`. - `BoolFormula.evalAux?_compileRawBatch`: exact packed-output semantics. -/ +@[expose] public section + namespace Complexity namespace BoolFormula diff --git a/Complexitylib/Circuits/Encoding/Formula/Batch/Defs.lean b/Complexitylib/Circuits/Encoding/Formula/Batch/Defs.lean index 6ef118f3..0a4c71a6 100644 --- a/Complexitylib/Circuits/Encoding/Formula/Batch/Defs.lean +++ b/Complexitylib/Circuits/Encoding/Formula/Batch/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Formula.Defs +module + +public import Complexitylib.Circuits.Encoding.Formula.Defs /-! # Batch compilation of Boolean formulas @@ -19,6 +21,8 @@ result by a base wire and an index without retaining the variable-sized offset of every formula tree. -/ +@[expose] public section + namespace Complexity namespace BoolFormula diff --git a/Complexitylib/Circuits/Encoding/Formula/Batch/Internal.lean b/Complexitylib/Circuits/Encoding/Formula/Batch/Internal.lean index 17cda545..ccd5d022 100644 --- a/Complexitylib/Circuits/Encoding/Formula/Batch/Internal.lean +++ b/Complexitylib/Circuits/Encoding/Formula/Batch/Internal.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Formula.Batch.Defs -import Complexitylib.Circuits.Encoding.Formula.Internal +module + +public import Complexitylib.Circuits.Encoding.Formula.Batch.Defs +public import Complexitylib.Circuits.Encoding.Formula.Internal /-! # Internals for batch formula compilation @@ -14,6 +16,8 @@ for `BoolFormula.compileRawBatch`. Public statements are re-exported by `Complexitylib.Circuits.Encoding.Formula.Batch`. -/ +@[expose] public section + namespace Complexity namespace BoolFormula diff --git a/Complexitylib/Circuits/Encoding/Formula/Defs.lean b/Complexitylib/Circuits/Encoding/Formula/Defs.lean index b9cbef97..a01ab55f 100644 --- a/Complexitylib/Circuits/Encoding/Formula/Defs.lean +++ b/Complexitylib/Circuits/Encoding/Formula/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Fragment.Defs -import Complexitylib.Circuits.Formula +module + +public import Complexitylib.Circuits.Encoding.Fragment.Defs +public import Complexitylib.Circuits.Formula /-! # Compile Boolean formulas to raw circuit fragments @@ -19,6 +21,8 @@ existing wire together with its negation, while formula negation uses the raw gate's free edge-negation flags. Binary formulas are emitted in postorder. -/ +@[expose] public section + namespace Complexity namespace BoolFormula diff --git a/Complexitylib/Circuits/Encoding/Formula/Internal.lean b/Complexitylib/Circuits/Encoding/Formula/Internal.lean index d59648b3..7b8b1d0e 100644 --- a/Complexitylib/Circuits/Encoding/Formula/Internal.lean +++ b/Complexitylib/Circuits/Encoding/Formula/Internal.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Formula.Defs -import Complexitylib.Circuits.Encoding.Fragment +module + +public import Complexitylib.Circuits.Encoding.Formula.Defs +public import Complexitylib.Circuits.Encoding.Fragment /-! # Boolean-formula raw compiler internals @@ -14,6 +16,8 @@ formula compiler. Public statements are re-exported by `Complexitylib.Circuits.Encoding.Formula`. -/ +@[expose] public section + namespace Complexity namespace BoolFormula diff --git a/Complexitylib/Circuits/Encoding/Formula/Stream.lean b/Complexitylib/Circuits/Encoding/Formula/Stream.lean index 5d2bf38d..c660eb14 100644 --- a/Complexitylib/Circuits/Encoding/Formula/Stream.lean +++ b/Complexitylib/Circuits/Encoding/Formula/Stream.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Formula.Stream.Defs -import Complexitylib.Circuits.Encoding.Formula.Stream.Internal +module + +public import Complexitylib.Circuits.Encoding.Formula.Stream.Defs +public import Complexitylib.Circuits.Encoding.Formula.Stream.Internal /-! # Stack-free streams for finite Boolean folds @@ -26,6 +28,8 @@ recomputation; no executable cursor is claimed here. - `BoolFormula.length_compileRawRightFold` gives its exact gate count. -/ +@[expose] public section + namespace Complexity namespace BoolFormula diff --git a/Complexitylib/Circuits/Encoding/Formula/Stream/Defs.lean b/Complexitylib/Circuits/Encoding/Formula/Stream/Defs.lean index 747a92d8..f7d4496f 100644 --- a/Complexitylib/Circuits/Encoding/Formula/Stream/Defs.lean +++ b/Complexitylib/Circuits/Encoding/Formula/Stream/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Formula.Batch.Defs +module + +public import Complexitylib.Circuits.Encoding.Formula.Batch.Defs /-! # Stack-free streams for finite Boolean folds — definitions @@ -15,6 +17,8 @@ connectors from right to left. This module names the connector suffix used by that decomposition. -/ +@[expose] public section + namespace Complexity namespace BoolFormula diff --git a/Complexitylib/Circuits/Encoding/Formula/Stream/Internal.lean b/Complexitylib/Circuits/Encoding/Formula/Stream/Internal.lean index 80ca456a..ca12f662 100644 --- a/Complexitylib/Circuits/Encoding/Formula/Stream/Internal.lean +++ b/Complexitylib/Circuits/Encoding/Formula/Stream/Internal.lean @@ -3,13 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Formula.Batch -import Complexitylib.Circuits.Encoding.Formula.Stream.Defs +module + +public import Complexitylib.Circuits.Encoding.Formula.Batch +public import Complexitylib.Circuits.Encoding.Formula.Stream.Defs /-! # Stack-free streams for finite Boolean folds — proof internals -/ +@[expose] public section + namespace Complexity namespace BoolFormula diff --git a/Complexitylib/Circuits/Encoding/Fragment.lean b/Complexitylib/Circuits/Encoding/Fragment.lean index 5dabf81c..967c7550 100644 --- a/Complexitylib/Circuits/Encoding/Fragment.lean +++ b/Complexitylib/Circuits/Encoding/Fragment.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Internal.Fragment +module + +public import Complexitylib.Circuits.Encoding.Internal.Fragment /-! # Appendable raw-circuit fragments @@ -14,6 +16,8 @@ Evaluation passes the memo array from one fragment to the next, and successful evaluation preserves every previously available wire. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Fragment/Defs.lean b/Complexitylib/Circuits/Encoding/Fragment/Defs.lean index c8c6be24..ef55e91a 100644 --- a/Complexitylib/Circuits/Encoding/Fragment/Defs.lean +++ b/Complexitylib/Circuits/Encoding/Fragment/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Defs +module + +public import Complexitylib.Circuits.Encoding.Defs /-! # Primitive raw-circuit fragment gates @@ -14,6 +16,8 @@ existing wire, while a wire paired with its negation supplies either Boolean constant. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Internal.lean b/Complexitylib/Circuits/Encoding/Internal.lean index b0816e4e..5478c7c7 100644 --- a/Complexitylib/Circuits/Encoding/Internal.lean +++ b/Complexitylib/Circuits/Encoding/Internal.lean @@ -3,10 +3,12 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Internal.Codec -import Complexitylib.Circuits.Encoding.Internal.Fragment -import Complexitylib.Circuits.Encoding.Internal.Semantics -import Complexitylib.Circuits.Encoding.Internal.ToCircuit +module + +public import Complexitylib.Circuits.Encoding.Internal.Codec +public import Complexitylib.Circuits.Encoding.Internal.Fragment +public import Complexitylib.Circuits.Encoding.Internal.Semantics +public import Complexitylib.Circuits.Encoding.Internal.ToCircuit /-! # Encoded-circuit proof internals @@ -15,3 +17,5 @@ Aggregation module for the codec, appendable-fragment laws, semantics, and raw-to-typed reconstruction internals of the canonical fan-in-two circuit encoding. -/ + +@[expose] public section diff --git a/Complexitylib/Circuits/Encoding/Internal/Codec.lean b/Complexitylib/Circuits/Encoding/Internal/Codec.lean index e9239ce9..6897e289 100644 --- a/Complexitylib/Circuits/Encoding/Internal/Codec.lean +++ b/Complexitylib/Circuits/Encoding/Internal/Codec.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Defs +module + +public import Complexitylib.Circuits.Encoding.Defs /-! # Correctness of the machine-facing circuit codec @@ -14,6 +16,8 @@ invariants. Semantic agreement with typed circuit evaluation is deliberately kept in a separate proof layer. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Internal/Fragment.lean b/Complexitylib/Circuits/Encoding/Internal/Fragment.lean index 136f37aa..6e0f46de 100644 --- a/Complexitylib/Circuits/Encoding/Internal/Fragment.lean +++ b/Complexitylib/Circuits/Encoding/Internal/Fragment.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Internal.Codec -import Complexitylib.Circuits.Encoding.Fragment.Defs +module + +public import Complexitylib.Circuits.Encoding.Internal.Codec +public import Complexitylib.Circuits.Encoding.Fragment.Defs /-! # Internal laws for appendable raw-circuit fragments @@ -14,6 +16,8 @@ iterative raw-circuit evaluator. The statements are exposed by `Complexitylib.Circuits.Encoding.Fragment`. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Internal/Semantics.lean b/Complexitylib/Circuits/Encoding/Internal/Semantics.lean index 7d055fcb..83484634 100644 --- a/Complexitylib/Circuits/Encoding/Internal/Semantics.lean +++ b/Complexitylib/Circuits/Encoding/Internal/Semantics.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.BitString -import Complexitylib.Circuits.Encoding.Internal.Codec -import Complexitylib.Circuits.Internal.CircuitToDescriptor +module + +public import Complexitylib.Circuits.BitString +public import Complexitylib.Circuits.Encoding.Internal.Codec +public import Complexitylib.Circuits.Internal.CircuitToDescriptor /-! # Internal: semantics of encoded fan-in-two circuits @@ -17,6 +19,8 @@ ordered gates have run, the evaluator's array contains exactly the values of descriptor wires `0, ..., N + k - 1`. -/ +@[expose] public section + namespace Complexity open CircDesc diff --git a/Complexitylib/Circuits/Encoding/Internal/ToCircuit.lean b/Complexitylib/Circuits/Encoding/Internal/ToCircuit.lean index cea6ad8d..d3a3eb5d 100644 --- a/Complexitylib/Circuits/Encoding/Internal/ToCircuit.lean +++ b/Complexitylib/Circuits/Encoding/Internal/ToCircuit.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Internal.Semantics -import Complexitylib.Circuits.Encoding.ToCircuit.Defs +module + +public import Complexitylib.Circuits.Encoding.Internal.Semantics +public import Complexitylib.Circuits.Encoding.ToCircuit.Defs /-! # Internal correctness of raw-to-typed circuit reconstruction @@ -14,6 +16,8 @@ them is an exact round trip. Semantic correctness is consequently inherited from the existing typed-to-raw evaluator theorem rather than reproved. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Machine.lean b/Complexitylib/Circuits/Encoding/Machine.lean index 5f8fc754..20d5632e 100644 --- a/Complexitylib/Circuits/Encoding/Machine.lean +++ b/Complexitylib/Circuits/Encoding/Machine.lean @@ -3,12 +3,14 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Machine.Defs -import Complexitylib.Circuits.Encoding.Machine.Core -import Complexitylib.Circuits.Encoding.Machine.Internal.FrontEnd -import Complexitylib.Circuits.Encoding.Machine.GateStream -import Complexitylib.Circuits.Encoding.Machine.NatCode -import Complexitylib.Circuits.Encoding.Machine.RawGate +module + +public import Complexitylib.Circuits.Encoding.Machine.Defs +public import Complexitylib.Circuits.Encoding.Machine.Core +public import Complexitylib.Circuits.Encoding.Machine.Internal.FrontEnd +public import Complexitylib.Circuits.Encoding.Machine.GateStream +public import Complexitylib.Circuits.Encoding.Machine.NatCode +public import Complexitylib.Circuits.Encoding.Machine.RawGate /-! # Serialized circuit-evaluator machine @@ -37,6 +39,8 @@ its final verdict. first-unused-wire counter after one emitted gate. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Machine/Core.lean b/Complexitylib/Circuits/Encoding/Machine/Core.lean index 2ca63edc..08c39e3b 100644 --- a/Complexitylib/Circuits/Encoding/Machine/Core.lean +++ b/Complexitylib/Circuits/Encoding/Machine/Core.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Machine.Core.Defs -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Evaluator -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Hoare +module + +public import Complexitylib.Circuits.Encoding.Machine.Core.Defs +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Evaluator +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Hoare /-! # Verified serialized-circuit evaluator @@ -26,6 +28,8 @@ concrete quadratic bound. - `evalFamilyTime_bigO_quadratic` proves the end-to-end budget is `O(n^2)`. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Machine/Core/Defs.lean b/Complexitylib/Circuits/Encoding/Machine/Core/Defs.lean index 90b484c6..47aa3101 100644 --- a/Complexitylib/Circuits/Encoding/Machine/Core/Defs.lean +++ b/Complexitylib/Circuits/Encoding/Machine/Core/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Machine.Defs +module + +public import Complexitylib.Circuits.Encoding.Machine.Defs /-! # Streaming serialized-circuit evaluator core @@ -19,6 +21,8 @@ each head action. Consequently `evalFamilyCoreTM` satisfies `TM.δ_right_of_start` structurally rather than through a large case proof. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Machine/Core/Internal.lean b/Complexitylib/Circuits/Encoding/Machine/Core/Internal.lean index 5aa930f0..518254d1 100644 --- a/Complexitylib/Circuits/Encoding/Machine/Core/Internal.lean +++ b/Complexitylib/Circuits/Encoding/Machine/Core/Internal.lean @@ -3,22 +3,24 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Action -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.EmptyReject -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.PositiveReject -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.Gate -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.Gate.Attempt -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.Gate.Reject -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.Gate.Loop -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.Gate.LoopReject -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.PositiveLoopReject -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.Family -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Evaluator -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Hoare -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Pure -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Stage -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Tape +module + +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Action +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.EmptyReject +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.PositiveReject +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.Gate +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.Gate.Attempt +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.Gate.Reject +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.Gate.Loop +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.Gate.LoopReject +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.PositiveLoopReject +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.Family +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Evaluator +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Hoare +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Pure +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Stage +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Tape /-! # Streaming evaluator proof internals @@ -27,3 +29,5 @@ Internal aggregation module for the evaluator's action, exact execution, successful and rejecting gate loops, total tagged-family semantics, quadratic core and end-to-end contracts, and tape-cursor proof seams. -/ + +@[expose] public section diff --git a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Action.lean b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Action.lean index c3edaf77..110f2deb 100644 --- a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Action.lean +++ b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Action.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Machine.Core.Defs +module + +public import Complexitylib.Circuits.Encoding.Machine.Core.Defs /-! # Projection lemmas for streaming evaluator actions @@ -13,6 +15,8 @@ actions behind the finite-index projections used by `TM.δ`. They keep later one-step proofs independent of the implementation's nested index tests. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Evaluator.lean b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Evaluator.lean index de61db18..8cedf087 100644 --- a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Evaluator.lean +++ b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Evaluator.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Asymptotics -import Complexitylib.Circuits.Encoding.Machine.Internal.FrontEnd -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Hoare -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Stage +module + +public import Complexitylib.Asymptotics +public import Complexitylib.Circuits.Encoding.Machine.Internal.FrontEnd +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Hoare +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Stage /-! # End-to-end serialized circuit evaluator @@ -17,6 +19,8 @@ machine as a decider for `circuitEvalLanguage`, and records the concrete quadratic running-time bound. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution.lean b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution.lean index 6bde4751..d5edde4e 100644 --- a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution.lean +++ b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Action -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Tape -import Complexitylib.Models.TuringMachine.Subroutines.Counter +module + +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Action +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Tape +public import Complexitylib.Models.TuringMachine.Subroutines.Counter /-! # Execution seams for the streaming circuit evaluator @@ -17,6 +19,8 @@ reduce one machine step to the corresponding named `CoreAction`, without reopening the finite-index projection plumbing. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/EmptyReject.lean b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/EmptyReject.lean index b13635fe..3cdbe613 100644 --- a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/EmptyReject.lean +++ b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/EmptyReject.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Pure +module + +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Pure /-! # Malformed empty-family execution @@ -15,6 +17,8 @@ answer bit: a missing answer rejects in two steps, while trailing data rejects in three. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Family.lean b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Family.lean index bbf69b83..570e7d77 100644 --- a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Family.lean +++ b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Family.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.EmptyReject -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.PositiveLoopReject -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.PositiveReject +module + +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.EmptyReject +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.PositiveLoopReject +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.PositiveReject /-! # Total tagged-family core execution @@ -15,6 +17,8 @@ count, and counted gate-loop branches. The output is the defaulted pure verdict: successful Boolean results are preserved and every malformed stream writes zero. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Gate.lean b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Gate.lean index 0dc1ee57..01497751 100644 --- a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Gate.lean +++ b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Gate.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution +module + +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution /-! # One-gate execution for the streaming circuit evaluator @@ -19,6 +21,8 @@ within this controller. They are the reusable proof-engineering seam between `CoreAction` and exact named configurations. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Gate/Attempt.lean b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Gate/Attempt.lean index e90832d3..9bf0d16b 100644 --- a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Gate/Attempt.lean +++ b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Gate/Attempt.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.Gate -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Pure +module + +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.Gate +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Pure /-! # Pure-to-machine gate-attempt bridge @@ -15,6 +17,8 @@ the first reference, so the machine runtime is existential but carries a uniform linear bound in the current wire-memo length. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Gate/Loop.lean b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Gate/Loop.lean index 26b4a844..e3baa5de 100644 --- a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Gate/Loop.lean +++ b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Gate/Loop.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.Gate.Attempt +module + +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.Gate.Attempt /-! # Successful gate-stream execution @@ -15,6 +17,8 @@ memo length. The resulting budget is quadratic once the maximum memo length is bounded by input length plus gate count. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Gate/LoopReject.lean b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Gate/LoopReject.lean index d9252897..88a41d2a 100644 --- a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Gate/LoopReject.lean +++ b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Gate/LoopReject.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.Gate.Loop -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.Gate.Reject +module + +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.Gate.Loop +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.Gate.Reject /-! # Rejecting gate-stream execution @@ -15,6 +17,8 @@ the same named budget, while preserving a well-formed counter remainder and recording the machine's zero verdict. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Gate/Reject.lean b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Gate/Reject.lean index d35a5298..e73d12fa 100644 --- a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Gate/Reject.lean +++ b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Gate/Reject.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.Gate -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Pure +module + +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.Gate +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Pure /-! # Rejecting gate attempts @@ -15,6 +17,8 @@ the current wire memo. Every path first consumes exactly one gate-count mark and then halts with an explicit zero write. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/PositiveLoopReject.lean b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/PositiveLoopReject.lean index 2fcd3461..434de0f9 100644 --- a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/PositiveLoopReject.lean +++ b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/PositiveLoopReject.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.Gate.LoopReject +module + +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.Gate.LoopReject /-! # Rejecting decoded positive-family execution @@ -13,6 +15,8 @@ positive-family header. It shares the successful branch's named budgets while retaining a well-formed counter remainder and an explicit zero verdict. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/PositiveReject.lean b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/PositiveReject.lean index a7f30da7..e79c96f2 100644 --- a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/PositiveReject.lean +++ b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/PositiveReject.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Internal.Codec -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution +module + +public import Complexitylib.Circuits.Encoding.Internal.Codec +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution /-! # Rejecting positive-family setup @@ -15,6 +17,8 @@ blank while the counter prefix is built, then rejected explicitly. The frontier-level wrappers also cover a positive tag paired with the empty input. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Hoare.lean b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Hoare.lean index aef24b77..6dcccab8 100644 --- a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Hoare.lean +++ b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Hoare.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.Family -import Complexitylib.Models.TuringMachine.Hoare +module + +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.Family +public import Complexitylib.Models.TuringMachine.Hoare /-! # Hoare contract for the serialized-family evaluator core @@ -13,6 +15,8 @@ This file packages the total frontier execution theorem behind the public staged-tape precondition and defaulted-verdict postcondition. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Pure.lean b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Pure.lean index b6a9f140..a1642121 100644 --- a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Pure.lean +++ b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Pure.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Machine.Core.Defs +module + +public import Complexitylib.Circuits.Encoding.Machine.Core.Defs /-! # Pure semantics for the streaming circuit evaluator @@ -17,6 +19,8 @@ retaining `evalFamilyCode` as their external specification; it is not a transition-level trace model. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Stage.lean b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Stage.lean index 36404af3..f85b90ba 100644 --- a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Stage.lean +++ b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Stage.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Machine.Core.Defs -import Complexitylib.Models.TuringMachine.Hoare +module + +public import Complexitylib.Circuits.Encoding.Machine.Core.Defs +public import Complexitylib.Models.TuringMachine.Hoare /-! # Circuit-evaluator staging seam @@ -13,6 +15,8 @@ This file connects the valid outer-pair staging contract to the streaming core's precondition across the standard sequential-composition tape transition. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Tape.lean b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Tape.lean index ee126d37..4bb3eba9 100644 --- a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Tape.lean +++ b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Tape.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Machine.Core.Defs +module + +public import Complexitylib.Circuits.Encoding.Machine.Core.Defs /-! # Tape cursors for the streaming circuit evaluator @@ -14,6 +16,8 @@ the current zero-based read position. This is intentionally internal: the neutral endpoint and suffix predicates remain the public tape API. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Machine/Defs.lean b/Complexitylib/Circuits/Encoding/Machine/Defs.lean index ef9e2e06..e7a7b51e 100644 --- a/Complexitylib/Circuits/Encoding/Machine/Defs.lean +++ b/Complexitylib/Circuits/Encoding/Machine/Defs.lean @@ -3,12 +3,14 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Family -import Complexitylib.Models.TuringMachine.Lift -import Complexitylib.Models.TuringMachine.Subroutines -import Complexitylib.Models.TuringMachine.Subroutines.PairSplit.Defs -import Complexitylib.Models.TuringMachine.Subroutines.PairValidate.Defs -import Complexitylib.Models.TuringMachine.Tape.Encoding +module + +public import Complexitylib.Circuits.Encoding.Family +public import Complexitylib.Models.TuringMachine.Lift +public import Complexitylib.Models.TuringMachine.Subroutines +public import Complexitylib.Models.TuringMachine.Subroutines.PairSplit.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.PairValidate.Defs +public import Complexitylib.Models.TuringMachine.Tape.Encoding /-! # Serialized circuit-evaluator machine front end @@ -19,6 +21,8 @@ places an evaluator core inside the valid branch, so malformed outer inputs can never fall through into that core. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Machine/GateStream.lean b/Complexitylib/Circuits/Encoding/Machine/GateStream.lean index 224e23cc..71ff9bc4 100644 --- a/Complexitylib/Circuits/Encoding/Machine/GateStream.lean +++ b/Complexitylib/Circuits/Encoding/Machine/GateStream.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Machine.GateStream.Defs -import Complexitylib.Circuits.Encoding.Machine.GateStream.Internal +module + +public import Complexitylib.Circuits.Encoding.Machine.GateStream.Defs +public import Complexitylib.Circuits.Encoding.Machine.GateStream.Internal /-! # One streaming raw-gate step @@ -21,6 +23,8 @@ restored to zero and every other tape is preserved literally. - `emitRawGateStepTM_isTransducer` proves append-only-output safety. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Machine/GateStream/Defs.lean b/Complexitylib/Circuits/Encoding/Machine/GateStream/Defs.lean index 6f1ab33f..f69580ff 100644 --- a/Complexitylib/Circuits/Encoding/Machine/GateStream/Defs.lean +++ b/Complexitylib/Circuits/Encoding/Machine/GateStream/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Machine.RawGate.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs +module + +public import Complexitylib.Circuits.Encoding.Machine.RawGate.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs /-! # One streaming raw-gate step @@ -14,6 +16,8 @@ binary counter that records the first unused circuit wire. It is the atomic append operation used by circuit serializers. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Machine/GateStream/Internal.lean b/Complexitylib/Circuits/Encoding/Machine/GateStream/Internal.lean index 72b81fea..2a7e013f 100644 --- a/Complexitylib/Circuits/Encoding/Machine/GateStream/Internal.lean +++ b/Complexitylib/Circuits/Encoding/Machine/GateStream/Internal.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Machine.GateStream.Defs -import Complexitylib.Circuits.Encoding.Machine.RawGate -import Complexitylib.Models.TuringMachine.Hoare.Space -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc +module + +public import Complexitylib.Circuits.Encoding.Machine.GateStream.Defs +public import Complexitylib.Circuits.Encoding.Machine.RawGate +public import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc /-! # One streaming raw-gate step -- proof internals @@ -17,6 +19,8 @@ ghost while converting successor's full-frame result into an exact work-tape update. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Machine/Internal/FrontEnd.lean b/Complexitylib/Circuits/Encoding/Machine/Internal/FrontEnd.lean index 5124c55c..e6303091 100644 --- a/Complexitylib/Circuits/Encoding/Machine/Internal/FrontEnd.lean +++ b/Complexitylib/Circuits/Encoding/Machine/Internal/FrontEnd.lean @@ -3,11 +3,13 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Machine.Defs -import Complexitylib.Models.TuringMachine.Hoare -import Complexitylib.Models.TuringMachine.Subroutines.Internal -import Complexitylib.Models.TuringMachine.Subroutines.PairSplit -import Complexitylib.Models.TuringMachine.Subroutines.PairValidate +module + +public import Complexitylib.Circuits.Encoding.Machine.Defs +public import Complexitylib.Models.TuringMachine.Hoare +public import Complexitylib.Models.TuringMachine.Subroutines.Internal +public import Complexitylib.Models.TuringMachine.Subroutines.PairSplit +public import Complexitylib.Models.TuringMachine.Subroutines.PairValidate /-! # Serialized circuit-evaluator front-end correctness @@ -16,6 +18,8 @@ Proof internals for validating a paired machine input, rewinding it, and staging its code and data components on appendable work tapes. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Machine/NatCode.lean b/Complexitylib/Circuits/Encoding/Machine/NatCode.lean index 462805f9..d442a078 100644 --- a/Complexitylib/Circuits/Encoding/Machine/NatCode.lean +++ b/Complexitylib/Circuits/Encoding/Machine/NatCode.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Machine.NatCode.Defs -import Complexitylib.Circuits.Encoding.Machine.NatCode.Internal +module + +public import Complexitylib.Circuits.Encoding.Machine.NatCode.Defs +public import Complexitylib.Circuits.Encoding.Machine.NatCode.Internal /-! # Machine emission of terminated-unary natural codes @@ -27,6 +29,8 @@ satisfies the one-way-output transducer discipline. - `emitNatCodeTM_isTransducer` proves one-way-output safety. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Machine/NatCode/Defs.lean b/Complexitylib/Circuits/Encoding/Machine/NatCode/Defs.lean index 1fc9b2fc..0e35ed48 100644 --- a/Complexitylib/Circuits/Encoding/Machine/NatCode/Defs.lean +++ b/Complexitylib/Circuits/Encoding/Machine/NatCode/Defs.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Defs -import Complexitylib.Models.TuringMachine.Registers.Emit -import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor +module + +public import Complexitylib.Circuits.Encoding.Defs +public import Complexitylib.Models.TuringMachine.Registers.Emit +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor /-! # Machine emission of terminated-unary natural codes — definitions @@ -21,6 +23,8 @@ preserved limit, the restored scratch counter, and every unrelated work tape are intended to be preserved literally. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Machine/NatCode/Internal.lean b/Complexitylib/Circuits/Encoding/Machine/NatCode/Internal.lean index cc39f757..0c5ebb4d 100644 --- a/Complexitylib/Circuits/Encoding/Machine/NatCode/Internal.lean +++ b/Complexitylib/Circuits/Encoding/Machine/NatCode/Internal.lean @@ -3,12 +3,14 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Machine.NatCode.Defs -import Complexitylib.Models.TuringMachine.Combinators.Internal.Seq -import Complexitylib.Models.TuringMachine.Hoare.Space -import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Internal.Control -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc -import Complexitylib.Models.TuringMachine.Subroutines.ClearWork +module + +public import Complexitylib.Circuits.Encoding.Machine.NatCode.Defs +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Seq +public import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Internal.Control +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc +public import Complexitylib.Models.TuringMachine.Subroutines.ClearWork /-! # Machine emission of terminated-unary natural codes — proof internals @@ -18,6 +20,8 @@ emission. The proof tracks concrete counter and output tapes at every loop index, then composes scratch clearing and the terminating zero-bit emitter. -/ +@[expose] public section + namespace Complexity namespace CircuitCode @@ -29,13 +33,13 @@ open TM variable {n : ℕ} /-- Replace the scratch counter by the canonical binary tape for `value`. -/ -private def natCodeWorkAt (work : Fin n → Tape) (counterIdx : Fin n) +def natCodeWorkAt (work : Fin n → Tape) (counterIdx : Fin n) (value : ℕ) : Fin n → Tape := Function.update work counterIdx ((Tape.init (value.bits.map Γ.ofBool)).move Dir3.right) /-- Concrete output tape after appending `count` one-bits. -/ -private def natCodeOutputAt (out : Tape) : ℕ → Tape +def natCodeOutputAt (out : Tape) : ℕ → Tape | 0 => out | count + 1 => (natCodeOutputAt out count).writeAndMove Γ.one Dir3.right diff --git a/Complexitylib/Circuits/Encoding/Machine/RawGate.lean b/Complexitylib/Circuits/Encoding/Machine/RawGate.lean index 382127dd..98fd9b06 100644 --- a/Complexitylib/Circuits/Encoding/Machine/RawGate.lean +++ b/Complexitylib/Circuits/Encoding/Machine/RawGate.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Machine.RawGate.Defs -import Complexitylib.Circuits.Encoding.Machine.RawGate.Internal +module + +public import Complexitylib.Circuits.Encoding.Machine.RawGate.Defs +public import Complexitylib.Circuits.Encoding.Machine.RawGate.Internal /-! # Machine emission of raw circuit gates @@ -21,6 +23,8 @@ and the reusable zero scratch are restored literally. - `emitRawGateTM_isTransducer` proves one-way-output safety. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Machine/RawGate/Defs.lean b/Complexitylib/Circuits/Encoding/Machine/RawGate/Defs.lean index 5cffc889..994e1222 100644 --- a/Complexitylib/Circuits/Encoding/Machine/RawGate/Defs.lean +++ b/Complexitylib/Circuits/Encoding/Machine/RawGate/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Machine.NatCode.Defs +module + +public import Complexitylib.Circuits.Encoding.Machine.NatCode.Defs /-! # Machine emission of raw circuit gates — definitions @@ -14,6 +16,8 @@ the references are read from preserved canonical binary work tapes. One reusable zero scratch tape drives both natural-code emitters. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Machine/RawGate/Internal.lean b/Complexitylib/Circuits/Encoding/Machine/RawGate/Internal.lean index 20b29807..e149fe0f 100644 --- a/Complexitylib/Circuits/Encoding/Machine/RawGate/Internal.lean +++ b/Complexitylib/Circuits/Encoding/Machine/RawGate/Internal.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Machine.NatCode -import Complexitylib.Circuits.Encoding.Machine.RawGate.Defs -import Complexitylib.Models.TuringMachine.Hoare.Space +module + +public import Complexitylib.Circuits.Encoding.Machine.NatCode +public import Complexitylib.Circuits.Encoding.Machine.RawGate.Defs +public import Complexitylib.Models.TuringMachine.Hoare.Space /-! # Machine emission of raw circuit gates — proof internals @@ -15,6 +17,8 @@ emitters. Both dynamic reference tapes and the reusable zero scratch are restored literally at the endpoint. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Threshold.lean b/Complexitylib/Circuits/Encoding/Threshold.lean index b2271bfa..6f6d1dfe 100644 --- a/Complexitylib/Circuits/Encoding/Threshold.lean +++ b/Complexitylib/Circuits/Encoding/Threshold.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Threshold.Internal +module + +public import Complexitylib.Circuits.Encoding.Threshold.Internal /-! # Correctness of raw threshold-circuit fragments @@ -28,6 +30,8 @@ higher layer where both APIs are already available. correctness of iterative evaluation. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Threshold/Defs.lean b/Complexitylib/Circuits/Encoding/Threshold/Defs.lean index 29cf762a..69030a8a 100644 --- a/Complexitylib/Circuits/Encoding/Threshold/Defs.lean +++ b/Complexitylib/Circuits/Encoding/Threshold/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Fragment.Defs +module + +public import Complexitylib.Circuits.Encoding.Fragment.Defs /-! # Raw threshold-circuit fragments @@ -22,6 +24,8 @@ row-major order, and ends with a copy of the requested final state. Thus it has exactly `3 + 2 * k * threshold` gates for `k` referenced inputs. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Threshold/Internal.lean b/Complexitylib/Circuits/Encoding/Threshold/Internal.lean index 1e80b08c..3dc693d4 100644 --- a/Complexitylib/Circuits/Encoding/Threshold/Internal.lean +++ b/Complexitylib/Circuits/Encoding/Threshold/Internal.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Threshold.Defs -import Complexitylib.Circuits.Encoding.Fragment +module + +public import Complexitylib.Circuits.Encoding.Threshold.Defs +public import Complexitylib.Circuits.Encoding.Fragment /-! # Raw threshold-fragment internals @@ -14,6 +16,8 @@ program defined in `Complexitylib.Circuits.Encoding.Threshold.Defs`. Public statements are re-exported by `Complexitylib.Circuits.Encoding.Threshold`. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/ToCircuit.lean b/Complexitylib/Circuits/Encoding/ToCircuit.lean index 558353a6..09aa188b 100644 --- a/Complexitylib/Circuits/Encoding/ToCircuit.lean +++ b/Complexitylib/Circuits/Encoding/ToCircuit.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Internal.ToCircuit +module + +public import Complexitylib.Circuits.Encoding.Internal.ToCircuit /-! # Typed circuits reconstructed from raw circuit syntax @@ -27,6 +29,8 @@ Boolean evaluation, and exact gate count. - `RawCircuit.size_toCircuit`: typed size equals the raw gate count. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/ToCircuit/Defs.lean b/Complexitylib/Circuits/Encoding/ToCircuit/Defs.lean index 6e18d15a..aea0b569 100644 --- a/Complexitylib/Circuits/Encoding/ToCircuit/Defs.lean +++ b/Complexitylib/Circuits/Encoding/ToCircuit/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Defs +module + +public import Complexitylib.Circuits.Encoding.Defs /-! # Reconstructing typed circuits from raw circuit syntax @@ -14,6 +16,8 @@ gate becomes the sole output gate; every preceding raw gate becomes an internal gate in the same order. -/ +@[expose] public section + namespace Complexity namespace CircuitCode diff --git a/Complexitylib/Circuits/Encoding/Validation.lean b/Complexitylib/Circuits/Encoding/Validation.lean index 762d69cc..1e8fab40 100644 --- a/Complexitylib/Circuits/Encoding/Validation.lean +++ b/Complexitylib/Circuits/Encoding/Validation.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Family -import Complexitylib.Circuits.Encoding.Machine.Core.Internal +module + +public import Complexitylib.Circuits.Encoding.Family +meta import Complexitylib.Circuits.Encoding.Family +public import Complexitylib.Circuits.Encoding.Machine.Core.Internal +meta import Complexitylib.Circuits.Encoding.Machine.Core.Internal /-! # Encoded-circuit evaluator — executable validation @@ -18,6 +22,8 @@ This module is not part of the public import graph. Build it explicitly with `lake build --wfail Complexitylib.Circuits.Encoding.Validation`. -/ +@[expose] public section + namespace Complexity namespace CircuitCode.Validation diff --git a/Complexitylib/Circuits/EssentialInput.lean b/Complexitylib/Circuits/EssentialInput.lean index cf48a964..93185a17 100644 --- a/Complexitylib/Circuits/EssentialInput.lean +++ b/Complexitylib/Circuits/EssentialInput.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Mathlib.Data.Fintype.BigOperators -import Complexitylib.Circuits.Basic +module + +public import Mathlib.Data.Fintype.BigOperators +public import Complexitylib.Circuits.Basic /-! # Essential Inputs @@ -17,6 +19,8 @@ for a Boolean function. * `essentialInputs` — the set of essential input variables -/ +@[expose] public section + namespace Complexity /-- A function `f` depends on input variable `i` if flipping that bit diff --git a/Complexitylib/Circuits/Family.lean b/Complexitylib/Circuits/Family.lean index 8ba083e5..85d3d5d0 100644 --- a/Complexitylib/Circuits/Family.lean +++ b/Complexitylib/Circuits/Family.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Family.Defs -import Complexitylib.Asymptotics +module + +public import Complexitylib.Circuits.Family.Defs +public import Complexitylib.Asymptotics /-! # Boolean circuit families @@ -14,6 +16,8 @@ size/depth bounds, and the equivalence between pointwise polynomial bounds and the power big-O convention used by complexity classes. -/ +@[expose] public section + namespace Complexity namespace Circuit diff --git a/Complexitylib/Circuits/Family/Defs.lean b/Complexitylib/Circuits/Family/Defs.lean index dc5b1ff7..ee03d304 100644 --- a/Complexitylib/Circuits/Family/Defs.lean +++ b/Complexitylib/Circuits/Family/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.BitString -import Mathlib.Algebra.Polynomial.Eval.Defs +module + +public import Complexitylib.Circuits.BitString +public import Mathlib.Algebra.Polynomial.Eval.Defs /-! # Boolean circuit families — definitions @@ -18,6 +20,8 @@ The first component of `circuits n` is the number of internal gates. Family free per-edge negation flags. -/ +@[expose] public section + namespace Complexity namespace Circuit diff --git a/Complexitylib/Circuits/Formula.lean b/Complexitylib/Circuits/Formula.lean index c5670ced..3d36dfc8 100644 --- a/Complexitylib/Circuits/Formula.lean +++ b/Complexitylib/Circuits/Formula.lean @@ -3,10 +3,12 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Mathlib.Data.Nat.Basic -import Mathlib.Data.Bool.Basic -import Mathlib.Data.Finset.Basic -import Mathlib.Data.Finset.Union +module + +public import Mathlib.Data.Nat.Basic +public import Mathlib.Data.Bool.Basic +public import Mathlib.Data.Finset.Basic +public import Mathlib.Data.Finset.Union /-! # Boolean formulas and formula size @@ -31,6 +33,8 @@ measures must not be conflated in lower-bound arguments. locality property (evaluation depends only on the variables that occur) -/ +@[expose] public section + namespace Complexity /-- A Boolean formula: a *tree* over variables, the constants `⊤`/`⊥`, and the diff --git a/Complexitylib/Circuits/FormulaEncoding.lean b/Complexitylib/Circuits/FormulaEncoding.lean index 3116466b..bc545ae6 100644 --- a/Complexitylib/Circuits/FormulaEncoding.lean +++ b/Complexitylib/Circuits/FormulaEncoding.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.FormulaEncoding.Defs -import Complexitylib.Circuits.FormulaEncoding.Internal +module + +public import Complexitylib.Circuits.FormulaEncoding.Defs +public import Complexitylib.Circuits.FormulaEncoding.Internal /-! # Canonical postfix encoding of Boolean formulas @@ -26,6 +28,8 @@ serialization is injective, and the code-length equation records every bit. - `FormulaCode.length_encode` -- exact serialized length. -/ +@[expose] public section + namespace Complexity namespace FormulaCode diff --git a/Complexitylib/Circuits/FormulaEncoding/Defs.lean b/Complexitylib/Circuits/FormulaEncoding/Defs.lean index cb13a09e..178c49ac 100644 --- a/Complexitylib/Circuits/FormulaEncoding/Defs.lean +++ b/Complexitylib/Circuits/FormulaEncoding/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Defs -import Complexitylib.Circuits.Formula +module + +public import Complexitylib.Circuits.Encoding.Defs +public import Complexitylib.Circuits.Formula /-! # Machine-facing encoding of Boolean formulas @@ -20,6 +22,8 @@ on-tape tree parser and gives the later Barrington generator a simple, self-delimiting input language. -/ +@[expose] public section + namespace Complexity namespace FormulaCode diff --git a/Complexitylib/Circuits/FormulaEncoding/Internal.lean b/Complexitylib/Circuits/FormulaEncoding/Internal.lean index 0a70dd6b..a53af67b 100644 --- a/Complexitylib/Circuits/FormulaEncoding/Internal.lean +++ b/Complexitylib/Circuits/FormulaEncoding/Internal.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding -import Complexitylib.Circuits.FormulaEncoding.Defs +module + +public import Complexitylib.Circuits.Encoding +public import Complexitylib.Circuits.FormulaEncoding.Defs /-! # Boolean-formula codec internals @@ -13,6 +15,8 @@ This module proves the stack-machine, round-trip, injectivity, and length properties of the canonical postfix formula encoding. -/ +@[expose] public section + namespace Complexity namespace FormulaCode diff --git a/Complexitylib/Circuits/Hardwiring.lean b/Complexitylib/Circuits/Hardwiring.lean index 45817906..dcaa9d0c 100644 --- a/Complexitylib/Circuits/Hardwiring.lean +++ b/Complexitylib/Circuits/Hardwiring.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Nondeterminism +module + +public import Complexitylib.Circuits.Nondeterminism /-! # Hardwiring Prefixes of Circuit Inputs @@ -26,6 +28,8 @@ Circuit families represent the zero-input member separately with `emptyOutput`. - `Circuit.restrictPrefix_size`: hardwiring preserves the exact circuit size. -/ +@[expose] public section + namespace Complexity namespace Circuit diff --git a/Complexitylib/Circuits/Internal/AndOrNot.lean b/Complexitylib/Circuits/Internal/AndOrNot.lean index d6d8f77c..46f31b26 100644 --- a/Complexitylib/Circuits/Internal/AndOrNot.lean +++ b/Complexitylib/Circuits/Internal/AndOrNot.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.AndOrNot.Defs +module + +public import Complexitylib.Circuits.AndOrNot.Defs /-! # Internal: AND/OR/NOT Completeness Proof @@ -13,6 +15,8 @@ in `Complexitylib.Circuits.AndOrNot.Defs`; this module is re-exported through `Complexitylib.Circuits.AndOrNot`. -/ +@[expose] public section + namespace Complexity /-- Indicator circuit: outputs `true` iff the input equals `s`. @@ -34,7 +38,7 @@ For each of the `2^N` possible inputs `s` (decoded via `Nat.testBit`), internal gate `i` is the indicator AND for `s` when `f s = true`, or a trivially-false 0-input OR otherwise. The single output OR gate disjoins all internal gates. -/ -private def andOrNotFor.mkGate {N : Nat} (f : BitString N → Bool) (i : Fin (2 ^ N)) : +def andOrNotFor.mkGate {N : Nat} (f : BitString N → Bool) (i : Fin (2 ^ N)) : Gate Basis.unboundedAndOr (N + 2 ^ N) := if f (fun j => i.val.testBit j.val) then { op := .and, fanIn := N, arityOk := trivial, @@ -45,7 +49,7 @@ private def andOrNotFor.mkGate {N : Nat} (f : BitString N → Bool) (i : Fin (2 inputs := Fin.elim0, negated := Fin.elim0 } -private lemma andOrNotFor.mkGate_acyclic {N : Nat} (f : BitString N → Bool) +lemma andOrNotFor.mkGate_acyclic {N : Nat} (f : BitString N → Bool) (i : Fin (2 ^ N)) (k : Fin (andOrNotFor.mkGate f i).fanIn) : ((andOrNotFor.mkGate f i).inputs k).val < N + i.val := by revert k; unfold mkGate @@ -67,7 +71,7 @@ def andOrNotFor {N : Nat} [NeZero N] (f : BitString N → Bool) : negated := fun _ => false } acyclic := andOrNotFor.mkGate_acyclic f -private lemma AONFor_wireValue_gate {N : Nat} [NeZero N] (f : BitString N → Bool) +lemma AONFor_wireValue_gate {N : Nat} [NeZero N] (f : BitString N → Bool) (x : BitString N) (i : Fin (2 ^ N)) : (andOrNotFor f).wireValue x (Fin.natAdd N i) = (andOrNotFor.mkGate f i).eval ((andOrNotFor f).wireValue x) := by @@ -86,7 +90,7 @@ private lemma AONFor_wireValue_gate {N : Nat} [NeZero N] (f : BitString N → Bo /-! ## Helper lemmas for andOrNotFor correctness -/ -private lemma foldl_bor_eq_true (n : Nat) (g : Fin n → Bool) : +lemma foldl_bor_eq_true (n : Nat) (g : Fin n → Bool) : (Fin.foldl n (fun acc i => acc || g i) false = true) ↔ (∃ i : Fin n, g i = true) := by induction n with | zero => simp [Fin.foldl_zero] @@ -105,7 +109,7 @@ private lemma foldl_bor_eq_true (n : Nat) (g : Fin n → Bool) : · left; rw [ih]; exact ⟨j, hi⟩ · right; exact hi -private lemma foldl_band_eq_true (n : Nat) (g : Fin n → Bool) : +lemma foldl_band_eq_true (n : Nat) (g : Fin n → Bool) : (Fin.foldl n (fun acc i => acc && g i) true = true) ↔ (∀ i : Fin n, g i = true) := by induction n with | zero => simp [Fin.foldl_zero] @@ -116,17 +120,17 @@ private lemma foldl_band_eq_true (n : Nat) (g : Fin n → Bool) : · intro h; rw [Bool.and_eq_true] exact ⟨(ih _).mpr (fun j => h j.castSucc), h (Fin.last n)⟩ -private lemma AONFor_wireValue_input {N : Nat} [NeZero N] (f : BitString N → Bool) +lemma AONFor_wireValue_input {N : Nat} [NeZero N] (f : BitString N → Bool) (x : BitString N) (j : Fin N) : (andOrNotFor f).wireValue x (j.castAdd (2 ^ N)) = x j := by have h : (j.castAdd (2 ^ N)).val < N := by simp [Fin.val_castAdd] rw [Circuit.wireValue_of_lt _ _ _ h] congr 1 -private lemma xor_not_eq_true_iff (a b : Bool) : ((!b).xor a = true) ↔ (a = b) := by +lemma xor_not_eq_true_iff (a b : Bool) : ((!b).xor a = true) ↔ (a = b) := by cases a <;> cases b <;> simp -private lemma mkGate_true {N : Nat} (f : BitString N → Bool) (i : Fin (2 ^ N)) +lemma mkGate_true {N : Nat} (f : BitString N → Bool) (i : Fin (2 ^ N)) (hfi : f (fun j => i.val.testBit j.val) = true) : andOrNotFor.mkGate f i = { op := .and, fanIn := N, arityOk := trivial, @@ -134,14 +138,14 @@ private lemma mkGate_true {N : Nat} (f : BitString N → Bool) (i : Fin (2 ^ N)) negated := fun j => !(i.val.testBit j.val) } := by unfold andOrNotFor.mkGate; simp [hfi] -private lemma mkGate_eval_false {N : Nat} (f : BitString N → Bool) (i : Fin (2 ^ N)) +lemma mkGate_eval_false {N : Nat} (f : BitString N → Bool) (i : Fin (2 ^ N)) (wv : BitString (N + 2 ^ N)) (hfi : f (fun j => i.val.testBit j.val) = false) : (andOrNotFor.mkGate f i).eval wv = false := by unfold andOrNotFor.mkGate Gate.eval simp [hfi, Basis.unboundedAndOr, AndOrOp.eval, Fin.foldl_zero] -private lemma mkGate_eval_true_iff {N : Nat} (f : BitString N → Bool) (i : Fin (2 ^ N)) +lemma mkGate_eval_true_iff {N : Nat} (f : BitString N → Bool) (i : Fin (2 ^ N)) (wv : BitString (N + 2 ^ N)) (hfi : f (fun j => i.val.testBit j.val) = true) : (andOrNotFor.mkGate f i).eval wv = true ↔ @@ -152,7 +156,7 @@ private lemma mkGate_eval_true_iff {N : Nat} (f : BitString N → Bool) (i : Fin exact ⟨fun h j => (xor_not_eq_true_iff _ _).mp (h j), fun h j => (xor_not_eq_true_iff _ _).mpr (h j)⟩ -private lemma exists_testBit_encode (N : Nat) (x : BitString N) : +lemma exists_testBit_encode (N : Nat) (x : BitString N) : ∃ m : Fin (2 ^ N), ∀ j : Fin N, m.val.testBit j.val = x j := by induction N with | zero => exact ⟨⟨0, Nat.one_pos⟩, fun j => j.elim0⟩ @@ -225,13 +229,16 @@ theorem andOrNotFor_eval {N : Nat} [NeZero N] (f : BitString N → Bool) : /-- Internal gate for the multi-output DNF circuit. Gate `idx` encodes output bit `j = idx / 2^N` and indicator index `i = idx % 2^N`. If `f(bitstring i)[j] = true`, it's an AND indicator gate; otherwise a trivially-false OR gate. -/ -private def AONForM_j {N M : Nat} (idx : Fin (M * 2 ^ N)) : Fin M := +@[nolint defsWithUnderscore] +def AONForM_j {N M : Nat} (idx : Fin (M * 2 ^ N)) : Fin M := ⟨idx.val / 2 ^ N, Nat.div_lt_of_lt_mul (Nat.mul_comm M (2^N) ▸ idx.isLt)⟩ -private def AONForM_i {N : Nat} {M : Nat} (idx : Fin (M * 2 ^ N)) : Fin (2 ^ N) := +@[nolint defsWithUnderscore docBlame] +def AONForM_i {N : Nat} {M : Nat} (idx : Fin (M * 2 ^ N)) : Fin (2 ^ N) := ⟨idx.val % 2 ^ N, Nat.mod_lt _ (Nat.two_pow_pos N)⟩ -private def AONForM_mkGate {N M : Nat} (f : BitString N → BitString M) (idx : Fin (M * 2 ^ N)) : +@[nolint defsWithUnderscore docBlame] +def AONForM_mkGate {N M : Nat} (f : BitString N → BitString M) (idx : Fin (M * 2 ^ N)) : Gate Basis.unboundedAndOr (N + M * 2 ^ N) := if f (fun k => (AONForM_i idx).val.testBit k.val) (AONForM_j idx) then { op := .and, fanIn := N, arityOk := trivial, @@ -242,7 +249,7 @@ private def AONForM_mkGate {N M : Nat} (f : BitString N → BitString M) (idx : inputs := Fin.elim0, negated := Fin.elim0 } -private lemma AONForM_mkGate_acyclic {N M : Nat} (f : BitString N → BitString M) +lemma AONForM_mkGate_acyclic {N M : Nat} (f : BitString N → BitString M) (idx : Fin (M * 2 ^ N)) (k : Fin (AONForM_mkGate f idx).fanIn) : ((AONForM_mkGate f idx).inputs k).val < N + idx.val := by revert k; unfold AONForM_mkGate @@ -250,7 +257,7 @@ private lemma AONForM_mkGate_acyclic {N M : Nat} (f : BitString N → BitString · intro k; exact Fin.elim0 k · intro k; simp; omega -private lemma AONForM_output_bound {N M : Nat} (j : Fin M) (k : Fin (2 ^ N)) : +lemma AONForM_output_bound {N M : Nat} (j : Fin M) (k : Fin (2 ^ N)) : N + j.val * 2 ^ N + k.val < N + M * 2 ^ N := by have hk := k.isLt suffices h : j.val * 2 ^ N + k.val < M * 2 ^ N by omega @@ -273,13 +280,13 @@ def andOrNotForM {N M : Nat} [NeZero N] [NeZero M] (f : BitString N → BitStrin negated := fun _ => false } acyclic := AONForM_mkGate_acyclic f -private lemma AONForM_wireValue_input {N M : Nat} [NeZero N] [NeZero M] +lemma AONForM_wireValue_input {N M : Nat} [NeZero N] [NeZero M] (f : BitString N → BitString M) (x : BitString N) (k : Fin N) : (andOrNotForM f).wireValue x ⟨k.val, by omega⟩ = x k := by have h : (⟨k.val, by omega⟩ : Fin (N + M * 2 ^ N)).val < N := k.isLt rw [Circuit.wireValue_of_lt _ _ _ h] -private lemma AONForM_wireValue_gate {N M : Nat} [NeZero N] [NeZero M] +lemma AONForM_wireValue_gate {N M : Nat} [NeZero N] [NeZero M] (f : BitString N → BitString M) (x : BitString N) (idx : Fin (M * 2 ^ N)) : (andOrNotForM f).wireValue x ⟨N + idx.val, by omega⟩ = (AONForM_mkGate f idx).eval ((andOrNotForM f).wireValue x) := by @@ -287,7 +294,7 @@ private lemma AONForM_wireValue_gate {N M : Nat} [NeZero N] [NeZero M] rw [Circuit.wireValue_of_not_lt _ _ _ hge] congr 1; simp only [andOrNotForM]; congr 1; exact Fin.ext (by simp) -private lemma AONForM_mkGate_eval_false {N M : Nat} +lemma AONForM_mkGate_eval_false {N M : Nat} (f : BitString N → BitString M) (idx : Fin (M * 2 ^ N)) (wv : BitString (N + M * 2 ^ N)) (hfi : f (fun k => (AONForM_i idx).val.testBit k.val) (AONForM_j idx) = false) : @@ -295,7 +302,7 @@ private lemma AONForM_mkGate_eval_false {N M : Nat} unfold AONForM_mkGate Gate.eval simp [hfi, Basis.unboundedAndOr, AndOrOp.eval, Fin.foldl_zero] -private lemma AONForM_mkGate_eval_true_iff {N M : Nat} +lemma AONForM_mkGate_eval_true_iff {N M : Nat} (f : BitString N → BitString M) (idx : Fin (M * 2 ^ N)) (wv : BitString (N + M * 2 ^ N)) (hfi : f (fun k => (AONForM_i idx).val.testBit k.val) (AONForM_j idx) = true) : @@ -312,12 +319,12 @@ private lemma AONForM_mkGate_eval_true_iff {N M : Nat} fun h k => (xor_not_eq_true_iff _ _).mpr (h k)⟩ -- Helper: relate index `j * 2^N + k` to `AONForM_i` and `AONForM_j` -private lemma AONForM_i_of_add {N M : Nat} (j : Fin M) (k : Fin (2 ^ N)) +lemma AONForM_i_of_add {N M : Nat} (j : Fin M) (k : Fin (2 ^ N)) (h : j.val * 2 ^ N + k.val < M * 2 ^ N) : AONForM_i (⟨j.val * 2 ^ N + k.val, h⟩ : Fin (M * 2 ^ N)) = k := by ext; simp [AONForM_i, Nat.mod_eq_of_lt k.isLt] -private lemma AONForM_j_of_add {N M : Nat} (j : Fin M) (k : Fin (2 ^ N)) +lemma AONForM_j_of_add {N M : Nat} (j : Fin M) (k : Fin (2 ^ N)) (h : j.val * 2 ^ N + k.val < M * 2 ^ N) : AONForM_j (⟨j.val * 2 ^ N + k.val, h⟩ : Fin (M * 2 ^ N)) = j := by ext; simp only [AONForM_j, Fin.val_mk] @@ -325,16 +332,17 @@ private lemma AONForM_j_of_add {N M : Nat} (j : Fin M) (k : Fin (2 ^ N)) rw [Nat.add_mul_div_left _ _ (Nat.two_pow_pos N), Nat.div_eq_of_lt k.isLt]; simp -- The idx corresponding to output j and indicator k -private def AONForM_idx {N M : Nat} (j : Fin M) (k : Fin (2 ^ N)) : +@[nolint defsWithUnderscore docBlame] +def AONForM_idx {N M : Nat} (j : Fin M) (k : Fin (2 ^ N)) : Fin (M * 2 ^ N) := ⟨j.val * 2 ^ N + k.val, by have := AONForM_output_bound (N := N) j k; omega⟩ -private lemma AONForM_idx_i {N M : Nat} (j : Fin M) (k : Fin (2 ^ N)) : +lemma AONForM_idx_i {N M : Nat} (j : Fin M) (k : Fin (2 ^ N)) : AONForM_i (AONForM_idx j k) = k := AONForM_i_of_add j k _ -private lemma AONForM_idx_j {N M : Nat} (j : Fin M) (k : Fin (2 ^ N)) : +lemma AONForM_idx_j {N M : Nat} (j : Fin M) (k : Fin (2 ^ N)) : AONForM_j (AONForM_idx j k) = j := AONForM_j_of_add j k _ diff --git a/Complexitylib/Circuits/Internal/Bridge.lean b/Complexitylib/Circuits/Internal/Bridge.lean index d634ac56..25117924 100644 --- a/Complexitylib/Circuits/Internal/Bridge.lean +++ b/Complexitylib/Circuits/Internal/Bridge.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Internal.ShannonBridge -import Complexitylib.Circuits.Internal.SchnorrBridge +module + +public import Complexitylib.Circuits.Internal.ShannonBridge +public import Complexitylib.Circuits.Internal.SchnorrBridge /-! # Internal circuit-descriptor bridges @@ -12,3 +14,5 @@ import Complexitylib.Circuits.Internal.SchnorrBridge Compatibility aggregation import for the independent Shannon-counting and Schnorr gate-elimination bridges. -/ + +@[expose] public section diff --git a/Complexitylib/Circuits/Internal/CircuitDescriptor.lean b/Complexitylib/Circuits/Internal/CircuitDescriptor.lean index 5dd00a20..c5011fdd 100644 --- a/Complexitylib/Circuits/Internal/CircuitDescriptor.lean +++ b/Complexitylib/Circuits/Internal/CircuitDescriptor.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Mathlib.Data.Fintype.BigOperators -import Mathlib.Tactic -import Complexitylib.Circuits.Basic +module + +public import Mathlib.Data.Fintype.BigOperators +public import Mathlib.Tactic +public import Complexitylib.Circuits.Basic /-! # Internal: Circuit Descriptors and Shannon Counting Bound @@ -15,6 +17,8 @@ theorem `shannon_lower_bound_circuit` (which speaks in terms of `Circuit`) is in `Complexitylib.Circuits.Internal.Bridge`. -/ +@[expose] public section + namespace Complexity /-! ## Gate and Circuit Descriptors -/ diff --git a/Complexitylib/Circuits/Internal/CircuitToDescriptor.lean b/Complexitylib/Circuits/Internal/CircuitToDescriptor.lean index d39c33a4..d50e980b 100644 --- a/Complexitylib/Circuits/Internal/CircuitToDescriptor.lean +++ b/Complexitylib/Circuits/Internal/CircuitToDescriptor.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.AndOrNot.Defs -import Complexitylib.Circuits.Internal.CircuitDescriptor +module + +public import Complexitylib.Circuits.AndOrNot.Defs +public import Complexitylib.Circuits.Internal.CircuitDescriptor /-! # Internal: Typed Circuits as Circuit Descriptors @@ -15,6 +17,8 @@ this bridge do not also acquire the lower-bound and padding machinery from `Internal.Bridge`. -/ +@[expose] public section + namespace Complexity open CircDesc diff --git a/Complexitylib/Circuits/Internal/LowerBound.lean b/Complexitylib/Circuits/Internal/LowerBound.lean index 3d097361..1eecc40f 100644 --- a/Complexitylib/Circuits/Internal/LowerBound.lean +++ b/Complexitylib/Circuits/Internal/LowerBound.lean @@ -3,10 +3,12 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Mathlib.Algebra.Order.BigOperators.Group.Finset -import Complexitylib.Circuits.EssentialInput -import Complexitylib.Circuits.AndOrNot.Defs -import Complexitylib.Circuits.Dependency.Defs +module + +public import Mathlib.Algebra.Order.BigOperators.Group.Finset +public import Complexitylib.Circuits.EssentialInput +public import Complexitylib.Circuits.AndOrNot.Defs +public import Complexitylib.Circuits.Dependency.Defs /-! # Internal: Gate Elimination Lower Bound @@ -21,6 +23,8 @@ are stated in `Complexitylib.Circuits.LowerBound`. -/ +@[expose] public section + namespace Complexity namespace Circuit diff --git a/Complexitylib/Circuits/Internal/Nondeterminism.lean b/Complexitylib/Circuits/Internal/Nondeterminism.lean index 8835aa8a..05c80548 100644 --- a/Complexitylib/Circuits/Internal/Nondeterminism.lean +++ b/Complexitylib/Circuits/Internal/Nondeterminism.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Nondeterminism.Defs -import Complexitylib.Circuits.Internal.ShannonUpper +module + +public import Complexitylib.Circuits.Nondeterminism.Defs +public import Complexitylib.Circuits.Internal.ShannonUpper /-! # Internal: Nondeterministic Quantification Circuit Constructions @@ -37,6 +39,8 @@ complexity of the OR of two Boolean functions by the sum of their complexities plus one; no OR-specific construction is defined here. -/ +@[expose] public section + namespace Complexity variable {k m : Nat} @@ -45,7 +49,7 @@ variable {k m : Nat} /-- Decompose the evaluation of a fan-in-2 AND/OR gate into a match on its operation applied to the two negation-adjusted input values. -/ -private theorem andOr2_eval_two {W : Nat} (g : Gate Basis.andOr2 W) +theorem andOr2_eval_two {W : Nat} (g : Gate Basis.andOr2 W) (wv : BitString W) : g.eval wv = let a0 := g.negated ⟨0, by rw [fanIn_andOr2]; omega⟩ ^^ @@ -63,7 +67,7 @@ private theorem andOr2_eval_two {W : Nat} (g : Gate Basis.andOr2 W) /-! ## Restriction gate construction -/ /-- A constant-output gate: `OR(x, ¬x) = true` or `AND(x, ¬x) = false`. -/ -private def mkConstGateBounded {G : Nat} [NeZero m] (val : Bool) (bound : Nat) : +def mkConstGateBounded {G : Nat} [NeZero m] (val : Bool) (bound : Nat) : { g : Gate Basis.andOr2 (k + m + G) // ∀ j : Fin g.fanIn, (g.inputs j).val < k + m + bound } := have hW : 0 < k + m + G := by have := NeZero.ne m; omega @@ -80,7 +84,7 @@ private def mkConstGateBounded {G : Nat} [NeZero m] (val : Bool) (bound : Nat) : fun _ => by dsimp; exact hB⟩ /-- An identity/passthrough gate: `OP(w, w)` with negation `neg`. -/ -private def mkIdentGateBounded {G : Nat} (op : AndOrOp) (w : Fin (k + m + G)) (neg : Bool) +def mkIdentGateBounded {G : Nat} (op : AndOrOp) (w : Fin (k + m + G)) (neg : Bool) (bound : Nat) (hw : w.val < k + m + bound) : { g : Gate Basis.andOr2 (k + m + G) // ∀ j : Fin g.fanIn, (g.inputs j).val < k + m + bound } := @@ -88,7 +92,7 @@ private def mkIdentGateBounded {G : Nat} (op : AndOrOp) (w : Fin (k + m + G)) (n inputs := fun _ => w, negated := fun _ => neg }, fun _ => by dsimp; exact hw⟩ -private theorem mkConstGateP_eval {G : Nat} [NeZero m] (val : Bool) (bound : Nat) +theorem mkConstGateP_eval {G : Nat} [NeZero m] (val : Bool) (bound : Nat) (wv : BitString (k + m + G)) : (mkConstGateBounded (k := k) (m := m) (G := G) val bound).val.eval wv = val := by unfold mkConstGateBounded @@ -98,7 +102,7 @@ private theorem mkConstGateP_eval {G : Nat} [NeZero m] (val : Bool) (bound : Nat · rename_i hval; rw [andOr2_eval_two]; simp only cases wv ⟨0, by have := NeZero.ne m; omega⟩ <;> simp at hval ⊢ <;> exact hval -private theorem mkIdentGateP_eval {G : Nat} (op : AndOrOp) (w : Fin (k + m + G)) (neg : Bool) +theorem mkIdentGateP_eval {G : Nat} (op : AndOrOp) (w : Fin (k + m + G)) (neg : Bool) (bound : Nat) (hw : w.val < k + m + bound) (wv : BitString (k + m + G)) : (mkIdentGateBounded (k := k) (m := m) (G := G) op w neg bound hw).val.eval wv = @@ -112,7 +116,7 @@ private theorem mkIdentGateP_eval {G : Nat} (op : AndOrOp) (w : Fin (k + m + G)) The gate's two inputs are inspected. For each input referencing wire 0, the effective constant `b ^^ negated` is computed. The gate is then simplified: identity, constant, or shifted, depending on the case. -/ -private def restrictGateBounded {G : Nat} [NeZero m] (b : Bool) +def restrictGateBounded {G : Nat} [NeZero m] (b : Bool) (g : Gate Basis.andOr2 ((k + 1) + m + G)) (hfanIn : g.fanIn = 2) (bound : Nat) @@ -179,7 +183,7 @@ def restrictCircuit {G : Nat} [NeZero m] (b : Bool) /-- The restricted gate evaluates identically to the original gate, given that wire 0 maps to `b` and all other wires shift down by 1. -/ -private theorem restrictGateP_eval_eq {G : Nat} [NeZero m] +theorem restrictGateP_eval_eq {G : Nat} [NeZero m] (b : Bool) (g : Gate Basis.andOr2 ((k + 1) + m + G)) (hfanIn : g.fanIn = 2) (bound : Nat) (hboundG : bound ≤ G) @@ -218,11 +222,11 @@ private theorem restrictGateP_eval_eq {G : Nat} [NeZero m] cases g.op <;> simp (config := { decide := true }) /-- The input to the old circuit obtained by prepending `b` to `x`. -/ -private def prependInput (b : Bool) (x : BitString (k + m)) : +def prependInput (b : Bool) (x : BitString (k + m)) : BitString ((k + 1) + m) := fun i => if h : i.val = 0 then b else x ⟨i.val - 1, by omega⟩ -private theorem wireValue_zero {G : Nat} [NeZero m] (b : Bool) +theorem wireValue_zero {G : Nat} [NeZero m] (b : Bool) (c : Circuit Basis.andOr2 ((k + 1) + m) 1 G) (x : BitString (k + m)) : c.wireValue (prependInput b x) ⟨0, by omega⟩ = b := by @@ -231,7 +235,7 @@ private theorem wireValue_zero {G : Nat} [NeZero m] (b : Bool) /-- Wire value correspondence: for wires > 0, the old circuit's wire value with prepended input equals the restricted circuit's shifted wire value. -/ -private theorem wireValue_restrict {G : Nat} [NeZero m] (b : Bool) +theorem wireValue_restrict {G : Nat} [NeZero m] (b : Bool) (c : Circuit Basis.andOr2 ((k + 1) + m) 1 G) (x : BitString (k + m)) (w : Nat) (hwlt : w < (k + 1) + m + G) diff --git a/Complexitylib/Circuits/Internal/NormalForm.lean b/Complexitylib/Circuits/Internal/NormalForm.lean index eda1576e..1fd95c5b 100644 --- a/Complexitylib/Circuits/Internal/NormalForm.lean +++ b/Complexitylib/Circuits/Internal/NormalForm.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.NormalForm.Defs -import Complexitylib.Circuits.AndOrNot.Defs -import Mathlib.Data.Fintype.BigOperators +module + +public import Complexitylib.Circuits.NormalForm.Defs +public import Complexitylib.Circuits.AndOrNot.Defs +public import Mathlib.Data.Fintype.BigOperators /-! # Internal: Normal Form Proof Machinery @@ -23,6 +25,8 @@ This internal module contains the proof infrastructure for CNF/DNF: The public interface re-exports the main theorems from `Complexitylib.Circuits.NormalForm`. -/ +@[expose] public section + namespace Complexity /-! ## Helper lemmas for toCircuit correctness -/ diff --git a/Complexitylib/Circuits/Internal/Schnorr.lean b/Complexitylib/Circuits/Internal/Schnorr.lean index 3a640075..02fdb596 100644 --- a/Complexitylib/Circuits/Internal/Schnorr.lean +++ b/Complexitylib/Circuits/Internal/Schnorr.lean @@ -3,9 +3,13 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Mathlib.Tactic -import Complexitylib.Circuits.XOR -import Complexitylib.Circuits.Internal.CircuitDescriptor +module + +public import Mathlib.Tactic +public import Complexitylib.Circuits.XOR +public import Complexitylib.Circuits.Internal.CircuitDescriptor + +@[expose] public section namespace Complexity diff --git a/Complexitylib/Circuits/Internal/SchnorrBridge.lean b/Complexitylib/Circuits/Internal/SchnorrBridge.lean index 8a4e52a3..b4387a8e 100644 --- a/Complexitylib/Circuits/Internal/SchnorrBridge.lean +++ b/Complexitylib/Circuits/Internal/SchnorrBridge.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Internal.CircuitToDescriptor -import Complexitylib.Circuits.Internal.Schnorr +module + +public import Complexitylib.Circuits.Internal.CircuitToDescriptor +public import Complexitylib.Circuits.Internal.Schnorr /-! # Internal: Schnorr bridge from descriptors to typed circuits @@ -13,6 +15,8 @@ This module transports the descriptor-level gate-elimination theorem to the typed fan-in-two circuit model. -/ +@[expose] public section + namespace Complexity open CircDesc diff --git a/Complexitylib/Circuits/Internal/ShannonBridge.lean b/Complexitylib/Circuits/Internal/ShannonBridge.lean index c8d633d9..a861a36d 100644 --- a/Complexitylib/Circuits/Internal/ShannonBridge.lean +++ b/Complexitylib/Circuits/Internal/ShannonBridge.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Internal.CircuitToDescriptor +module + +public import Complexitylib.Circuits.Internal.CircuitToDescriptor /-! # Internal: Shannon bridge from descriptors to typed circuits @@ -13,6 +15,8 @@ size used by the Shannon counting argument and transfers the resulting lower bound back to `Circuit`. -/ +@[expose] public section + namespace Complexity open CircDesc diff --git a/Complexitylib/Circuits/Internal/ShannonUpper.lean b/Complexitylib/Circuits/Internal/ShannonUpper.lean index 719a1278..e0ee57c9 100644 --- a/Complexitylib/Circuits/Internal/ShannonUpper.lean +++ b/Complexitylib/Circuits/Internal/ShannonUpper.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.AndOrNot.Defs -import Mathlib.Data.Nat.Log -import Mathlib.Tactic +module + +public import Complexitylib.Circuits.AndOrNot.Defs +public import Mathlib.Data.Nat.Log +public import Mathlib.Tactic /-! # Internal: Shannon Upper Bound Construction @@ -28,6 +30,8 @@ for column functions, AND/OR combining layers. Total ≤ `18 · 2^N / N` gates for `N ≥ 16`. -/ +@[expose] public section + namespace Complexity namespace ShannonUpper @@ -43,7 +47,7 @@ def dataBits (N : Nat) : Nat := N - addrBits N /-! ## Gate Construction Helpers -/ /-- Build a fan-in-2 gate bundled with an acyclicity proof. -/ -private def mkGate2' (op : AndOrOp) {W : Nat} (w₀ w₁ : Fin W) (n₀ n₁ : Bool) +def mkGate2' (op : AndOrOp) {W : Nat} (w₀ w₁ : Fin W) (n₀ n₁ : Bool) (bound : Nat) (hw₀ : w₀.val < bound) (hw₁ : w₁.val < bound) : { g : Gate Basis.andOr2 W // ∀ k : Fin g.fanIn, (g.inputs k).val < bound } := ⟨{ op := op, fanIn := 2, arityOk := rfl, @@ -52,26 +56,28 @@ private def mkGate2' (op : AndOrOp) {W : Nat} (w₀ w₁ : Fin W) (n₀ n₁ : B fun k => by dsimp; split_ifs <;> assumption⟩ /-- Remap a wire from c₂'s space into the combined space. -/ -private def remap₂ (N G₁ G₂ : Nat) (w : Fin (N + G₂)) : Fin (N + (G₁ + G₂ + 2)) := +def remap₂ (N G₁ G₂ : Nat) (w : Fin (N + G₂)) : Fin (N + (G₁ + G₂ + 2)) := if h : w.val < N then ⟨w.val, by omega⟩ else ⟨w.val + G₁ + 1, by have := w.isLt; omega⟩ -private lemma remap₂_val_lt (N G₁ G₂ : Nat) (w : Fin (N + G₂)) +lemma remap₂_val_lt (N G₁ G₂ : Nat) (w : Fin (N + G₂)) (bound : Nat) (hb : G₁ + 1 ≤ bound) (hw : w.val < N + (bound - G₁ - 1)) : (remap₂ N G₁ G₂ w).val < N + bound := by unfold remap₂; split_ifs <;> dsimp <;> omega -private def gw (idx : Nat) {W : Nat} (g : Gate Basis.andOr2 W) +@[nolint docBlame] +def gw (idx : Nat) {W : Nat} (g : Gate Basis.andOr2 W) (_ : idx < 2 := by omega) : Fin W := g.inputs ⟨idx, by rw [fanIn_andOr2]; omega⟩ -private def gn (idx : Nat) {W : Nat} (g : Gate Basis.andOr2 W) +@[nolint docBlame] +def gn (idx : Nat) {W : Nat} (g : Gate Basis.andOr2 W) (_ : idx < 2 := by omega) : Bool := g.negated ⟨idx, by rw [fanIn_andOr2]; omega⟩ /-! ## Binary Circuit Composition -/ /-- Gate + acyclicity proof for the binary composition, bundled as a subtype. -/ -private def binopGWP {N G₁ G₂ : Nat} [NeZero N] +def binopGWP {N G₁ G₂ : Nat} [NeZero N] (c₁ : Circuit Basis.andOr2 N 1 G₁) (c₂ : Circuit Basis.andOr2 N 1 G₂) (i : Fin (G₁ + G₂ + 2)) : { g : Gate Basis.andOr2 (N + (G₁ + G₂ + 2)) // @@ -117,7 +123,7 @@ def binopCircuit (op : AndOrOp) {N G₁ G₂ : Nat} [NeZero N] negated := fun _ => false } acyclic i k := (binopGWP c₁ c₂ i).property k -private theorem mkGate2'_eval (o : AndOrOp) {W : Nat} (w₀ w₁ : Fin W) (n₀ n₁ : Bool) +theorem mkGate2'_eval (o : AndOrOp) {W : Nat} (w₀ w₁ : Fin W) (n₀ n₁ : Bool) (b : Nat) (h₀ : w₀.val < b) (h₁ : w₁.val < b) (wv : BitString W) : (mkGate2' o w₀ w₁ n₀ n₁ b h₀ h₁).val.eval wv = @@ -127,7 +133,7 @@ private theorem mkGate2'_eval (o : AndOrOp) {W : Nat} (w₀ w₁ : Fin W) (n₀ simp only [mkGate2', Gate.eval, Basis.andOr2] cases o <;> simp [AndOrOp.eval, Fin.foldl_succ_last, Fin.foldl_zero] -private theorem andOr2_gate_eval_two_inputs {W : Nat} +theorem andOr2_gate_eval_two_inputs {W : Nat} (g : Gate Basis.andOr2 W) (wv : BitString W) : g.eval wv = match g.op with @@ -137,7 +143,7 @@ private theorem andOr2_gate_eval_two_inputs {W : Nat} simp only [Gate.eval, Basis.andOr2, gw, gn] cases g.op <;> simp_all [AndOrOp.eval, Fin.foldl_succ_last, Fin.foldl_zero, Fin.cast] -private theorem binop_wireValue_c₁ {N G₁ G₂ : Nat} [NeZero N] +theorem binop_wireValue_c₁ {N G₁ G₂ : Nat} [NeZero N] (op : AndOrOp) (c₁ : Circuit Basis.andOr2 N 1 G₁) (c₂ : Circuit Basis.andOr2 N 1 G₂) (x : BitString N) (w : Fin (N + G₁)) @@ -176,7 +182,7 @@ private theorem binop_wireValue_c₁ {N G₁ G₂ : Nat} [NeZero N] have := key w.val (by omega) hw convert this using 2 -private theorem binop_wireValue_c₂ {N G₁ G₂ : Nat} [NeZero N] +theorem binop_wireValue_c₂ {N G₁ G₂ : Nat} [NeZero N] (op : AndOrOp) (c₁ : Circuit Basis.andOr2 N 1 G₁) (c₂ : Circuit Basis.andOr2 N 1 G₂) (x : BitString N) (w : Fin (N + G₂)) : @@ -289,10 +295,10 @@ theorem binopCircuit_or_correct {N G₁ G₂ : Nat} [NeZero N] /-! ### Nat.log helpers -/ -private theorem log_ge_one (N : Nat) (hN : 16 ≤ N) : 1 ≤ Nat.log 2 N := +theorem log_ge_one (N : Nat) (hN : 16 ≤ N) : 1 ≤ Nat.log 2 N := Nat.le_log_of_pow_le (by omega) (by omega) -private theorem log_lt_N (N : Nat) (hN : 16 ≤ N) : Nat.log 2 N < N := +theorem log_lt_N (N : Nat) (hN : 16 ≤ N) : Nat.log 2 N < N := Nat.log_lt_of_lt_pow (by omega) (@Nat.lt_pow_self N 2 (by omega)) /-- For `N ≥ 16` there are at least three address variables. -/ @@ -314,18 +320,18 @@ theorem dataBits_ge_two (N : Nat) (hN : 16 ≤ N) : 2 ≤ dataBits N := by /-! ### Key identities -/ -private theorem addr_le_N (N : Nat) (hN : 16 ≤ N) : addrBits N ≤ N := by +theorem addr_le_N (N : Nat) (hN : 16 ≤ N) : addrBits N ≤ N := by unfold addrBits; have := log_lt_N N hN; omega -private theorem addr_data_sum (N : Nat) (hN : 16 ≤ N) : +theorem addr_data_sum (N : Nat) (hN : 16 ≤ N) : dataBits N + addrBits N = N := by unfold dataBits; have := addr_le_N N hN; omega -private theorem pow_split (N : Nat) (hN : 16 ≤ N) : +theorem pow_split (N : Nat) (hN : 16 ≤ N) : 2 ^ dataBits N * 2 ^ addrBits N = 2 ^ N := by rw [← Nat.pow_add]; congr 1; exact addr_data_sum N hN -private theorem two_mul_pow_addr_le (N : Nat) (hN : 16 ≤ N) : +theorem two_mul_pow_addr_le (N : Nat) (hN : 16 ≤ N) : 2 * 2 ^ addrBits N ≤ N := by unfold addrBits have hlog := log_ge_one N hN @@ -334,7 +340,7 @@ private theorem two_mul_pow_addr_le (N : Nat) (hN : 16 ≤ N) : rw [Nat.pow_succ]; ring rw [this]; exact Nat.pow_log_le_self 2 (by omega) -private theorem n_lt_four_pow_addr (N : Nat) (hN : 16 ≤ N) : +theorem n_lt_four_pow_addr (N : Nat) (hN : 16 ≤ N) : N < 4 * 2 ^ addrBits N := by unfold addrBits have hlog := log_ge_one N hN @@ -345,7 +351,7 @@ private theorem n_lt_four_pow_addr (N : Nat) (hN : 16 ≤ N) : /-! ### N² ≤ 2^N for N ≥ 16 -/ -private theorem two_n_plus_one_le (N : Nat) (hN : 4 ≤ N) : 2 * N + 1 ≤ 2 ^ N := by +theorem two_n_plus_one_le (N : Nat) (hN : 4 ≤ N) : 2 * N + 1 ≤ 2 ^ N := by induction N with | zero => omega | succ n ih => @@ -358,7 +364,7 @@ private theorem two_n_plus_one_le (N : Nat) (hN : 4 ≤ N) : 2 * N + 1 ≤ 2 ^ N _ ≤ 2 ^ n + 2 ^ n := by nlinarith [@Nat.lt_pow_self n 2 (by omega)] _ = 2 ^ (n + 1) := by ring -private theorem sq_le_pow (N : Nat) (hN : 16 ≤ N) : N * N ≤ 2 ^ N := by +theorem sq_le_pow (N : Nat) (hN : 16 ≤ N) : N * N ≤ 2 ^ N := by induction N with | zero => omega | succ n ih => @@ -374,7 +380,7 @@ private theorem sq_le_pow (N : Nat) (hN : 16 ≤ N) : N * N ≤ 2 ^ N := by /-! ### Term-by-term bounds -/ -private theorem term1 (N : Nat) (hN : 16 ≤ N) : +theorem term1 (N : Nat) (hN : 16 ≤ N) : 4 * 2 ^ dataBits N * N ≤ 16 * 2 ^ N := by have hlt := n_lt_four_pow_addr N hN calc 4 * 2 ^ dataBits N * N @@ -385,13 +391,13 @@ private theorem term1 (N : Nat) (hN : 16 ≤ N) : _ = 16 * (2 ^ dataBits N * 2 ^ addrBits N) := by ring _ = 16 * 2 ^ N := by rw [pow_split N hN] -private theorem term2 (N : Nat) (hN : 16 ≤ N) : +theorem term2 (N : Nat) (hN : 16 ≤ N) : 2 * 2 ^ addrBits N * N ≤ 2 ^ N := by calc 2 * 2 ^ addrBits N * N ≤ N * N := by apply Nat.mul_le_mul_right; exact two_mul_pow_addr_le N hN _ ≤ 2 ^ N := sq_le_pow N hN -private theorem pow_ge_four_mul (k : Nat) (hk : 4 ≤ k) : 4 * k ≤ 2 ^ k := by +theorem pow_ge_four_mul (k : Nat) (hk : 4 ≤ k) : 4 * k ≤ 2 ^ k := by induction k with | zero => omega | succ n ih => @@ -404,13 +410,13 @@ private theorem pow_ge_four_mul (k : Nat) (hk : 4 ≤ k) : 4 * k ≤ 2 ^ k := by _ ≤ 2 ^ n + 2 ^ n := by nlinarith [@Nat.lt_pow_self n 2 (by omega)] _ = 2 ^ (n + 1) := by ring -private theorem log_le_quarter (N : Nat) (hN : 16 ≤ N) : 4 * Nat.log 2 N ≤ N := by +theorem log_le_quarter (N : Nat) (hN : 16 ≤ N) : 4 * Nat.log 2 N ≤ N := by have hlog4 : 4 ≤ Nat.log 2 N := Nat.le_log_of_pow_le (by omega) (by omega) calc 4 * Nat.log 2 N ≤ 2 ^ Nat.log 2 N := pow_ge_four_mul (Nat.log 2 N) hlog4 _ ≤ N := Nat.pow_log_le_self 2 (by omega) -private theorem pow_addr_plus_addr_le (N : Nat) (hN : 16 ≤ N) : +theorem pow_addr_plus_addr_le (N : Nat) (hN : 16 ≤ N) : 2 ^ addrBits N + addrBits N + (Nat.log 2 N + 1) ≤ N := by unfold addrBits have hlog1 : 1 ≤ Nat.log 2 N := Nat.le_log_of_pow_le (by omega) (by omega) @@ -422,7 +428,7 @@ private theorem pow_addr_plus_addr_le (N : Nat) (hN : 16 ≤ N) : have := log_le_quarter N hN omega -private theorem term3 (N : Nat) (hN : 16 ≤ N) : +theorem term3 (N : Nat) (hN : 16 ≤ N) : 2 ^ (2 ^ addrBits N + addrBits N) * N ≤ 2 ^ N := by have hkey := pow_addr_plus_addr_le N hN have hsub : Nat.log 2 N + 1 ≤ N - (2 ^ addrBits N + addrBits N) := by omega @@ -441,7 +447,7 @@ private theorem term3 (N : Nat) (hN : 16 ≤ N) : apply Nat.mul_le_mul_left; omega _ = 2 ^ N := hsplit -private theorem n_le_pow (N : Nat) : N ≤ 2 ^ N := by +theorem n_le_pow (N : Nat) : N ≤ 2 ^ N := by have := @Nat.lt_pow_self N 2 (by omega); omega /-- Core counting bound: the total Shannon gate budget times `N` is at most @@ -472,7 +478,8 @@ theorem shannon_size_le (N : Nat) (hN : 16 ≤ N) (G : Nat) /-! ### Gate construction helper -/ -private def mkG (W : Nat) (op : AndOrOp) (w0 w1 : Nat) (n0 n1 : Bool) +@[nolint docBlame] +def mkG (W : Nat) (op : AndOrOp) (w0 w1 : Nat) (n0 n1 : Bool) (hw0 : w0 < W) (hw1 : w1 < W) (bound : Nat) (hb0 : w0 < bound) (hb1 : w1 < bound) : { g : Gate Basis.andOr2 W // ∀ j : Fin g.fanIn, (g.inputs j).val < bound } := @@ -509,11 +516,11 @@ def orChainOffset (kk qq : Nat) : Nat := andLayerOffset kk qq + 2^qq /-! ### Power-of-2 helpers -/ -private lemma pow_ge_4 (n : Nat) (hn : 2 ≤ n) : 4 ≤ 2 ^ n := by +lemma pow_ge_4 (n : Nat) (hn : 2 ≤ n) : 4 ≤ 2 ^ n := by have : (4 : Nat) = 2 ^ 2 := by norm_num rw [this]; exact Nat.pow_le_pow_right (by omega) hn -private lemma pow_double (n : Nat) : 2 ^ (n + 1) = 2 * 2 ^ n := by ring +lemma pow_double (n : Nat) : 2 ^ (n + 1) = 2 * 2 ^ n := by ring /-! ### Minterm tree level -/ @@ -575,7 +582,7 @@ lemma treeParentIndex_lt_j (l m j : Nat) (hl : 2 ≤ l) rw [hpow_eq] omega -private lemma treeLevel_parent (l m : Nat) (hl : 2 ≤ l) : +lemma treeLevel_parent (l m : Nat) (hl : 2 ≤ l) : treeLevel (treeParentIndex l m) = l - 1 := by unfold treeLevel treeParentIndex treeBase have h4l : 4 ≤ 2 ^ l := pow_ge_4 l hl @@ -590,7 +597,7 @@ private lemma treeLevel_parent (l m : Nat) (hl : 2 ≤ l) : (show 2 ^ l + m % 2 ^ l < 2 ^ (l + 1) by have := pow_double l; omega)) · exact Nat.le_log_of_pow_le (by omega) (by omega) -private lemma treePosition_parent (l m : Nat) (_hl : 2 ≤ l) : +lemma treePosition_parent (l m : Nat) (_hl : 2 ≤ l) : treePosition (treeParentIndex l m) (l - 1) = m % 2 ^ l := by show treeParentIndex l m - treeBase (l - 1) = m % 2 ^ l show treeBase (l - 1) + m % 2 ^ l - treeBase (l - 1) = m % 2 ^ l @@ -604,7 +611,7 @@ noncomputable def encodeColumn (k : Nat) (col : Fin (2^k) → Bool) : Nat := Finset.sum (Finset.univ : Finset (Fin (2^k))) fun j => if col j then 2^j.val else 0 -private lemma sum_pow_two_lt (n : Nat) : +lemma sum_pow_two_lt (n : Nat) : Finset.sum Finset.univ (fun j : Fin n => (2 : Nat) ^ j.val) < 2 ^ n := by rw [Fin.sum_univ_eq_sum_range] induction n with @@ -651,7 +658,8 @@ theorem columnPatternIndex_lt (N : Nat) (f : BitString N → Bool) /-! ### Shannon gate array -/ -private noncomputable def shannonGateArray (N : Nat) [NeZero N] +@[nolint docBlame unusedArguments] +noncomputable def shannonGateArray (N : Nat) [NeZero N] (f : BitString N → Bool) (hN : 16 ≤ N) : (i : Fin (totalSectionGates (addrBits N) (dataBits N))) → { g : Gate Basis.andOr2 (N + totalSectionGates (addrBits N) (dataBits N)) // @@ -880,7 +888,8 @@ private noncomputable def shannonGateArray (N : Nat) [NeZero N] unfold orChainOffset at hiF; omega exact mkG W .or w0 w1 false false hw0_lt hw1_lt (N + i.val) hb0 hb1 -private noncomputable def shannonCircuit (N : Nat) [NeZero N] +@[nolint docBlame] +noncomputable def shannonCircuit (N : Nat) [NeZero N] (f : BitString N → Bool) (hN : 16 ≤ N) : Circuit Basis.andOr2 N 1 (totalSectionGates (addrBits N) (dataBits N)) where gates i := (shannonGateArray N f hN i).val @@ -898,7 +907,7 @@ private noncomputable def shannonCircuit (N : Nat) [NeZero N] /-- The sum Σ_{j < k} (if b j then 2^j else 0) has no overlap between powers, so it is bounded by 2^k. -/ -private lemma sum_cond_pow_range_lt (k : Nat) (b : Nat → Bool) : +lemma sum_cond_pow_range_lt (k : Nat) (b : Nat → Bool) : Finset.sum (Finset.range k) (fun j => if b j then 2^j else 0) < 2^k := by induction k with | zero => simp @@ -909,7 +918,7 @@ private lemma sum_cond_pow_range_lt (k : Nat) (b : Nat → Bool) : _ = 2^(n+1) := by ring /-- testBit of a sum of conditional powers of 2 (range version). -/ -private theorem testBit_sum_cond_pow_range (k : Nat) (b : Nat → Bool) +theorem testBit_sum_cond_pow_range (k : Nat) (b : Nat → Bool) (i : Nat) (hi : i < k) : Nat.testBit (Finset.sum (Finset.range k) (fun j => if b j then 2^j else 0)) i = b i := by @@ -930,7 +939,7 @@ private theorem testBit_sum_cond_pow_range (k : Nat) (b : Nat → Bool) exact (Bool.eq_false_iff.mpr hbn).symm /-- Bound on conditional-power sum over Fin. -/ -private lemma sum_cond_pow_fin_lt (k : Nat) (b : BitString k) : +lemma sum_cond_pow_fin_lt (k : Nat) (b : BitString k) : Finset.sum (Finset.univ : Finset (Fin k)) (fun j => if b j then 2^j.val else 0) < 2^k := calc _ ≤ Finset.sum Finset.univ (fun j : Fin k => 2^j.val) := by @@ -938,7 +947,7 @@ private lemma sum_cond_pow_fin_lt (k : Nat) (b : BitString k) : _ < 2^k := sum_pow_two_lt k /-- testBit of a conditional-power sum over Fin k recovers the bit. -/ -private theorem testBit_sum_cond_pow_fin (k : Nat) (b : BitString k) (i : Nat) (hi : i < k) : +theorem testBit_sum_cond_pow_fin (k : Nat) (b : BitString k) (i : Nat) (hi : i < k) : Nat.testBit (Finset.sum (Finset.univ : Finset (Fin k)) (fun j => if b j then 2^j.val else 0)) i = b ⟨i, hi⟩ := by -- Prove by induction on k using a helper with ∀ quantifiers @@ -983,12 +992,12 @@ private theorem testBit_sum_cond_pow_fin (k : Nat) (b : BitString k) (i : Nat) ( /-! #### columnFunction reconstruction lemma -/ /-- Shift the data bits of x to form a q-bit function. -/ -private def shiftedBits (N k q : Nat) (hkq : k + q = N) (x : BitString N) : +def shiftedBits (N k q : Nat) (hkq : k + q = N) (x : BitString N) : BitString q := fun j => x ⟨k + j.val, by have := j.isLt; omega⟩ /-- columnFunction at the actual bit-vector address/data values equals f(x). -/ -private theorem columnFunction_at_actual_bits (N : Nat) [NeZero N] +theorem columnFunction_at_actual_bits (N : Nat) [NeZero N] (f : BitString N → Bool) (x : BitString N) (k q : Nat) (hkq : k + q = N) : let addr : BitString k := fun j => x ⟨j.val, by have := j.isLt; omega⟩ @@ -1017,13 +1026,13 @@ private theorem columnFunction_at_actual_bits (N : Nat) [NeZero N] /-! ##### Key identity -/ -private theorem addrDataSum (N : Nat) (hN : 16 ≤ N) : +theorem addrDataSum (N : Nat) (hN : 16 ≤ N) : addrBits N + dataBits N = N := by have := addr_data_sum N hN; omega /-! ##### Connecting the last wire to the OR chain -/ -private theorem lastWire_is_orChain_last (N : Nat) (hN : 16 ≤ N) : +theorem lastWire_is_orChain_last (N : Nat) (hN : 16 ≤ N) : N + totalSectionGates (addrBits N) (dataBits N) - 1 = N + orChainOffset (addrBits N) (dataBits N) + (2 ^ dataBits N - 2) := by have hq2 : 2 ≤ dataBits N := dataBits_ge_two N hN @@ -1035,7 +1044,7 @@ private theorem lastWire_is_orChain_last (N : Nat) (hN : 16 ≤ N) : /-! ##### Semantic decomposition of the circuit -/ /-- The semantic value of each AND-layer wire (Section E). -/ -private noncomputable def andLayerSem (N : Nat) +noncomputable def andLayerSem (N : Nat) (f : BitString N → Bool) (hN : 16 ≤ N) (x : BitString N) (y : Nat) (hy : y < 2 ^ dataBits N) : Bool := let k := addrBits N @@ -1051,7 +1060,7 @@ private noncomputable def andLayerSem (N : Nat) ⟨aVal, sum_cond_pow_fin_lt k addr⟩ /-- Foldl of OR over a list where all elements are false gives false. -/ -private theorem foldl_or_all_false {n : Nat} {P : Nat → Bool} +theorem foldl_or_all_false {n : Nat} {P : Nat → Bool} (hP : ∀ y, y < n → P y = false) : (List.range n).foldl (fun acc y => acc || P y) false = false := by induction n with @@ -1063,7 +1072,7 @@ private theorem foldl_or_all_false {n : Nat} {P : Nat → Bool} /-- A list foldl of OR where each non-matching term is false produces the value at the matching position. -/ -private theorem foldl_or_unique_true {n : Nat} {P : Nat → Bool} +theorem foldl_or_unique_true {n : Nat} {P : Nat → Bool} (target : Nat) (htarget : target < n) (hP : ∀ y, y < n → y ≠ target → P y = false) : (List.range n).foldl (fun acc y => acc || P y) false = P target := by @@ -1084,17 +1093,17 @@ private theorem foldl_or_unique_true {n : Nat} {P : Nat → Bool} simp [Bool.false_or] /-- The data sum: encode the data bits of x as a natural number. -/ -private noncomputable def dataSum (N : Nat) (hN : 16 ≤ N) (x : BitString N) : Nat := +noncomputable def dataSum (N : Nat) (hN : 16 ≤ N) (x : BitString N) : Nat := Finset.sum (Finset.univ : Finset (Fin (dataBits N))) (fun j => if shiftedBits N (addrBits N) (dataBits N) (addrDataSum N hN) x j then 2^j.val else 0) -private theorem dataSum_lt (N : Nat) (hN : 16 ≤ N) (x : BitString N) : +theorem dataSum_lt (N : Nat) (hN : 16 ≤ N) (x : BitString N) : dataSum N hN x < 2 ^ dataBits N := sum_cond_pow_fin_lt (dataBits N) (shiftedBits N (addrBits N) (dataBits N) (addrDataSum N hN) x) /-- andLayerSem at y is false when y ≠ dataSum. -/ -private theorem andLayerSem_ne (N : Nat) [NeZero N] +theorem andLayerSem_ne (N : Nat) [NeZero N] (f : BitString N → Bool) (hN : 16 ≤ N) (x : BitString N) (y : Nat) (hy : y < 2 ^ dataBits N) (hne : y ≠ dataSum N hN x) : andLayerSem N f hN x y hy = false := by @@ -1102,14 +1111,14 @@ private theorem andLayerSem_ne (N : Nat) [NeZero N] simp only [beq_eq_false_iff_ne.mpr hne, Bool.false_and] /-- andLayerSem at dataSum gives columnFunction at actual bits. -/ -private theorem andLayerSem_eq (N : Nat) [NeZero N] +theorem andLayerSem_eq (N : Nat) [NeZero N] (f : BitString N → Bool) (hN : 16 ≤ N) (x : BitString N) : andLayerSem N f hN x (dataSum N hN x) (dataSum_lt N hN x) = f x := by unfold andLayerSem dataSum simp only [beq_self_eq_true, Bool.true_and] exact columnFunction_at_actual_bits N f x (addrBits N) (dataBits N) (addrDataSum N hN) -private theorem or_andLayerSem_eq_f (N : Nat) [NeZero N] +theorem or_andLayerSem_eq_f (N : Nat) [NeZero N] (f : BitString N → Bool) (hN : 16 ≤ N) (x : BitString N) : (List.range (2 ^ dataBits N)).foldl (fun acc y => acc || if h : y < 2 ^ dataBits N @@ -1142,7 +1151,7 @@ private theorem or_andLayerSem_eq_f (N : Nat) [NeZero N] trace wireValue through Sections B and D respectively via tree-level induction. -/ -private theorem wireValue_dataLeaf (N : Nat) [NeZero N] +theorem wireValue_dataLeaf (N : Nat) [NeZero N] (f : BitString N → Bool) (hN : 16 ≤ N) (x : BitString N) (y : Nat) (hy : y < 2 ^ dataBits N) (hyW : N + 1 + (2 ^ dataBits N - 4) + y < @@ -1316,7 +1325,7 @@ private theorem wireValue_dataLeaf (N : Nat) [NeZero N] -- traces wireValue through the full column library and address tree; genuine elaboration cost set_option maxHeartbeats 12800000 in -private theorem wireValue_colOutput (N : Nat) [NeZero N] +theorem wireValue_colOutput (N : Nat) [NeZero N] (f : BitString N → Bool) (hN : 16 ≤ N) (x : BitString N) (y : Nat) (hy : y < 2 ^ dataBits N) (hyW : N + columnLibraryOffset (addrBits N) (dataBits N) + @@ -1671,7 +1680,7 @@ private theorem wireValue_colOutput (N : Nat) [NeZero N] The deep wireValue unfolding through all 6 sections (required for wireValue_andLayer_sem) and the gate array branch analysis make this the most technically challenging part of the formalization. -/ -private theorem wireValue_orChain_sem (N : Nat) [NeZero N] +theorem wireValue_orChain_sem (N : Nat) [NeZero N] (f : BitString N → Bool) (hN : 16 ≤ N) (x : BitString N) (r : Nat) (hr : r < 2 ^ dataBits N - 1) (hW : N + orChainOffset (addrBits N) (dataBits N) + r < @@ -1830,7 +1839,7 @@ private theorem wireValue_orChain_sem (N : Nat) [NeZero N] dif_pos (show r' + 1 < 2 ^ dataBits N from by omega), Bool.or_assoc] -private theorem lastOrChain_eq_f (N : Nat) [NeZero N] +theorem lastOrChain_eq_f (N : Nat) [NeZero N] (f : BitString N → Bool) (hN : 16 ≤ N) (x : BitString N) (hW : N + orChainOffset (addrBits N) (dataBits N) + (2 ^ dataBits N - 2) < N + totalSectionGates (addrBits N) (dataBits N)) : @@ -1854,7 +1863,7 @@ private theorem lastOrChain_eq_f (N : Nat) [NeZero N] The correctness argument proceeds in two steps: 1. The last wire index = orChainOffset(k,q) + (2^q - 2) (lastWire_is_orChain_last) 2. That wire evaluates to f(x) (lastOrChain_eq_f) -/ -private theorem shannon_lastWire_correct (N : Nat) [NeZero N] +theorem shannon_lastWire_correct (N : Nat) [NeZero N] (f : BitString N → Bool) (hN : 16 ≤ N) (x : BitString N) : (shannonCircuit N f hN).wireValue x ⟨N + totalSectionGates (addrBits N) (dataBits N) - 1, @@ -1878,7 +1887,7 @@ private theorem shannon_lastWire_correct (N : Nat) [NeZero N] -- Step 2: that wire = f(x) exact lastOrChain_eq_f N f hN x hW_or -private theorem shannonCircuit_correct (N : Nat) [NeZero N] +theorem shannonCircuit_correct (N : Nat) [NeZero N] (f : BitString N → Bool) (hN : 16 ≤ N) (x : BitString N) : ((shannonCircuit N f hN).eval x) 0 = f x := by -- eval at output 0 = outputs-gate.eval(wireValue) @@ -1887,7 +1896,7 @@ private theorem shannonCircuit_correct (N : Nat) [NeZero N] simp only [Bool.false_xor, Bool.or_self] exact shannon_lastWire_correct N f hN x -private theorem totalSectionGates_le_bound (N : Nat) (_hN : 16 ≤ N) : +theorem totalSectionGates_le_bound (N : Nat) (_hN : 16 ≤ N) : totalSectionGates (addrBits N) (dataBits N) + 1 ≤ 4 * 2 ^ dataBits N + 2 * 2 ^ addrBits N + 2 ^ (2 ^ addrBits N + addrBits N) := by unfold totalSectionGates diff --git a/Complexitylib/Circuits/Internal/Simulation.lean b/Complexitylib/Circuits/Internal/Simulation.lean index 21a8094b..848bbbbe 100644 --- a/Complexitylib/Circuits/Internal/Simulation.lean +++ b/Complexitylib/Circuits/Internal/Simulation.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Internal.AndOrNot -import Complexitylib.Circuits.Dependency.Defs -import Mathlib.Algebra.BigOperators.Fin +module + +public import Complexitylib.Circuits.Internal.AndOrNot +public import Complexitylib.Circuits.Dependency.Defs +public import Mathlib.Algebra.BigOperators.Fin /-! # Internal: Completeness of fan-in-2 AND/OR @@ -30,6 +32,8 @@ gates followed by chains for all original output gates. The new output gates are trivial passthroughs reading the last wire of each output chain. -/ +@[expose] public section + namespace Complexity /-! ## AndOrOp extensions -/ @@ -107,7 +111,7 @@ lemma chainLen_of_ge_two {k : Nat} (hk : 2 ≤ k) : chainLen k = k - 1 := by simp only [chainLen, show ¬(k ≤ 1) from by omega, ite_false] /-- A chain uses at most one more gate than the simulated gate's fan-in. -/ -private lemma chainLen_le_succ (k : Nat) : chainLen k ≤ k + 1 := by +lemma chainLen_le_succ (k : Nat) : chainLen k ≤ k + 1 := by unfold chainLen split <;> omega @@ -130,7 +134,7 @@ lemma prefixSum_mono (f : Nat → Nat) {i j : Nat} (h : i ≤ j) : | refl => exact Nat.le.refl | step _ ih => rw [prefixSum_succ]; omega -private lemma prefixSum_congr {f g : Nat → Nat} {n : Nat} +lemma prefixSum_congr {f g : Nat → Nat} {n : Nat} (h : ∀ i, i < n → f i = g i) : prefixSum f n = prefixSum g n := by induction n with @@ -139,7 +143,7 @@ private lemma prefixSum_congr {f g : Nat → Nat} {n : Nat} rw [prefixSum_succ, prefixSum_succ] rw [ih (fun i hi => h i (by omega)), h n (by omega)] -private lemma prefixSum_le_add +lemma prefixSum_le_add (f g : Nat → Nat) (n : Nat) (h : ∀ i, i < n → f i ≤ g i + 1) : prefixSum f n ≤ prefixSum g n + n := by @@ -151,7 +155,7 @@ private lemma prefixSum_le_add have hlast := h n (by omega) omega -private lemma prefixSum_fin_eq {n : Nat} (f : Fin n → Nat) : +lemma prefixSum_fin_eq {n : Nat} (f : Fin n → Nat) : prefixSum (fun i => if h : i < n then f ⟨i, h⟩ else 0) n = ∑ i, f i := by induction n with @@ -344,11 +348,11 @@ lemma fin2_zero (a b : α) : fin2 a b ⟨0, by omega⟩ = a := rfl lemma fin2_one (a b : α) : fin2 a b ⟨1, by omega⟩ = b := rfl /-- Operation for the chain gate: dual-op for constants, same op otherwise. -/ -private def mkChainOp (op : AndOrOp) (k : Nat) : AndOrOp := +def mkChainOp (op : AndOrOp) (k : Nat) : AndOrOp := if k = 0 then op.dual else op /-- Input wires for the j-th chain gate. -/ -private def mkChainInputs {W : Nat} (hW : 0 < W) (k : Nat) +def mkChainInputs {W : Nat} (hW : 0 < W) (k : Nat) (ri : Fin k → Fin W) (base : Nat) (j : Nat) (hj : j < chainLen k) (hbase : base + chainLen k ≤ W) : Fin 2 → Fin W := if hk0 : k = 0 then fun _ => ⟨0, hW⟩ @@ -362,7 +366,7 @@ private def mkChainInputs {W : Nat} (hW : 0 < W) (k : Nat) fin2 ⟨base + j - 1, by omega⟩ (ri ⟨j + 1, by omega⟩) /-- Negation flags for the j-th chain gate. -/ -private def mkChainNeg (k : Nat) (rn : Fin k → Bool) (j : Nat) +def mkChainNeg (k : Nat) (rn : Fin k → Bool) (j : Nat) (hj : j < chainLen k) : Fin 2 → Bool := if hk0 : k = 0 then fin2 false true else if hk1 : k = 1 then fun _ => rn ⟨0, by omega⟩ @@ -383,7 +387,7 @@ def mkChainGate {W : Nat} (hW : 0 < W) (op : AndOrOp) (k : Nat) negated := mkChainNeg k rn j hj } /-- All inputs of a chain are strictly before `base + j` in the wire ordering. -/ -private lemma mkChainInputs_lt {W : Nat} (hW : 0 < W) (k : Nat) +lemma mkChainInputs_lt {W : Nat} (hW : 0 < W) (k : Nat) (ri : Fin k → Fin W) (base : Nat) (j : Nat) (hj : j < chainLen k) (hbase : base + chainLen k ≤ W) (hri_lt : ∀ i, (ri i).val < base) (hbase_pos : 0 < base) @@ -403,7 +407,7 @@ private lemma mkChainInputs_lt {W : Nat} (hW : 0 < W) (k : Nat) /-! ## Compiled circuit -/ /-- Input wires for the compiled gate at flat index `idx`. -/ -private def compileGateInputs (c : Circuit Basis.unboundedAndOr N M G) (idx : Fin (G' c)) : +def compileGateInputs (c : Circuit Basis.unboundedAndOr N M G) (idx : Fin (G' c)) : Fin 2 → Fin (N + G' c) := if h : idx.val < iTotal c then let seg := segLookup G (iChainF c) idx.val h @@ -427,7 +431,7 @@ private def compileGateInputs (c : Circuit Basis.unboundedAndOr N M G) (idx : Fi (by have := oOffset_chain_le_G' c hj; omega) /-- Operation for the compiled gate at flat index `idx`. -/ -private def compileGateOp (c : Circuit Basis.unboundedAndOr N M G) (idx : Fin (G' c)) : AndOrOp := +def compileGateOp (c : Circuit Basis.unboundedAndOr N M G) (idx : Fin (G' c)) : AndOrOp := if h : idx.val < iTotal c then let seg := segLookup G (iChainF c) idx.val h have hi : seg.1 < G := segLookup_fst_lt G _ _ h @@ -440,7 +444,7 @@ private def compileGateOp (c : Circuit Basis.unboundedAndOr N M G) (idx : Fin (G mkChainOp (c.outputs ⟨seg.1, hj⟩).op (c.outputs ⟨seg.1, hj⟩).fanIn /-- Negation flags for the compiled gate at flat index `idx`. -/ -private def compileGateNeg (c : Circuit Basis.unboundedAndOr N M G) (idx : Fin (G' c)) : +def compileGateNeg (c : Circuit Basis.unboundedAndOr N M G) (idx : Fin (G' c)) : Fin 2 → Bool := if h : idx.val < iTotal c then let seg := segLookup G (iChainF c) idx.val h @@ -558,34 +562,34 @@ lemma segLookup_of_prefixSum (n : Nat) (f : Nat → Nat) (i j : Nat) simp /-- Partial fold: the result of folding `op.binOp` over the first `j` values. -/ -private def partialFold (op : AndOrOp) (v : Fin k → Bool) (j : Nat) : Bool := +def partialFold (op : AndOrOp) (v : Fin k → Bool) (j : Nat) : Bool := if h : j ≤ k then Fin.foldl j (fun acc i => op.binOp acc (v ⟨i.val, by omega⟩)) op.identity else op.eval k v -private lemma partialFold_zero (op : AndOrOp) (v : Fin k → Bool) : +lemma partialFold_zero (op : AndOrOp) (v : Fin k → Bool) : partialFold op v 0 = op.identity := by simp [partialFold, Fin.foldl_zero] -private lemma partialFold_succ (op : AndOrOp) (v : Fin k → Bool) (j : Nat) (hj : j < k) : +lemma partialFold_succ (op : AndOrOp) (v : Fin k → Bool) (j : Nat) (hj : j < k) : partialFold op v (j + 1) = op.binOp (partialFold op v j) (v ⟨j, hj⟩) := by simp only [partialFold, show j + 1 ≤ k from by omega, show j ≤ k from by omega, dite_true] rw [Fin.foldl_succ_last]; congr 1 -private lemma partialFold_one (op : AndOrOp) (v : Fin k → Bool) (hk : 0 < k) : +lemma partialFold_one (op : AndOrOp) (v : Fin k → Bool) (hk : 0 < k) : partialFold op v 1 = op.binOp op.identity (v ⟨0, hk⟩) := by rw [partialFold_succ op v 0 hk, partialFold_zero] -private lemma partialFold_two (op : AndOrOp) (v : Fin k → Bool) (hk : 1 < k) : +lemma partialFold_two (op : AndOrOp) (v : Fin k → Bool) (hk : 1 < k) : partialFold op v 2 = op.binOp (op.binOp op.identity (v ⟨0, by omega⟩)) (v ⟨1, hk⟩) := by rw [partialFold_succ op v 1 hk, partialFold_one op v (by omega)] -private lemma partialFold_full (op : AndOrOp) (v : Fin k → Bool) : +lemma partialFold_full (op : AndOrOp) (v : Fin k → Bool) : partialFold op v k = op.eval k v := by simp only [partialFold, le_refl, dite_true, AndOrOp.eval_eq_foldl] /-- The segLookup at `iOffset c i + j` returns `(i, j)`. -/ -private lemma iSegLookup_eq (c : Circuit Basis.unboundedAndOr N M G) +lemma iSegLookup_eq (c : Circuit Basis.unboundedAndOr N M G) (i : Nat) (hi : i < G) (j : Nat) (hj : j < chainLen (c.gates ⟨i, hi⟩).fanIn) (h : iOffset c i + j < iTotal c := by have := iOffset_chain_le_iTotal c hi; omega) : @@ -595,7 +599,7 @@ private lemma iSegLookup_eq (c : Circuit Basis.unboundedAndOr N M G) · rw [iChainF_eq c hi]; exact hj /-- The segLookup at `prefixSum (oChainF c) j' + p` returns `(j', p)`. -/ -private lemma oSegLookup_eq (c : Circuit Basis.unboundedAndOr N M G) +lemma oSegLookup_eq (c : Circuit Basis.unboundedAndOr N M G) (j' : Nat) (hj' : j' < M) (p : Nat) (hp : p < chainLen (c.outputs ⟨j', hj'⟩).fanIn) (h : prefixSum (oChainF c) j' + p < oTotal c := by have := oOffset_chain_le_G' c hj'; unfold G' oOffset oTotal at *; omega) : @@ -605,12 +609,12 @@ private lemma oSegLookup_eq (c : Circuit Basis.unboundedAndOr N M G) · rw [oChainF_eq c hj']; exact hp /-- Evaluating a fan-in-2 gate: `op.eval 2 v = op.binOp (v 0) (v 1)`. -/ -private lemma andOr2_eval (op : AndOrOp) (v : BitString 2) : +lemma andOr2_eval (op : AndOrOp) (v : BitString 2) : op.eval 2 v = op.binOp (v 0) (v 1) := by cases op <;> simp [AndOrOp.eval, Fin.foldl_succ_last, Fin.foldl_zero, AndOrOp.binOp] /-- For k = 0: the single chain gate computes `op.identity`. -/ -private lemma mkChainGate_eval_zero {W base : Nat} (op : AndOrOp) +lemma mkChainGate_eval_zero {W base : Nat} (op : AndOrOp) (ri : Fin 0 → Fin W) (rn : Fin 0 → Bool) (hW : 0 < W) (hj : 0 < chainLen 0) (hbase : base + chainLen 0 ≤ W) (wv : BitString W) : @@ -620,7 +624,7 @@ private lemma mkChainGate_eval_zero {W base : Nat} (op : AndOrOp) exact AndOrOp.dual_const op (wv ⟨0, hW⟩) /-- For k = 1: the single chain gate is a passthrough. -/ -private lemma mkChainGate_eval_one {W base : Nat} (op : AndOrOp) +lemma mkChainGate_eval_one {W base : Nat} (op : AndOrOp) (ri : Fin 1 → Fin W) (rn : Fin 1 → Bool) (hW : 0 < W) (hj : 0 < chainLen 1) (hbase : base + chainLen 1 ≤ W) (wv : BitString W) : @@ -630,7 +634,7 @@ private lemma mkChainGate_eval_one {W base : Nat} (op : AndOrOp) AndOrOp.passthrough_eq] /-- For k ≥ 2, j = 0: first chain gate computes `op.binOp (v 0) (v 1)`. -/ -private lemma mkChainGate_eval_ge2_zero {W base : Nat} (op : AndOrOp) {k : Nat} (hk : 2 ≤ k) +lemma mkChainGate_eval_ge2_zero {W base : Nat} (op : AndOrOp) {k : Nat} (hk : 2 ≤ k) (ri : Fin k → Fin W) (rn : Fin k → Bool) (hW : 0 < W) (hj : 0 < chainLen k) (hbase : base + chainLen k ≤ W) (wv : BitString W) : @@ -642,7 +646,7 @@ private lemma mkChainGate_eval_ge2_zero {W base : Nat} (op : AndOrOp) {k : Nat} rw [andOr2_eval]; simp [fin2] /-- For k ≥ 2, j > 0: chain gate reads previous chain output and next original input. -/ -private lemma mkChainGate_eval_ge2_succ {W base : Nat} (op : AndOrOp) {k : Nat} (hk : 2 ≤ k) +lemma mkChainGate_eval_ge2_succ {W base : Nat} (op : AndOrOp) {k : Nat} (hk : 2 ≤ k) (ri : Fin k → Fin W) (rn : Fin k → Bool) (hW : 0 < W) {j' : Nat} (hj : j' + 1 < chainLen k) (hbase : base + chainLen k ≤ W) (wv : BitString W) : @@ -661,7 +665,7 @@ private lemma mkChainGate_eval_ge2_succ {W base : Nat} (op : AndOrOp) {k : Nat} /-- The eval of the compiled gate at `iOffset c i + j` equals the chain gate's eval. This requires showing that `segLookup` at `iOffset c i + j` returns `(i, j)` and the resulting gate components match. -/ -private lemma compileGate_eval_at_iOffset (c : Circuit Basis.unboundedAndOr N M G) +lemma compileGate_eval_at_iOffset (c : Circuit Basis.unboundedAndOr N M G) (i : Nat) (hi : i < G) (j : Nat) (hj : j < chainLen (c.gates ⟨i, hi⟩).fanIn) (hidx : iOffset c i + j < G' c := by have := iOffset_chain_le_iTotal c hi; have := chainLen_pos (c.gates ⟨i, hi⟩).fanIn; @@ -695,7 +699,7 @@ private lemma compileGate_eval_at_iOffset (c : Circuit Basis.unboundedAndOr N M | (simp [iSegLookup_eq c i hi j hj]) /-- The last chain gate for internal gate `i` evaluates to the original gate's eval. -/ -private theorem lastChainValue_eq (c : Circuit Basis.unboundedAndOr N M G) (input : BitString N) +theorem lastChainValue_eq (c : Circuit Basis.unboundedAndOr N M G) (input : BitString N) (i : Nat) (hi : i < G) (ih_outer : ∀ w : Fin (N + G), w.val < N + i → (compileFn c).wireValue input (remapWire c w) = c.wireValue input w) : @@ -833,7 +837,7 @@ theorem wireValue_remapWire (c : Circuit Basis.unboundedAndOr N M G) (input : Bi exact hmain w.val w.isLt /-- The eval of the compiled gate at output offset position equals the chain gate's eval. -/ -private lemma compileGate_eval_at_oOffset (c : Circuit Basis.unboundedAndOr N M G) +lemma compileGate_eval_at_oOffset (c : Circuit Basis.unboundedAndOr N M G) (j' : Nat) (hj' : j' < M) (p : Nat) (hp : p < chainLen (c.outputs ⟨j', hj'⟩).fanIn) (hidx : iTotal c + prefixSum (oChainF c) j' + p < G' c := by have := oOffset_chain_le_G' c hj'; unfold oOffset G' at *; omega) @@ -860,7 +864,7 @@ private lemma compileGate_eval_at_oOffset (c : Circuit Basis.unboundedAndOr N M | (simp only [hoff]; simp [oSegLookup_eq c j' hj' p hp]) /-- The last chain gate for output `j` evaluates to the original output gate's eval. -/ -private theorem lastOutputChainValue_eq (c : Circuit Basis.unboundedAndOr N M G) +theorem lastOutputChainValue_eq (c : Circuit Basis.unboundedAndOr N M G) (input : BitString N) (j' : Nat) (hj' : j' < M) : (compileFn c).wireValue input diff --git a/Complexitylib/Circuits/Internal/Spira.lean b/Complexitylib/Circuits/Internal/Spira.lean index b0a5991b..34ce1454 100644 --- a/Complexitylib/Circuits/Internal/Spira.lean +++ b/Complexitylib/Circuits/Internal/Spira.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Formula -import Mathlib.Data.Nat.Log -import Mathlib.Tactic +module + +public import Complexitylib.Circuits.Formula +public import Mathlib.Data.Nat.Log +public import Mathlib.Tactic /-! # Spira formula balancing -- proof internals @@ -15,6 +17,8 @@ balancing theorem. The construction is kept internal; the public surface states only the existence of an equivalent shallow, polynomial-size formula. -/ +@[expose] public section + namespace Complexity namespace BoolFormula diff --git a/Complexitylib/Circuits/Internal/Valiant.lean b/Complexitylib/Circuits/Internal/Valiant.lean index 0573ebb9..165d8b12 100644 --- a/Complexitylib/Circuits/Internal/Valiant.lean +++ b/Complexitylib/Circuits/Internal/Valiant.lean @@ -3,16 +3,18 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Mathlib.Digraph -import Mathlib.Algebra.BigOperators.Group.Finset.Basic -import Mathlib.Algebra.Order.BigOperators.Group.Finset -import Mathlib.Data.Finset.Card -import Mathlib.Data.Finset.Max -import Mathlib.Data.Fintype.BigOperators -import Mathlib.Data.Fintype.Prod -import Mathlib.Data.Nat.Bitwise -import Mathlib.Data.Nat.Log -import Mathlib.Tactic.Ring +module + +public import Complexitylib.Mathlib.Digraph +public import Mathlib.Algebra.BigOperators.Group.Finset.Basic +public import Mathlib.Algebra.Order.BigOperators.Group.Finset +public import Mathlib.Data.Finset.Card +public import Mathlib.Data.Finset.Max +public import Mathlib.Data.Fintype.BigOperators +public import Mathlib.Data.Fintype.Prod +public import Mathlib.Data.Nat.Bitwise +public import Mathlib.Data.Nat.Log +public import Mathlib.Tactic.Ring /-! # Internal helpers for Valiant's Depth Reduction Lemma @@ -25,6 +27,8 @@ bounds for `canonicalLabel`), the edge partition by first-differing bit, the averaging step, and the relabeling-after-removal bound. -/ +@[expose] public section + namespace Complexity namespace Valiant diff --git a/Complexitylib/Circuits/KarchmerWigderson.lean b/Complexitylib/Circuits/KarchmerWigderson.lean index 06dd5880..a3c849eb 100644 --- a/Complexitylib/Circuits/KarchmerWigderson.lean +++ b/Complexitylib/Circuits/KarchmerWigderson.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.KarchmerWigderson.Defs -import Complexitylib.Circuits.KarchmerWigderson.Internal +module + +public import Complexitylib.Circuits.KarchmerWigderson.Defs +public import Complexitylib.Circuits.KarchmerWigderson.Internal /-! # The monotone Karchmer--Wigderson correspondence @@ -23,6 +25,8 @@ its root Karchmer--Wigderson relation has a depth-`d` protocol in this model. No uniformity condition is present. -/ +@[expose] public section + namespace Complexity namespace KarchmerWigderson namespace Protocol diff --git a/Complexitylib/Circuits/KarchmerWigderson/Defs.lean b/Complexitylib/Circuits/KarchmerWigderson/Defs.lean index 1b08fa1c..9ad9518c 100644 --- a/Complexitylib/Circuits/KarchmerWigderson/Defs.lean +++ b/Complexitylib/Circuits/KarchmerWigderson/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Mathlib.Data.Set.Basic -import Complexitylib.Circuits.Monotone.Defs +module + +public import Mathlib.Data.Set.Basic +public import Complexitylib.Circuits.Monotone.Defs /-! # Karchmer--Wigderson protocols -- definitions @@ -15,6 +17,8 @@ At a leaf, one coordinate separates every zero input from every one input in the current rectangle. -/ +@[expose] public section + namespace Complexity namespace KarchmerWigderson diff --git a/Complexitylib/Circuits/KarchmerWigderson/Internal.lean b/Complexitylib/Circuits/KarchmerWigderson/Internal.lean index 92a5c3bb..290dbc0e 100644 --- a/Complexitylib/Circuits/KarchmerWigderson/Internal.lean +++ b/Complexitylib/Circuits/KarchmerWigderson/Internal.lean @@ -3,12 +3,16 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.KarchmerWigderson.Defs +module + +public import Complexitylib.Circuits.KarchmerWigderson.Defs /-! # Karchmer--Wigderson protocols -- proof internals -/ +@[expose] public section + namespace Complexity namespace KarchmerWigderson namespace Protocol diff --git a/Complexitylib/Circuits/LowerBound.lean b/Complexitylib/Circuits/LowerBound.lean index 40f1a235..ae68d697 100644 --- a/Complexitylib/Circuits/LowerBound.lean +++ b/Complexitylib/Circuits/LowerBound.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.EssentialInput -import Complexitylib.Circuits.Internal.LowerBound +module + +public import Complexitylib.Circuits.EssentialInput +public import Complexitylib.Circuits.Internal.LowerBound /-! # Gate Elimination Lower Bound @@ -44,6 +46,8 @@ And its corollary for functions that depend on all inputs: N ≤ k * c.size -/ +@[expose] public section + namespace Complexity namespace Circuit diff --git a/Complexitylib/Circuits/Monotone.lean b/Complexitylib/Circuits/Monotone.lean index ca05784f..7d312b14 100644 --- a/Complexitylib/Circuits/Monotone.lean +++ b/Complexitylib/Circuits/Monotone.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Monotone.Defs -import Complexitylib.Circuits.Monotone.Internal +module + +public import Complexitylib.Circuits.Monotone.Defs +public import Complexitylib.Circuits.Monotone.Internal /-! # Monotone Boolean formulas @@ -18,6 +20,8 @@ monotonicity, locality, and two elementary lower bounds: distinct variables and essential variables are both bounded by the number of formula leaves. -/ +@[expose] public section + namespace Complexity namespace MonotoneFormula diff --git a/Complexitylib/Circuits/Monotone/Defs.lean b/Complexitylib/Circuits/Monotone/Defs.lean index 362c020f..6b48781f 100644 --- a/Complexitylib/Circuits/Monotone/Defs.lean +++ b/Complexitylib/Circuits/Monotone/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.BitString -import Complexitylib.Circuits.Formula +module + +public import Complexitylib.Circuits.BitString +public import Complexitylib.Circuits.Formula /-! # Monotone Boolean formulas -- definitions @@ -14,6 +16,8 @@ disjunctions only. Constants and negations are deliberately absent: this is the standard syntax used by the Karchmer--Wigderson correspondence. -/ +@[expose] public section + namespace Complexity /-- A monotone Boolean formula over exactly `N` input variables. -/ diff --git a/Complexitylib/Circuits/Monotone/Internal.lean b/Complexitylib/Circuits/Monotone/Internal.lean index 04e44566..c86e9c75 100644 --- a/Complexitylib/Circuits/Monotone/Internal.lean +++ b/Complexitylib/Circuits/Monotone/Internal.lean @@ -3,13 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.EssentialInput -import Complexitylib.Circuits.Monotone.Defs +module + +public import Complexitylib.Circuits.EssentialInput +public import Complexitylib.Circuits.Monotone.Defs /-! # Monotone Boolean formulas -- proof internals -/ +@[expose] public section + namespace Complexity namespace MonotoneFormula diff --git a/Complexitylib/Circuits/MultilinearExtension.lean b/Complexitylib/Circuits/MultilinearExtension.lean index 0c7b25eb..50d0cfa9 100644 --- a/Complexitylib/Circuits/MultilinearExtension.lean +++ b/Complexitylib/Circuits/MultilinearExtension.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Mathlib.Algebra.Ring.Defs -import Mathlib.Tactic.Ring +module + +public import Mathlib.Algebra.Ring.Defs +public import Mathlib.Tactic.Ring /-! # Multilinear extension (one variable) @@ -23,6 +25,8 @@ arithmetized formulas agree with their Boolean originals on the cube. - `mle₁_bool` — it agrees with `f` at both Boolean points -/ +@[expose] public section + namespace Complexity /-- The one-variable multilinear extension of `f : Bool → R` into a commutative diff --git a/Complexitylib/Circuits/Nondeterminism.lean b/Complexitylib/Circuits/Nondeterminism.lean index 7d490ca7..92bf2d7e 100644 --- a/Complexitylib/Circuits/Nondeterminism.lean +++ b/Complexitylib/Circuits/Nondeterminism.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Nondeterminism.Defs -import Complexitylib.Circuits.Internal.Nondeterminism -import Complexitylib.Circuits.Shannon +module + +public import Complexitylib.Circuits.Nondeterminism.Defs +public import Complexitylib.Circuits.Internal.Nondeterminism +public import Complexitylib.Circuits.Shannon /-! # Nondeterministic Circuit Complexity Bounds @@ -47,6 +49,8 @@ The naive bound is tighter when `k` is small and `f` has low complexity; the Shannon bound wins when `k` is large, regardless of `f`'s complexity. -/ +@[expose] public section + namespace Complexity variable {k m : Nat} diff --git a/Complexitylib/Circuits/Nondeterminism/Defs.lean b/Complexitylib/Circuits/Nondeterminism/Defs.lean index 91069ab2..3cfc22e5 100644 --- a/Complexitylib/Circuits/Nondeterminism/Defs.lean +++ b/Complexitylib/Circuits/Nondeterminism/Defs.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Basic -import Mathlib.Data.Fin.Tuple.Basic -import Mathlib.Data.Fintype.BigOperators +module + +public import Complexitylib.Circuits.Basic +public import Mathlib.Data.Fin.Tuple.Basic +public import Mathlib.Data.Fintype.BigOperators /-! # Nondeterministic Quantification of Boolean Functions @@ -32,6 +34,8 @@ guesses the first `k` input bits. * `existsQuantify_mono` — monotonicity under pointwise implication -/ +@[expose] public section + namespace Complexity variable {k m : Nat} diff --git a/Complexitylib/Circuits/NormalForm.lean b/Complexitylib/Circuits/NormalForm.lean index 9a659e7f..3c4f1a9e 100644 --- a/Complexitylib/Circuits/NormalForm.lean +++ b/Complexitylib/Circuits/NormalForm.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.NormalForm.Defs -import Complexitylib.Circuits.Internal.NormalForm -import Complexitylib.Circuits.XOR +module + +public import Complexitylib.Circuits.NormalForm.Defs +public import Complexitylib.Circuits.Internal.NormalForm +public import Complexitylib.Circuits.XOR /-! # Normal Forms: CNF/DNF Lower Bound for XOR @@ -31,6 +33,8 @@ De Morgan duality (`CNF.neg`). * `CNF.two_pow_le_complexity_of_xorBool` — any CNF computing XOR has `≥ 2^{N-1}` clauses -/ +@[expose] public section + namespace Complexity /-- Any DNF computing N-variable XOR requires at least `2^{N-1}` terms. -/ diff --git a/Complexitylib/Circuits/NormalForm/Defs.lean b/Complexitylib/Circuits/NormalForm/Defs.lean index 939bf7fb..7378ec82 100644 --- a/Complexitylib/Circuits/NormalForm/Defs.lean +++ b/Complexitylib/Circuits/NormalForm/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Basic +module + +public import Complexitylib.Circuits.Basic /-! # Normal Forms — Core Definitions @@ -29,6 +31,8 @@ variable count `N` and are used for circuit lower bounds, whereas the `SAT` vers `Nat`-indexed and serve as the language encoding for SAT. -/ +@[expose] public section + namespace Complexity /-- A literal: a Boolean variable (by index) together with a polarity flag. diff --git a/Complexitylib/Circuits/NormalForm/Operations.lean b/Complexitylib/Circuits/NormalForm/Operations.lean index 6089560c..59e92632 100644 --- a/Complexitylib/Circuits/NormalForm/Operations.lean +++ b/Complexitylib/Circuits/NormalForm/Operations.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.NormalForm.Operations.Defs -import Complexitylib.Circuits.NormalForm.Operations.Internal +module + +public import Complexitylib.Circuits.NormalForm.Operations.Defs +public import Complexitylib.Circuits.NormalForm.Operations.Internal /-! # Operations on CNF and DNF @@ -15,6 +17,8 @@ decision trees be assembled into the matching normal form without a distributive expansion. -/ +@[expose] public section + namespace Complexity namespace DNF diff --git a/Complexitylib/Circuits/NormalForm/Operations/Defs.lean b/Complexitylib/Circuits/NormalForm/Operations/Defs.lean index 21a7c10a..07adf1c2 100644 --- a/Complexitylib/Circuits/NormalForm/Operations/Defs.lean +++ b/Complexitylib/Circuits/NormalForm/Operations/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.NormalForm.Defs +module + +public import Complexitylib.Circuits.NormalForm.Defs /-! # Operations on CNF and DNF -- definitions @@ -14,6 +16,8 @@ used when one alternating formula layer is assembled from normal forms for its children. -/ +@[expose] public section + namespace Complexity namespace DNF diff --git a/Complexitylib/Circuits/NormalForm/Operations/Internal.lean b/Complexitylib/Circuits/NormalForm/Operations/Internal.lean index beace94b..da7d8430 100644 --- a/Complexitylib/Circuits/NormalForm/Operations/Internal.lean +++ b/Complexitylib/Circuits/NormalForm/Operations/Internal.lean @@ -3,12 +3,16 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.NormalForm.Operations.Defs +module + +public import Complexitylib.Circuits.NormalForm.Operations.Defs /-! # Operations on CNF and DNF -- proof internals -/ +@[expose] public section + namespace Complexity namespace DNF diff --git a/Complexitylib/Circuits/NormalForm/Restriction.lean b/Complexitylib/Circuits/NormalForm/Restriction.lean index 16792241..63830990 100644 --- a/Complexitylib/Circuits/NormalForm/Restriction.lean +++ b/Complexitylib/Circuits/NormalForm/Restriction.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.NormalForm.Defs -import Complexitylib.Circuits.Restriction +module + +public import Complexitylib.Circuits.NormalForm.Defs +public import Complexitylib.Circuits.Restriction /-! # Restricting CNF and DNF formulas @@ -25,6 +27,8 @@ The result preserves evaluation and cannot increase clause/term count or width. * `CNF.width_restrict_le` / `DNF.width_restrict_le`. -/ +@[expose] public section + namespace Complexity namespace Literal diff --git a/Complexitylib/Circuits/RandomRestriction.lean b/Complexitylib/Circuits/RandomRestriction.lean index c152d10d..782e49ac 100644 --- a/Complexitylib/Circuits/RandomRestriction.lean +++ b/Complexitylib/Circuits/RandomRestriction.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.RandomRestriction.Defs -import Complexitylib.Circuits.RandomRestriction.Internal +module + +public import Complexitylib.Circuits.RandomRestriction.Defs +public import Complexitylib.Circuits.RandomRestriction.Internal /-! # Finite random restrictions @@ -21,6 +23,8 @@ stated in cardinality form so later switching arguments do not depend on rounding or division conventions. -/ +@[expose] public section + namespace Complexity namespace RandomRestriction diff --git a/Complexitylib/Circuits/RandomRestriction/Defs.lean b/Complexitylib/Circuits/RandomRestriction/Defs.lean index febf0128..1ab5fa96 100644 --- a/Complexitylib/Circuits/RandomRestriction/Defs.lean +++ b/Complexitylib/Circuits/RandomRestriction/Defs.lean @@ -3,11 +3,13 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Restriction -import Mathlib.Data.Fintype.Card -import Mathlib.Data.Fintype.Pi -import Mathlib.Data.Fintype.Prod -import Mathlib.Data.Fintype.Sum +module + +public import Complexitylib.Circuits.Restriction +public import Mathlib.Data.Fintype.Card +public import Mathlib.Data.Fintype.Pi +public import Mathlib.Data.Fintype.Prod +public import Mathlib.Data.Fintype.Sum /-! # Finite random restrictions @@ -25,6 +27,8 @@ uniform on an honest finite type; no measure-theoretic or rational-probability convention is hidden in later counting arguments. -/ +@[expose] public section + namespace Complexity namespace RandomRestriction diff --git a/Complexitylib/Circuits/RandomRestriction/Internal.lean b/Complexitylib/Circuits/RandomRestriction/Internal.lean index 35428140..e8cf672d 100644 --- a/Complexitylib/Circuits/RandomRestriction/Internal.lean +++ b/Complexitylib/Circuits/RandomRestriction/Internal.lean @@ -3,14 +3,18 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.RandomRestriction.Defs -import Mathlib.Data.Fintype.BigOperators -import Mathlib.Data.Finset.Card +module + +public import Complexitylib.Circuits.RandomRestriction.Defs +public import Mathlib.Data.Fintype.BigOperators +public import Mathlib.Data.Finset.Card /-! # Finite random restrictions -- proof internals -/ +@[expose] public section + namespace Complexity namespace RandomRestriction diff --git a/Complexitylib/Circuits/Restriction.lean b/Complexitylib/Circuits/Restriction.lean index 15bc1fb3..9607b723 100644 --- a/Complexitylib/Circuits/Restriction.lean +++ b/Complexitylib/Circuits/Restriction.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Basic -import Complexitylib.Circuits.Formula +module + +public import Complexitylib.Circuits.Basic +public import Complexitylib.Circuits.Formula /-! # Restrictions @@ -26,6 +28,8 @@ assignment (evaluation commutes with restriction). `BoolFormula.restrict_comp` — evaluation and composition laws -/ +@[expose] public section + namespace Complexity /-- A restriction: a partial assignment fixing some variables (`some b`) and diff --git a/Complexitylib/Circuits/Schnorr.lean b/Complexitylib/Circuits/Schnorr.lean index 9019d61e..d3ffcb4e 100644 --- a/Complexitylib/Circuits/Schnorr.lean +++ b/Complexitylib/Circuits/Schnorr.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.XOR -import Complexitylib.Circuits.Internal.SchnorrBridge +module + +public import Complexitylib.Circuits.XOR +public import Complexitylib.Circuits.Internal.SchnorrBridge /-! # Schnorr's Lower Bound for XOR Circuits @@ -38,6 +40,8 @@ When `Basis.andOr2` is known to be complete, this yields a `sizeComplexity` bound via `sizeComplexity_xorBool_ge`. -/ +@[expose] public section + namespace Complexity /-- **Schnorr's lower bound for circuits**: any fan-in-two AND/OR circuit diff --git a/Complexitylib/Circuits/Shannon.lean b/Complexitylib/Circuits/Shannon.lean index 8b90e935..6bdc3aa0 100644 --- a/Complexitylib/Circuits/Shannon.lean +++ b/Complexitylib/Circuits/Shannon.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Internal.ShannonBridge -import Complexitylib.Circuits.Internal.ShannonUpper +module + +public import Complexitylib.Circuits.Internal.ShannonBridge +public import Complexitylib.Circuits.Internal.ShannonUpper /-! # Shannon Bounds @@ -37,6 +39,8 @@ When `Basis.andOr2` is known to be complete, this yields a Together these establish that worst-case circuit complexity is `Θ(2^N / N)`. -/ +@[expose] public section + namespace Complexity /-- **Shannon lower bound for circuits**: for `N ≥ 6`, there exists a Boolean diff --git a/Complexitylib/Circuits/Spira.lean b/Complexitylib/Circuits/Spira.lean index ee99f49f..ac0c9bfa 100644 --- a/Complexitylib/Circuits/Spira.lean +++ b/Complexitylib/Circuits/Spira.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Formula -import Complexitylib.Circuits.Internal.Spira +module + +public import Complexitylib.Circuits.Formula +public import Complexitylib.Circuits.Internal.Spira /-! # Spira's formula-balancing theorem @@ -24,6 +26,8 @@ transformation. polynomial-size Boolean formula. -/ +@[expose] public section + namespace Complexity namespace BoolFormula diff --git a/Complexitylib/Circuits/Threshold.lean b/Complexitylib/Circuits/Threshold.lean index 9a9183ff..6a56f3bf 100644 --- a/Complexitylib/Circuits/Threshold.lean +++ b/Complexitylib/Circuits/Threshold.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Threshold.Defs -import Complexitylib.Circuits.Threshold.Internal +module + +public import Complexitylib.Circuits.Threshold.Defs +public import Complexitylib.Circuits.Threshold.Internal /-! # Threshold circuits @@ -18,6 +20,8 @@ AND/OR circuit becomes a threshold circuit without changing wiring, size, depth, negation flags, or semantics. -/ +@[expose] public section + namespace Complexity namespace ThresholdOp diff --git a/Complexitylib/Circuits/Threshold/Defs.lean b/Complexitylib/Circuits/Threshold/Defs.lean index 0e7deffe..64771689 100644 --- a/Complexitylib/Circuits/Threshold/Defs.lean +++ b/Complexitylib/Circuits/Threshold/Defs.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.AndOrNot.Defs -import Complexitylib.Circuits.BasisHom.Defs -import Batteries.Data.Fin.Lemmas +module + +public import Complexitylib.Circuits.AndOrNot.Defs +public import Complexitylib.Circuits.BasisHom.Defs +public import Batteries.Data.Fin.Lemmas /-! # Threshold circuits -- definitions @@ -17,6 +19,8 @@ standard nonuniform threshold-circuit convention with NOT gates available at no asymptotic cost. -/ +@[expose] public section + namespace Complexity /-- An unweighted threshold operation with a natural cutoff. -/ diff --git a/Complexitylib/Circuits/Threshold/Internal.lean b/Complexitylib/Circuits/Threshold/Internal.lean index 6f6326af..4cfd809d 100644 --- a/Complexitylib/Circuits/Threshold/Internal.lean +++ b/Complexitylib/Circuits/Threshold/Internal.lean @@ -3,13 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.BasisHom -import Complexitylib.Circuits.Threshold.Defs +module + +public import Complexitylib.Circuits.BasisHom +public import Complexitylib.Circuits.Threshold.Defs /-! # Threshold circuits -- proof internals -/ +@[expose] public section + namespace Complexity private theorem countP_eq_arity_iff (n : ℕ) diff --git a/Complexitylib/Circuits/Unrolling.lean b/Complexitylib/Circuits/Unrolling.lean index 7dd68646..24b9bee9 100644 --- a/Complexitylib/Circuits/Unrolling.lean +++ b/Complexitylib/Circuits/Unrolling.lean @@ -3,14 +3,16 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Unrolling.Defs -import Complexitylib.Circuits.Unrolling.Acceptance -import Complexitylib.Circuits.Unrolling.Acceptance.Hardwiring -import Complexitylib.Circuits.Unrolling.Amplification -import Complexitylib.Circuits.Unrolling.Internal.Initialization -import Complexitylib.Circuits.Unrolling.Trace -import Complexitylib.Circuits.Unrolling.Transition -import Complexitylib.Circuits.Unrolling.Transition.Fragment +module + +public import Complexitylib.Circuits.Unrolling.Defs +public import Complexitylib.Circuits.Unrolling.Acceptance +public import Complexitylib.Circuits.Unrolling.Acceptance.Hardwiring +public import Complexitylib.Circuits.Unrolling.Amplification +public import Complexitylib.Circuits.Unrolling.Internal.Initialization +public import Complexitylib.Circuits.Unrolling.Trace +public import Complexitylib.Circuits.Unrolling.Transition +public import Complexitylib.Circuits.Unrolling.Transition.Fragment /-! # Circuit unrolling for bounded Turing-machine traces @@ -25,6 +27,8 @@ the data input, consume disjoint choice blocks, and feed a strict-majority threshold with an explicit polynomial gate bound. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Circuits/Unrolling/Acceptance.lean b/Complexitylib/Circuits/Unrolling/Acceptance.lean index 2e3d9fe3..30bc95c4 100644 --- a/Complexitylib/Circuits/Unrolling/Acceptance.lean +++ b/Complexitylib/Circuits/Unrolling/Acceptance.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.ToCircuit -import Complexitylib.Circuits.Unrolling.Acceptance.Defs -import Complexitylib.Circuits.Unrolling.Acceptance.Internal.Evaluation -import Complexitylib.Circuits.Unrolling.Acceptance.Internal.Structure +module + +public import Complexitylib.Circuits.Encoding.ToCircuit +public import Complexitylib.Circuits.Unrolling.Acceptance.Defs +public import Complexitylib.Circuits.Unrolling.Acceptance.Internal.Evaluation +public import Complexitylib.Circuits.Unrolling.Acceptance.Internal.Structure /-! # Acceptance circuits for bounded Turing-machine traces @@ -32,6 +34,8 @@ zero-length case separately. accepting paths exactly. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Circuits/Unrolling/Acceptance/Defs.lean b/Complexitylib/Circuits/Unrolling/Acceptance/Defs.lean index 77ba0869..7bb2952d 100644 --- a/Complexitylib/Circuits/Unrolling/Acceptance/Defs.lean +++ b/Complexitylib/Circuits/Unrolling/Acceptance/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.BitString -import Complexitylib.Circuits.Unrolling.Trace.Defs +module + +public import Complexitylib.Circuits.BitString +public import Complexitylib.Circuits.Unrolling.Trace.Defs /-! # Acceptance gates for bounded Turing-machine traces @@ -16,6 +18,8 @@ therefore both the raw circuit's designated output and the acceptance bit used when the raw circuit is reconstructed as a typed single-output circuit. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Circuits/Unrolling/Acceptance/Hardwiring.lean b/Complexitylib/Circuits/Unrolling/Acceptance/Hardwiring.lean index 75da74c1..6c22e0f9 100644 --- a/Complexitylib/Circuits/Unrolling/Acceptance/Hardwiring.lean +++ b/Complexitylib/Circuits/Unrolling/Acceptance/Hardwiring.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Hardwiring -import Complexitylib.Circuits.Unrolling.Acceptance +module + +public import Complexitylib.Circuits.Hardwiring +public import Complexitylib.Circuits.Unrolling.Acceptance /-! # Fixed-choice bounded acceptance circuits @@ -21,6 +23,8 @@ single-run analogue of amplified-seed hardwiring. - `fixedChoicesAcceptanceCircuit_size_le`: inherited cubic size bound. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Circuits/Unrolling/Acceptance/Internal/Evaluation.lean b/Complexitylib/Circuits/Unrolling/Acceptance/Internal/Evaluation.lean index c9394326..826b7388 100644 --- a/Complexitylib/Circuits/Unrolling/Acceptance/Internal/Evaluation.lean +++ b/Complexitylib/Circuits/Unrolling/Acceptance/Internal/Evaluation.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Unrolling.Acceptance.Defs -import Complexitylib.Circuits.Unrolling.Acceptance.Internal.Structure -import Complexitylib.Circuits.Unrolling.Trace.Internal.Evaluation +module + +public import Complexitylib.Circuits.Unrolling.Acceptance.Defs +public import Complexitylib.Circuits.Unrolling.Acceptance.Internal.Structure +public import Complexitylib.Circuits.Unrolling.Trace.Internal.Evaluation /-! # Evaluation of bounded-trace acceptance circuits @@ -15,6 +17,8 @@ halt-and-output AND gate. The resulting raw circuit's last wire is exactly the Boolean acceptance predicate used by `NTM.acceptCount`. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Circuits/Unrolling/Acceptance/Internal/Structure.lean b/Complexitylib/Circuits/Unrolling/Acceptance/Internal/Structure.lean index 90134df3..65853506 100644 --- a/Complexitylib/Circuits/Unrolling/Acceptance/Internal/Structure.lean +++ b/Complexitylib/Circuits/Unrolling/Acceptance/Internal/Structure.lean @@ -3,11 +3,13 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Fragment -import Complexitylib.Circuits.Unrolling.Acceptance.Defs -import Complexitylib.Circuits.Unrolling.Trace.Internal.Structure -import Complexitylib.Circuits.Unrolling.Trace.Internal.Topology -import Mathlib.Tactic.Ring +module + +public import Complexitylib.Circuits.Encoding.Fragment +public import Complexitylib.Circuits.Unrolling.Acceptance.Defs +public import Complexitylib.Circuits.Unrolling.Trace.Internal.Structure +public import Complexitylib.Circuits.Unrolling.Trace.Internal.Topology +public import Mathlib.Tactic.Ring /-! # Structure of bounded-trace acceptance circuits @@ -17,6 +19,8 @@ exactly one gate, preserves topological well-formedness, and retains a cubic machine-dependent size bound. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Circuits/Unrolling/Amplification.lean b/Complexitylib/Circuits/Unrolling/Amplification.lean index 47664135..9af8a585 100644 --- a/Complexitylib/Circuits/Unrolling/Amplification.lean +++ b/Complexitylib/Circuits/Unrolling/Amplification.lean @@ -3,11 +3,13 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.ToCircuit -import Complexitylib.Circuits.Unrolling.Amplification.Defs -import Complexitylib.Circuits.Unrolling.Amplification.Internal.Evaluation -import Complexitylib.Circuits.Unrolling.Amplification.Internal.Structure -import Complexitylib.Circuits.Unrolling.Amplification.Internal.Topology +module + +public import Complexitylib.Circuits.Encoding.ToCircuit +public import Complexitylib.Circuits.Unrolling.Amplification.Defs +public import Complexitylib.Circuits.Unrolling.Amplification.Internal.Evaluation +public import Complexitylib.Circuits.Unrolling.Amplification.Internal.Structure +public import Complexitylib.Circuits.Unrolling.Amplification.Internal.Topology /-! # Parallel amplification circuits @@ -32,6 +34,8 @@ the randomized layer's `blockMajority` is supplied by quadratic threshold circuit. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Circuits/Unrolling/Amplification/Defs.lean b/Complexitylib/Circuits/Unrolling/Amplification/Defs.lean index 09cdabfe..0d8b878a 100644 --- a/Complexitylib/Circuits/Unrolling/Amplification/Defs.lean +++ b/Complexitylib/Circuits/Unrolling/Amplification/Defs.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Threshold.Defs -import Complexitylib.Circuits.BitString -import Complexitylib.Circuits.Unrolling.Acceptance.Defs -import Mathlib.Data.List.FinRange +module + +public import Complexitylib.Circuits.Encoding.Threshold.Defs +public import Complexitylib.Circuits.BitString +public import Complexitylib.Circuits.Unrolling.Acceptance.Defs +public import Mathlib.Data.List.FinRange /-! # Parallel amplification circuits -- definitions @@ -22,6 +24,8 @@ strict majority. The construction is proof-free. Later modules establish the exact gate count, topological ordering, and evaluation semantics. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Circuits/Unrolling/Amplification/Internal/Evaluation.lean b/Complexitylib/Circuits/Unrolling/Amplification/Internal/Evaluation.lean index 2407b906..595fec62 100644 --- a/Complexitylib/Circuits/Unrolling/Amplification/Internal/Evaluation.lean +++ b/Complexitylib/Circuits/Unrolling/Amplification/Internal/Evaluation.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Threshold.Internal -import Complexitylib.Circuits.Unrolling.Acceptance.Internal.Evaluation -import Complexitylib.Circuits.Unrolling.Amplification.Internal.Structure +module + +public import Complexitylib.Circuits.Encoding.Threshold.Internal +public import Complexitylib.Circuits.Unrolling.Acceptance.Internal.Evaluation +public import Complexitylib.Circuits.Unrolling.Amplification.Internal.Structure /-! # Evaluation internals for parallel amplification circuits @@ -21,6 +23,8 @@ The final result intentionally remains in the dependency-light form circuit layer. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Circuits/Unrolling/Amplification/Internal/Structure.lean b/Complexitylib/Circuits/Unrolling/Amplification/Internal/Structure.lean index 326ea8c2..692d209b 100644 --- a/Complexitylib/Circuits/Unrolling/Amplification/Internal/Structure.lean +++ b/Complexitylib/Circuits/Unrolling/Amplification/Internal/Structure.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Threshold.Internal -import Complexitylib.Circuits.Unrolling.Acceptance.Internal.Structure -import Complexitylib.Circuits.Unrolling.Amplification.Defs -import Mathlib.Tactic.Ring +module + +public import Complexitylib.Circuits.Encoding.Threshold.Internal +public import Complexitylib.Circuits.Unrolling.Acceptance.Internal.Structure +public import Complexitylib.Circuits.Unrolling.Amplification.Defs +public import Mathlib.Tactic.Ring /-! # Structural internals for parallel amplification circuits @@ -17,6 +19,8 @@ results locate completed verdict wires and bound the complete amplified circuit by one cubic unrolling per run plus a quadratic majority threshold. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Circuits/Unrolling/Amplification/Internal/Topology.lean b/Complexitylib/Circuits/Unrolling/Amplification/Internal/Topology.lean index 74b93e4a..31a15cc4 100644 --- a/Complexitylib/Circuits/Unrolling/Amplification/Internal/Topology.lean +++ b/Complexitylib/Circuits/Unrolling/Amplification/Internal/Topology.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Unrolling.Amplification.Internal.Structure +module + +public import Complexitylib.Circuits.Unrolling.Amplification.Internal.Structure /-! # Topology internals for parallel amplification circuits @@ -14,6 +16,8 @@ threshold fragment. This file proves that both stages are topologically ordered and that the final nonempty raw circuit is well formed. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Circuits/Unrolling/Defs.lean b/Complexitylib/Circuits/Unrolling/Defs.lean index 79948d5d..5bb88c2c 100644 --- a/Complexitylib/Circuits/Unrolling/Defs.lean +++ b/Complexitylib/Circuits/Unrolling/Defs.lean @@ -3,11 +3,13 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Fragment.Defs -import Complexitylib.Models.TuringMachine -import Mathlib.Data.Fintype.Sum -import Mathlib.Logic.Equiv.Fin.Basic -import Mathlib.Tactic.DeriveFintype +module + +public import Complexitylib.Circuits.Encoding.Fragment.Defs +public import Complexitylib.Models.TuringMachine +public import Mathlib.Data.Fintype.Sum +public import Mathlib.Logic.Equiv.Fin.Basic +public import Mathlib.Tactic.DeriveFintype /-! # Circuit layouts for bounded Turing-machine traces @@ -23,6 +25,8 @@ lets later clients place random choices, data, and auxiliary inputs wherever they choose. `prefixInputWires` supplies the canonical choices-first order. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling @@ -97,7 +101,7 @@ def configWidth (tm : NTM k) (T : ℕ) : ℕ := Fintype.card tm.Q + (k + 2) * (T + 1) + 4 * (k + 2) * (T + 2) /-- State/head/cell sum representation used to construct the explicit layout. -/ -private def configAtomSumEquiv (tm : NTM k) (T : ℕ) : +def configAtomSumEquiv (tm : NTM k) (T : ℕ) : ConfigAtom tm T ≃ tm.Q ⊕ ((TapeSlot k × Fin (T + 1)) ⊕ ((TapeSlot k × Fin (T + 2)) × Γ)) where toFun @@ -111,7 +115,7 @@ private def configAtomSumEquiv (tm : NTM k) (T : ℕ) : left_inv atom := by cases atom <;> rfl right_inv atom := by rcases atom with q | head | cell <;> rfl -private theorem TapeSlot.index_injective : Function.Injective (@TapeSlot.index k) := by +theorem TapeSlot.index_injective : Function.Injective (@TapeSlot.index k) := by intro first second h cases first with | input => @@ -136,7 +140,7 @@ private theorem TapeSlot.index_injective : Function.Injective (@TapeSlot.index k omega | output => rfl -private theorem TapeSlot.index_surjective : Function.Surjective (@TapeSlot.index k) := by +theorem TapeSlot.index_surjective : Function.Surjective (@TapeSlot.index k) := by intro i by_cases hzero : i.val = 0 · refine ⟨.input, Fin.ext ?_⟩ @@ -154,22 +158,24 @@ noncomputable def tapeSlotEquiv (k : ℕ) : TapeSlot k ≃ Fin (k + 2) := Equiv.ofBijective TapeSlot.index ⟨TapeSlot.index_injective, TapeSlot.index_surjective⟩ -private theorem symbolIndex_injective : Function.Injective symbolIndex := by +theorem symbolIndex_injective : Function.Injective symbolIndex := by intro first second h cases first <;> cases second <;> simp_all [symbolIndex] -private theorem symbolIndex_surjective : Function.Surjective symbolIndex := by +theorem symbolIndex_surjective : Function.Surjective symbolIndex := by decide /-- Alphabet symbols are explicitly equivalent to their four layout indices. -/ noncomputable def symbolEquiv : Γ ≃ Fin 4 := Equiv.ofBijective symbolIndex ⟨symbolIndex_injective, symbolIndex_surjective⟩ -private noncomputable def headAtomEquiv (k T : ℕ) : +@[nolint docBlame] +noncomputable def headAtomEquiv (k T : ℕ) : TapeSlot k × Fin (T + 1) ≃ Fin ((k + 2) * (T + 1)) := (Equiv.prodCongr (tapeSlotEquiv k) (Equiv.refl _)).trans finProdFinEquiv -private noncomputable def cellAtomEquiv (k T : ℕ) : +@[nolint docBlame] +noncomputable def cellAtomEquiv (k T : ℕ) : (TapeSlot k × Fin (T + 2)) × Γ ≃ Fin (4 * (k + 2) * (T + 2)) := ((Equiv.prodCongr ((Equiv.prodCongr (tapeSlotEquiv k) (Equiv.refl _)).trans finProdFinEquiv) @@ -204,7 +210,7 @@ noncomputable def configIndex (tm : NTM k) (T : ℕ) : ConfigAtom tm T → ℕ Fintype.card tm.Q + (k + 2) * (T + 1) + (tape.index.val * (T + 2) + position.val) * 4 + symbolIndex symbol -private theorem configIndex_eq_equivVal (tm : NTM k) (T : ℕ) +theorem configIndex_eq_equivVal (tm : NTM k) (T : ℕ) (atom : ConfigAtom tm T) : configIndex tm T atom = (configAtomEquiv tm T atom).val := by cases atom with diff --git a/Complexitylib/Circuits/Unrolling/Internal/Initialization.lean b/Complexitylib/Circuits/Unrolling/Internal/Initialization.lean index 949a2981..a638e132 100644 --- a/Complexitylib/Circuits/Unrolling/Internal/Initialization.lean +++ b/Complexitylib/Circuits/Unrolling/Internal/Initialization.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Fragment -import Complexitylib.Circuits.BitString -import Complexitylib.Circuits.Unrolling.Defs +module + +public import Complexitylib.Circuits.Encoding.Fragment +public import Complexitylib.Circuits.BitString +public import Complexitylib.Circuits.Unrolling.Defs /-! # Internal correctness of bounded-trace initialization circuits @@ -14,6 +16,8 @@ This file proves the exact size, topological ordering, and iterative-evaluator semantics of the one-gate-per-atom initialization fragment. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Circuits/Unrolling/Trace.lean b/Complexitylib/Circuits/Unrolling/Trace.lean index 7baa2d70..2faa9011 100644 --- a/Complexitylib/Circuits/Unrolling/Trace.lean +++ b/Complexitylib/Circuits/Unrolling/Trace.lean @@ -3,11 +3,13 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Unrolling.Trace.Defs -import Complexitylib.Circuits.Unrolling.Trace.Internal.Evaluation -import Complexitylib.Circuits.Unrolling.Trace.Internal.HeadBounds -import Complexitylib.Circuits.Unrolling.Trace.Internal.Structure -import Complexitylib.Circuits.Unrolling.Trace.Internal.Topology +module + +public import Complexitylib.Circuits.Unrolling.Trace.Defs +public import Complexitylib.Circuits.Unrolling.Trace.Internal.Evaluation +public import Complexitylib.Circuits.Unrolling.Trace.Internal.HeadBounds +public import Complexitylib.Circuits.Unrolling.Trace.Internal.Structure +public import Complexitylib.Circuits.Unrolling.Trace.Internal.Topology /-! # Circuits for bounded Turing-machine traces @@ -27,6 +29,8 @@ arity and has machine-dependent cubic size in the trace horizon. - `traceFragmentSize_le`: a machine-dependent cubic gate-count bound. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Circuits/Unrolling/Trace/Defs.lean b/Complexitylib/Circuits/Unrolling/Trace/Defs.lean index 104c43b8..65077925 100644 --- a/Complexitylib/Circuits/Unrolling/Trace/Defs.lean +++ b/Complexitylib/Circuits/Unrolling/Trace/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Unrolling.Transition.Fragment.Defs -import Mathlib.Data.List.FinRange +module + +public import Complexitylib.Circuits.Unrolling.Transition.Fragment.Defs +public import Mathlib.Data.List.FinRange /-! # Definitions for tiled bounded-trace circuits @@ -20,6 +22,8 @@ of topology, evaluation, and polynomial size without introducing dependent casts into the circuit construction itself. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Circuits/Unrolling/Trace/Internal/Evaluation.lean b/Complexitylib/Circuits/Unrolling/Trace/Internal/Evaluation.lean index 3bfa121f..b3cf8471 100644 --- a/Complexitylib/Circuits/Unrolling/Trace/Internal/Evaluation.lean +++ b/Complexitylib/Circuits/Unrolling/Trace/Internal/Evaluation.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Unrolling.Trace.Internal.HeadBounds -import Complexitylib.Circuits.Unrolling.Trace.Internal.Structure -import Complexitylib.Circuits.Unrolling.Transition.Fragment.Internal.ArrayEvaluation +module + +public import Complexitylib.Circuits.Unrolling.Trace.Internal.HeadBounds +public import Complexitylib.Circuits.Unrolling.Trace.Internal.Structure +public import Complexitylib.Circuits.Unrolling.Transition.Fragment.Internal.ArrayEvaluation /-! # Evaluation of tiled bounded-trace circuits @@ -17,6 +19,8 @@ the current packed block synchronized with the corresponding NTM trace prefix. The complete-trace theorem is the horizon specialization. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Circuits/Unrolling/Trace/Internal/HeadBounds.lean b/Complexitylib/Circuits/Unrolling/Trace/Internal/HeadBounds.lean index 7d8e97ff..b79af733 100644 --- a/Complexitylib/Circuits/Unrolling/Trace/Internal/HeadBounds.lean +++ b/Complexitylib/Circuits/Unrolling/Trace/Internal/HeadBounds.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Unrolling.Transition.Defs -import Complexitylib.Models.TuringMachine.Internal +module + +public import Complexitylib.Circuits.Unrolling.Transition.Defs +public import Complexitylib.Models.TuringMachine.Internal /-! # Head bounds for prefixes of bounded traces @@ -16,6 +18,8 @@ below `T`. It also identifies one `choiceStep` from prefix `i` with prefix `i + 1` of the same full choice sequence. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Circuits/Unrolling/Trace/Internal/Structure.lean b/Complexitylib/Circuits/Unrolling/Trace/Internal/Structure.lean index 7302dd14..02651212 100644 --- a/Complexitylib/Circuits/Unrolling/Trace/Internal/Structure.lean +++ b/Complexitylib/Circuits/Unrolling/Trace/Internal/Structure.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Unrolling.Internal.Initialization -import Complexitylib.Circuits.Unrolling.Trace.Defs -import Complexitylib.Circuits.Unrolling.Transition.Fragment.Internal.Size +module + +public import Complexitylib.Circuits.Unrolling.Internal.Initialization +public import Complexitylib.Circuits.Unrolling.Trace.Defs +public import Complexitylib.Circuits.Unrolling.Transition.Fragment.Internal.Size /-! # Structural properties of tiled bounded-trace circuits @@ -15,6 +17,8 @@ gate count and first unused wire. It also identifies the final packed configuration block and derives a machine-dependent cubic size bound. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Circuits/Unrolling/Trace/Internal/Topology.lean b/Complexitylib/Circuits/Unrolling/Trace/Internal/Topology.lean index aa604dbb..dcdec07f 100644 --- a/Complexitylib/Circuits/Unrolling/Trace/Internal/Topology.lean +++ b/Complexitylib/Circuits/Unrolling/Trace/Internal/Topology.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Fragment -import Complexitylib.Circuits.Unrolling.Trace.Internal.Structure -import Complexitylib.Circuits.Unrolling.Transition.Fragment.Internal.Topology +module + +public import Complexitylib.Circuits.Encoding.Fragment +public import Complexitylib.Circuits.Unrolling.Trace.Internal.Structure +public import Complexitylib.Circuits.Unrolling.Transition.Fragment.Internal.Topology /-! # Topology of tiled bounded-trace circuits @@ -16,6 +18,8 @@ tracks the exact circuit length, first unused wire, and end of the current configuration block supplied by the trace-structure layer. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Circuits/Unrolling/Transition.lean b/Complexitylib/Circuits/Unrolling/Transition.lean index 0ca1f12c..ceae62e3 100644 --- a/Complexitylib/Circuits/Unrolling/Transition.lean +++ b/Complexitylib/Circuits/Unrolling/Transition.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Unrolling.Transition.Defs -import Complexitylib.Circuits.Unrolling.Transition.Internal.Semantics -import Complexitylib.Circuits.Unrolling.Transition.Internal.Support +module + +public import Complexitylib.Circuits.Unrolling.Transition.Defs +public import Complexitylib.Circuits.Unrolling.Transition.Internal.Semantics +public import Complexitylib.Circuits.Unrolling.Transition.Internal.Support /-! # Boolean formulas for one Turing-machine transition @@ -23,6 +25,8 @@ successor machine step. - `vars_nextFormula_lt`: all references lie in a sufficiently large prefix. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Circuits/Unrolling/Transition/Defs.lean b/Complexitylib/Circuits/Unrolling/Transition/Defs.lean index 34b4b89c..6e3e127d 100644 --- a/Complexitylib/Circuits/Unrolling/Transition/Defs.lean +++ b/Complexitylib/Circuits/Unrolling/Transition/Defs.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Formula.Batch.Defs -import Complexitylib.Circuits.Unrolling.Defs -import Mathlib.Data.Fintype.Prod +module + +public import Complexitylib.Circuits.Encoding.Formula.Batch.Defs +public import Complexitylib.Circuits.Unrolling.Defs +public import Mathlib.Data.Fintype.Prod /-! # Boolean formulas for one Turing-machine transition @@ -23,6 +25,8 @@ the largest represented head position has no represented target; clients rule out that case with `HeadsLt` before applying transition correctness. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling @@ -51,7 +55,7 @@ end WritableSlot deriving DecidableEq /-- Product representation used to enumerate complete local views. -/ -private def transitionCaseEquiv (tm : NTM k) : +def transitionCaseEquiv (tm : NTM k) : TransitionCase tm ≃ Bool × tm.Q × Γ × (Fin k → Γ) × Γ where toFun view := (view.choice, view.state, view.inputRead, view.workRead, view.outputRead) diff --git a/Complexitylib/Circuits/Unrolling/Transition/Fragment.lean b/Complexitylib/Circuits/Unrolling/Transition/Fragment.lean index 28f0eae6..06811a7f 100644 --- a/Complexitylib/Circuits/Unrolling/Transition/Fragment.lean +++ b/Complexitylib/Circuits/Unrolling/Transition/Fragment.lean @@ -3,12 +3,14 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Unrolling.Transition.Fragment.Defs -import Complexitylib.Circuits.Unrolling.Transition.Fragment.Internal.ArrayEvaluation -import Complexitylib.Circuits.Unrolling.Transition.Fragment.Internal.Evaluation -import Complexitylib.Circuits.Unrolling.Transition.Fragment.Internal.Size -import Complexitylib.Circuits.Unrolling.Transition.Fragment.Internal.Structure -import Complexitylib.Circuits.Unrolling.Transition.Fragment.Internal.Topology +module + +public import Complexitylib.Circuits.Unrolling.Transition.Fragment.Defs +public import Complexitylib.Circuits.Unrolling.Transition.Fragment.Internal.ArrayEvaluation +public import Complexitylib.Circuits.Unrolling.Transition.Fragment.Internal.Evaluation +public import Complexitylib.Circuits.Unrolling.Transition.Fragment.Internal.Size +public import Complexitylib.Circuits.Unrolling.Transition.Fragment.Internal.Structure +public import Complexitylib.Circuits.Unrolling.Transition.Fragment.Internal.Topology /-! # Packed circuit fragments for one Turing-machine transition @@ -26,6 +28,8 @@ machine-dependent quadratic size in the trace horizon. - `stepFragmentSize_le`: a machine-dependent quadratic size bound. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Circuits/Unrolling/Transition/Fragment/Defs.lean b/Complexitylib/Circuits/Unrolling/Transition/Fragment/Defs.lean index 3a501ef4..df991a98 100644 --- a/Complexitylib/Circuits/Unrolling/Transition/Fragment/Defs.lean +++ b/Complexitylib/Circuits/Unrolling/Transition/Fragment/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Formula.Batch.Defs -import Complexitylib.Circuits.Unrolling.Transition.Defs +module + +public import Complexitylib.Circuits.Encoding.Formula.Batch.Defs +public import Complexitylib.Circuits.Unrolling.Transition.Defs /-! # Packed circuit fragments for one Turing-machine transition @@ -15,6 +17,8 @@ copied into a contiguous block in configuration-atom order, so that block can serve directly as the input configuration of a later unrolled step. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Circuits/Unrolling/Transition/Fragment/Internal/ArrayEvaluation.lean b/Complexitylib/Circuits/Unrolling/Transition/Fragment/Internal/ArrayEvaluation.lean index fb58cb15..ea41f953 100644 --- a/Complexitylib/Circuits/Unrolling/Transition/Fragment/Internal/ArrayEvaluation.lean +++ b/Complexitylib/Circuits/Unrolling/Transition/Fragment/Internal/ArrayEvaluation.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Unrolling.Transition.Fragment.Internal.Evaluation +module + +public import Complexitylib.Circuits.Unrolling.Transition.Fragment.Internal.Evaluation /-! # Array-level evaluation of packed transition fragments @@ -14,6 +16,8 @@ evaluate a packed transition using an encoded configuration and an actual choice wire, without separately constructing a total Boolean assignment. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Circuits/Unrolling/Transition/Fragment/Internal/Evaluation.lean b/Complexitylib/Circuits/Unrolling/Transition/Fragment/Internal/Evaluation.lean index 390a89d4..843f4031 100644 --- a/Complexitylib/Circuits/Unrolling/Transition/Fragment/Internal/Evaluation.lean +++ b/Complexitylib/Circuits/Unrolling/Transition/Fragment/Internal/Evaluation.lean @@ -3,11 +3,13 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Formula.Batch -import Complexitylib.Circuits.Unrolling.Transition.Fragment.Defs -import Complexitylib.Circuits.Unrolling.Transition.Fragment.Internal.Structure -import Complexitylib.Circuits.Unrolling.Transition.Internal.Semantics -import Complexitylib.Circuits.Unrolling.Transition.Internal.Support +module + +public import Complexitylib.Circuits.Encoding.Formula.Batch +public import Complexitylib.Circuits.Unrolling.Transition.Fragment.Defs +public import Complexitylib.Circuits.Unrolling.Transition.Fragment.Internal.Structure +public import Complexitylib.Circuits.Unrolling.Transition.Internal.Semantics +public import Complexitylib.Circuits.Unrolling.Transition.Internal.Support /-! # Evaluation of packed one-step circuit fragments @@ -17,6 +19,8 @@ through the formula batch compiler. The packed outputs form a fresh encoded configuration block for the halted-or-successor machine configuration. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Circuits/Unrolling/Transition/Fragment/Internal/Size.lean b/Complexitylib/Circuits/Unrolling/Transition/Fragment/Internal/Size.lean index ac8d76f7..56aaea33 100644 --- a/Complexitylib/Circuits/Unrolling/Transition/Fragment/Internal/Size.lean +++ b/Complexitylib/Circuits/Unrolling/Transition/Fragment/Internal/Size.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Unrolling.Transition.Fragment.Internal.Structure -import Mathlib.Algebra.Order.BigOperators.Group.List -import Mathlib.Tactic.Ring +module + +public import Complexitylib.Circuits.Unrolling.Transition.Fragment.Internal.Structure +public import Mathlib.Algebra.Order.BigOperators.Group.List +public import Mathlib.Tactic.Ring /-! # Size bounds for packed one-step transition fragments @@ -15,23 +17,29 @@ machine-dependent linear function of the trace horizon. Since a configuration block itself has linear width, the packed one-step fragment has quadratic size. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling -private def caseSizeCoeff (k : ℕ) : ℕ := +@[nolint docBlame] +def caseSizeCoeff (k : ℕ) : ℕ := 4 * (k + 2) + 6 -private noncomputable def effectSizeCoeff (tm : NTM k) : ℕ := +@[nolint docBlame] +noncomputable def effectSizeCoeff (tm : NTM k) : ℕ := 1 + (transitionCases tm).length * (caseSizeCoeff k + 1) -private noncomputable def nextSizeCoeff (tm : NTM k) : ℕ := +@[nolint docBlame] +noncomputable def nextSizeCoeff (tm : NTM k) : ℕ := 3 * effectSizeCoeff tm + 20 -private def widthSizeCoeff (tm : NTM k) : ℕ := +@[nolint docBlame] +def widthSizeCoeff (tm : NTM k) : ℕ := Fintype.card tm.Q + 5 * (k + 2) -private theorem sum_map_le_length_mul {alpha : Type*} (items : List alpha) +theorem sum_map_le_length_mul {alpha : Type*} (items : List alpha) (weight : alpha → ℕ) (bound : ℕ) (hbound : ∀ item ∈ items, weight item ≤ bound) : (items.map weight).sum ≤ items.length * bound := by @@ -48,7 +56,7 @@ private theorem sum_map_le_length_mul {alpha : Type*} (items : List alpha) bound + items.length * bound := Nat.add_le_add hitem (ih htail) _ = (items.length + 1) * bound := by ring -private theorem size_disjs_le_of_succ_le (formulas : List BoolFormula) +theorem size_disjs_le_of_succ_le (formulas : List BoolFormula) (bound : ℕ) (hbound : ∀ formula ∈ formulas, formula.size + 1 ≤ bound) : (BoolFormula.disjs formulas).size ≤ 1 + formulas.length * bound := by rw [BoolFormula.size_disjs] @@ -426,7 +434,7 @@ theorem configWidth_le_explicit_internal (tm : NTM k) (T : ℕ) : (Fintype.card tm.Q + 5 * (k + 2)) * (T + 2) := by simpa [widthSizeCoeff] using configWidth_le_linear_internal tm T -private theorem stepSizeCoeff_eq_internal (tm : NTM k) : +theorem stepSizeCoeff_eq_internal (tm : NTM k) : stepSizeCoeff tm = widthSizeCoeff tm * (nextSizeCoeff tm + 1) := by simp only [stepSizeCoeff, widthSizeCoeff, nextSizeCoeff, effectSizeCoeff, caseSizeCoeff] diff --git a/Complexitylib/Circuits/Unrolling/Transition/Fragment/Internal/Structure.lean b/Complexitylib/Circuits/Unrolling/Transition/Fragment/Internal/Structure.lean index 7ea21457..fa1cd30c 100644 --- a/Complexitylib/Circuits/Unrolling/Transition/Fragment/Internal/Structure.lean +++ b/Complexitylib/Circuits/Unrolling/Transition/Fragment/Internal/Structure.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Formula.Batch -import Complexitylib.Circuits.Unrolling.Internal.Initialization -import Complexitylib.Circuits.Unrolling.Transition.Fragment.Defs +module + +public import Complexitylib.Circuits.Encoding.Formula.Batch +public import Complexitylib.Circuits.Unrolling.Internal.Initialization +public import Complexitylib.Circuits.Unrolling.Transition.Fragment.Defs /-! # Structural properties of packed one-step circuit fragments @@ -15,6 +17,8 @@ the formula batch compiler. It records the exact formula and gate counts, formula lookup order, and arithmetic addresses of packed successor atoms. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Circuits/Unrolling/Transition/Fragment/Internal/Topology.lean b/Complexitylib/Circuits/Unrolling/Transition/Fragment/Internal/Topology.lean index 76bcac1d..b9e125eb 100644 --- a/Complexitylib/Circuits/Unrolling/Transition/Fragment/Internal/Topology.lean +++ b/Complexitylib/Circuits/Unrolling/Transition/Fragment/Internal/Topology.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Formula.Batch -import Complexitylib.Circuits.Unrolling.Transition.Fragment.Defs -import Complexitylib.Circuits.Unrolling.Transition.Internal.Support +module + +public import Complexitylib.Circuits.Encoding.Formula.Batch +public import Complexitylib.Circuits.Unrolling.Transition.Fragment.Defs +public import Complexitylib.Circuits.Unrolling.Transition.Internal.Support /-! # Topology of packed one-step circuit fragments @@ -15,6 +17,8 @@ topologically well formed whenever its choice wire and incoming configuration block lie in the existing circuit prefix. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Circuits/Unrolling/Transition/Internal/Semantics.lean b/Complexitylib/Circuits/Unrolling/Transition/Internal/Semantics.lean index 3839ac02..c120200f 100644 --- a/Complexitylib/Circuits/Unrolling/Transition/Internal/Semantics.lean +++ b/Complexitylib/Circuits/Unrolling/Transition/Internal/Semantics.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Formula.Batch -import Complexitylib.Circuits.Unrolling.Transition.Defs -import Mathlib.Data.List.OfFn +module + +public import Complexitylib.Circuits.Encoding.Formula.Batch +public import Complexitylib.Circuits.Unrolling.Transition.Defs +public import Mathlib.Data.List.OfFn /-! # Semantic correctness of one-step transition formulas @@ -16,6 +18,8 @@ The proofs first decode reads and complete local transition cases, then verify the head-movement and tape-write formulas atom by atom. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Circuits/Unrolling/Transition/Internal/Support.lean b/Complexitylib/Circuits/Unrolling/Transition/Internal/Support.lean index dd3115c7..662b0f2d 100644 --- a/Complexitylib/Circuits/Unrolling/Transition/Internal/Support.lean +++ b/Complexitylib/Circuits/Unrolling/Transition/Internal/Support.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Formula.Batch -import Complexitylib.Circuits.Unrolling.Transition.Defs +module + +public import Complexitylib.Circuits.Encoding.Formula.Batch +public import Complexitylib.Circuits.Unrolling.Transition.Defs /-! # Variable support of transition formulas @@ -15,6 +17,8 @@ The resulting numeric bound is the topological-ordering premise needed by the packed Boolean-formula compiler. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Circuits/Valiant.lean b/Complexitylib/Circuits/Valiant.lean index 49b9e07a..2152048c 100644 --- a/Complexitylib/Circuits/Valiant.lean +++ b/Complexitylib/Circuits/Valiant.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Internal.Valiant +module + +public import Complexitylib.Circuits.Internal.Valiant /-! # Valiant's Depth Reduction Lemma @@ -27,6 +29,8 @@ first-differing bit, averaging, and the relabeling-after-removal bound — lives in `Complexitylib.Circuits.Internal.Valiant`. -/ +@[expose] public section + namespace Complexity namespace Valiant diff --git a/Complexitylib/Circuits/XOR.lean b/Complexitylib/Circuits/XOR.lean index f6ac836a..e47a854c 100644 --- a/Complexitylib/Circuits/XOR.lean +++ b/Complexitylib/Circuits/XOR.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Basic +module + +public import Complexitylib.Circuits.Basic /-! # XOR (Parity) Function @@ -19,6 +21,8 @@ This module defines the N-input XOR function and its key properties. * `Schnorr.xorBool_essential` — XOR depends on all inputs -/ +@[expose] public section + namespace Complexity namespace Schnorr diff --git a/Complexitylib/Circuits/XOR/Restriction.lean b/Complexitylib/Circuits/XOR/Restriction.lean index ac43af87..6a16767e 100644 --- a/Complexitylib/Circuits/XOR/Restriction.lean +++ b/Complexitylib/Circuits/XOR/Restriction.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.XOR.Restriction.Defs -import Complexitylib.Circuits.XOR.Restriction.Internal +module + +public import Complexitylib.Circuits.XOR.Restriction.Defs +public import Complexitylib.Circuits.XOR.Restriction.Internal /-! # Parity under finite restrictions @@ -18,6 +20,8 @@ parity on `support` has depth at least `support.card`. This is the parity-side contradiction needed after a switching argument leaves many variables free. -/ +@[expose] public section + namespace Complexity namespace Schnorr diff --git a/Complexitylib/Circuits/XOR/Restriction/Defs.lean b/Complexitylib/Circuits/XOR/Restriction/Defs.lean index c4a32ea9..195c5342 100644 --- a/Complexitylib/Circuits/XOR/Restriction/Defs.lean +++ b/Complexitylib/Circuits/XOR/Restriction/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.XOR +module + +public import Complexitylib.Circuits.XOR /-! # Parity on a finite support -- definitions @@ -12,6 +14,8 @@ Random restrictions leave parity on the remaining free coordinates, possibly complemented by the fixed coordinates. `xorOn` makes that support explicit. -/ +@[expose] public section + namespace Complexity namespace Schnorr diff --git a/Complexitylib/Circuits/XOR/Restriction/Internal.lean b/Complexitylib/Circuits/XOR/Restriction/Internal.lean index f59e3a1f..80649aff 100644 --- a/Complexitylib/Circuits/XOR/Restriction/Internal.lean +++ b/Complexitylib/Circuits/XOR/Restriction/Internal.lean @@ -3,13 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.DecisionTree.Finite -import Complexitylib.Circuits.XOR.Restriction.Defs +module + +public import Complexitylib.Circuits.DecisionTree.Finite +public import Complexitylib.Circuits.XOR.Restriction.Defs /-! # Parity on a finite support -- proof internals -/ +@[expose] public section + namespace Complexity namespace Schnorr diff --git a/Complexitylib/Classes.lean b/Complexitylib/Classes.lean index dc8ceb19..1d05b393 100644 --- a/Complexitylib/Classes.lean +++ b/Complexitylib/Classes.lean @@ -3,68 +3,70 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.Time -import Complexitylib.Classes.Space -import Complexitylib.Classes.FiniteCounting -import Complexitylib.Classes.EventProb -import Complexitylib.Classes.PropertyDensity -import Complexitylib.Classes.SharpP -import Complexitylib.Classes.Negligible -import Complexitylib.Classes.P -import Complexitylib.Classes.PPoly -import Complexitylib.Classes.PPoly.Advice -import Complexitylib.Classes.PPoly.Unrolling -import Complexitylib.Classes.PPoly.Uniform -import Complexitylib.Classes.PPoly.Uniform.Unrolling -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Padded -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Containment -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Finalization -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Initialization -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Offset -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.PolynomialOffset -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Primitive -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Program -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Tableau -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Effect -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.MovedHead -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Next -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.PackedCopy -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Predecessor -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Read -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Case -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.WrittenCell -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Stream -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Bounds -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Finalization -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Initialization -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Atomic -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Case -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Effect -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.MovedHead -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Next -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Polynomial -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Step -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.WrittenCell -import Complexitylib.Classes.PPoly.Uniform.Preprocessing -import Complexitylib.Classes.PPoly.Uniform.Containment -import Complexitylib.Classes.NP -import Complexitylib.Classes.Randomized -import Complexitylib.Classes.Randomized.GoodSeed -import Complexitylib.Classes.Randomized.CircuitAmplification -import Complexitylib.Classes.Randomized.PPoly -import Complexitylib.Classes.Pairing -import Complexitylib.Classes.FNP -import Complexitylib.Classes.NP.Witness -import Complexitylib.Classes.NP.Reduction -import Complexitylib.Classes.L -import Complexitylib.Classes.L.PolynomialTime -import Complexitylib.Classes.Exponential -import Complexitylib.Classes.DTISP -import Complexitylib.Classes.Containments -import Complexitylib.Classes.Hierarchy +module + +public import Complexitylib.Classes.Time +public import Complexitylib.Classes.Space +public import Complexitylib.Classes.FiniteCounting +public import Complexitylib.Classes.EventProb +public import Complexitylib.Classes.PropertyDensity +public import Complexitylib.Classes.SharpP +public import Complexitylib.Classes.Negligible +public import Complexitylib.Classes.P +public import Complexitylib.Classes.PPoly +public import Complexitylib.Classes.PPoly.Advice +public import Complexitylib.Classes.PPoly.Unrolling +public import Complexitylib.Classes.PPoly.Uniform +public import Complexitylib.Classes.PPoly.Uniform.Unrolling +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Padded +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Containment +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Finalization +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Initialization +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Offset +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.PolynomialOffset +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Primitive +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Program +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Tableau +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Effect +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.MovedHead +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Next +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.PackedCopy +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Predecessor +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Read +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Case +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.WrittenCell +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Stream +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Bounds +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Finalization +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Initialization +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Atomic +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Case +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Effect +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.MovedHead +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Next +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Polynomial +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Step +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.WrittenCell +public import Complexitylib.Classes.PPoly.Uniform.Preprocessing +public import Complexitylib.Classes.PPoly.Uniform.Containment +public import Complexitylib.Classes.NP +public import Complexitylib.Classes.Randomized +public import Complexitylib.Classes.Randomized.GoodSeed +public import Complexitylib.Classes.Randomized.CircuitAmplification +public import Complexitylib.Classes.Randomized.PPoly +public import Complexitylib.Classes.Pairing +public import Complexitylib.Classes.FNP +public import Complexitylib.Classes.NP.Witness +public import Complexitylib.Classes.NP.Reduction +public import Complexitylib.Classes.L +public import Complexitylib.Classes.L.PolynomialTime +public import Complexitylib.Classes.Exponential +public import Complexitylib.Classes.DTISP +public import Complexitylib.Classes.Containments +public import Complexitylib.Classes.Hierarchy /-! # Complexity classes @@ -74,3 +76,5 @@ time and space classes, `P`, `NP`, randomized and nonuniform classes, the logspace-uniform circuit containment in `P`, function classes, reductions, containments, and the time hierarchy. -/ + +@[expose] public section diff --git a/Complexitylib/Classes/Containments.lean b/Complexitylib/Classes/Containments.lean index 96f644c5..8cd3785e 100644 --- a/Complexitylib/Classes/Containments.lean +++ b/Complexitylib/Classes/Containments.lean @@ -3,13 +3,15 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.P -import Complexitylib.Classes.NP -import Complexitylib.Classes.Randomized -import Complexitylib.Classes.L -import Complexitylib.Classes.Exponential -import Complexitylib.Models.TuringMachine.Internal -import Complexitylib.Models.TuringMachine.Combinators.Internal.Complement +module + +public import Complexitylib.Classes.P +public import Complexitylib.Classes.NP +public import Complexitylib.Classes.Randomized +public import Complexitylib.Classes.L +public import Complexitylib.Classes.Exponential +public import Complexitylib.Models.TuringMachine.Internal +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Complement /-! # Containment relations between complexity classes @@ -48,6 +50,8 @@ This file collects the standard containment results between complexity classes. - `P_inter` — `L₁ ∈ P → L₂ ∈ P → L₁ ∩ L₂ ∈ P` (P closed under intersection) -/ +@[expose] public section + namespace Complexity diff --git a/Complexitylib/Classes/DTISP.lean b/Complexitylib/Classes/DTISP.lean index b2251e40..e86f7cea 100644 --- a/Complexitylib/Classes/DTISP.lean +++ b/Complexitylib/Classes/DTISP.lean @@ -3,10 +3,12 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine -import Complexitylib.Classes.Space -import Complexitylib.Asymptotics -import Mathlib.Data.Nat.Log +module + +public import Complexitylib.Models.TuringMachine +public import Complexitylib.Classes.Space +public import Complexitylib.Asymptotics +public import Mathlib.Data.Nat.Log /-! # Simultaneous time-space complexity classes @@ -18,6 +20,8 @@ The key distinction from intersecting separate time and space classes is that `DTISP` requires a *single* machine satisfying both bounds simultaneously. -/ +@[expose] public section + namespace Complexity diff --git a/Complexitylib/Classes/EventProb.lean b/Complexitylib/Classes/EventProb.lean index 700347a6..e5fce49f 100644 --- a/Complexitylib/Classes/EventProb.lean +++ b/Complexitylib/Classes/EventProb.lean @@ -3,17 +3,19 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.FiniteCounting -import Complexitylib.Models.TuringMachine -import Mathlib.Algebra.BigOperators.Field -import Mathlib.Algebra.Order.Field.Basic -import Mathlib.Data.Nat.Choose.Sum -import Mathlib.Tactic.FieldSimp -import Mathlib.Tactic.GCongr -import Mathlib.Tactic.Linarith -import Mathlib.Tactic.NormNum -import Mathlib.Tactic.Positivity -import Mathlib.Tactic.Ring +module + +public import Complexitylib.Classes.FiniteCounting +public import Complexitylib.Models.TuringMachine +public import Mathlib.Algebra.BigOperators.Field +public import Mathlib.Algebra.Order.Field.Basic +public import Mathlib.Data.Nat.Choose.Sum +public import Mathlib.Tactic.FieldSimp +public import Mathlib.Tactic.GCongr +public import Mathlib.Tactic.Linarith +public import Mathlib.Tactic.NormNum +public import Mathlib.Tactic.Positivity +public import Mathlib.Tactic.Ring /-! # Finite event probability @@ -49,6 +51,8 @@ rational PTM acceptance probability `NTM.acceptProb` (roadmap track N2). bits when a machine's acceptance factors through the compact repetition seed -/ +@[expose] public section + namespace Complexity /-- The uniform probability of a finite event `E ⊆ (Fin T → Bool)`: the fraction diff --git a/Complexitylib/Classes/Exponential.lean b/Complexitylib/Classes/Exponential.lean index 48d39967..34dc53a7 100644 --- a/Complexitylib/Classes/Exponential.lean +++ b/Complexitylib/Classes/Exponential.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.Time +module + +public import Complexitylib.Classes.Time /-! # Exponential time complexity classes @@ -12,6 +14,8 @@ This file defines **EXP** and **NEXP**, the exponential-time analogues of P and NP respectively. -/ +@[expose] public section + namespace Complexity /-- **EXP** is the class of languages decidable by a deterministic TM in diff --git a/Complexitylib/Classes/FNP.lean b/Complexitylib/Classes/FNP.lean index ffb8900f..2a93508b 100644 --- a/Complexitylib/Classes/FNP.lean +++ b/Complexitylib/Classes/FNP.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.FNP.Defs -import Complexitylib.Classes.FNP.Internal +module + +public import Complexitylib.Classes.FNP.Defs +public import Complexitylib.Classes.FNP.Internal /-! # FNP and TFNP @@ -15,6 +17,8 @@ NP ∩ coNP: if a language has both NP and coNP witness relations, the combined certificate-finding problem is in TFNP (Megiddo–Papadimitriou 1991). -/ +@[expose] public section + namespace Complexity /-- **NP ∩ coNP yields TFNP** (Megiddo–Papadimitriou 1991): given FNP relations diff --git a/Complexitylib/Classes/FNP/Defs.lean b/Complexitylib/Classes/FNP/Defs.lean index 50410802..122bb815 100644 --- a/Complexitylib/Classes/FNP/Defs.lean +++ b/Complexitylib/Classes/FNP/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.Pairing -import Complexitylib.Classes.P +module + +public import Complexitylib.Classes.Pairing +public import Complexitylib.Classes.P /-! # FNP and TFNP — Definitions @@ -14,6 +16,8 @@ and the `OrRelation` combinator used to construct TFNP problems from NP ∩ coNP witness pairs. -/ +@[expose] public section + namespace Complexity /-- **FNP** is the class of search problems defined by NP relations: binary diff --git a/Complexitylib/Classes/FNP/Internal.lean b/Complexitylib/Classes/FNP/Internal.lean index 75a502b7..c5d47bcf 100644 --- a/Complexitylib/Classes/FNP/Internal.lean +++ b/Complexitylib/Classes/FNP/Internal.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.FNP.Defs -import Complexitylib.Classes.P -import Mathlib.Analysis.Asymptotics.Defs +module + +public import Complexitylib.Classes.FNP.Defs +public import Complexitylib.Classes.P +public import Mathlib.Analysis.Asymptotics.Defs /-! # FNP and TFNP — Internal proofs @@ -14,6 +16,8 @@ Helper lemmas for `OrRelation` used by the surface-layer theorem `orRelation_mem_TFNP_of_NP_coNP_witnesses`. -/ +@[expose] public section + namespace Complexity open Complexity Asymptotics Filter diff --git a/Complexitylib/Classes/FiniteCounting.lean b/Complexitylib/Classes/FiniteCounting.lean index 41370621..7801ad06 100644 --- a/Complexitylib/Classes/FiniteCounting.lean +++ b/Complexitylib/Classes/FiniteCounting.lean @@ -3,18 +3,20 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Mathlib.Data.Fintype.Card -import Mathlib.Data.Fintype.Fin -import Mathlib.Data.Fintype.Sum -import Mathlib.Data.Fintype.BigOperators -import Mathlib.Data.Finset.Card -import Mathlib.Data.Finset.Powerset -import Mathlib.Logic.Equiv.Prod -import Mathlib.Logic.Equiv.Fin.Basic -import Mathlib.Algebra.BigOperators.Group.Finset.Basic -import Mathlib.Algebra.BigOperators.Group.Finset.Piecewise -import Mathlib.Algebra.Ring.Parity -import Mathlib.Order.Interval.Finset.Nat +module + +public import Mathlib.Data.Fintype.Card +public import Mathlib.Data.Fintype.Fin +public import Mathlib.Data.Fintype.Sum +public import Mathlib.Data.Fintype.BigOperators +public import Mathlib.Data.Finset.Card +public import Mathlib.Data.Finset.Powerset +public import Mathlib.Logic.Equiv.Prod +public import Mathlib.Logic.Equiv.Fin.Basic +public import Mathlib.Algebra.BigOperators.Group.Finset.Basic +public import Mathlib.Algebra.BigOperators.Group.Finset.Piecewise +public import Mathlib.Algebra.Ring.Parity +public import Mathlib.Order.Interval.Finset.Nat /-! # Finite counting toolkit @@ -55,6 +57,8 @@ and interactive proofs (roadmap track N2). negation at odd length -/ +@[expose] public section + namespace Complexity /-! ### Cardinality of the random-bit sample space -/ @@ -291,7 +295,8 @@ def blocksEquiv (k T : ℕ) : /-! ### Fixed-time repetition schedules -/ -private def repeatStrideIndexEquiv (k T : ℕ) : +@[nolint docBlame] +def repeatStrideIndexEquiv (k T : ℕ) : Fin (k * T) ⊕ Fin (k * (T + 2)) ≃ Fin (k * (2 * T + 2)) := (Equiv.sumCongr finProdFinEquiv.symm finProdFinEquiv.symm).trans <| (Equiv.prodSumDistrib (Fin k) (Fin T) (Fin (T + 2))).symm |>.trans <| @@ -301,13 +306,15 @@ private def repeatStrideIndexEquiv (k T : ℕ) : congr 1 omega) -private def repeatStrideSeedEquiv (k T : ℕ) : +@[nolint docBlame] +def repeatStrideSeedEquiv (k T : ℕ) : (Fin (k * (2 * T + 2)) → Bool) ≃ (Fin (k * T) → Bool) × (Fin (k * (T + 2)) → Bool) := (Equiv.arrowCongr (repeatStrideIndexEquiv k T) (Equiv.refl Bool)).symm.trans (Equiv.sumArrowEquivProdArrow (Fin (k * T)) (Fin (k * (T + 2))) Bool) -private def repeatStrideRandomSeed (k T : ℕ) +@[nolint docBlame] +def repeatStrideRandomSeed (k T : ℕ) (w : Fin (k * (2 * T + 2)) → Bool) : Fin (k * T) → Bool := (repeatStrideSeedEquiv k T w).1 diff --git a/Complexitylib/Classes/Hierarchy.lean b/Complexitylib/Classes/Hierarchy.lean index b518d9c7..6a472ef2 100644 --- a/Complexitylib/Classes/Hierarchy.lean +++ b/Complexitylib/Classes/Hierarchy.lean @@ -3,10 +3,12 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.UTM.Diagonal -import Complexitylib.Models.TuringMachine.UTM.Universal -import Complexitylib.Classes.Containments -import Mathlib.Analysis.Asymptotics.SpecificAsymptotics +module + +public import Complexitylib.Models.TuringMachine.UTM.Diagonal +public import Complexitylib.Models.TuringMachine.UTM.Universal +public import Complexitylib.Classes.Containments +public import Mathlib.Analysis.Asymptotics.SpecificAsymptotics /-! # The deterministic time hierarchy theorem (weak form) @@ -39,6 +41,8 @@ The witness is the diagonal language `diagLang clk` of the diagonalizer `DTIME((n + 1)^a) ⊂ DTIME((n + 1)^(2a + 5))` for `a ≥ 1` -/ +@[expose] public section + namespace Complexity open Asymptotics Filter Complexity diff --git a/Complexitylib/Classes/L.lean b/Complexitylib/Classes/L.lean index ccc75ffc..fdeffb3b 100644 --- a/Complexitylib/Classes/L.lean +++ b/Complexitylib/Classes/L.lean @@ -3,11 +3,13 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine -import Complexitylib.Classes.Time -import Complexitylib.Classes.Pairing -import Complexitylib.Asymptotics -import Mathlib.Data.Nat.Log +module + +public import Complexitylib.Models.TuringMachine +public import Complexitylib.Classes.Time +public import Complexitylib.Classes.Pairing +public import Complexitylib.Asymptotics +public import Mathlib.Data.Nat.Log /-! # Log-space transducer classes @@ -23,6 +25,8 @@ never moves left. `TM.ComputesInSpace` includes this discipline internally so function output may have unbounded length without becoming read-write workspace. -/ +@[expose] public section + namespace Complexity diff --git a/Complexitylib/Classes/L/PolynomialTime.lean b/Complexitylib/Classes/L/PolynomialTime.lean index 950065c9..2ba5e3f1 100644 --- a/Complexitylib/Classes/L/PolynomialTime.lean +++ b/Complexitylib/Classes/L/PolynomialTime.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.L.PolynomialTime.Internal +module + +public import Complexitylib.Classes.L.PolynomialTime.Internal /-! # Log-space transducers run in polynomial time @@ -20,6 +22,8 @@ bound. Consequently `L ⊆ P` and `FL ⊆ FP`. - `FL_subset_FP` — deterministic log-space functions are polynomial-time -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Classes/L/PolynomialTime/Internal.lean b/Complexitylib/Classes/L/PolynomialTime/Internal.lean index 59b4ec05..314d1866 100644 --- a/Complexitylib/Classes/L/PolynomialTime/Internal.lean +++ b/Complexitylib/Classes/L/PolynomialTime/Internal.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.L -import Complexitylib.Classes.P.Defs -import Complexitylib.Models.TuringMachine.SpaceTime +module + +public import Complexitylib.Classes.L +public import Complexitylib.Classes.P.Defs +public import Complexitylib.Models.TuringMachine.SpaceTime /-! # Log-space transducers run in polynomial time — proof internals @@ -15,6 +17,8 @@ transducers into a polynomial bound when the auxiliary space is logarithmic. The public results are in `Complexitylib.Classes.L.PolynomialTime`. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Classes/NP.lean b/Complexitylib/Classes/NP.lean index d2569533..90a87f3b 100644 --- a/Complexitylib/Classes/NP.lean +++ b/Complexitylib/Classes/NP.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.Time -import Complexitylib.Classes.Space +module + +public import Complexitylib.Classes.Time +public import Complexitylib.Classes.Space /-! # NP, coNP, and NPSPACE @@ -14,6 +16,8 @@ This file defines **NP** (nondeterministic polynomial time), **coNP**, and `NTIME` and `NSPACE`. -/ +@[expose] public section + namespace Complexity /-- **NP** is the class of languages decidable by a nondeterministic TM in diff --git a/Complexitylib/Classes/NP/Internal/PairBuildTM.lean b/Complexitylib/Classes/NP/Internal/PairBuildTM.lean index 8f444734..685eb7f9 100644 --- a/Complexitylib/Classes/NP/Internal/PairBuildTM.lean +++ b/Complexitylib/Classes/NP/Internal/PairBuildTM.lean @@ -3,11 +3,14 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -import Complexitylib.Models.TuringMachine.Hoare.Defs -import Complexitylib.Models.TuringMachine.Trace -import Complexitylib.Classes.Pairing +module + +public import Mathlib.Tactic.Ring +public import Complexitylib.Models.TuringMachine.Combinators +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +public import Complexitylib.Models.TuringMachine.Hoare.Defs +public import Complexitylib.Models.TuringMachine.Trace +public import Complexitylib.Classes.Pairing /-! # `pairBuildTM`: construct `pair x y` on a work tape @@ -68,6 +71,8 @@ Everything in this file is fully proved (no `sorry`). The main contents: and `pIdx` are untouched), each assuming the tape's head is past `▷`. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Classes/NP/Internal/PairSplitTM.lean b/Complexitylib/Classes/NP/Internal/PairSplitTM.lean index ff069cb2..ac010f4a 100644 --- a/Complexitylib/Classes/NP/Internal/PairSplitTM.lean +++ b/Complexitylib/Classes/NP/Internal/PairSplitTM.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.PairSplit +module + +public import Complexitylib.Models.TuringMachine.Subroutines.PairSplit /-! # Pair-split compatibility import @@ -13,3 +15,5 @@ Turing-machine subroutine modules. This file preserves the former import path for downstream code; new code should import `Complexitylib.Models.TuringMachine.Subroutines.PairSplit` directly. -/ + +@[expose] public section diff --git a/Complexitylib/Classes/NP/Reduction.lean b/Complexitylib/Classes/NP/Reduction.lean index df0c19b4..cb09e66e 100644 --- a/Complexitylib/Classes/NP/Reduction.lean +++ b/Complexitylib/Classes/NP/Reduction.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.NP -import Complexitylib.Classes.P +module + +public import Complexitylib.Classes.NP +public import Complexitylib.Classes.P /-! # Polynomial-time many-one reductions and NP-completeness @@ -21,6 +23,8 @@ The headline application is `SAT.NPComplete_language` (Cook–Levin), in `Complexitylib/SAT/CookLevin.lean`. -/ +@[expose] public section + namespace Complexity diff --git a/Complexitylib/Classes/NP/Witness.lean b/Complexitylib/Classes/NP/Witness.lean index ace5fac9..6153e1c7 100644 --- a/Complexitylib/Classes/NP/Witness.lean +++ b/Complexitylib/Classes/NP/Witness.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.NP -import Complexitylib.Classes.FNP +module + +public import Complexitylib.Classes.NP +public import Complexitylib.Classes.FNP /-! # NP witness characterization @@ -50,6 +52,8 @@ All downstream consequences (including `SAT ∈ NP` conditional on the SAT verifier being in P) rest only on that single lemma. -/ +@[expose] public section + namespace Complexity diff --git a/Complexitylib/Classes/Negligible.lean b/Complexitylib/Classes/Negligible.lean index 0de2665f..6431f2c8 100644 --- a/Complexitylib/Classes/Negligible.lean +++ b/Complexitylib/Classes/Negligible.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Mathlib.Data.Real.Basic +module + +public import Mathlib.Data.Real.Basic /-! # Negligible functions @@ -12,6 +14,8 @@ A function `f : ℕ → ℝ` is *negligible* if it vanishes faster than any inve polynomial. This is the standard notion used in cryptographic definitions. -/ +@[expose] public section + namespace Complexity /-- A function `f : ℕ → ℝ` is negligible if for every `c`, `|f(n)| < 1/n^c` diff --git a/Complexitylib/Classes/P.lean b/Complexitylib/Classes/P.lean index af84b827..bd684341 100644 --- a/Complexitylib/Classes/P.lean +++ b/Complexitylib/Classes/P.lean @@ -3,15 +3,17 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.P.Defs -import Complexitylib.Classes.P.Internal -import Complexitylib.Classes.P.NormalForm -import Complexitylib.Classes.P.Composition -import Complexitylib.Classes.P.PairWithInput -import Complexitylib.Classes.P.Preimage -import Complexitylib.Classes.P.UnaryLength -import Complexitylib.Classes.P.FinsetDomain -import Complexitylib.Models.TuringMachine.Subroutines.CopyOutput +module + +public import Complexitylib.Classes.P.Defs +public import Complexitylib.Classes.P.Internal +public import Complexitylib.Classes.P.NormalForm +public import Complexitylib.Classes.P.Composition +public import Complexitylib.Classes.P.PairWithInput +public import Complexitylib.Classes.P.Preimage +public import Complexitylib.Classes.P.UnaryLength +public import Complexitylib.Classes.P.FinsetDomain +public import Complexitylib.Models.TuringMachine.Subroutines.CopyOutput /-! # P — surface layer @@ -37,6 +39,8 @@ This file aggregates the definitions and theorems for P, FP, and PSPACE. - `ite_mem_finset_mem_FP` — functions supported on a finite set belong to `FP` -/ +@[expose] public section + namespace Complexity diff --git a/Complexitylib/Classes/P/Composition.lean b/Complexitylib/Classes/P/Composition.lean index 1b834d1f..445b37fc 100644 --- a/Complexitylib/Classes/P/Composition.lean +++ b/Complexitylib/Classes/P/Composition.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.P.Internal.Composition +module + +public import Complexitylib.Classes.P.Internal.Composition /-! # Closure of FP under composition @@ -13,6 +15,8 @@ import Complexitylib.Classes.P.Internal.Composition - `mem_FP_comp` — polynomial-time string functions are closed under composition -/ +@[expose] public section + namespace Complexity /-- The composition of two polynomial-time string functions is polynomial-time. -/ diff --git a/Complexitylib/Classes/P/Defs.lean b/Complexitylib/Classes/P/Defs.lean index d844be7e..10164e4a 100644 --- a/Complexitylib/Classes/P/Defs.lean +++ b/Complexitylib/Classes/P/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.Time -import Complexitylib.Classes.Space +module + +public import Complexitylib.Classes.Time +public import Complexitylib.Classes.Space /-! # P, FP, and PSPACE @@ -14,6 +16,8 @@ and **PSPACE** (polynomial space) in terms of the base classes `DTIME` and `DSPACE`. -/ +@[expose] public section + namespace Complexity diff --git a/Complexitylib/Classes/P/FinsetDomain.lean b/Complexitylib/Classes/P/FinsetDomain.lean index b5a0eaff..b614c5b6 100644 --- a/Complexitylib/Classes/P/FinsetDomain.lean +++ b/Complexitylib/Classes/P/FinsetDomain.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Bolton Bailey. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Bolton Bailey -/ -import Complexitylib.Classes.P.FinsetDomain.Internal +module + +public import Complexitylib.Classes.P.FinsetDomain.Internal /-! # Finite-deviation functions are polynomial-time @@ -24,6 +26,8 @@ regardless of how the values `g s` are chosen. - `ite_mem_finset_mem_FP` — `fun s => if s ∈ S then g s else []` belongs to `FP` -/ +@[expose] public section + namespace Complexity /-- A function that agrees with the constant empty-output function except on a diff --git a/Complexitylib/Classes/P/FinsetDomain/Internal.lean b/Complexitylib/Classes/P/FinsetDomain/Internal.lean index b14cd854..5dd421ae 100644 --- a/Complexitylib/Classes/P/FinsetDomain/Internal.lean +++ b/Complexitylib/Classes/P/FinsetDomain/Internal.lean @@ -3,13 +3,15 @@ Copyright (c) 2026 Bolton Bailey. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Bolton Bailey -/ -import Mathlib.Data.Fintype.Sets -import Mathlib.Data.Fintype.Option -import Mathlib.Data.Finset.Lattice.Fold -import Complexitylib.Mathlib.FinsetPrefixes -import Complexitylib.Classes.P.NormalForm -import Complexitylib.Models.TuringMachine.Tape.Encoding -import Complexitylib.Models.TuringMachine.Combinators +module + +public import Mathlib.Data.Fintype.Sets +public import Mathlib.Data.Fintype.Option +public import Mathlib.Data.Finset.Lattice.Fold +public import Complexitylib.Mathlib.FinsetPrefixes +public import Complexitylib.Classes.P.NormalForm +public import Complexitylib.Models.TuringMachine.Tape.Encoding +public import Complexitylib.Models.TuringMachine.Combinators /-! # Finite-domain lookup machine (internal) @@ -38,6 +40,8 @@ The public statement (`ite_mem_finset_mem_FP`) lives in `Complexitylib.Classes.P.FinsetDomain`. -/ +@[expose] public section + namespace Complexity namespace TM.FinsetDomain @@ -90,7 +94,7 @@ inductive LookupState (g : List Bool → List Bool) (S : Finset (List Bool)) : T /-- `LookupState` as a sum of two finite subtypes and two extra states. This equivalence supplies the `DecidableEq` and `Fintype` instances, which cannot be derived because the `read`/`write` constructors have dependent fields. -/ -private def lookupStateEquiv : +def lookupStateEquiv : LookupState g S ≃ (Option {p : List Bool // p ∈ S.prefixes} ⊕ Option {w : List Bool // w ∈ (outputsFinset g S).suffixes}) where diff --git a/Complexitylib/Classes/P/Internal.lean b/Complexitylib/Classes/P/Internal.lean index 3dbd111d..22f815d3 100644 --- a/Complexitylib/Classes/P/Internal.lean +++ b/Complexitylib/Classes/P/Internal.lean @@ -3,10 +3,12 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.P.Defs -import Complexitylib.Models.TuringMachine.Combinators -import Complexitylib.Models.TuringMachine.Combinators.Internal -import Mathlib.Analysis.Asymptotics.Defs +module + +public import Complexitylib.Classes.P.Defs +public import Complexitylib.Models.TuringMachine.Combinators +public import Complexitylib.Models.TuringMachine.Combinators.Internal +public import Mathlib.Analysis.Asymptotics.Defs /-! # P closure properties — proof internals @@ -16,6 +18,8 @@ The key simulation theorem `unionTM_decidesInTime` establishes that the composite machine from `TM.unionTM` correctly decides `L₁ ∪ L₂`. -/ +@[expose] public section + namespace Complexity open Complexity Asymptotics Filter diff --git a/Complexitylib/Classes/P/Internal/Composition.lean b/Complexitylib/Classes/P/Internal/Composition.lean index 0152f570..7ce1b7ae 100644 --- a/Complexitylib/Classes/P/Internal/Composition.lean +++ b/Complexitylib/Classes/P/Internal/Composition.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Asymptotics.PolynomialComposition -import Complexitylib.Classes.P.Internal.NormalForm -import Complexitylib.Models.TuringMachine.Composition +module + +public import Complexitylib.Asymptotics.PolynomialComposition +public import Complexitylib.Classes.P.Internal.NormalForm +public import Complexitylib.Models.TuringMachine.Composition /-! # Closure of FP under composition — proof internals @@ -15,6 +17,8 @@ normal forms for its two component computations. The public theorem is in `Complexitylib.Classes.P.Composition`. -/ +@[expose] public section + namespace Complexity /-- Internal proof that polynomial-time string functions are closed under diff --git a/Complexitylib/Classes/P/Internal/NormalForm.lean b/Complexitylib/Classes/P/Internal/NormalForm.lean index cd9721c4..ed7af4f4 100644 --- a/Complexitylib/Classes/P/Internal/NormalForm.lean +++ b/Complexitylib/Classes/P/Internal/NormalForm.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.P.Defs +module + +public import Complexitylib.Classes.P.Defs /-! # Polynomial-time normal forms — proof internals @@ -15,6 +17,8 @@ polynomial over the naturals, giving everywhere-valid monotone time bounds. The public theorem is in `Complexitylib.Classes.P.NormalForm`. -/ +@[expose] public section + namespace Complexity /-- Internal proof that `P` membership is equivalent to decision within the diff --git a/Complexitylib/Classes/P/Internal/Preimage.lean b/Complexitylib/Classes/P/Internal/Preimage.lean index d7eed8ad..93d6b93f 100644 --- a/Complexitylib/Classes/P/Internal/Preimage.lean +++ b/Complexitylib/Classes/P/Internal/Preimage.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.P.Internal.NormalForm -import Complexitylib.Models.TuringMachine.Composition +module + +public import Complexitylib.Classes.P.Internal.NormalForm +public import Complexitylib.Models.TuringMachine.Composition /-! # Closure of P under FP preimages — proof internals @@ -15,6 +17,8 @@ decides the preimage language within the polynomial obtained by composing those bounds. -/ +@[expose] public section + namespace Complexity /-- Internal proof that polynomial-time languages are closed under preimages diff --git a/Complexitylib/Classes/P/NormalForm.lean b/Complexitylib/Classes/P/NormalForm.lean index 54ad369b..7ef7282c 100644 --- a/Complexitylib/Classes/P/NormalForm.lean +++ b/Complexitylib/Classes/P/NormalForm.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.P.Internal.NormalForm +module + +public import Complexitylib.Classes.P.Internal.NormalForm /-! # Polynomial-time normal forms @@ -19,6 +21,8 @@ normalized bounds are valid on every input length and are monotone. - `mem_FP_iff_computesInTime_polynomial` — polynomial-evaluation normal form for `FP` -/ +@[expose] public section + namespace Complexity /-- A language belongs to `P` exactly when some deterministic machine decides diff --git a/Complexitylib/Classes/P/PairWithInput.lean b/Complexitylib/Classes/P/PairWithInput.lean index 80c18d17..a5384654 100644 --- a/Complexitylib/Classes/P/PairWithInput.lean +++ b/Complexitylib/Classes/P/PairWithInput.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.P.PairWithInput.Internal +module + +public import Complexitylib.Classes.P.PairWithInput.Internal /-! # Polynomial-time pairing with the original input @@ -13,6 +15,8 @@ import Complexitylib.Classes.P.PairWithInput.Internal - `mem_FP_pairWithInput` — if `f ∈ FP`, then `x ↦ pair (f x) x` is in `FP` -/ +@[expose] public section + namespace Complexity /-- A polynomial-time function can be evaluated and paired with its unchanged diff --git a/Complexitylib/Classes/P/PairWithInput/Internal.lean b/Complexitylib/Classes/P/PairWithInput/Internal.lean index 5507f8ea..b4e9842b 100644 --- a/Complexitylib/Classes/P/PairWithInput/Internal.lean +++ b/Complexitylib/Classes/P/PairWithInput/Internal.lean @@ -3,13 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.P.Internal.NormalForm -import Complexitylib.Models.TuringMachine.Composition.PairWithInput +module + +public import Complexitylib.Classes.P.Internal.NormalForm +public import Complexitylib.Models.TuringMachine.Composition.PairWithInput /-! # Polynomial-time pairing with the original input — proof internals -/ +@[expose] public section + namespace Complexity /-- Internal closure of `FP` under `x ↦ pair (f x) x`. -/ diff --git a/Complexitylib/Classes/P/Preimage.lean b/Complexitylib/Classes/P/Preimage.lean index 619aef79..86da8510 100644 --- a/Complexitylib/Classes/P/Preimage.lean +++ b/Complexitylib/Classes/P/Preimage.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.P.Internal.Preimage +module + +public import Complexitylib.Classes.P.Internal.Preimage /-! # Closure of P under FP preimages @@ -13,6 +15,8 @@ import Complexitylib.Classes.P.Internal.Preimage - `mem_P_preimage` — polynomial-time preprocessing preserves membership in `P` -/ +@[expose] public section + namespace Complexity /-- If `f` is polynomial-time computable and `L` is polynomial-time diff --git a/Complexitylib/Classes/P/UnaryLength.lean b/Complexitylib/Classes/P/UnaryLength.lean index e281e913..af164552 100644 --- a/Complexitylib/Classes/P/UnaryLength.lean +++ b/Complexitylib/Classes/P/UnaryLength.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.P.UnaryLength.Internal +module + +public import Complexitylib.Classes.P.UnaryLength.Internal /-! # Polynomial-time unary input length @@ -13,6 +15,8 @@ import Complexitylib.Classes.P.UnaryLength.Internal - `unaryLength_mem_FP` — `x ↦ 1^|x|` is polynomial-time computable -/ +@[expose] public section + namespace Complexity /-- Writing one unary mark per input bit is a polynomial-time string diff --git a/Complexitylib/Classes/P/UnaryLength/Internal.lean b/Complexitylib/Classes/P/UnaryLength/Internal.lean index a78e3112..037f58ac 100644 --- a/Complexitylib/Classes/P/UnaryLength/Internal.lean +++ b/Complexitylib/Classes/P/UnaryLength/Internal.lean @@ -3,13 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.P.Defs -import Complexitylib.Models.TuringMachine.Subroutines.UnaryLength +module + +public import Complexitylib.Classes.P.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.UnaryLength /-! # Polynomial-time unary input length — proof internals -/ +@[expose] public section + namespace Complexity /-- Internal proof that materializing unary input length is in `FP`. -/ diff --git a/Complexitylib/Classes/PPoly.lean b/Complexitylib/Classes/PPoly.lean index d9eaf285..1d3e1fcd 100644 --- a/Complexitylib/Classes/PPoly.lean +++ b/Complexitylib/Classes/PPoly.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Defs -import Complexitylib.Circuits.Family +module + +public import Complexitylib.Classes.PPoly.Defs +public import Complexitylib.Circuits.Family /-! # P/poly and circuit-size classes @@ -14,6 +16,8 @@ the exact pointwise-polynomial definition of `PPoly` to the big-O power convention used elsewhere in the library. -/ +@[expose] public section + namespace Complexity namespace BoolFunFamily diff --git a/Complexitylib/Classes/PPoly/Advice.lean b/Complexitylib/Classes/PPoly/Advice.lean index 834c57c7..7180a765 100644 --- a/Complexitylib/Classes/PPoly/Advice.lean +++ b/Complexitylib/Classes/PPoly/Advice.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Advice.Defs -import Complexitylib.Classes.PPoly.Advice.Internal -import Complexitylib.Classes.PPoly.Advice.Reverse +module + +public import Complexitylib.Classes.PPoly.Advice.Defs +public import Complexitylib.Classes.PPoly.Advice.Internal +public import Complexitylib.Classes.PPoly.Advice.Reverse /-! # Polynomial advice and nonuniform circuits @@ -27,6 +29,8 @@ evaluator. - `PAdvice_eq_PPoly`: the two nonuniform formulations coincide. -/ +@[expose] public section + namespace Complexity /-- The advised input has the exact self-delimiting pairing length. -/ diff --git a/Complexitylib/Classes/PPoly/Advice/Defs.lean b/Complexitylib/Classes/PPoly/Advice/Defs.lean index 1ece65a2..b08552cf 100644 --- a/Complexitylib/Classes/PPoly/Advice/Defs.lean +++ b/Complexitylib/Classes/PPoly/Advice/Defs.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Asymptotics -import Complexitylib.Classes.Pairing -import Complexitylib.Classes.PPoly.Defs -import Complexitylib.Circuits.Unrolling.Acceptance.Hardwiring +module + +public import Complexitylib.Asymptotics +public import Complexitylib.Classes.Pairing +public import Complexitylib.Classes.PPoly.Defs +public import Complexitylib.Circuits.Unrolling.Acceptance.Hardwiring /-! # Polynomial advice — definitions @@ -20,6 +22,8 @@ the deterministic choice prefix and the length-dependent advice prefix of a bounded acceptance circuit. -/ +@[expose] public section + namespace Complexity /-- A binary advice string for every original input length. -/ diff --git a/Complexitylib/Classes/PPoly/Advice/Internal.lean b/Complexitylib/Classes/PPoly/Advice/Internal.lean index 6230c449..514eed88 100644 --- a/Complexitylib/Classes/PPoly/Advice/Internal.lean +++ b/Complexitylib/Classes/PPoly/Advice/Internal.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly -import Complexitylib.Classes.PPoly.Advice.Defs -import Complexitylib.Models.TuringMachine.Internal +module + +public import Complexitylib.Classes.PPoly +public import Complexitylib.Classes.PPoly.Advice.Defs +public import Complexitylib.Models.TuringMachine.Internal /-! # Polynomial advice — proof internals @@ -15,6 +17,8 @@ for advised-computation circuit families. Public statements are exposed by `Complexitylib.Classes.PPoly.Advice`. -/ +@[expose] public section + namespace Complexity namespace Advice diff --git a/Complexitylib/Classes/PPoly/Advice/Reverse.lean b/Complexitylib/Classes/PPoly/Advice/Reverse.lean index a2db82f6..df10b3ba 100644 --- a/Complexitylib/Classes/PPoly/Advice/Reverse.lean +++ b/Complexitylib/Classes/PPoly/Advice/Reverse.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Advice.Reverse.Defs -import Complexitylib.Classes.PPoly.Advice.Reverse.Internal +module + +public import Complexitylib.Classes.PPoly.Advice.Reverse.Defs +public import Complexitylib.Classes.PPoly.Advice.Reverse.Internal /-! # Nonuniform circuits as polynomial advice @@ -24,6 +26,8 @@ length-dependent advice for the verified circuit evaluator. - `PPoly_subset_PAdvice`: `P/poly` is contained in polynomial advice. -/ +@[expose] public section + namespace Complexity namespace CircuitFamily diff --git a/Complexitylib/Classes/PPoly/Advice/Reverse/Defs.lean b/Complexitylib/Classes/PPoly/Advice/Reverse/Defs.lean index ddc56946..d89a1012 100644 --- a/Complexitylib/Classes/PPoly/Advice/Reverse/Defs.lean +++ b/Complexitylib/Classes/PPoly/Advice/Reverse/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Advice.Defs -import Complexitylib.Circuits.Encoding.Machine.Core.Defs +module + +public import Complexitylib.Classes.PPoly.Advice.Defs +public import Complexitylib.Circuits.Encoding.Machine.Core.Defs /-! # Nonuniform circuits as polynomial advice — definitions @@ -14,6 +16,8 @@ circuit family's canonical member code is supplied as advice to the verified serialized-circuit evaluator. -/ +@[expose] public section + namespace Complexity namespace CircuitFamily diff --git a/Complexitylib/Classes/PPoly/Advice/Reverse/Internal.lean b/Complexitylib/Classes/PPoly/Advice/Reverse/Internal.lean index 12ab0958..f31946e6 100644 --- a/Complexitylib/Classes/PPoly/Advice/Reverse/Internal.lean +++ b/Complexitylib/Classes/PPoly/Advice/Reverse/Internal.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly -import Complexitylib.Classes.PPoly.Advice.Reverse.Defs -import Complexitylib.Circuits.Encoding.Machine +module + +public import Complexitylib.Classes.PPoly +public import Complexitylib.Classes.PPoly.Advice.Reverse.Defs +public import Complexitylib.Circuits.Encoding.Machine /-! # Nonuniform circuits as polynomial advice — proof internals @@ -16,6 +18,8 @@ correctness on that advice, and polynomial time measured in the original input length. -/ +@[expose] public section + namespace Complexity namespace CircuitFamily diff --git a/Complexitylib/Classes/PPoly/Defs.lean b/Complexitylib/Classes/PPoly/Defs.lean index 35835299..a33498fb 100644 --- a/Complexitylib/Classes/PPoly/Defs.lean +++ b/Complexitylib/Classes/PPoly/Defs.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Family.Defs -import Complexitylib.Circuits.AndOrNot.Defs -import Complexitylib.Models.TuringMachine +module + +public import Complexitylib.Circuits.Family.Defs +public import Complexitylib.Circuits.AndOrNot.Defs +public import Complexitylib.Models.TuringMachine /-! # Nonuniform circuit classes — definitions @@ -21,6 +23,8 @@ convention-dependent. Basis/size invariance must be proved rather than treated as definitional. -/ +@[expose] public section + namespace Complexity namespace BoolFunFamily diff --git a/Complexitylib/Classes/PPoly/Uniform.lean b/Complexitylib/Classes/PPoly/Uniform.lean index 57cb38e7..9e67b91f 100644 --- a/Complexitylib/Classes/PPoly/Uniform.lean +++ b/Complexitylib/Classes/PPoly/Uniform.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly -import Complexitylib.Classes.L -import Complexitylib.Circuits.Encoding.Family +module + +public import Complexitylib.Classes.PPoly +public import Complexitylib.Classes.L +public import Complexitylib.Circuits.Encoding.Family /-! # Uniform P/poly @@ -36,6 +38,8 @@ The circuits-to-machines containment is exposed separately as `UniformPPoly_subset_P` in `Complexitylib.Classes.PPoly.Uniform.Containment`. -/ +@[expose] public section + namespace Complexity /-- The unary encoding of `n` as `1ⁿ` (n `true` bits): the standard generator input diff --git a/Complexitylib/Classes/PPoly/Uniform/Containment.lean b/Complexitylib/Classes/PPoly/Uniform/Containment.lean index 8bef9437..2802b20f 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Containment.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Containment.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Containment.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Containment.Internal /-! # Uniform polynomial-size circuits are in P @@ -18,6 +20,8 @@ polynomial time. A generic fanout combinator then constructs the serialized - `UniformPPoly_subset_P` — logspace-uniform polynomial-size circuits are in `P` -/ +@[expose] public section + namespace Complexity /-- The language recognized by the verified serialized circuit-family diff --git a/Complexitylib/Classes/PPoly/Uniform/Containment/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Containment/Internal.lean index 8ddda5c0..83feaf4d 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Containment/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Containment/Internal.lean @@ -3,16 +3,20 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.L.PolynomialTime -import Complexitylib.Classes.P.Preimage -import Complexitylib.Classes.PPoly.Uniform -import Complexitylib.Classes.PPoly.Uniform.Preprocessing -import Complexitylib.Circuits.Encoding.Machine +module + +public import Complexitylib.Classes.L.PolynomialTime +public import Complexitylib.Classes.P.Preimage +public import Complexitylib.Classes.PPoly.Uniform +public import Complexitylib.Classes.PPoly.Uniform.Preprocessing +public import Complexitylib.Circuits.Encoding.Machine /-! # Uniform polynomial-size circuits are in P — proof internals -/ +@[expose] public section + namespace Complexity /-- Internal packaging of the verified serialized evaluator as a language in diff --git a/Complexitylib/Classes/PPoly/Uniform/Preprocessing.lean b/Complexitylib/Classes/PPoly/Uniform/Preprocessing.lean index 94ac07ad..d7bff6e0 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Preprocessing.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Preprocessing.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Preprocessing.Defs -import Complexitylib.Classes.PPoly.Uniform.Preprocessing.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Preprocessing.Defs +public import Complexitylib.Classes.PPoly.Uniform.Preprocessing.Internal /-! # Inputs for uniform circuit-family evaluation @@ -14,6 +16,8 @@ import Complexitylib.Classes.PPoly.Uniform.Preprocessing.Internal - `generatorEvalInput_mem_FP` — construct `pair (gen 1^|x|) x` in `FP` -/ +@[expose] public section + namespace Complexity /-- A polynomial-time uniformity generator can be run on unary input length diff --git a/Complexitylib/Classes/PPoly/Uniform/Preprocessing/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Preprocessing/Defs.lean index f4ad4e0c..cfc7275a 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Preprocessing/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Preprocessing/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Encoding.Pairing +module + +public import Complexitylib.Encoding.Pairing /-! # Inputs for uniform circuit-family evaluation @@ -13,6 +15,8 @@ and the circuit input. A uniformity generator consumes unary length instead. This module names the pure preprocessing map connecting those interfaces. -/ +@[expose] public section + namespace Complexity /-- On input `x`, run the prospective uniformity generator on `1^|x|` and diff --git a/Complexitylib/Classes/PPoly/Uniform/Preprocessing/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Preprocessing/Internal.lean index 888aa47f..1e3e7557 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Preprocessing/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Preprocessing/Internal.lean @@ -3,16 +3,20 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.P.Composition -import Complexitylib.Classes.P.PairWithInput -import Complexitylib.Classes.P.UnaryLength -import Complexitylib.Classes.PPoly.Uniform -import Complexitylib.Classes.PPoly.Uniform.Preprocessing.Defs +module + +public import Complexitylib.Classes.P.Composition +public import Complexitylib.Classes.P.PairWithInput +public import Complexitylib.Classes.P.UnaryLength +public import Complexitylib.Classes.PPoly.Uniform +public import Complexitylib.Classes.PPoly.Uniform.Preprocessing.Defs /-! # Inputs for uniform circuit-family evaluation — proof internals -/ +@[expose] public section + namespace Complexity /-- Internal polynomial-time construction of the serialized evaluator input. -/ diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling.lean index 256817b2..10261d0c 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Internal /-! # Streamable deterministic unrolling families @@ -25,6 +27,8 @@ uniformity emitter. - `TM.directUnrollingCircuitFamily_size_bigO` — cubic-in-time size. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Containment.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Containment.lean index 4bb44b2d..779cfc88 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Containment.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Containment.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Containment.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Containment.Internal /-! # Deterministic unrolling into uniform P/poly @@ -24,6 +26,8 @@ discharges them unconditionally. - `P_subset_UniformPPoly` and `UniformPPoly_eq_P` are the completed headline. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Containment/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Containment/Internal.lean index b8b97c72..02c30802 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Containment/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Containment/Internal.lean @@ -3,11 +3,13 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.P.NormalForm -import Complexitylib.Classes.PPoly.Uniform -import Complexitylib.Classes.PPoly.Uniform.Containment -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Tableau -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Padded +module + +public import Complexitylib.Classes.P.NormalForm +public import Complexitylib.Classes.PPoly.Uniform +public import Complexitylib.Classes.PPoly.Uniform.Containment +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Tableau +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Padded /-! # Deterministic unrolling into uniform P/poly -- proof internals @@ -17,6 +19,8 @@ conditional `FL` seams and then through the verified canonical padded serializer, yielding the unconditional machines-to-circuits containment. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Defs.lean index 4f330a56..bfac26c4 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Family -import Complexitylib.Circuits.Unrolling.Acceptance +module + +public import Complexitylib.Circuits.Encoding.Family +public import Complexitylib.Circuits.Unrolling.Acceptance /-! # Streamable deterministic unrolling families — definitions @@ -21,6 +23,8 @@ typed circuit is reconstructed directly from `acceptanceRawCircuit`, so erasing it recovers exactly the raw list that a streaming generator will emit. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Finalization.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Finalization.lean index aab252b6..a052f7bc 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Finalization.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Finalization.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Finalization.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Finalization.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Finalization.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Finalization.Internal /-! # Direct-unrolling finalization generator @@ -15,6 +17,8 @@ binary `available` counter and the precomputed closed frontier, so the routine uses logarithmic-width work values and performs no preliminary counting pass. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Finalization/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Finalization/Defs.lean index 8e5ab02d..d275c600 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Finalization/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Finalization/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Program.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Finalization.Defs +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Program.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Finalization.Defs /-! # Direct-unrolling finalization generator -- definitions @@ -15,6 +17,8 @@ wire. The binary padding driver uses `available` itself as its counter, so no gate-counting pass or unary work fuel is needed. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Finalization/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Finalization/Internal.lean index 516033aa..f141fdcf 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Finalization/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Finalization/Internal.lean @@ -3,16 +3,20 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Finalization.Defs -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.SpaceBounds +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Finalization.Defs +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.SpaceBounds /-! # Direct-unrolling finalization generator -- proof internals -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Initialization.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Initialization.lean index 83c8ede6..820ae1dc 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Initialization.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Initialization.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Initialization.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Initialization.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Initialization.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Initialization.Internal /-! # Verified direct-unrolling initialization generator @@ -14,6 +16,8 @@ effects, exact raw-gate emission, and the positive-input entry contract for the direct initialization phase. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Initialization/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Initialization/Defs.lean index d895cbd2..dbaf9a52 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Initialization/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Initialization/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Program.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Initialization.Defs +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Program.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Initialization.Defs /-! # Direct-unrolling initialization generator -- definitions @@ -15,6 +17,8 @@ definition time; input-dependent head and cell ranges use canonical binary loops over natural counters. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Initialization/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Initialization/Internal.lean index a5c3d78a..a168e2da 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Initialization/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Initialization/Internal.lean @@ -3,19 +3,23 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Initialization.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Bounds -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Initialization -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.InputLength -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.SpaceBounds +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Initialization.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Bounds +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Initialization +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.InputLength +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.SpaceBounds /-! # Direct-unrolling initialization generator -- proof internals -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling @@ -867,7 +871,8 @@ private theorem repeatRoutine_emitted_eq_indexedGateBlocks ih _ (hupdate values (values Work.available + step) hinvariant)] simp [indexedGateBlocks, List.flatMap_append] -private def tapeInvariant (T : ℕ) (values : BinaryValues WorkCount) : Prop := +@[nolint docBlame] +def tapeInvariant (T : ℕ) (values : BinaryValues WorkCount) : Prop := values Work.reference₀ = 0 ∧ values Work.loop₀ = 0 ∧ values Work.limit₀ = T + 1 ∧ values Work.horizon = T diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Offset.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Offset.lean index 8fac7d17..650b4995 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Offset.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Offset.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Offset.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Offset.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Offset.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Offset.Internal /-! # Dynamic recent-wire offsets @@ -13,6 +15,8 @@ Proof-carrying helpers for subtracting a run-time wire offset and emitting a raw gate with one dynamic and one fixed recent-wire reference. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Offset/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Offset/Defs.lean index 8dfec8b6..32a2fd57 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Offset/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Offset/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Primitive.Defs +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Primitive.Defs /-! # Dynamic recent-wire offsets -- definitions @@ -17,6 +19,8 @@ scratch, reference, and emission registers. They make preservation claims about the dynamic offset and loop counter part of the auditable interface. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Offset/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Offset/Internal.lean index 7b4cb090..f2a1bc39 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Offset/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Offset/Internal.lean @@ -3,15 +3,19 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Offset.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Primitive -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.SpaceBounds +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Offset.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Primitive +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.SpaceBounds /-! # Dynamic recent-wire offsets -- proof internals -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/PolynomialOffset.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/PolynomialOffset.lean index a46c5d71..193bf799 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/PolynomialOffset.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/PolynomialOffset.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.PolynomialOffset.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.PolynomialOffset.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.PolynomialOffset.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.PolynomialOffset.Internal /-! # Polynomial recent-wire offsets @@ -13,6 +15,8 @@ Proof-carrying evaluation and raw-gate emission for recent-wire offsets that are fixed polynomials in the run-time tableau horizon. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/PolynomialOffset/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/PolynomialOffset/Defs.lean index 2a9536a7..dc737295 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/PolynomialOffset/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/PolynomialOffset/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Offset.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Polynomial.Defs +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Offset.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Polynomial.Defs /-! # Polynomial recent-wire offsets -- definitions @@ -15,6 +17,8 @@ evaluate that polynomial into one scratch value, use the dynamic-offset gate emitter, and restore every owned register. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/PolynomialOffset/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/PolynomialOffset/Internal.lean index 6c7f8f74..eef72af5 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/PolynomialOffset/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/PolynomialOffset/Internal.lean @@ -3,13 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Offset -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.PolynomialOffset.Defs +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Offset +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.PolynomialOffset.Defs /-! # Polynomial recent-wire offsets -- proof internals -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Primitive.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Primitive.lean index fe63de17..658202c8 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Primitive.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Primitive.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Primitive.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Primitive.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Primitive.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Primitive.Internal /-! # Direct-unrolling generator primitives @@ -13,6 +15,8 @@ Executable fixed-work helpers for recent-wire raw gates and numeric state, head, and cell configuration-wire references. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Primitive/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Primitive/Defs.lean index 23d8f327..cdaa2be0 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Primitive/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Primitive/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Program.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Case.Defs +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Program.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Case.Defs /-! # Direct-unrolling generator primitives -- definitions @@ -23,6 +25,8 @@ preserved. All framed copy, addition, multiplication, and emission counters are restored by their underlying leaves. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Primitive/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Primitive/Internal.lean index b19dfc2d..b973c88d 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Primitive/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Primitive/Internal.lean @@ -3,15 +3,19 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Primitive.Defs -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.SpaceBounds +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Primitive.Defs +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.SpaceBounds /-! # Direct-unrolling generator primitives -- proof internals -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Program.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Program.lean index 18003001..42d5ef0f 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Program.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Program.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Program.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Program.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Program.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Program.Internal /-! # Direct-unrolling generator program @@ -14,6 +16,8 @@ prefix of the direct-unrolling generator. A later module supplies the positive tableau body and discharges its value-level entry condition. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Program/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Program/Defs.lean index 48b243cf..18cb5550 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Program/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Program/Defs.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Bounds.Defs -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic.Defs -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control.Defs -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List.Defs +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Bounds.Defs +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic.Defs +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control.Defs +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List.Defs /-! # Direct-unrolling generator program -- definitions @@ -18,6 +20,8 @@ hardwired two-bit word; the positive tableau body remains a compositional `BinaryRoutine` parameter at this layer. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Program/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Program/Internal.lean index 9a948902..64980354 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Program/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Program/Internal.lean @@ -3,17 +3,21 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Program.Defs -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.InputLength -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.SpaceBounds +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Program.Defs +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.InputLength +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.SpaceBounds /-! # Direct-unrolling generator program -- proof internals -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Tableau.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Tableau.lean index 2414bcc4..8437aa36 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Tableau.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Tableau.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Tableau.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Tableau.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Tableau.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Tableau.Internal /-! # Verified direct-tableau generator @@ -15,6 +17,8 @@ exactly the family's tagged circuit code (including the separate zero-length member), and has a verified logarithmic all-prefix auxiliary-space bound. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Tableau/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Tableau/Defs.lean index 17c8cae3..d0883089 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Tableau/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Tableau/Defs.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Finalization.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Initialization.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Program.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Defs +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Finalization.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Initialization.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Program.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Defs /-! # Complete direct-unrolling generator -- definitions @@ -18,6 +20,8 @@ body with `program` also handles the separately tagged length-zero family member. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Tableau/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Tableau/Internal.lean index ef2705d6..3e0b2908 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Tableau/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Tableau/Internal.lean @@ -3,16 +3,18 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Finalization -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Initialization -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Program -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Tableau.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Padded -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Finalization -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Stream -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.InputLength -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.SpaceBounds +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Finalization +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Initialization +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Program +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Tableau.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Padded +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Finalization +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Stream +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.InputLength +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.SpaceBounds /-! # Complete direct-unrolling generator -- proof internals @@ -22,6 +24,8 @@ keeps the step scratch convention reusable, preserves the horizon, and advances the dedicated layer counter exactly once per emitted packed step. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling @@ -32,7 +36,7 @@ namespace DirectGenerator open scoped BigOperators -private theorem stepLoopValues_invariant (tm : TM k) +theorem stepLoopValues_invariant (tm : TM k) (values : BinaryValues WorkCount) (hclean : StepClean values) (hhorizon : 0 < values Work.horizon) (count : ℕ) : let current := BinaryRoutine.binaryForValues (emitStep tm) Work.loop₂ @@ -75,7 +79,7 @@ private theorem stepLoopValues_invariant (tm : TM k) (values Work.loop₂ + count) + 1 := by rw [hcurrentLoop] _ = values Work.loop₂ + (count + 1) := by omega -private theorem stepLoopValues_frontier (tm : TM k) +theorem stepLoopValues_frontier (tm : TM k) (values : BinaryValues WorkCount) (hclean : StepClean values) (hhorizon : 0 < values Work.horizon) (count : ℕ) : BinaryRoutine.binaryForValues (emitStep tm) Work.loop₂ values count @@ -99,7 +103,7 @@ private theorem stepLoopValues_frontier (tm : TM k) simpa [Work.available, Work.configBase, Work.gateBound, Work.gateCount, Work.frontier] using ih -private theorem stepScheduleSize_eq_directStepSizeInternal (tm : NTM k) +theorem stepScheduleSize_eq_directStepSizeInternal (tm : NTM k) (T configBase : ℕ) : stepScheduleSize (transitionCases tm).length (Fintype.card tm.Q) k T (stepAtomKindAt tm T) (stepAtomEffectSelectedAt tm T) @@ -107,7 +111,7 @@ private theorem stepScheduleSize_eq_directStepSizeInternal (tm : NTM k) rw [← stepFragmentSize_eq_stepScheduleSize tm T configBase 0, stepFragmentSize_eq_directStepSize] -private theorem initializationEndpoint (tm : TM k) (q : Polynomial ℕ) +theorem initializationEndpoint (tm : TM k) (q : Polynomial ℕ) (n : ℕ) : let values := preambleValues tm q (BinaryRoutine.inputLengthValues Work.inputLength n) @@ -183,7 +187,7 @@ private theorem initializationEndpoint (tm : TM k) (q : Polynomial ℕ) rw [hcard] ring -private theorem stepScheduleOutputBase_eq_nextInternal (tm : TM k) +theorem stepScheduleOutputBase_eq_nextInternal (tm : TM k) (T n count available configBase : ℕ) (havailable : available = n + configWidth tm.toNTM T + count * directStepSize tm.toNTM T) : @@ -205,7 +209,7 @@ private theorem stepScheduleOutputBase_eq_nextInternal (tm : TM k) rw [hrhs] at hend exact Nat.add_right_cancel hend -private theorem stepLoopValues_numeric_invariant (tm : TM k) +theorem stepLoopValues_numeric_invariant (tm : TM k) (values : BinaryValues WorkCount) (hclean : StepClean values) (hhorizon : 0 < values Work.horizon) (n count : ℕ) (hloop : values Work.loop₂ = 0) @@ -297,7 +301,8 @@ private theorem stepLoopValues_numeric_invariant (tm : TM k) refine ⟨hbasic.1, hbasic.2.1, ?_, hnumeric⟩ simpa [hloop] using hbasic.2.2 -private noncomputable def stepLoopIndexPolynomial +@[nolint docBlame] +noncomputable def stepLoopIndexPolynomial (tm : NTM k) : Polynomial ℕ := Polynomial.C (Fintype.card tm.Q) + Polynomial.C (k + 2) * (Polynomial.X + Polynomial.C 2) + @@ -307,7 +312,8 @@ private noncomputable def stepLoopIndexPolynomial (Polynomial.X + Polynomial.C 2) + Polynomial.C (2 * (k + 2) + 8) -private noncomputable def stepLoopEvaluatorPolynomial +@[nolint docBlame] +noncomputable def stepLoopEvaluatorPolynomial (tm : NTM k) : Polynomial ℕ := TM.binaryPolynomialSpaceWidthPolynomial predecessorHeadSchedulePolynomial + @@ -331,7 +337,8 @@ private noncomputable def stepLoopEvaluatorPolynomial (writtenNextFormulaPolynomial tm tape symbol)) + TM.binaryPolynomialSpaceWidthPolynomial (Polynomial.C 1) -private noncomputable def stepLoopEndPolynomial +@[nolint docBlame] +noncomputable def stepLoopEndPolynomial (tm : TM k) (q : Polynomial ℕ) : Polynomial ℕ := let horizon := TM.directSerializerHorizonPolynomial q Polynomial.X + @@ -341,7 +348,8 @@ private noncomputable def stepLoopEndPolynomial (Polynomial.C (stepSizeCoeff tm.toNTM) * (horizon + Polynomial.C 2) ^ 2) -private noncomputable def stepLoopWidthPolynomial +@[nolint docBlame] +noncomputable def stepLoopWidthPolynomial (tm : TM k) (q : Polynomial ℕ) : Polynomial ℕ := let horizon := TM.directSerializerHorizonPolynomial q let endpoint := stepLoopEndPolynomial tm q @@ -353,12 +361,12 @@ private noncomputable def stepLoopWidthPolynomial Polynomial.C 5 * (stepLoopIndexPolynomial tm.toNTM).comp horizon + (stepLoopEvaluatorPolynomial tm.toNTM).comp horizon -private theorem directStepSize_le_stepBound (tm : NTM k) (T : ℕ) : +theorem directStepSize_le_stepBound (tm : NTM k) (T : ℕ) : directStepSize tm T ≤ stepSizeCoeff tm * (T + 2) ^ 2 := by rw [← stepFragmentSize_eq_directStepSize tm T 0 0] exact stepFragmentSize_le tm T 0 0 -private theorem stepLoopEndPolynomial_eval (tm : TM k) +theorem stepLoopEndPolynomial_eval (tm : TM k) (q : Polynomial ℕ) (n : ℕ) : (stepLoopEndPolynomial tm q).eval n = n + (Fintype.card tm.Q + 5 * (k + 2)) * @@ -369,7 +377,7 @@ private theorem stepLoopEndPolynomial_eval (tm : TM k) simp [stepLoopEndPolynomial, Polynomial.eval_add, Polynomial.eval_mul, Polynomial.eval_pow] -private theorem stepLoopWidthPolynomial_eval (tm : TM k) +theorem stepLoopWidthPolynomial_eval (tm : TM k) (q : Polynomial ℕ) (n : ℕ) : (stepLoopWidthPolynomial tm q).eval n = n + (TM.directSerializerHorizonPolynomial q).eval n + @@ -383,7 +391,7 @@ private theorem stepLoopWidthPolynomial_eval (tm : TM k) ((TM.directSerializerHorizonPolynomial q).eval n) := by simp [stepLoopWidthPolynomial, Polynomial.eval_comp] -private theorem stepLoopEnd_final_le (tm : TM k) +theorem stepLoopEnd_final_le (tm : TM k) (q : Polynomial ℕ) (n : ℕ) : let T := (TM.directSerializerHorizonPolynomial q).eval n n + configWidth tm.toNTM T + T * directStepSize tm.toNTM T ≤ @@ -399,7 +407,7 @@ private theorem stepLoopEnd_final_le (tm : TM k) dsimp only [T] at hconfig hstep hmul ⊢ omega -private theorem stepLoopIndex_bounds +theorem stepLoopIndex_bounds (tm : NTM k) (T base stateIndex tapeIndex symbolIndex position : ℕ) (hstate : stateIndex < Fintype.card tm.Q) (htape : tapeIndex ≤ k + 1) (hsymbol : symbolIndex < 4) @@ -429,7 +437,7 @@ private theorem stepLoopIndex_bounds unfold transitionStateRef transitionHeadRef transitionCellRef caseReadSize omega -private theorem stepLoopEvaluator_caps +theorem stepLoopEvaluator_caps (tm : NTM k) (T : ℕ) (state : tm.Q) (headTape : TapeSlot k) (writtenTape : WritableSlot k) (symbol : Γ) : 2 * TM.binaryPolynomialValueCap predecessorHeadSchedulePolynomial T + @@ -560,7 +568,7 @@ private theorem stepLoopEvaluator_caps TM.binaryPolynomialSpaceWidthPolynomial_eval] omega -private theorem stepLoopCap_sum_le +theorem stepLoopCap_sum_le {endpoint index evaluator frontier stateRef headRef cellRef readSize horizonArithmetic evaluatorCaps : ℕ} (hfrontier : frontier ≤ endpoint) @@ -575,7 +583,7 @@ private theorem stepLoopCap_sum_le 4 * endpoint + 5 * index + evaluator := by omega -private theorem stepLoopValues_all_le +theorem stepLoopValues_all_le (tm : TM k) (values : BinaryValues WorkCount) (hclean : StepClean values) (hhorizon : 0 < values Work.horizon) (n width : ℕ) (hloop : values Work.loop₂ = 0) @@ -703,7 +711,7 @@ private theorem stepLoopValues_all_le rw [hcurrentLoop] omega -private theorem stepLoopInitialValues_le (tm : TM k) +theorem stepLoopInitialValues_le (tm : TM k) (q : Polynomial ℕ) (n : ℕ) : let initial := (initialization tm).effect (preambleValues tm q @@ -781,7 +789,7 @@ private theorem stepLoopInitialValues_le (tm : TM k) (BinaryRoutine.values_update_le Work.available hpreamble havailable) (Nat.zero_le _) -private theorem stepLoopWidthEnvelope (tm : TM k) (q : Polynomial ℕ) +theorem stepLoopWidthEnvelope (tm : TM k) (q : Polynomial ℕ) (n count : ℕ) (hcount : count < (TM.directSerializerHorizonPolynomial q).eval n) : let initial := (initialization tm).effect @@ -1015,7 +1023,7 @@ private theorem stepLoopWidthEnvelope (tm : TM k) (q : Polynomial ℕ) (stepLoopEvaluatorPolynomial tm.toNTM).eval T := hcap _ ≤ width := hcapWidth -private theorem stepLoopEmitted_eq_prefix (tm : TM k) +theorem stepLoopEmitted_eq_prefix (tm : TM k) (values : BinaryValues WorkCount) (hclean : StepClean values) (hhorizon : 0 < values Work.horizon) (n count : ℕ) (hcount : count ≤ values Work.horizon) @@ -1276,7 +1284,7 @@ theorem emitTransitionSteps_effect_internal (tm : TM k) (values Work.horizon - values Work.loop₂)) Work.loop₂ 0 := by rfl -private theorem transitionFinalValues_le (tm : TM k) +theorem transitionFinalValues_le (tm : TM k) (q : Polynomial ℕ) (n : ℕ) : let initial := (initialization tm).effect (preambleValues tm q diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Case.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Case.lean index 32d684d9..3339711e 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Case.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Case.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Case.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Case.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Case.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Case.Internal /-! # Direct-unrolling transition-case generator @@ -13,6 +15,8 @@ Exact contracts for the forward stream of a fixed transition case, together with soundness of the complete case-formula emitter. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Case/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Case/Defs.lean index b053883d..370d88a9 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Case/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Case/Defs.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Initialization.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Offset.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Read.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Case.Defs +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Initialization.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Offset.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Read.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Case.Defs /-! # Direct-unrolling transition-case generator -- definitions @@ -19,6 +21,8 @@ read-formula size, then by the final one-gate state member. No formula stack is materialized on a work tape. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Case/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Case/Internal.lean index c550e1fd..6198068d 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Case/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Case/Internal.lean @@ -3,18 +3,22 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Initialization -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Offset -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Case.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Read -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Case -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Initialization +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Offset +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Case.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Read +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Case +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List /-! # Direct-unrolling transition-case generator -- proof internals -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling @@ -159,7 +163,8 @@ private theorem emitCopyGate_reference₀_requires refine ⟨⟨by decide, by decide, by decide, by decide, by decide⟩, ?_⟩ simpa [Work.emitCounter] using hemit -private def caseReadStartValues (values : BinaryValues WorkCount) +@[nolint docBlame] +def caseReadStartValues (values : BinaryValues WorkCount) (tapeIndex symbolIndex : ℕ) : BinaryValues WorkCount := Function.update (Function.update values Work.tapeIndex tapeIndex) diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Effect.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Effect.lean index f5c4e80b..d3bb3094 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Effect.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Effect.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Effect.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Effect.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Effect.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Effect.Internal /-! # Direct-unrolling transition-effect generator @@ -13,6 +15,8 @@ Exact contracts for the generated disjunction over a machine's finite transition table. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Effect/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Effect/Defs.lean index c5dc19db..781b0144 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Effect/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Effect/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Case.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Effect.Defs +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Case.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Effect.Defs /-! # Direct-unrolling transition-effect generator -- definitions @@ -15,6 +17,8 @@ one false gate. The suffix traverses the hardwired case table in reverse and rolls one output reference backward by each intervening case size. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Effect/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Effect/Internal.lean index 5fc15d82..682c3f69 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Effect/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Effect/Internal.lean @@ -3,17 +3,21 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Offset -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Case -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Read -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Effect.Defs -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Offset +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Case +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Read +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Effect.Defs +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List /-! # Direct-unrolling transition-effect generator -- proof internals -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling @@ -24,7 +28,7 @@ namespace DirectGenerator /-- Scratch invariant while a rolling effect-member output reference moves backward through the variable-width case stream. -/ -private structure EffectConnectorClean +structure EffectConnectorClean (values : BinaryValues WorkCount) : Prop where reference₁ : values Work.reference₁ = 0 loop₃ : values Work.loop₃ = 0 @@ -35,7 +39,7 @@ private structure EffectConnectorClean multiplyCounter : values Work.multiplyCounter = 0 addCounter : values Work.addCounter = 0 -private theorem CaseFormulaClean.updateAvailable +theorem CaseFormulaClean.updateAvailable (values : BinaryValues WorkCount) (hclean : CaseFormulaClean values) (available : ℕ) : CaseFormulaClean (Function.update values Work.available available) := by @@ -79,7 +83,7 @@ private theorem CaseFormulaClean.updateAvailable · exact hclean.tapeIndex · exact hclean.symbolIndex -private theorem CaseFormulaClean.effectConnectorClean +theorem CaseFormulaClean.effectConnectorClean (values : BinaryValues WorkCount) (hclean : CaseFormulaClean values) : EffectConnectorClean values := { reference₁ := hclean.reference₁ @@ -91,7 +95,7 @@ private theorem CaseFormulaClean.effectConnectorClean multiplyCounter := hclean.multiplyCounter addCounter := hclean.addCounter } -private theorem EffectConnectorClean.updateReference₀ +theorem EffectConnectorClean.updateReference₀ (values : BinaryValues WorkCount) (hclean : EffectConnectorClean values) (reference : ℕ) : EffectConnectorClean @@ -115,7 +119,7 @@ private theorem EffectConnectorClean.updateReference₀ hclean.multiplyCounter · simpa [Work.reference₀, Work.addCounter] using hclean.addCounter -private theorem EffectConnectorClean.afterReadConnector +theorem EffectConnectorClean.afterReadConnector (values : BinaryValues WorkCount) (hclean : EffectConnectorClean values) : EffectConnectorClean (emitReadConnector.effect values) := by rw [emitReadConnector_effect_internal] @@ -143,7 +147,7 @@ private theorem EffectConnectorClean.afterReadConnector · simpa [Work.available, Work.reference₁, Work.addCounter] using hclean.addCounter -private theorem emitReadConnector_sound_for_effect : +theorem emitReadConnector_sound_for_effect : emitReadConnector.Sound := by apply BinaryRoutine.seqList_sound intro member hmember @@ -236,7 +240,7 @@ theorem emitEffectCaseAt_emitted_internal (tm : NTM k) emitConstantGate_emitted_internal false values hclean.reference₀] simp [effectFormulaCaseBlock, hselected, directInitConstant] -private theorem emitEffectMembersFrom_sound (tm : NTM k) +theorem emitEffectMembersFrom_sound (tm : NTM k) (selects : TransitionEffect tm → Bool) (start count : ℕ) : (emitEffectMembersFrom tm selects start count).Sound := by induction count generalizing start with @@ -250,7 +254,7 @@ theorem emitEffectMembers_sound_internal (tm : NTM k) (emitEffectMembers tm selects).Sound := emitEffectMembersFrom_sound tm selects 0 (transitionCases tm).length -private theorem emitEffectMembersFrom_requires (tm : NTM k) +theorem emitEffectMembersFrom_requires (tm : NTM k) (selects : TransitionEffect tm → Bool) (start count : ℕ) (values : BinaryValues WorkCount) (hclean : CaseFormulaClean values) : (emitEffectMembersFrom tm selects start count).requires values := by @@ -273,7 +277,7 @@ theorem emitEffectMembers_requires_internal (tm : NTM k) emitEffectMembersFrom_requires tm selects 0 (transitionCases tm).length values hclean -private theorem emitEffectMembersFrom_effect +theorem emitEffectMembersFrom_effect (tm : NTM k) (selects : TransitionEffect tm → Bool) (start count base T : ℕ) (values : BinaryValues WorkCount) (hclean : CaseFormulaClean values) @@ -358,7 +362,7 @@ private theorem emitEffectMembersFrom_effect (values Work.available) (values Work.horizon) values hclean (by omega) rfl (by simp [prefixSize]) -private theorem emitEffectMembersFrom_emitted +theorem emitEffectMembersFrom_emitted (tm : NTM k) (selects : TransitionEffect tm → Bool) (start count base T configBase choiceWire : ℕ) (values : BinaryValues WorkCount) (hclean : CaseFormulaClean values) @@ -721,7 +725,7 @@ theorem emitPreviousEffectConnector_requires_internal (workCount : ℕ) simp [BinaryRoutine.clear, Work.reference₀, Work.temporary₃, Work.temporary₂, Work.loop₃, Work.available] -private theorem EffectConnectorClean.afterPrevious +theorem EffectConnectorClean.afterPrevious (workCount : ℕ) (selected choiceValue : Bool) (values : BinaryValues WorkCount) (hclean : EffectConnectorClean values) : EffectConnectorClean @@ -755,7 +759,7 @@ private theorem EffectConnectorClean.afterPrevious · simpa [Work.reference₀, Work.addCounter, Work.available] using hclean.addCounter -private theorem effectFormulaCaseSize_pos (workCount T : ℕ) +theorem effectFormulaCaseSize_pos (workCount T : ℕ) (selected choiceValue : Bool) : 1 ≤ effectFormulaCaseSize workCount T selected choiceValue := by cases selected @@ -764,7 +768,7 @@ private theorem effectFormulaCaseSize_pos (workCount T : ℕ) caseFormulaMembersSize, caseFormulaMemberCount, caseReadSize] omega -private theorem emitPreviousEffectConnectorsCount_requires +theorem emitPreviousEffectConnectorsCount_requires (tm : NTM k) (selects : TransitionEffect tm → Bool) (count base : ℕ) (values : BinaryValues WorkCount) (hclean : EffectConnectorClean values) (hcount : count + 1 ≤ (transitionCases tm).length) (hbase : 1 ≤ base) @@ -831,7 +835,7 @@ private theorem emitPreviousEffectConnectorsCount_requires rw [hhorizon] exact hcurrentReference -private theorem emitPreviousEffectConnectorsCount_effect +theorem emitPreviousEffectConnectorsCount_effect (tm : NTM k) (selects : TransitionEffect tm → Bool) (count base : ℕ) (values : BinaryValues WorkCount) (hclean : EffectConnectorClean values) (hcount : count + 1 ≤ (transitionCases tm).length) (hbase : 1 ≤ base) @@ -914,7 +918,7 @@ private theorem emitPreviousEffectConnectorsCount_effect simp_all [Work.reference₀, Work.available, Work.horizon] all_goals omega -private theorem emitPreviousEffectConnectorsCount_emitted +theorem emitPreviousEffectConnectorsCount_emitted (tm : NTM k) (selects : TransitionEffect tm → Bool) (count nextRank base T : ℕ) (values : BinaryValues WorkCount) (hclean : EffectConnectorClean values) @@ -1034,7 +1038,7 @@ private theorem emitPreviousEffectConnectorsCount_emitted (indexedRightFoldConnector .or base (transitionCases tm).length sizeAt) (by omega) -private theorem emitPreviousEffectConnectorsCount_sound +theorem emitPreviousEffectConnectorsCount_sound (tm : NTM k) (selects : TransitionEffect tm → Bool) (count : ℕ) : (emitPreviousEffectConnectorsCount tm selects count).Sound := by induction count with @@ -1521,7 +1525,7 @@ theorem emitEffectFormula_emitted_internal (tm : NTM k) /-- One global arithmetic envelope for every machine-selected case and every bounded read selector used by complete effect-formula emission. -/ -private def EffectFormulaWidthCap (tm : NTM k) +def EffectFormulaWidthCap (tm : NTM k) (selects : TransitionEffect tm → Bool) (values : ℕ → BinaryValues WorkCount) (width : ℕ → ℕ) : Prop := ∀ inputLength stateIndex tapeIndex symbolIndex position, @@ -1546,7 +1550,7 @@ private def EffectFormulaWidthCap (tm : NTM k) caseReadSize (values inputLength Work.horizon) + values inputLength Work.horizon ≤ width inputLength -private theorem EffectFormulaWidthCap.frontier +theorem EffectFormulaWidthCap.frontier {tm : NTM k} {selects : TransitionEffect tm → Bool} {values : ℕ → BinaryValues WorkCount} {width : ℕ → ℕ} (hcap : EffectFormulaWidthCap tm selects values width) : @@ -1563,25 +1567,25 @@ private theorem EffectFormulaWidthCap.frontier hstate (by omega) (by omega) (Nat.zero_le _) omega -private theorem effectCaseStateIndexAt_lt (tm : NTM k) (caseIndex : ℕ) +theorem effectCaseStateIndexAt_lt (tm : NTM k) (caseIndex : ℕ) (hcase : caseIndex < (transitionCases tm).length) : effectCaseStateIndexAt tm caseIndex < Fintype.card tm.Q := by rw [effectCaseStateIndexAt, dif_pos hcase] exact (Fintype.equivFin tm.Q _).isLt -private theorem effectCaseInputSymbolIndexAt_lt (tm : NTM k) +theorem effectCaseInputSymbolIndexAt_lt (tm : NTM k) (caseIndex : ℕ) (hcase : caseIndex < (transitionCases tm).length) : effectCaseInputSymbolIndexAt tm caseIndex < 4 := by rw [effectCaseInputSymbolIndexAt, dif_pos hcase] exact (symbolIndex _).isLt -private theorem effectCaseOutputSymbolIndexAt_lt (tm : NTM k) +theorem effectCaseOutputSymbolIndexAt_lt (tm : NTM k) (caseIndex : ℕ) (hcase : caseIndex < (transitionCases tm).length) : effectCaseOutputSymbolIndexAt tm caseIndex < 4 := by rw [effectCaseOutputSymbolIndexAt, dif_pos hcase] exact (symbolIndex _).isLt -private theorem effectCaseWorkSymbolIndexAt_lt (tm : NTM k) +theorem effectCaseWorkSymbolIndexAt_lt (tm : NTM k) (caseIndex workIndex : ℕ) (hcase : caseIndex < (transitionCases tm).length) (hwork : workIndex < k) : @@ -1589,7 +1593,7 @@ private theorem effectCaseWorkSymbolIndexAt_lt (tm : NTM k) rw [effectCaseWorkSymbolIndexAt, dif_pos hcase, dif_pos hwork] exact (symbolIndex _).isLt -private theorem prefixSize_mono_effect +theorem prefixSize_mono_effect (sizeAt : ℕ → ℕ) {first second : ℕ} (hle : first ≤ second) : prefixSize sizeAt first ≤ prefixSize sizeAt second := by induction second with @@ -1601,7 +1605,7 @@ private theorem prefixSize_mono_effect · have hfirst : first ≤ second := by omega exact (ih hfirst).trans (by rw [prefixSize_succ]; omega) -private theorem EffectFormulaWidthCap.caseSize +theorem EffectFormulaWidthCap.caseSize {tm : NTM k} {selects : TransitionEffect tm → Bool} {values : ℕ → BinaryValues WorkCount} {width : ℕ → ℕ} (hcap : EffectFormulaWidthCap tm selects values width) @@ -1632,7 +1636,7 @@ private theorem EffectFormulaWidthCap.caseSize dsimp only [sizeAt] at hprefix omega -private theorem emitEffectCaseAt_spaceBoundByWidthAt +theorem emitEffectCaseAt_spaceBoundByWidthAt (tm : NTM k) (selects : TransitionEffect tm → Bool) (caseIndex : ℕ) {initialSpace : ℕ → ℕ} {values : ℕ → BinaryValues WorkCount} {width : ℕ → ℕ} @@ -1685,7 +1689,7 @@ private theorem emitEffectCaseAt_spaceBoundByWidthAt (fun inputLength => hvalues inputLength Work.available) (fun inputLength => hvalues inputLength Work.reference₀) -private theorem emitEffectMembersFrom_spaceBoundByWidthAt +theorem emitEffectMembersFrom_spaceBoundByWidthAt (tm : NTM k) (selects : TransitionEffect tm → Bool) (start count : ℕ) {initialSpace : ℕ → ℕ} {source values : ℕ → BinaryValues WorkCount} @@ -1820,7 +1824,7 @@ private theorem emitEffectMembersFrom_spaceBoundByWidthAt have hseq := BinaryRoutine.SpaceBoundByWidthAt.seq hhead htail simpa [emitEffectMembersFrom, nextValues] using hseq -private theorem emitEffectMembers_spaceBoundByWidthAt +theorem emitEffectMembers_spaceBoundByWidthAt (tm : NTM k) (selects : TransitionEffect tm → Bool) {initialSpace : ℕ → ℕ} {values : ℕ → BinaryValues WorkCount} {width : ℕ → ℕ} @@ -1840,7 +1844,7 @@ private theorem emitEffectMembers_spaceBoundByWidthAt · simp [prefixSize, hindex] · exact hcap -private theorem prepareEffectCaseSize_spaceBoundByWidthAt +theorem prepareEffectCaseSize_spaceBoundByWidthAt (workCount : ℕ) (selected choiceValue : Bool) {initialSpace : ℕ → ℕ} {values : ℕ → BinaryValues WorkCount} {width : ℕ → ℕ} @@ -1927,7 +1931,7 @@ private theorem prepareEffectCaseSize_spaceBoundByWidthAt Work.temporary₂, Work.temporary₃] using hfactor inputLength · trivial -private theorem emitPreviousEffectConnector_spaceBoundByWidthAt +theorem emitPreviousEffectConnector_spaceBoundByWidthAt (workCount : ℕ) (selected choiceValue : Bool) {initialSpace : ℕ → ℕ} {values : ℕ → BinaryValues WorkCount} {width : ℕ → ℕ} @@ -2067,7 +2071,7 @@ private theorem emitPreviousEffectConnector_spaceBoundByWidthAt simpa [emitPreviousEffectConnector, BinaryRoutine.seqList, prepare, decrement, prepared, decremented, connected] using hroutine -private theorem emitPreviousEffectConnectorsCount_spaceBoundByWidthAt +theorem emitPreviousEffectConnectorsCount_spaceBoundByWidthAt (tm : NTM k) (selects : TransitionEffect tm → Bool) (count : ℕ) (base horizon : ℕ → ℕ) {initialSpace : ℕ → ℕ} {values : ℕ → BinaryValues WorkCount} {width : ℕ → ℕ} @@ -2275,7 +2279,7 @@ private theorem emitPreviousEffectConnectorsCount_spaceBoundByWidthAt simpa [emitPreviousEffectConnectorsCount, BinaryRoutine.seq, current] using htailValues inputLength index -private theorem emitEffectConnectors_spaceBoundByWidthAt +theorem emitEffectConnectors_spaceBoundByWidthAt (tm : NTM k) (selects : TransitionEffect tm → Bool) {initialSpace : ℕ → ℕ} {source values : ℕ → BinaryValues WorkCount} diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/MovedHead.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/MovedHead.lean index b83168b2..897ee959 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/MovedHead.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/MovedHead.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.MovedHead.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.MovedHead.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.MovedHead.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.MovedHead.Internal /-! # Verified direct moved-head formula generation @@ -14,6 +16,8 @@ with its clean entry domain, restored work-vector effect, and exact encoded numeric schedule. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/MovedHead/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/MovedHead/Defs.lean index 0b13bbf0..7a478e75 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/MovedHead/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/MovedHead/Defs.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.PolynomialOffset.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Effect.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Predecessor.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.MovedHead.Defs +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.PolynomialOffset.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Effect.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Predecessor.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.MovedHead.Defs /-! # Direct-unrolling moved-head generator -- definitions @@ -18,6 +20,8 @@ unused enclosing register, so the final three-way disjunction needs no dynamic size recomputation. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/MovedHead/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/MovedHead/Internal.lean index 38390cce..8d40dc58 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/MovedHead/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/MovedHead/Internal.lean @@ -3,18 +3,22 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.PolynomialOffset -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Effect -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.MovedHead.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Predecessor -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.MovedHead -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Polynomial -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.PolynomialOffset +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Effect +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.MovedHead.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Predecessor +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.MovedHead +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Polynomial +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List /-! # Direct-unrolling moved-head generator -- proof internals -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling @@ -24,7 +28,7 @@ namespace Serializer namespace DirectGenerator /-- Numeric direction code used by the canonical moved-head schedule. -/ -private def movedHeadDirectionCode : Dir3 → ℕ +def movedHeadDirectionCode : Dir3 → ℕ | .left => 0 | .right => 1 | .stay => 2 @@ -32,7 +36,7 @@ private def movedHeadDirectionCode : Dir3 → ℕ /-- Scratch owned by the conjunction between an effect child and a predecessor-head child. The run-time target and tape selector are deliberately excluded because the predecessor routine preserves them. -/ -private structure MovedHeadConjunctionClean +structure MovedHeadConjunctionClean (values : BinaryValues WorkCount) : Prop where temporary₃ : values Work.temporary₃ = 0 polynomialScratch : values Work.polynomialScratch = 0 @@ -44,7 +48,7 @@ private structure MovedHeadConjunctionClean reference₀ : values Work.reference₀ = 0 reference₁ : values Work.reference₁ = 0 -private theorem CaseFormulaClean.movedHeadConjunctionClean +theorem CaseFormulaClean.movedHeadConjunctionClean {values : BinaryValues WorkCount} (hclean : CaseFormulaClean values) (available₀ position tapeIndex available₁ : ℕ) : MovedHeadConjunctionClean @@ -68,7 +72,7 @@ private theorem CaseFormulaClean.movedHeadConjunctionClean · simpa using hclean.reference₀ · simpa using hclean.reference₁ -private theorem CaseFormulaClean.updateMovedHeadOuter +theorem CaseFormulaClean.updateMovedHeadOuter {values : BinaryValues WorkCount} (hclean : CaseFormulaClean values) (index : Fin WorkCount) (value : ℕ) (hindex : index = Work.available ∨ index = Work.limit₂ ∨ @@ -263,7 +267,8 @@ theorem saveMovedHeadMemberOutput_sound_internal (save : Fin WorkCount) : (saveMovedHeadMemberOutput save).Sound := prepareRecentReference_sound save 1 -private def movedHeadMemberResult (values : BinaryValues WorkCount) +@[nolint docBlame] +def movedHeadMemberResult (values : BinaryValues WorkCount) (save : Fin WorkCount) (effectSize : ℕ) : BinaryValues WorkCount := Function.update (Function.update @@ -275,7 +280,7 @@ private def movedHeadMemberResult (values : BinaryValues WorkCount) movedHeadPredecessorSize (values Work.horizon))) Work.position 0) Work.tapeIndex 0 -private theorem clearMovedHeadSelectors +theorem clearMovedHeadSelectors (values : BinaryValues WorkCount) (save : Fin WorkCount) (frontier saved target tapeIndex : ℕ) : Function.update @@ -312,7 +317,7 @@ private theorem clearMovedHeadSelectors simp [htapeIndex, hpositionIndex, hsaveIndex, havailableIndex] -private theorem movedHeadConjunctionUpdates +theorem movedHeadConjunctionUpdates (values : BinaryValues WorkCount) (effectSize predecessorSize : ℕ) (target tapeIndex : ℕ) : Function.update @@ -345,7 +350,7 @@ private theorem movedHeadConjunctionUpdates simp [Work.available, Work.position, Work.tapeIndex] simp [havailableIndex, hpositionIndex, htapeIndex] -private theorem seqListEight_effect +theorem seqListEight_effect (routine₀ routine₁ routine₂ routine₃ routine₄ routine₅ routine₆ routine₇ : BinaryRoutine n) (values : BinaryValues n) : (BinaryRoutine.seqList @@ -359,7 +364,7 @@ private theorem seqListEight_effect (routine₂.effect (routine₁.effect (routine₀.effect values))))))) := rfl -private theorem add_sub_add_one (value extra : ℕ) : +theorem add_sub_add_one (value extra : ℕ) : value + extra - (extra + 1) = value - 1 := by omega @@ -836,13 +841,14 @@ theorem emitSavedMovedHeadConnector_requires_internal BinaryRoutine.emitRawGateStep, BinaryRoutine.clear, Work.reference₁, Work.savedOutput, Work.direction, Work.atomKind] -private def movedHeadStartValues (values : BinaryValues WorkCount) : +@[nolint docBlame] +def movedHeadStartValues (values : BinaryValues WorkCount) : BinaryValues WorkCount := Function.update (Function.update values Work.limit₂ (values Work.position)) Work.position 0 -private theorem movedHeadStartValues_caseClean +theorem movedHeadStartValues_caseClean (values : BinaryValues WorkCount) (hclean : MovedHeadFormulaClean values) : CaseFormulaClean (movedHeadStartValues values) := by have h := hclean.caseClean.updateMovedHeadOuter Work.limit₂ @@ -853,7 +859,7 @@ private theorem movedHeadStartValues_caseClean simp only [movedHeadStartValues] rw [Function.update_comm (show Work.limit₂ ≠ Work.position by decide)] -private theorem CaseFormulaClean.movedHeadMemberResult +theorem CaseFormulaClean.movedHeadMemberResult {values : BinaryValues WorkCount} (hclean : CaseFormulaClean values) (save : Fin WorkCount) (effectSize : ℕ) (hsave : save = Work.savedOutput ∨ save = Work.direction ∨ @@ -1483,7 +1489,7 @@ theorem emitMovedHeadFormula_emitted_internal (tm : NTM k) simpa [Work.available] using havailable first | omega | (congr 1 <;> omega) -private theorem emitSavedMovedHeadConnector_spaceBoundByWidthAt +theorem emitSavedMovedHeadConnector_spaceBoundByWidthAt (save : Fin WorkCount) {initialSpace : ℕ → ℕ} {values : ℕ → BinaryValues WorkCount} {width : ℕ → ℕ} (hvalues : ∀ inputLength index, @@ -1534,7 +1540,7 @@ private theorem emitSavedMovedHeadConnector_spaceBoundByWidthAt simp only [BinaryRoutine.SeqListSpaceBoundByWidthAt] exact ⟨hprepare, hemit, hclear, trivial⟩ -private theorem emitMovedHeadConjunction_spaceBoundByWidthAt +theorem emitMovedHeadConjunction_spaceBoundByWidthAt {initialSpace : ℕ → ℕ} {values : ℕ → BinaryValues WorkCount} {width : ℕ → ℕ} (hvalues : ∀ inputLength index, @@ -1560,7 +1566,7 @@ private theorem emitMovedHeadConjunction_spaceBoundByWidthAt simpa [predecessorHeadSchedulePolynomial_eval] using hoffset inputLength · exact havailable -private theorem emitMovedHeadMember_spaceBoundByWidthAt +theorem emitMovedHeadMember_spaceBoundByWidthAt (tm : NTM k) (tape : TapeSlot k) (direction : Dir3) (directionCode : ℕ) (save : Fin WorkCount) {initialSpace : ℕ → ℕ} {values : ℕ → BinaryValues WorkCount} @@ -1910,7 +1916,7 @@ private theorem emitMovedHeadMember_spaceBoundByWidthAt hpredecessorTrajectory, hconjunctionTrajectory, hsaveTrajectory, hclearPositionTrajectory] using hclearTape -private theorem movedHeadMemberResult_values_le +theorem movedHeadMemberResult_values_le {values : ℕ → BinaryValues WorkCount} {effectSize width : ℕ → ℕ} (save : Fin WorkCount) (hvalues : ∀ inputLength index, @@ -1935,7 +1941,7 @@ private theorem movedHeadMemberResult_values_le · omega · omega -private theorem emitMovedHeadFormulaSuffix_seqListSpaceBoundByWidthAt +theorem emitMovedHeadFormulaSuffix_seqListSpaceBoundByWidthAt {initialSpace : ℕ → ℕ} {values : ℕ → BinaryValues WorkCount} {width : ℕ → ℕ} (hclean : ∀ inputLength, CaseFormulaClean (values inputLength)) diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Next.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Next.lean index 1afe77e8..23abc679 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Next.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Next.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Next.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Next.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Next.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Next.Internal /-! # Verified direct next-atom generation @@ -17,6 +19,8 @@ Input cells and writable marker cells share the same copy routine because their canonical raw schedules are literally identical. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Next/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Next/Defs.lean index 26ce4777..79dd40ca 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Next/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Next/Defs.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.MovedHead.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.WrittenCell.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Next.Defs +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.MovedHead.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.WrittenCell.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Next.Defs /-! # Direct-unrolling next-atom generator -- definitions @@ -16,6 +18,8 @@ fixed child-size polynomial after child emission. Immutable input cells and writable marker cells use a direct old-cell copy. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Next/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Next/Internal.lean index e0218a71..652ad337 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Next/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Next/Internal.lean @@ -3,18 +3,22 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.PolynomialOffset -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Primitive -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Next.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Effect -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.MovedHead -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.WrittenCell -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Polynomial +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.PolynomialOffset +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Primitive +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Next.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Effect +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.MovedHead +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.WrittenCell +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Polynomial /-! # Direct-unrolling next-atom generator -- proof internals -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling @@ -23,18 +27,19 @@ namespace Serializer namespace DirectGenerator -private def advanceAvailableValues (values : BinaryValues WorkCount) +@[nolint docBlame] +def advanceAvailableValues (values : BinaryValues WorkCount) (amount : ℕ) : BinaryValues WorkCount := Function.update values Work.available (values Work.available + amount) -@[simp] private theorem advanceAvailableValues_zero +@[simp] theorem advanceAvailableValues_zero (values : BinaryValues WorkCount) : advanceAvailableValues values 0 = values := by funext i simp [advanceAvailableValues] -private theorem advanceAvailableValues_le +theorem advanceAvailableValues_le {values : ℕ → BinaryValues WorkCount} {width amount : ℕ → ℕ} (hvalues : ∀ inputLength index, values inputLength index ≤ width inputLength) @@ -49,7 +54,7 @@ private theorem advanceAvailableValues_le (hvalues inputLength) exact havailable inputLength -private theorem seqListEight_requires +theorem seqListEight_requires (routine₀ routine₁ routine₂ routine₃ routine₄ routine₅ routine₆ routine₇ : BinaryRoutine n) (values : BinaryValues n) : (BinaryRoutine.seqList @@ -82,7 +87,7 @@ private theorem seqListEight_requires (routine₁.effect (routine₀.effect values))))))) ∧ True := Iff.rfl -private theorem HaltedOrFormulaClean.advanceAvailable +theorem HaltedOrFormulaClean.advanceAvailable (values : BinaryValues WorkCount) (hclean : HaltedOrFormulaClean values) (amount : ℕ) : HaltedOrFormulaClean (advanceAvailableValues values amount) := by @@ -95,7 +100,7 @@ private theorem HaltedOrFormulaClean.advanceAvailable Work.multiplyCounter, Work.addCounter, Work.loop₃, Work.temporary₃, Work.polynomialScratch] -private theorem CaseFormulaClean.advanceAvailable +theorem CaseFormulaClean.advanceAvailable (values : BinaryValues WorkCount) (hclean : CaseFormulaClean values) (amount : ℕ) : CaseFormulaClean (advanceAvailableValues values amount) := @@ -134,7 +139,7 @@ private theorem CaseFormulaClean.advanceAvailable symbolIndex := by simpa [advanceAvailableValues, Work.available, Work.symbolIndex] using hclean.symbolIndex } -private theorem MovedHeadFormulaClean.advanceAvailable +theorem MovedHeadFormulaClean.advanceAvailable (values : BinaryValues WorkCount) (hclean : MovedHeadFormulaClean values) (amount : ℕ) : MovedHeadFormulaClean (advanceAvailableValues values amount) := by @@ -166,7 +171,7 @@ private theorem MovedHeadFormulaClean.advanceAvailable · simpa [advanceAvailableValues, Work.available, Work.atomKind] using hclean.atomKind -private theorem WrittenCellFormulaClean.advanceAvailable +theorem WrittenCellFormulaClean.advanceAvailable (values : BinaryValues WorkCount) (hclean : WrittenCellFormulaClean values) (amount : ℕ) : WrittenCellFormulaClean (advanceAvailableValues values amount) := by @@ -186,7 +191,7 @@ private theorem WrittenCellFormulaClean.advanceAvailable · simpa [advanceAvailableValues, Work.available, Work.savedOutput] using hclean.savedOutput -private theorem CaseFormulaClean.haltedOrClean +theorem CaseFormulaClean.haltedOrClean {values : BinaryValues WorkCount} (hclean : CaseFormulaClean values) : HaltedOrFormulaClean values := { reference₀ := hclean.reference₀ @@ -199,7 +204,7 @@ private theorem CaseFormulaClean.haltedOrClean temporary₃ := hclean.temporary₃ polynomialScratch := hclean.polynomialScratch } -private theorem parkedCase_haltedOrClean +theorem parkedCase_haltedOrClean {values : BinaryValues WorkCount} (hclean : CaseFormulaClean (Function.update values Work.position 0)) : HaltedOrFormulaClean values := @@ -221,7 +226,7 @@ private theorem parkedCase_haltedOrClean polynomialScratch := by simpa [Work.position, Work.polynomialScratch] using hclean.polynomialScratch } -private theorem emitStateReference_effect_advanceAvailable +theorem emitStateReference_effect_advanceAvailable (stateIndex amount : ℕ) (values : BinaryValues WorkCount) (hclean : HaltedOrFormulaClean values) : (emitStateReference stateIndex).effect @@ -239,7 +244,7 @@ private theorem emitStateReference_effect_advanceAvailable hclean.reference₀.symm · simp [advanceAvailableValues, havailable, hreference] -private theorem emitRecentGate_effect_advanceAvailable +theorem emitRecentGate_effect_advanceAvailable (op : AndOrOp) (negated₀ negated₁ : Bool) (offset₀ offset₁ amount : ℕ) (values : BinaryValues WorkCount) (hclean : HaltedOrFormulaClean values) : (emitRecentGate op negated₀ negated₁ offset₀ offset₁).effect @@ -261,7 +266,7 @@ private theorem emitRecentGate_effect_advanceAvailable Work.reference₁] using hclean.reference₁.symm · simp [advanceAvailableValues, havailable, hreference₀, hreference₁] -private theorem emitPolynomialRecentGate_effect_advanceAvailable +theorem emitPolynomialRecentGate_effect_advanceAvailable (polynomial : Polynomial ℕ) (extra : ℕ) (op : AndOrOp) (negated₀ negated₁ : Bool) (fixedOffset₁ amount : ℕ) (values : BinaryValues WorkCount) (hclean : HaltedOrFormulaClean values) : @@ -505,7 +510,7 @@ theorem emitOldCellValue_effect_internal BinaryRoutine.identity, BinaryRoutine.emitBits, Work.tapeIndex, Work.symbolIndex, Work.horizon, Work.configBase, Work.position] -private theorem emitOldStateValue_spaceBoundByWidthAt +theorem emitOldStateValue_spaceBoundByWidthAt (stateIndex : ℕ) {initialSpace : ℕ → ℕ} {values : ℕ → BinaryValues WorkCount} {width : ℕ → ℕ} (hvalues : ∀ inputLength index, @@ -518,7 +523,7 @@ private theorem emitOldStateValue_spaceBoundByWidthAt simpa [emitOldStateValue] using (emitStateReference_spaceBoundByWidth stateIndex false hvalues hcap) -private theorem emitOldHeadValue_spaceBoundByWidthAt +theorem emitOldHeadValue_spaceBoundByWidthAt (stateCount tapeIndex : ℕ) {initialSpace : ℕ → ℕ} {values : ℕ → BinaryValues WorkCount} {width : ℕ → ℕ} (hvalues : ∀ inputLength index, @@ -574,7 +579,7 @@ private theorem emitOldHeadValue_spaceBoundByWidthAt simp only [BinaryRoutine.SeqListSpaceBoundByWidthAt] exact ⟨hset, hhead, hclear, trivial⟩ -private theorem emitOldCellValue_spaceBoundByWidthAt +theorem emitOldCellValue_spaceBoundByWidthAt (stateCount tapeCount tapeIndex symbolIndex : ℕ) {initialSpace : ℕ → ℕ} {values : ℕ → BinaryValues WorkCount} {width : ℕ → ℕ} @@ -779,7 +784,7 @@ theorem emitNextCellCopy_spaceBoundByWidth_internal (emitOldCellValue_spaceBoundByWidthAt stateCount tapeCount tapeIndex symbolIndex hvalues htapeIndex hsymbolIndex hcap) -private theorem emitHaltedOrFormula_spaceBoundByWidthAt +theorem emitHaltedOrFormula_spaceBoundByWidthAt (haltStateIndex : ℕ) (childSize : Polynomial ℕ) (oldValue nextValue : BinaryRoutine WorkCount) {initialSpace : ℕ → ℕ} @@ -1765,7 +1770,8 @@ theorem emitNextHeadFormula_emitted_internal (tm : NTM k) simpa [emitNextHeadFormula, nextHeadFormulaSchedule, nextSchedule, nextFormulaChildAvailable] using hresult -private structure NextHeadFormulaWidthCap (tm : NTM k) +@[nolint docBlame] +structure NextHeadFormulaWidthCap (tm : NTM k) (tape : TapeSlot k) (values : ℕ → BinaryValues WorkCount) (width : ℕ → ℕ) : Prop where bound : ∀ inputLength stateIndex tapeIndex symbolIndex position, @@ -1796,7 +1802,7 @@ private structure NextHeadFormulaWidthCap (tm : NTM k) 2 * TM.binaryPolynomialValueCap (headNextChildPolynomial tm tape) (values inputLength Work.horizon) ≤ width inputLength -private theorem emitNextHeadOldValue_spaceAndEffect +theorem emitNextHeadOldValue_spaceAndEffect (tm : NTM k) (tape : TapeSlot k) {initialSpace : ℕ → ℕ} {values : ℕ → BinaryValues WorkCount} {width : ℕ → ℕ} (hclean : ∀ inputLength, @@ -1861,7 +1867,7 @@ private theorem emitNextHeadOldValue_spaceAndEffect (advanceAvailableValues (values inputLength) 1) htape htemporary hreference) -private theorem emitNextHeadChild_spaceAndEffect +theorem emitNextHeadChild_spaceAndEffect (tm : NTM k) (tape : TapeSlot k) {initialSpace : ℕ → ℕ} {values : ℕ → BinaryValues WorkCount} {width : ℕ → ℕ} (hclean : ∀ inputLength, @@ -2272,7 +2278,8 @@ theorem emitNextWrittenCellFormula_emitted_internal (tm : NTM k) simpa [emitNextWrittenCellFormula, nextWrittenCellFormulaSchedule, nextSchedule, nextFormulaChildAvailable] using hresult -private structure NextWrittenCellFormulaWidthCap (tm : NTM k) +@[nolint docBlame] +structure NextWrittenCellFormulaWidthCap (tm : NTM k) (tape : WritableSlot k) (symbol : Γ) (values : ℕ → BinaryValues WorkCount) (width : ℕ → ℕ) : Prop where bound : ∀ inputLength stateIndex tapeIndex symbolIndex position, @@ -2302,7 +2309,7 @@ private structure NextWrittenCellFormulaWidthCap (tm : NTM k) (writtenNextChildPolynomial tm tape symbol) (values inputLength Work.horizon) ≤ width inputLength -private theorem emitNextWrittenCellOldValue_spaceAndEffect +theorem emitNextWrittenCellOldValue_spaceAndEffect (tm : NTM k) (tape : WritableSlot k) (symbol : Γ) {initialSpace : ℕ → ℕ} {values : ℕ → BinaryValues WorkCount} {width : ℕ → ℕ} @@ -2403,7 +2410,7 @@ private theorem emitNextWrittenCellOldValue_spaceAndEffect (advanceAvailableValues (values inputLength) 1) htape hsymbol htemporary₀ htemporary₁ htemporary₂ hreference) -private theorem emitNextWrittenCellChild_spaceAndEffect +theorem emitNextWrittenCellChild_spaceAndEffect (tm : NTM k) (tape : WritableSlot k) (symbol : Γ) {initialSpace : ℕ → ℕ} {values : ℕ → BinaryValues WorkCount} {width : ℕ → ℕ} diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/PackedCopy.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/PackedCopy.lean index a1e9b3f0..644fa6de 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/PackedCopy.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/PackedCopy.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.PackedCopy.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.PackedCopy.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.PackedCopy.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.PackedCopy.Internal /-! # Delayed packed-formula copies @@ -13,6 +15,8 @@ An executable proof-carrying primitive that advances the rolling formula cursor and emits the corresponding packed-output copy gate. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/PackedCopy/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/PackedCopy/Defs.lean index 10f1f5cf..28734b3b 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/PackedCopy/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/PackedCopy/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.PolynomialOffset.Defs +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.PolynomialOffset.Defs /-! # Delayed packed-formula copies -- definitions @@ -18,6 +20,8 @@ That deliberately rules out empty formula blocks independently of the old cursor value. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/PackedCopy/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/PackedCopy/Internal.lean index 3c93220a..262930e0 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/PackedCopy/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/PackedCopy/Internal.lean @@ -3,13 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.PolynomialOffset -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.PackedCopy.Defs +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.PolynomialOffset +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.PackedCopy.Defs /-! # Delayed packed-formula copies -- proof internals -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Predecessor.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Predecessor.lean index 25452871..251d56a3 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Predecessor.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Predecessor.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Predecessor.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Predecessor.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Predecessor.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Predecessor.Internal /-! # Verified direct predecessor-head formula generation @@ -15,6 +17,8 @@ schedule. Direction codes zero and one mean left and right; all other codes mean stay, matching `movedHeadPositionCode`. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Predecessor/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Predecessor/Defs.lean index 681feaef..bab173eb 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Predecessor/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Predecessor/Defs.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Initialization.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Offset.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Primitive.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.MovedHead.Defs +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Initialization.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Offset.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Primitive.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.MovedHead.Defs /-! # Direct predecessor-head formula generation -- definitions @@ -18,6 +20,8 @@ head-wire copies. The right-fold suffix uses a dynamic recent-wire offset offset one selects the preceding identity or connector. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Predecessor/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Predecessor/Internal.lean index 89c58906..9f47a62f 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Predecessor/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Predecessor/Internal.lean @@ -3,19 +3,23 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Initialization -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Offset -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Primitive -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Predecessor.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Initialization +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Offset +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Primitive +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Predecessor.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List /-! # Direct predecessor-head formula generation -- proof internals -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Read.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Read.lean index 4044b928..5da05a91 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Read.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Read.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Read.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Read.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Read.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Read.Internal /-! # Direct-unrolling read-formula generator @@ -13,6 +15,8 @@ A stack-free proof-carrying routine that emits the exact numeric gate schedule for reading one symbol from a bounded encoded configuration. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Read/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Read/Defs.lean index d567a1b8..7024dc27 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Read/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Read/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Primitive.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Defs +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Primitive.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Defs /-! # Direct-unrolling read-formula generator -- definitions @@ -20,6 +22,8 @@ temporaries zero through two are owned as scratch. In particular, `temporary₃` remains available to an enclosing transition generator. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Read/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Read/Internal.lean index 5b9ef294..4409713e 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Read/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Read/Internal.lean @@ -3,18 +3,22 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Primitive -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Read.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List -import Mathlib.Data.Nat.Pairing +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Primitive +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Read.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List +public import Mathlib.Data.Nat.Pairing /-! # Direct-unrolling read-formula generator -- proof internals -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step.lean index bbe8739b..737b8698 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal /-! # Verified direct packed-step generation @@ -15,6 +17,8 @@ register effect, restored scratch convention, and byte-for-byte emitted packed transition fragment. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Defs.lean index 76565cda..88abc0c1 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Defs.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Next.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.PackedCopy.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Step.Defs +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Next.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.PackedCopy.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Step.Defs /-! # Direct-unrolling packed-step generator -- definitions @@ -18,6 +20,8 @@ is reused, after its header has already been emitted, as the rolling source cursor. Neither requires a new work tape. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal.lean index cbef5ff4..768b255d 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal.lean @@ -3,24 +3,28 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.PackedCopy -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Next -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Effect -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Emitted -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Packed -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Requires -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Sound -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Space -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Top -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Step -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.PackedCopy +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Next +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Effect +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Emitted +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Packed +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Requires +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Sound +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Space +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Top +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Step +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List /-! # Direct-unrolling packed-step generator -- proof internals -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Effect.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Effect.lean index 267536f8..de2458ab 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Effect.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Effect.lean @@ -3,12 +3,14 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Next -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.PackedCopy -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Defs -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Next +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.PackedCopy +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Defs +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List /-! # Exact effects of the direct packed-step generator @@ -19,6 +21,8 @@ they do not assume that the saved formula cursor or either gate register is initially zero. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Emitted.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Emitted.lean index 408eded2..2a922d7d 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Emitted.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Emitted.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Effect +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Effect /-! # Exact output of the direct packed-step generator @@ -13,6 +15,8 @@ schedule byte for byte. The intermediate results identify each nested enumeration with its contiguous slice of the global configuration-atom order. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling @@ -84,7 +88,7 @@ noncomputable def stepPackedCopySpecializedInternal (tm : NTM k) available (stepAtomKindAt tm T) (stepAtomEffectSelectedAt tm T) (effectCaseChoiceAt tm) atomIndex -private theorem stepConfigAtomAt_configIndex (tm : NTM k) (T : ℕ) +theorem stepConfigAtomAt_configIndex (tm : NTM k) (T : ℕ) (atom : ConfigAtom tm T) : stepConfigAtomAt tm T (configIndex tm T atom) = atom := by unfold stepConfigAtomAt @@ -96,7 +100,7 @@ private theorem stepConfigAtomAt_configIndex (tm : NTM k) (T : ℕ) exact (configAtomEquiv_apply_val tm T atom).symm rw [hindex, Equiv.symm_apply_apply] -private theorem indexedGateBlocks_succ_last +theorem indexedGateBlocks_succ_last (count : ℕ) (blockAt : ℕ → CircuitCode.RawCircuit) : indexedGateBlocks (count + 1) blockAt = indexedGateBlocks count blockAt ++ blockAt count := by @@ -111,7 +115,7 @@ private theorem indexedGateBlocks_succ_last rw [ih (fun index => blockAt (index + 1))] simp [List.append_assoc] -private theorem indexedGateBlocks_add +theorem indexedGateBlocks_add (firstCount secondCount : ℕ) (blockAt : ℕ → CircuitCode.RawCircuit) : indexedGateBlocks (firstCount + secondCount) blockAt = @@ -127,7 +131,7 @@ private theorem indexedGateBlocks_add indexedGateBlocks_succ_last] simp [List.append_assoc] -private theorem indexedGateBlocks_group_four +theorem indexedGateBlocks_group_four (count : ℕ) (blockAt : ℕ → CircuitCode.RawCircuit) : indexedGateBlocks (4 * count) blockAt = indexedGateBlocks count fun position => @@ -178,12 +182,12 @@ theorem indexedGateBlocks_group_internal (width count : ℕ) (fun offset => blockAt (width * count + offset)) := by rw [ih] _ = _ := (indexedGateBlocks_succ_last count _).symm -private theorem list_ofFn_four (f : Fin 4 → α) : +theorem list_ofFn_four (f : Fin 4 → α) : List.ofFn f = [f 0, f 1, f 2, f 3] := by rw [List.ofFn_succ, List.ofFn_succ, List.ofFn_succ, List.ofFn_succ] rfl -private theorem binaryForValues_eq_trajectory +theorem binaryForValues_eq_trajectory (body : BinaryRoutine n) (counter : Fin n) (initial : BinaryValues n) (trajectory : ℕ → BinaryValues n) (hzero : trajectory 0 = initial) @@ -199,7 +203,7 @@ private theorem binaryForValues_eq_trajectory | succ count ih => rw [BinaryRoutine.binaryForValues, ih, hstep] -private theorem binaryForEmitted_eq_indexedGateBlocks +theorem binaryForEmitted_eq_indexedGateBlocks (body : BinaryRoutine n) (counter : Fin n) (initial : BinaryValues n) (trajectory : ℕ → BinaryValues n) (blockAt : ℕ → CircuitCode.RawCircuit) @@ -224,7 +228,7 @@ private theorem binaryForEmitted_eq_indexedGateBlocks hemitted, indexedGateBlocks_succ_last] simp [List.flatMap_append] -private theorem binaryForValues_eq_trajectory_bounded +theorem binaryForValues_eq_trajectory_bounded (body : BinaryRoutine n) (counter : Fin n) (initial : BinaryValues n) (trajectory : ℕ → BinaryValues n) (count : ℕ) (hzero : trajectory 0 = initial) @@ -240,7 +244,7 @@ private theorem binaryForValues_eq_trajectory_bounded ih (fun index hindex => hstep index (by omega)), hstep count (by omega)] -private theorem binaryForEmitted_eq_indexedGateBlocks_bounded +theorem binaryForEmitted_eq_indexedGateBlocks_bounded (body : BinaryRoutine n) (counter : Fin n) (initial : BinaryValues n) (trajectory : ℕ → BinaryValues n) (blockAt : ℕ → CircuitCode.RawCircuit) (count : ℕ) @@ -265,7 +269,7 @@ private theorem binaryForEmitted_eq_indexedGateBlocks_bounded hemitted count (by omega), indexedGateBlocks_succ_last] simp [List.flatMap_append] -private theorem seqList_ofFn_effect_eq_trajectory +theorem seqList_ofFn_effect_eq_trajectory (count : ℕ) (routineAt : Fin count → BinaryRoutine n) (initial : BinaryValues n) (trajectory : ℕ → BinaryValues n) (hzero : trajectory 0 = initial) @@ -292,7 +296,7 @@ private theorem seqList_ofFn_effect_eq_trajectory · intro index simpa [Nat.add_assoc] using hstep index.succ -private theorem seqList_ofFn_emitted_eq_indexedGateBlocks +theorem seqList_ofFn_emitted_eq_indexedGateBlocks (count : ℕ) (routineAt : Fin count → BinaryRoutine n) (initial : BinaryValues n) (trajectory : ℕ → BinaryValues n) (blockAt : ℕ → CircuitCode.RawCircuit) @@ -331,7 +335,7 @@ private theorem seqList_ofFn_emitted_eq_indexedGateBlocks · intro index simpa using hemitted index.succ -private theorem seqList_ofFn_emitted_congr +theorem seqList_ofFn_emitted_congr (first second : Fin count → BinaryRoutine n) (heffect : ∀ index values, (first index).effect values = (second index).effect values) @@ -360,7 +364,7 @@ private theorem seqList_ofFn_emitted_congr · intro index current exact hemitted index.succ current -private theorem seqList_ofFn_emitted_congr_of_invariant +theorem seqList_ofFn_emitted_congr_of_invariant (first second : Fin count → BinaryRoutine n) (invariant : BinaryValues n → Prop) (values : BinaryValues n) (hinvariant : invariant values) @@ -403,7 +407,7 @@ private theorem seqList_ofFn_emitted_congr_of_invariant second index.succ)).emitted ((second 0).effect values) := by rw [heffect 0 values hinvariant] -private theorem CaseFormulaClean.updateAvailable_emitted_internal +theorem CaseFormulaClean.updateAvailable_emitted_internal {values : BinaryValues WorkCount} (hclean : CaseFormulaClean values) (value : ℕ) : CaseFormulaClean (Function.update values Work.available value) := by @@ -481,7 +485,7 @@ theorem MovedHeadFormulaClean.updateAvailable_emitted_internal | simpa [Work.available, Work.direction] using hclean.direction | simpa [Work.available, Work.atomKind] using hclean.atomKind -private theorem StepClean.movedHeadAtPositionAvailable_emitted +theorem StepClean.movedHeadAtPositionAvailable_emitted {values : BinaryValues WorkCount} (hclean : StepClean values) (position available : ℕ) : MovedHeadFormulaClean @@ -490,7 +494,7 @@ private theorem StepClean.movedHeadAtPositionAvailable_emitted apply MovedHeadFormulaClean.updateAvailable_emitted_internal exact hclean.movedHeadClean_atPosition_internal position -private theorem MovedHeadFormulaClean.atPositionAvailable_emitted +theorem MovedHeadFormulaClean.atPositionAvailable_emitted {values : BinaryValues WorkCount} (hclean : MovedHeadFormulaClean values) (position available : ℕ) : MovedHeadFormulaClean @@ -517,14 +521,14 @@ private theorem MovedHeadFormulaClean.atPositionAvailable_emitted · simpa [Work.position, Work.direction] using hclean.direction · simpa [Work.position, Work.atomKind] using hclean.atomKind -private theorem stateAtom_index (tm : NTM k) +theorem stateAtom_index (tm : NTM k) (index : Fin (Fintype.card tm.Q)) : configIndex tm T (.state ((Fintype.equivFin tm.Q).symm index)) = index.val := by unfold configIndex stateIndex exact congrArg Fin.val ((Fintype.equivFin tm.Q).apply_symm_apply index) -private theorem stepFormulaSizeAtSpecialized_internal_state (tm : NTM k) (T : ℕ) +theorem stepFormulaSizeAtSpecialized_internal_state (tm : NTM k) (T : ℕ) (index : Fin (Fintype.card tm.Q)) : stepFormulaSizeAtSpecializedInternal tm T index.val = nextStateFormulaScheduleSize (transitionCases tm).length k T @@ -553,7 +557,7 @@ theorem stepFormulaSizeAtSpecialized_state_forSpace_internal (tm : NTM k) (effectCaseChoiceAt tm) := stepFormulaSizeAtSpecialized_internal_state tm T index -private theorem stepFormulaBlockSpecialized_internal_state (tm : NTM k) +theorem stepFormulaBlockSpecialized_internal_state (tm : NTM k) (T configBase available : ℕ) (index : Fin (Fintype.card tm.Q)) : stepFormulaBlockSpecializedInternal tm T configBase available index.val = nextStateFormulaSchedule (transitionCases tm).length @@ -632,7 +636,7 @@ theorem emitStepStateFormulas_emitted_internal (tm : NTM k) rw [hrefTrajectory] simp [trajectory, sizeAt, Work.available, Work.horizon, Work.configBase] -private theorem stepFormulaSizeAtSpecialized_internal_head (tm : NTM k) (T : ℕ) +theorem stepFormulaSizeAtSpecialized_internal_head (tm : NTM k) (T : ℕ) (tape : TapeSlot k) (position : Fin (T + 1)) : stepFormulaSizeAtSpecializedInternal tm T (configIndex tm T (.head tape position)) = @@ -645,7 +649,7 @@ private theorem stepFormulaSizeAtSpecialized_internal_head (tm : NTM k) (T : ℕ rw [stepConfigAtomAt_configIndex] rfl -private theorem stepFormulaBlockSpecialized_internal_head (tm : NTM k) +theorem stepFormulaBlockSpecialized_internal_head (tm : NTM k) (T configBase available : ℕ) (tape : TapeSlot k) (position : Fin (T + 1)) : stepFormulaBlockSpecializedInternal tm T configBase available @@ -666,7 +670,7 @@ private theorem stepFormulaBlockSpecialized_internal_head (tm : NTM k) rw [stepConfigAtomAt_configIndex] rfl -private theorem stepFormulaSizeAtSpecialized_internal_cellCopy (tm : NTM k) +theorem stepFormulaSizeAtSpecialized_internal_cellCopy (tm : NTM k) (T : ℕ) (tape : TapeSlot k) (position : Fin (T + 2)) (symbol : Γ) (hcopy : tape = .input ∨ position.val = 0) : stepFormulaSizeAtSpecializedInternal tm T @@ -683,7 +687,7 @@ private theorem stepFormulaSizeAtSpecialized_internal_cellCopy (tm : NTM k) nextWritableCellAtomKind, nextFormulaScheduleSize, nextCellCopyScheduleSize] -private theorem stepFormulaBlockSpecialized_internal_cellCopy (tm : NTM k) +theorem stepFormulaBlockSpecialized_internal_cellCopy (tm : NTM k) (T configBase available : ℕ) (tape : TapeSlot k) (position : Fin (T + 2)) (symbol : Γ) (hcopy : tape = .input ∨ position.val = 0) : @@ -703,7 +707,7 @@ private theorem stepFormulaBlockSpecialized_internal_cellCopy (tm : NTM k) nextWritableMarkerAtomKind, nextWritableCellAtomKind, nextAtomTapeIndex, nextAtomPosition, nextAtomSymbolIndex] -private theorem stepFormulaSizeAtSpecialized_internal_writtenCell (tm : NTM k) +theorem stepFormulaSizeAtSpecialized_internal_writtenCell (tm : NTM k) (T : ℕ) (tape : WritableSlot k) (position : Fin (T + 2)) (symbol : Γ) (hpositive : 0 < position.val) : stepFormulaSizeAtSpecializedInternal tm T @@ -721,7 +725,7 @@ private theorem stepFormulaSizeAtSpecialized_internal_writtenCell (tm : NTM k) nextFormulaScheduleSize, nextWrittenCellFormulaScheduleSize, nextAtomEffectSelectedAt, hpositive.ne'] -private theorem stepFormulaBlockSpecialized_internal_writtenCell (tm : NTM k) +theorem stepFormulaBlockSpecialized_internal_writtenCell (tm : NTM k) (T configBase available : ℕ) (tape : WritableSlot k) (position : Fin (T + 2)) (symbol : Γ) (hpositive : 0 < position.val) : @@ -750,12 +754,13 @@ private theorem stepFormulaBlockSpecialized_internal_writtenCell (tm : NTM k) nextWritableCellAtomKind, nextAtomTapeIndex, nextAtomPosition, nextAtomSymbolIndex, nextAtomEffectSelectedAt, hpositive.ne'] -private def stepCellStart (tm : NTM k) (T : ℕ) (tape : TapeSlot k) +@[nolint docBlame] +def stepCellStart (tm : NTM k) (T : ℕ) (tape : TapeSlot k) (position : ℕ) : ℕ := Fintype.card tm.Q + (k + 2) * (T + 1) + (tape.index.val * (T + 2) + position) * 4 -private theorem stepFormulaSizeAtSpecialized_internal_cellCopyIndex (tm : NTM k) +theorem stepFormulaSizeAtSpecialized_internal_cellCopyIndex (tm : NTM k) (T : ℕ) (tape : TapeSlot k) (position : Fin (T + 2)) (symbolIndex : Fin 4) (hcopy : tape = .input ∨ position.val = 0) : stepFormulaSizeAtSpecializedInternal tm T @@ -773,7 +778,7 @@ private theorem stepFormulaSizeAtSpecialized_internal_cellCopyIndex (tm : NTM k) exact stepFormulaSizeAtSpecialized_internal_cellCopy tm T tape position (symbolEquiv.symm symbolIndex) hcopy -private theorem stepFormulaSizeAtSpecialized_internal_writtenCellIndex (tm : NTM k) +theorem stepFormulaSizeAtSpecialized_internal_writtenCellIndex (tm : NTM k) (T : ℕ) (tape : WritableSlot k) (position : Fin (T + 2)) (symbolIndex : Fin 4) (hpositive : 0 < position.val) : stepFormulaSizeAtSpecializedInternal tm T @@ -794,17 +799,19 @@ private theorem stepFormulaSizeAtSpecialized_internal_writtenCellIndex (tm : NTM exact stepFormulaSizeAtSpecialized_internal_writtenCell tm T tape position (symbolEquiv.symm symbolIndex) hpositive -private def fourSize (sizeAt : ℕ → ℕ) (start : ℕ) : ℕ := +@[nolint docBlame] +def fourSize (sizeAt : ℕ → ℕ) (start : ℕ) : ℕ := sizeAt start + sizeAt (start + 1) + sizeAt (start + 2) + sizeAt (start + 3) -private theorem prefixSize_add_four (sizeAt : ℕ → ℕ) (start : ℕ) : +theorem prefixSize_add_four (sizeAt : ℕ → ℕ) (start : ℕ) : prefixSize sizeAt (start + 4) = prefixSize sizeAt start + fourSize sizeAt start := by simp [fourSize, prefixSize_succ] omega -private noncomputable def stepCellPositionSizeEmitted (tm : NTM k) +@[nolint docBlame] +noncomputable def stepCellPositionSizeEmitted (tm : NTM k) (tape : TapeSlot k) (T position : ℕ) : ℕ := match tape with | .input => 4 @@ -823,7 +830,7 @@ private noncomputable def stepCellPositionSizeEmitted (tm : NTM k) (writtenCellEffectSelectedAt tm .output symbol) (effectCaseChoiceAt tm)).sum -private theorem stepCellPositionEffectSize_eq_fourSize (tm : NTM k) +theorem stepCellPositionEffectSize_eq_fourSize (tm : NTM k) (tape : TapeSlot k) (T position : ℕ) (hposition : position < T + 2) : stepCellPositionSizeEmitted tm tape T position = fourSize (stepFormulaSizeAtSpecializedInternal tm T) @@ -1530,7 +1537,7 @@ theorem emitStepStateCopies_emitted_internal (tm : NTM k) rw [prefixSize_succ] simp [Nat.add_assoc] -private theorem seqListPackedCopies_emitted +theorem seqListPackedCopies_emitted (polynomialAt : Fin count → Polynomial ℕ) (values : BinaryValues WorkCount) (sizeAt : ℕ → ℕ) (start stepAvailable : ℕ) @@ -1627,7 +1634,7 @@ theorem emitStepImmutableCellCopies_emitted_internal intro index simpa using (hsize index).symm -private theorem seqList_writableCopies_emitted_eq_packed +theorem seqList_writableCopies_emitted_eq_packed (tm : NTM k) (tape : WritableSlot k) (symbols : List Γ) (values : BinaryValues WorkCount) : (BinaryRoutine.seqList (symbols.map fun symbol => @@ -2236,7 +2243,7 @@ theorem emitStepCellTapeCopies_emitted_internal (tm : NTM k) rw [indexedGateBlocks_group_four] <;> simp [start, Nat.add_assoc] -private theorem prefixSize_eq_sum_ofFn (sizeAt : ℕ → ℕ) (count : ℕ) : +theorem prefixSize_eq_sum_ofFn (sizeAt : ℕ → ℕ) (count : ℕ) : prefixSize sizeAt count = (List.ofFn fun index : Fin count => sizeAt index.val).sum := by induction count with @@ -2250,7 +2257,7 @@ theorem tapeSlotEquiv_symm_index_internal (index : Fin (k + 2)) : have h := congrArg Fin.val ((tapeSlotEquiv k).apply_symm_apply index) exact h -private theorem prefixSize_constBlock (sizeAt : ℕ → ℕ) +theorem prefixSize_constBlock (sizeAt : ℕ → ℕ) (start blockSize count : ℕ) (hsize : ∀ index < count, sizeAt (start + index) = blockSize) : prefixSize sizeAt (start + count) = @@ -2263,7 +2270,7 @@ private theorem prefixSize_constBlock (sizeAt : ℕ → ℕ) ih (fun index hindex => hsize index (by omega))] ring -private theorem prefixSize_fourBlocks (sizeAt blockSize : ℕ → ℕ) +theorem prefixSize_fourBlocks (sizeAt blockSize : ℕ → ℕ) (start count : ℕ) (hsize : ∀ index < count, blockSize index = fourSize sizeAt (start + 4 * index)) : @@ -2277,7 +2284,7 @@ private theorem prefixSize_fourBlocks (sizeAt blockSize : ℕ → ℕ) ih (fun index hindex => hsize index (by omega))] omega -private theorem prefixSize_indexedBlocks (sizeAt blockSize : ℕ → ℕ) +theorem prefixSize_indexedBlocks (sizeAt blockSize : ℕ → ℕ) (start width count : ℕ) (hblock : ∀ index < count, prefixSize sizeAt (start + index * width + width) = diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/FormulaSpace.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/FormulaSpace.lean index ddeb455c..e2382d52 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/FormulaSpace.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/FormulaSpace.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Space.Common +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Space.Common /-! # Formula-phase space bound for one direct transition step @@ -12,6 +14,8 @@ This module follows the exact state, head, and cell formula trajectories and certifies every nested routine against the shared packed-step width envelope. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Packed.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Packed.lean index 46dd23f7..00943e29 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Packed.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Packed.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Emitted +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Emitted /-! # Exact packed-copy output of the direct step generator @@ -13,6 +15,8 @@ numeric packed-copy suffix. Formula emission and the outer deterministic step are intentionally handled by separate modules. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Requires.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Requires.lean index 6cfda40e..12012df0 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Requires.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Requires.lean @@ -3,11 +3,13 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Next -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.PackedCopy -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Defs -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Next +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.PackedCopy +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Defs +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List /-! # Packed-step generator domains @@ -16,6 +18,8 @@ Reachable-position loop invariants and exact scratch-domain proofs for the formula and delayed-copy phases of one packed transition step. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Sound.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Sound.lean index 820aec0e..6ba17efe 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Sound.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Sound.lean @@ -3,12 +3,14 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Next -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.PackedCopy -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Defs -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Next +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.PackedCopy +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Defs +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List /-! # Packed-step generator soundness @@ -17,6 +19,8 @@ Soundness proofs for the compositional formula and delayed-copy routines used by one direct-unrolling transition step. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Space.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Space.lean index bfc76336..5ac3d5a9 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Space.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Space.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.FormulaSpace -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Space.Packed +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.FormulaSpace +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Space.Packed /-! # Whole-step space bound for direct transition generation @@ -13,6 +15,8 @@ This module composes the formula and delayed-copy certificates through the seven exact register phases of `emitStep`. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Space/Common.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Space/Common.lean index 99abd723..6085b667 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Space/Common.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Space/Common.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Emitted -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.SpaceBounds +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Emitted +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.SpaceBounds /-! # Common packed-step width helpers @@ -13,6 +15,8 @@ This module supplies the shared list-trajectory and position-limit certificates used to assemble the auxiliary-space proof for direct packed-step generation. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Space/Packed.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Space/Packed.lean index 9d969196..77c43692 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Space/Packed.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Space/Packed.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Emitted -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Space.Common +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Emitted +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Space.Common /-! # Packed-copy space bound for one direct transition step @@ -15,6 +17,8 @@ state, head, and cell regions and bounds every loop prefix by the shared step width envelope. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Top.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Top.lean index b7a41916..413a7b67 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Top.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Top.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Packed +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Packed /-! # Whole-step direct-generator contracts @@ -12,6 +14,8 @@ This file composes the exact per-region contracts into byte-for-byte contracts for the complete formula phase, packed-copy phase, and deterministic step. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/WrittenCell.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/WrittenCell.lean index 807f2270..a3265df1 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/WrittenCell.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/WrittenCell.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.WrittenCell.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.WrittenCell.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.WrittenCell.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.WrittenCell.Internal /-! # Verified direct written-cell formula generation @@ -14,6 +16,8 @@ its clean entry domain, restored work-vector effect, and exact encoded numeric schedule. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/WrittenCell/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/WrittenCell/Defs.lean index 8a81c738..9ec39cb1 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/WrittenCell/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/WrittenCell/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Effect.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.WrittenCell.Defs +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Effect.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.WrittenCell.Defs /-! # Direct-unrolling written-cell generator -- definitions @@ -16,6 +18,8 @@ references. The final represented cell has no head wire, detected by a bounded subtraction from `horizon + 1` rather than a general equality routine. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/WrittenCell/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/WrittenCell/Internal.lean index 7ffe43ba..1776435c 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/WrittenCell/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/WrittenCell/Internal.lean @@ -3,15 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Initialization -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Offset -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Primitive -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Effect -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Read -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.WrittenCell.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.WrittenCell -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Initialization +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Offset +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Primitive +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Effect +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Read +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.WrittenCell.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.WrittenCell +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List /-! # Direct-unrolling written-cell generator -- proof internals @@ -21,6 +23,8 @@ on both sides of a written-cell formula. The enclosing effect-formula proof is intentionally deferred until that generator's public contracts are available. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Internal.lean index 2e09e3d6..d2a2fb71 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Internal.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Defs -import Complexitylib.Classes.PPoly.Unrolling -import Complexitylib.Models.TuringMachine.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Defs +public import Complexitylib.Classes.PPoly.Unrolling +public import Complexitylib.Models.TuringMachine.Internal /-! # Streamable deterministic unrolling families — proof internals @@ -15,6 +17,8 @@ semantics and cubic size bound as the fixed-choice family, while exposing an exact positive-length serialization theorem. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Padded.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Padded.lean index 1d27f1b5..6695b931 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Padded.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Padded.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Padded.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Padded.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Padded.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Padded.Internal /-! # Regularly padded deterministic unrolling families @@ -24,6 +26,8 @@ library's explicit answer-bit convention. - `TM.paddedDirectUnrollingCircuitFamily_size_bigO` retains the cubic size bound. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Padded/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Padded/Defs.lean index c99c9c7c..aa26d106 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Padded/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Padded/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling /-! # Regularly padded deterministic unrolling families -- definitions @@ -15,6 +17,8 @@ closed expression of the time horizon while retaining the original acceptance wire. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Padded/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Padded/Internal.lean index e9a89612..00c7c95d 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Padded/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Padded/Internal.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Padded.Defs -import Complexitylib.Circuits.Encoding.Fragment +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Padded.Defs +public import Complexitylib.Circuits.Encoding.Fragment /-! # Regularly padded deterministic unrolling families -- proof internals @@ -14,6 +16,8 @@ cubic budget, constant gates remain topological at every later frontier, and the terminal copy reads the original acceptance wire through the dead padding. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer.lean index 55724f09..8e5e7747 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Internal /-! # Numeric schedules for streaming tableau serialization @@ -34,6 +36,8 @@ They isolate the exact arithmetic that the later finite controller must realize. numeric copy schedule. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Bounds.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Bounds.lean index b7d010b9..5ac07cd7 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Bounds.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Bounds.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Bounds.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Bounds.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Bounds.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Bounds.Internal /-! # Polynomial counters for direct tableau serialization @@ -23,6 +25,8 @@ padding frontier without first counting the emitted raw gates. - `DecidesInTime.directSerializerHorizon` safely enlarges a time witness. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Bounds/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Bounds/Defs.lean index 7622e739..10d56454 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Bounds/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Bounds/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Padded.Defs -import Mathlib.Algebra.Polynomial.Eval.Defs +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Padded.Defs +public import Mathlib.Algebra.Polynomial.Eval.Defs /-! # Polynomial counters for direct tableau serialization -- definitions @@ -16,6 +18,8 @@ the positive member's gate-count header. Keeping these values as polynomials lets the binary polynomial subroutine compute them in logarithmic workspace. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Bounds/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Bounds/Internal.lean index 809f1980..1aae5686 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Bounds/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Bounds/Internal.lean @@ -3,12 +3,16 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Bounds.Defs +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Bounds.Defs /-! # Polynomial counters for direct tableau serialization -- proof internals -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Defs.lean index 2c32dcd2..971ce8b4 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Formula.Stream.Defs +module + +public import Complexitylib.Circuits.Encoding.Formula.Stream.Defs /-! # Numeric schedules for streaming tableau serialization @@ -19,6 +21,8 @@ members in reverse order. The batch-copy schedule counts source formulas forward and reconstructs each delayed output reference from a prefix-size sum. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Finalization.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Finalization.lean index 4e9103cd..7dbbbee3 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Finalization.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Finalization.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Finalization.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Finalization.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Finalization.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Finalization.Internal /-! # Numeric finalization schedule for direct tableau serialization @@ -23,6 +25,8 @@ specifies the raw gate stream without run-time configuration atoms or formulas. list decomposition. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Finalization/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Finalization/Defs.lean index 6d6415eb..e11d5fa9 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Finalization/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Finalization/Defs.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Padded.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Initialization.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Stream.Defs +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Padded.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Initialization.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Stream.Defs /-! # Numeric finalization schedule for direct tableau serialization @@ -17,6 +19,8 @@ fixed compile-time parameters in the bridge theorems; no run-time schedule value contains a configuration atom or formula tree. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Finalization/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Finalization/Internal.lean index bfa7d818..39401438 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Finalization/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Finalization/Internal.lean @@ -3,15 +3,19 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Finalization.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Initialization -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Stream -import Complexitylib.Circuits.Unrolling +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Finalization.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Initialization +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Stream +public import Complexitylib.Circuits.Unrolling /-! # Numeric direct-tableau finalization -- proof internals -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Initialization.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Initialization.lean index 32ab21da..4930707b 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Initialization.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Initialization.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Initialization.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Initialization.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Initialization.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Initialization.Internal /-! # Numeric initialization schedule for direct tableau serialization @@ -25,6 +27,8 @@ does not yet construct a Turing machine that emits those gates. existing positive-input initialization fragment. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Initialization/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Initialization/Defs.lean index 891f9529..d4c5f94d 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Initialization/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Initialization/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Defs +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Defs /-! # Numeric initialization schedule for direct tableau serialization @@ -19,6 +21,8 @@ and the blank tail. Work and output tapes share one blank-tape schedule. No run-time schedule value stores a configuration atom or formula tree. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Initialization/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Initialization/Internal.lean index 6645520e..635d4f5d 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Initialization/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Initialization/Internal.lean @@ -3,14 +3,18 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Initialization.Defs -import Complexitylib.Circuits.Unrolling +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Initialization.Defs +public import Complexitylib.Circuits.Unrolling /-! # Numeric initialization schedule -- proof internals -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Internal.lean index b81361cd..99f25009 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Internal.lean @@ -3,13 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Defs -import Complexitylib.Circuits.Encoding.Formula.Stream +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Defs +public import Complexitylib.Circuits.Encoding.Formula.Stream /-! # Numeric schedules for streaming tableau serialization -- proof internals -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition.lean index 36f6b6e7..3ee2b311 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Internal /-! # Numeric transition-formula schedules @@ -23,6 +25,8 @@ proof adapters. - The length and `getElem` theorems expose their exact numeric phases. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Atomic.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Atomic.lean index 8a02bf8d..2b142451 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Atomic.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Atomic.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Atomic.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Atomic.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Atomic.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Atomic.Internal /-! # Numeric schedules for atomic transition formulas @@ -13,6 +15,8 @@ This module exposes the one-gate numeric head-at-cell schedule and the fixed postorder halted-or wrapper used by state, head, and writable-cell successors. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Atomic/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Atomic/Defs.lean index 0ad8ba92..f7b11bfb 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Atomic/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Atomic/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Defs +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Defs /-! # Numeric schedules for atomic transition formulas -- definitions @@ -14,6 +16,8 @@ indices, while `haltedOrSchedule` gives the fixed postorder wrapper around already scheduled old-value and next-value fragments. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Atomic/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Atomic/Internal.lean index 2f011178..1f376720 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Atomic/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Atomic/Internal.lean @@ -3,14 +3,18 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Atomic.Defs -import Complexitylib.Circuits.Encoding.Formula +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Atomic.Defs +public import Complexitylib.Circuits.Encoding.Formula /-! # Numeric schedules for atomic transition formulas -- proof internals -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Case.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Case.lean index 9d6e8056..b7e27e84 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Case.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Case.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Case.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Case.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Case.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Case.Internal /-! # Numeric transition-case schedules @@ -21,6 +23,8 @@ only in the final compilation adapter. - `compileRaw_caseFormula_eq_schedule` identifies the complete raw stream. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Case/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Case/Defs.lean index 1740fd0a..72a6a254 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Case/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Case/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Defs +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Defs /-! # Numeric schedules for transition-case formulas @@ -16,6 +18,8 @@ No formula tree, configuration atom, tape slot, symbol, or bounded position is stored by the schedule. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Case/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Case/Internal.lean index 36b27354..b1598398 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Case/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Case/Internal.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Case.Defs -import Complexitylib.Circuits.Unrolling.Transition +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Case.Defs +public import Complexitylib.Circuits.Unrolling.Transition /-! # Numeric transition-case schedules -- proof internals @@ -15,6 +17,8 @@ as compile-time parameters. It erases them to numeric state, tape, and symbol indices before identifying the emitted stream with the definitions layer. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Defs.lean index b07bf4f8..e021f2d3 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Initialization.Defs +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Initialization.Defs /-! # Numeric transition-formula schedules @@ -20,6 +22,8 @@ head-wire copy or false. Both streams finish with the existing numeric right-fold disjunction suffix. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Effect.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Effect.lean index 749bfb29..0e1bd090 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Effect.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Effect.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Effect.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Effect.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Effect.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Effect.Internal /-! # Numeric schedules for transition-effect formulas @@ -23,6 +25,8 @@ the disjunction. - `compileRaw_effectFormula_eq_schedule` proves literal raw-list equality. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Effect/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Effect/Defs.lean index 215ca275..00abba4d 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Effect/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Effect/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Case.Defs +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Case.Defs /-! # Numeric schedules for transition-effect formulas @@ -19,6 +21,8 @@ extractors. The streaming schedule itself carries no transition case, effect, formula tree, bounded index, or list traversal state. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Effect/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Effect/Internal.lean index 76c4abf7..4ec47beb 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Effect/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Effect/Internal.lean @@ -3,14 +3,18 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Case -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Effect.Defs -import Complexitylib.Circuits.Encoding.Formula +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Case +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Effect.Defs +public import Complexitylib.Circuits.Encoding.Formula /-! # Numeric transition-effect schedules -- proof internals -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Internal.lean index ce3570e8..fc55398c 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Internal.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Initialization.Internal -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Defs -import Complexitylib.Circuits.Unrolling.Transition +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Initialization.Internal +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Defs +public import Complexitylib.Circuits.Unrolling.Transition /-! # Numeric transition-formula schedules -- proof internals @@ -17,6 +19,8 @@ bounded positions, tape slots, and symbols appear only in the final adapter theorems. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/MovedHead.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/MovedHead.lean index e1ab44ce..3e1149f6 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/MovedHead.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/MovedHead.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.MovedHead.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.MovedHead.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.MovedHead.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.MovedHead.Internal /-! # Numeric moved-head schedules @@ -21,6 +23,8 @@ reverse disjunction connectors complete the stream. - `compileRaw_movedHeadFormula_eq_schedule` proves literal raw-list equality. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/MovedHead/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/MovedHead/Defs.lean index f195e86b..1fc741d3 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/MovedHead/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/MovedHead/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Effect.Defs +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Effect.Defs /-! # Numeric schedules for moved-head formulas -- definitions @@ -18,6 +20,8 @@ tape slots, directions, bounded indices, formula trees, and list cursors occur only in the compile-time extractor or the proof adapter. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/MovedHead/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/MovedHead/Internal.lean index e647288f..5c624608 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/MovedHead/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/MovedHead/Internal.lean @@ -3,14 +3,18 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Effect -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.MovedHead.Defs -import Complexitylib.Circuits.Unrolling.Transition +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Effect +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.MovedHead.Defs +public import Complexitylib.Circuits.Unrolling.Transition /-! # Numeric moved-head schedules -- proof internals -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Next.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Next.lean index 244ebd15..285135b3 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Next.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Next.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Next.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Next.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Next.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Next.Internal /-! # Numeric schedules for next-configuration atoms @@ -24,6 +26,8 @@ public transition schedule. common numeric count. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Next/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Next/Defs.lean index 85187e25..625ffe91 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Next/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Next/Defs.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Atomic.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Effect.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.MovedHead.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.WrittenCell.Defs +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Atomic.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Effect.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.MovedHead.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.WrittenCell.Defs /-! # Numeric schedules for next-configuration atoms @@ -22,6 +24,8 @@ machine and `ConfigAtom` appear solely in compile-time extractors used by the literal proof adapter. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Next/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Next/Internal.lean index 105e8ea9..b962f38a 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Next/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Next/Internal.lean @@ -3,17 +3,21 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Atomic -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Effect -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.MovedHead -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Next.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.WrittenCell -import Complexitylib.Circuits.Encoding.Formula +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Atomic +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Effect +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.MovedHead +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Next.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.WrittenCell +public import Complexitylib.Circuits.Encoding.Formula /-! # Numeric next-atom schedules -- proof internals -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Polynomial.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Polynomial.lean index 85c6a3e8..c86a303d 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Polynomial.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Polynomial.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Polynomial.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Polynomial.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Polynomial.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Polynomial.Internal /-! # Fixed transition-schedule size polynomials @@ -13,6 +15,8 @@ This module exposes literal evaluation theorems for the fixed polynomials that measure nested transition schedules as functions of the tableau horizon. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Polynomial/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Polynomial/Defs.lean index 15e6c2e7..40bc7895 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Polynomial/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Polynomial/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Next.Defs -import Mathlib.Algebra.Polynomial.Eval.Defs +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Next.Defs +public import Mathlib.Algebra.Polynomial.Eval.Defs /-! # Fixed transition-schedule size polynomials -- definitions @@ -16,6 +18,8 @@ with the verified binary polynomial evaluator instead of replaying a formula tree or counting emitted gates. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Polynomial/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Polynomial/Internal.lean index ace05a7b..ffd2de66 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Polynomial/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Polynomial/Internal.lean @@ -3,13 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Polynomial.Defs +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Polynomial.Defs /-! # Fixed transition-schedule size polynomials -- proof internals -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Step.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Step.lean index c0e53fca..c456b37d 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Step.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Step.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Step.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Step.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Step.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Step.Internal /-! # Numeric schedules for one packed transition step @@ -26,6 +28,8 @@ one packed-output copy per atom in that same order. public successor-configuration layout. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Step/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Step/Defs.lean index ba4a3543..ae39d070 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Step/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Step/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Next.Defs +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Next.Defs /-! # Numeric schedules for one packed transition step @@ -19,6 +21,8 @@ numeric atom fields, numeric transition-case fields, prefix sizes, and Boolean selection oracles. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Step/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Step/Internal.lean index 49d4413b..177d3a06 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Step/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Step/Internal.lean @@ -3,15 +3,19 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Next -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Step.Defs -import Complexitylib.Circuits.Unrolling.Transition.Fragment +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Next +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Step.Defs +public import Complexitylib.Circuits.Unrolling.Transition.Fragment /-! # Numeric packed-step schedules -- proof internals -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/WrittenCell.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/WrittenCell.lean index 37d40667..d5b0daba 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/WrittenCell.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/WrittenCell.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.WrittenCell.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.WrittenCell.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.WrittenCell.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.WrittenCell.Internal /-! # Numeric schedules for written-cell formulas @@ -21,6 +23,8 @@ six-gate suffix combines the selected write with the old cell value. - `compileRaw_writtenCellFormula_eq_schedule` proves literal raw-list equality. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/WrittenCell/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/WrittenCell/Defs.lean index 5cb1634a..71a32106 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/WrittenCell/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/WrittenCell/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Atomic.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Effect.Defs +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Atomic.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Effect.Defs /-! # Numeric schedules for written-cell formulas @@ -20,6 +22,8 @@ compile-time selection oracle. No run-time schedule value contains a formula, bounded index, transition case, tape slot, symbol, or list cursor. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/WrittenCell/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/WrittenCell/Internal.lean index a3d80ee2..b9f0d59c 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/WrittenCell/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/WrittenCell/Internal.lean @@ -3,16 +3,20 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Initialization -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Atomic -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Effect -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.WrittenCell.Defs -import Complexitylib.Circuits.Encoding.Formula +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Initialization +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Atomic +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Effect +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.WrittenCell.Defs +public import Complexitylib.Circuits.Encoding.Formula /-! # Numeric written-cell schedules -- proof internals -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Stream.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Stream.lean index e23c061d..0e9959fd 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Stream.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Stream.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Stream.Defs -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Stream.Internal +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Stream.Defs +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Stream.Internal /-! # Streamable deterministic unrolling arithmetic @@ -30,6 +32,8 @@ that serializer reproduce the recursive `TraceBuild` arithmetic at run time. circuit is initialization, a flat canonical layer list, and acceptance. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Stream/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Stream/Defs.lean index 728b4118..5a488329 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Stream/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Stream/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Defs +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Defs /-! # Streamable deterministic unrolling arithmetic — definitions @@ -18,6 +20,8 @@ The direct deterministic prefix build fixes the primary-wire layout used by no Turing-machine generator is defined here. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Stream/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Stream/Internal.lean index 97ede67e..8a4ca82f 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Stream/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Stream/Internal.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Uniform.Unrolling.Stream.Defs -import Complexitylib.Circuits.Unrolling.Trace.Internal.Structure +module + +public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Stream.Defs +public import Complexitylib.Circuits.Unrolling.Trace.Internal.Structure /-! # Streamable deterministic unrolling arithmetic — proof internals @@ -14,6 +16,8 @@ tree sizes, then solves the deterministic trace-prefix recurrences using the resulting constant packed-layer size. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/PPoly/Unrolling.lean b/Complexitylib/Classes/PPoly/Unrolling.lean index e9a171ab..bf7fd9af 100644 --- a/Complexitylib/Classes/PPoly/Unrolling.lean +++ b/Complexitylib/Classes/PPoly/Unrolling.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Unrolling.Defs -import Complexitylib.Classes.PPoly.Unrolling.Internal +module + +public import Complexitylib.Classes.PPoly.Unrolling.Defs +public import Complexitylib.Classes.PPoly.Unrolling.Internal /-! # Deterministic time has nonuniform circuits @@ -23,6 +25,8 @@ and concludes `P ⊆ P/poly` directly from the unrolling construction. - `P_subset_PPoly`: deterministic polynomial time has polynomial-size circuits. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Classes/PPoly/Unrolling/Defs.lean b/Complexitylib/Classes/PPoly/Unrolling/Defs.lean index 307813f6..547c3af8 100644 --- a/Complexitylib/Classes/PPoly/Unrolling/Defs.lean +++ b/Complexitylib/Classes/PPoly/Unrolling/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Family.Defs -import Complexitylib.Circuits.Unrolling.Acceptance.Hardwiring +module + +public import Complexitylib.Circuits.Family.Defs +public import Complexitylib.Circuits.Unrolling.Acceptance.Hardwiring /-! # Deterministic unrolling families — definitions @@ -18,6 +20,8 @@ the construction therefore depends only on the machine and time horizon, not on a target language or correctness proof. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Classes/PPoly/Unrolling/Internal.lean b/Complexitylib/Classes/PPoly/Unrolling/Internal.lean index d8fe5325..6e405b02 100644 --- a/Complexitylib/Classes/PPoly/Unrolling/Internal.lean +++ b/Complexitylib/Classes/PPoly/Unrolling/Internal.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.P -import Complexitylib.Classes.PPoly -import Complexitylib.Classes.PPoly.Unrolling.Defs -import Complexitylib.Models.TuringMachine.Internal +module + +public import Complexitylib.Classes.P +public import Complexitylib.Classes.PPoly +public import Complexitylib.Classes.PPoly.Unrolling.Defs +public import Complexitylib.Models.TuringMachine.Internal /-! # Deterministic unrolling families — proof internals @@ -16,6 +18,8 @@ by unrolling a deterministic machine. Public statements are exposed by `Complexitylib.Classes.PPoly.Unrolling`. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Classes/Pairing.lean b/Complexitylib/Classes/Pairing.lean index fc01421d..68131798 100644 --- a/Complexitylib/Classes/Pairing.lean +++ b/Complexitylib/Classes/Pairing.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Encoding.Pairing -import Complexitylib.Models.TuringMachine -import Mathlib.Algebra.Polynomial.Eval.Defs +module + +public import Complexitylib.Encoding.Pairing +public import Complexitylib.Models.TuringMachine +public import Mathlib.Algebra.Polynomial.Eval.Defs /-! # Paired relation predicates @@ -14,6 +16,8 @@ This file adds the complexity-class predicates built on the neutral binary pairing codec from `Complexitylib.Encoding.Pairing`. -/ +@[expose] public section + namespace Complexity /-- A binary relation is **polynomially balanced** if witness length is bounded diff --git a/Complexitylib/Classes/PropertyDensity.lean b/Complexitylib/Classes/PropertyDensity.lean index 11b9dd3c..7fd72f74 100644 --- a/Complexitylib/Classes/PropertyDensity.lean +++ b/Complexitylib/Classes/PropertyDensity.lean @@ -3,11 +3,13 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.FiniteCounting -import Mathlib.Algebra.Order.Field.Basic -import Mathlib.Tactic.FieldSimp -import Mathlib.Tactic.GCongr -import Mathlib.Tactic.Positivity +module + +public import Complexitylib.Classes.FiniteCounting +public import Mathlib.Algebra.Order.Field.Basic +public import Mathlib.Tactic.FieldSimp +public import Mathlib.Tactic.GCongr +public import Mathlib.Tactic.Positivity /-! # Property density @@ -23,6 +25,8 @@ random-bit `eventProb` layer but over the sample space of all Boolean functions. `density_compl`, and the union bound `density_union_le` -/ +@[expose] public section + namespace Complexity /-- The density of a property `P` of `n`-bit Boolean functions: the fraction of diff --git a/Complexitylib/Classes/Randomized.lean b/Complexitylib/Classes/Randomized.lean index c7c5b192..351c2be6 100644 --- a/Complexitylib/Classes/Randomized.lean +++ b/Complexitylib/Classes/Randomized.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine -import Complexitylib.Asymptotics -import Complexitylib.Classes.Time +module + +public import Complexitylib.Models.TuringMachine +public import Complexitylib.Asymptotics +public import Complexitylib.Classes.Time /-! # Randomized complexity classes @@ -25,6 +27,8 @@ The acceptance-probability conditions shared across classes are factored into `NTM.RejectsWithProb` (upper-bounding acceptance on no-instances). -/ +@[expose] public section + namespace Complexity diff --git a/Complexitylib/Classes/Randomized/CircuitAmplification.lean b/Complexitylib/Classes/Randomized/CircuitAmplification.lean index 6307a6ed..40d64abb 100644 --- a/Complexitylib/Classes/Randomized/CircuitAmplification.lean +++ b/Complexitylib/Classes/Randomized/CircuitAmplification.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Hardwiring -import Complexitylib.Circuits.Unrolling.Amplification -import Complexitylib.Models.TuringMachine.Repetition.Defs +module + +public import Complexitylib.Circuits.Hardwiring +public import Complexitylib.Circuits.Unrolling.Amplification +public import Complexitylib.Models.TuringMachine.Repetition.Defs /-! # Probabilistic semantics of circuit amplification @@ -18,6 +20,8 @@ provides the fixed-seed wrapper that hardwires every choice input while leaving the positive-length data suffix live. -/ +@[expose] public section + namespace Complexity namespace CircuitUnrolling diff --git a/Complexitylib/Classes/Randomized/GoodSeed.lean b/Complexitylib/Classes/Randomized/GoodSeed.lean index f780307a..7047a449 100644 --- a/Complexitylib/Classes/Randomized/GoodSeed.lean +++ b/Complexitylib/Classes/Randomized/GoodSeed.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.BitString -import Complexitylib.Classes.Randomized -import Complexitylib.Models.TuringMachine.Repetition.Correctness +module + +public import Complexitylib.Circuits.BitString +public import Complexitylib.Classes.Randomized +public import Complexitylib.Models.TuringMachine.Repetition.Correctness /-! # Uniform good seeds for bounded-error machines @@ -18,6 +20,8 @@ The result only concerns the fixed-time acceptance event, so it does not need an all-paths-halting hypothesis. -/ +@[expose] public section + namespace Complexity namespace NTM diff --git a/Complexitylib/Classes/Randomized/PPoly.lean b/Complexitylib/Classes/Randomized/PPoly.lean index 9c5909f7..52be9dce 100644 --- a/Complexitylib/Classes/Randomized/PPoly.lean +++ b/Complexitylib/Classes/Randomized/PPoly.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly.Advice.Reverse -import Complexitylib.Classes.Randomized.PPoly.Defs -import Complexitylib.Classes.Randomized.PPoly.Internal +module + +public import Complexitylib.Classes.PPoly.Advice.Reverse +public import Complexitylib.Classes.Randomized.PPoly.Defs +public import Complexitylib.Classes.Randomized.PPoly.Internal /-! # Bounded-error probabilistic computation has polynomial-size circuits @@ -26,6 +28,8 @@ decider. - `BPP_subset_PAdvice`: every language in `BPP` has a polynomial-advice decider. -/ +@[expose] public section + namespace Complexity namespace NTM diff --git a/Complexitylib/Classes/Randomized/PPoly/Defs.lean b/Complexitylib/Classes/Randomized/PPoly/Defs.lean index f6c6a3c7..5770c9bd 100644 --- a/Complexitylib/Classes/Randomized/PPoly/Defs.lean +++ b/Complexitylib/Classes/Randomized/PPoly/Defs.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.Randomized.CircuitAmplification -import Complexitylib.Classes.Randomized.GoodSeed -import Complexitylib.Circuits.Family.Defs +module + +public import Complexitylib.Classes.Randomized.CircuitAmplification +public import Complexitylib.Classes.Randomized.GoodSeed +public import Complexitylib.Circuits.Family.Defs /-! # Nonuniform derandomization — definitions @@ -18,6 +20,8 @@ Correctness, size bounds, and the containment theorem are proved in the internal and surface modules. -/ +@[expose] public section + namespace Complexity namespace NTM diff --git a/Complexitylib/Classes/Randomized/PPoly/Internal.lean b/Complexitylib/Classes/Randomized/PPoly/Internal.lean index 81922ed5..7c018a03 100644 --- a/Complexitylib/Classes/Randomized/PPoly/Internal.lean +++ b/Complexitylib/Classes/Randomized/PPoly/Internal.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.PPoly -import Complexitylib.Classes.Randomized.PPoly.Defs +module + +public import Complexitylib.Classes.PPoly +public import Complexitylib.Classes.Randomized.PPoly.Defs /-! # Nonuniform derandomization — proof internals @@ -14,6 +16,8 @@ hardwires a uniformly correct amplified seed at each input length. Public statements are exposed by `Complexitylib.Classes.Randomized.PPoly`. -/ +@[expose] public section + namespace Complexity namespace NTM diff --git a/Complexitylib/Classes/SharpP.lean b/Complexitylib/Classes/SharpP.lean index 8549a5b3..91bcd96d 100644 --- a/Complexitylib/Classes/SharpP.lean +++ b/Complexitylib/Classes/SharpP.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine -import Complexitylib.Asymptotics -import Complexitylib.Classes.FiniteCounting +module + +public import Complexitylib.Models.TuringMachine +public import Complexitylib.Asymptotics +public import Complexitylib.Classes.FiniteCounting /-! # The counting class `#P` @@ -23,6 +25,8 @@ existing `NTM.acceptCount` path semantics (roadmap track L5). polynomial clock `T` -/ +@[expose] public section + namespace Complexity /-- The number of accepting choice sequences is at most the total number of diff --git a/Complexitylib/Classes/Space.lean b/Complexitylib/Classes/Space.lean index f0ea04c9..abfa494d 100644 --- a/Complexitylib/Classes/Space.lean +++ b/Complexitylib/Classes/Space.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine -import Complexitylib.Asymptotics +module + +public import Complexitylib.Models.TuringMachine +public import Complexitylib.Asymptotics /-! # Base space complexity classes @@ -19,6 +21,8 @@ output verdict cell is free, while farther two-way output-head travel is also charged. This prevents either infinite named tape from becoming hidden workspace. -/ +@[expose] public section + namespace Complexity diff --git a/Complexitylib/Classes/Time.lean b/Complexitylib/Classes/Time.lean index 533e64a0..3bf79cce 100644 --- a/Complexitylib/Classes/Time.lean +++ b/Complexitylib/Classes/Time.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine -import Complexitylib.Asymptotics +module + +public import Complexitylib.Models.TuringMachine +public import Complexitylib.Asymptotics /-! # Base time complexity classes @@ -17,6 +19,8 @@ Both use `=O` (Mathlib's `IsBigO` lifted to `ℕ → ℕ`) to express asymptotic bounds. -/ +@[expose] public section + namespace Complexity diff --git a/Complexitylib/DescriptiveComplexity.lean b/Complexitylib/DescriptiveComplexity.lean index 33a76719..3f845841 100644 --- a/Complexitylib/DescriptiveComplexity.lean +++ b/Complexitylib/DescriptiveComplexity.lean @@ -3,19 +3,21 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.DescriptiveComplexity.Vocabulary -import Complexitylib.DescriptiveComplexity.Structure -import Complexitylib.DescriptiveComplexity.Isomorphism -import Complexitylib.DescriptiveComplexity.Query -import Complexitylib.DescriptiveComplexity.Env -import Complexitylib.DescriptiveComplexity.FirstOrder -import Complexitylib.DescriptiveComplexity.SecondOrder -import Complexitylib.DescriptiveComplexity.Definable -import Complexitylib.DescriptiveComplexity.Reduction -import Complexitylib.DescriptiveComplexity.Encoding -import Complexitylib.DescriptiveComplexity.ModelChecking -import Complexitylib.DescriptiveComplexity.Language -import Complexitylib.DescriptiveComplexity.Examples +module + +public import Complexitylib.DescriptiveComplexity.Vocabulary +public import Complexitylib.DescriptiveComplexity.Structure +public import Complexitylib.DescriptiveComplexity.Isomorphism +public import Complexitylib.DescriptiveComplexity.Query +public import Complexitylib.DescriptiveComplexity.Env +public import Complexitylib.DescriptiveComplexity.FirstOrder +public import Complexitylib.DescriptiveComplexity.SecondOrder +public import Complexitylib.DescriptiveComplexity.Definable +public import Complexitylib.DescriptiveComplexity.Reduction +public import Complexitylib.DescriptiveComplexity.Encoding +public import Complexitylib.DescriptiveComplexity.ModelChecking +public import Complexitylib.DescriptiveComplexity.Language +public import Complexitylib.DescriptiveComplexity.Examples /-! # Descriptive complexity @@ -32,3 +34,5 @@ queries. This is the substrate for the logic-vs-complexity correspondences (Fagin's theorem `NP = ∃SO`, `FO ⊆ AC⁰`, etc.) on roadmap track L (descriptive complexity). -/ + +@[expose] public section diff --git a/Complexitylib/DescriptiveComplexity/Definable.lean b/Complexitylib/DescriptiveComplexity/Definable.lean index 0a36f749..8284ba35 100644 --- a/Complexitylib/DescriptiveComplexity/Definable.lean +++ b/Complexitylib/DescriptiveComplexity/Definable.lean @@ -3,10 +3,12 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.DescriptiveComplexity.Query -import Complexitylib.DescriptiveComplexity.FirstOrder -import Complexitylib.DescriptiveComplexity.Reduction -import Complexitylib.DescriptiveComplexity.SecondOrder +module + +public import Complexitylib.DescriptiveComplexity.Query +public import Complexitylib.DescriptiveComplexity.FirstOrder +public import Complexitylib.DescriptiveComplexity.Reduction +public import Complexitylib.DescriptiveComplexity.SecondOrder /-! # First-order definable queries @@ -33,6 +35,8 @@ bounds. - `FODefinable.toSODefinable` — `FO ⊆ SO` at the query level. -/ +@[expose] public section + open scoped Complexity.DescriptiveComplexity namespace Complexity diff --git a/Complexitylib/DescriptiveComplexity/Encoding.lean b/Complexitylib/DescriptiveComplexity/Encoding.lean index d382c860..8d7ed8ae 100644 --- a/Complexitylib/DescriptiveComplexity/Encoding.lean +++ b/Complexitylib/DescriptiveComplexity/Encoding.lean @@ -3,12 +3,14 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.DescriptiveComplexity.Structure -import Mathlib.Data.Fintype.Pi -import Mathlib.Data.Fintype.BigOperators -import Mathlib.Data.List.FinRange -import Mathlib.Data.Fin.Tuple.Basic -import Mathlib.Data.List.TakeWhile +module + +public import Complexitylib.DescriptiveComplexity.Structure +public import Mathlib.Data.Fintype.Pi +public import Mathlib.Data.Fintype.BigOperators +public import Mathlib.Data.List.FinRange +public import Mathlib.Data.Fin.Tuple.Basic +public import Mathlib.Data.List.TakeWhile /-! # Encoding finite structures as bit strings @@ -31,6 +33,8 @@ relational part of that encoding and computes its length; it is step 5 (structur Fagin bridge). -/ +@[expose] public section + namespace Complexity namespace DescriptiveComplexity diff --git a/Complexitylib/DescriptiveComplexity/Env.lean b/Complexitylib/DescriptiveComplexity/Env.lean index 8c27d970..46fac7a0 100644 --- a/Complexitylib/DescriptiveComplexity/Env.lean +++ b/Complexitylib/DescriptiveComplexity/Env.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.DescriptiveComplexity.Vocabulary +module + +public import Complexitylib.DescriptiveComplexity.Vocabulary /-! Variable environments for first-order logic. @@ -12,6 +14,8 @@ import Complexitylib.DescriptiveComplexity.Vocabulary environment machinery for mapping de Bruijn variables to universe elements. -/ +@[expose] public section + namespace Complexity namespace DescriptiveComplexity diff --git a/Complexitylib/DescriptiveComplexity/Examples.lean b/Complexitylib/DescriptiveComplexity/Examples.lean index 0a5a2871..e4f859e4 100644 --- a/Complexitylib/DescriptiveComplexity/Examples.lean +++ b/Complexitylib/DescriptiveComplexity/Examples.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.DescriptiveComplexity.Query -import Complexitylib.DescriptiveComplexity.FirstOrder +module + +public import Complexitylib.DescriptiveComplexity.Query +public import Complexitylib.DescriptiveComplexity.FirstOrder /-! # Examples of Finite Structures @@ -15,6 +17,8 @@ import Complexitylib.DescriptiveComplexity.FirstOrder - An isomorphism between two concrete graphs -/ +@[expose] public section + namespace Complexity namespace DescriptiveComplexity @@ -51,7 +55,7 @@ def cycle3' : FinStruct graph where const := Fin.elim0 /-- The permutation 0↦0, 1↦2, 2↦1 on Fin 3 (an involution). -/ -private def perm3 : Fin 3 → Fin 3 +def perm3 : Fin 3 → Fin 3 | ⟨0, _⟩ => ⟨0, by omega⟩ | ⟨1, _⟩ => ⟨2, by omega⟩ | ⟨2, _⟩ => ⟨1, by omega⟩ diff --git a/Complexitylib/DescriptiveComplexity/FirstOrder.lean b/Complexitylib/DescriptiveComplexity/FirstOrder.lean index ddad63a7..4f79b39b 100644 --- a/Complexitylib/DescriptiveComplexity/FirstOrder.lean +++ b/Complexitylib/DescriptiveComplexity/FirstOrder.lean @@ -3,13 +3,17 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.DescriptiveComplexity.FirstOrder.Syntax -import Complexitylib.DescriptiveComplexity.FirstOrder.Semantics -import Complexitylib.DescriptiveComplexity.FirstOrder.Isomorphism -import Complexitylib.DescriptiveComplexity.FirstOrder.Substitution +module + +public import Complexitylib.DescriptiveComplexity.FirstOrder.Syntax +public import Complexitylib.DescriptiveComplexity.FirstOrder.Semantics +public import Complexitylib.DescriptiveComplexity.FirstOrder.Isomorphism +public import Complexitylib.DescriptiveComplexity.FirstOrder.Substitution /-! # First-order logic over finite structures Aggregates the first-order syntax, semantics, and isomorphism-invariance modules. -/ + +@[expose] public section diff --git a/Complexitylib/DescriptiveComplexity/FirstOrder/Isomorphism.lean b/Complexitylib/DescriptiveComplexity/FirstOrder/Isomorphism.lean index 3b6d7cee..8a88e412 100644 --- a/Complexitylib/DescriptiveComplexity/FirstOrder/Isomorphism.lean +++ b/Complexitylib/DescriptiveComplexity/FirstOrder/Isomorphism.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.DescriptiveComplexity.Query -import Complexitylib.DescriptiveComplexity.FirstOrder.Semantics +module + +public import Complexitylib.DescriptiveComplexity.Query +public import Complexitylib.DescriptiveComplexity.FirstOrder.Semantics /-! Isomorphism preservation for first-order logic. @@ -15,6 +17,8 @@ import Complexitylib.DescriptiveComplexity.FirstOrder.Semantics 3. FO sentences are order-independent (Immerman Proposition 1.16) -/ +@[expose] public section + namespace Complexity namespace DescriptiveComplexity diff --git a/Complexitylib/DescriptiveComplexity/FirstOrder/Semantics.lean b/Complexitylib/DescriptiveComplexity/FirstOrder/Semantics.lean index 41b8a9be..c57fca29 100644 --- a/Complexitylib/DescriptiveComplexity/FirstOrder/Semantics.lean +++ b/Complexitylib/DescriptiveComplexity/FirstOrder/Semantics.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.DescriptiveComplexity.Structure -import Complexitylib.DescriptiveComplexity.Env -import Complexitylib.DescriptiveComplexity.FirstOrder.Syntax +module + +public import Complexitylib.DescriptiveComplexity.Structure +public import Complexitylib.DescriptiveComplexity.Env +public import Complexitylib.DescriptiveComplexity.FirstOrder.Syntax /-! First-order logic semantics: term evaluation, formula satisfaction, models. @@ -13,6 +15,8 @@ import Complexitylib.DescriptiveComplexity.FirstOrder.Syntax Follows Immerman Definition 1.11 (semantics part). -/ +@[expose] public section + namespace Complexity namespace DescriptiveComplexity diff --git a/Complexitylib/DescriptiveComplexity/FirstOrder/Substitution.lean b/Complexitylib/DescriptiveComplexity/FirstOrder/Substitution.lean index 6fd3031b..0e1bffc8 100644 --- a/Complexitylib/DescriptiveComplexity/FirstOrder/Substitution.lean +++ b/Complexitylib/DescriptiveComplexity/FirstOrder/Substitution.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.DescriptiveComplexity.FirstOrder.Semantics +module + +public import Complexitylib.DescriptiveComplexity.FirstOrder.Semantics /-! # First-order substitution @@ -29,6 +31,8 @@ formula along an `FOInterpretation`. - `Formula.subst_sat` — the substitution theorem. -/ +@[expose] public section + namespace Complexity namespace DescriptiveComplexity diff --git a/Complexitylib/DescriptiveComplexity/FirstOrder/Syntax.lean b/Complexitylib/DescriptiveComplexity/FirstOrder/Syntax.lean index 77a4c5f1..b15a5bde 100644 --- a/Complexitylib/DescriptiveComplexity/FirstOrder/Syntax.lean +++ b/Complexitylib/DescriptiveComplexity/FirstOrder/Syntax.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.DescriptiveComplexity.Vocabulary +module + +public import Complexitylib.DescriptiveComplexity.Vocabulary /-! First-order logic syntax: terms, formulas, sentences, derived connectives. @@ -13,6 +15,8 @@ import Complexitylib.DescriptiveComplexity.Vocabulary Formulas are indexed by the number of free variables. -/ +@[expose] public section + namespace Complexity namespace DescriptiveComplexity diff --git a/Complexitylib/DescriptiveComplexity/Isomorphism.lean b/Complexitylib/DescriptiveComplexity/Isomorphism.lean index f7fee9d3..ead1e008 100644 --- a/Complexitylib/DescriptiveComplexity/Isomorphism.lean +++ b/Complexitylib/DescriptiveComplexity/Isomorphism.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.DescriptiveComplexity.Structure +module + +public import Complexitylib.DescriptiveComplexity.Structure /-! # Isomorphisms, Embeddings, and Substructures @@ -13,6 +15,8 @@ import Complexitylib.DescriptiveComplexity.Structure cardinality. We also define embeddings and substructures. -/ +@[expose] public section + namespace Complexity namespace DescriptiveComplexity diff --git a/Complexitylib/DescriptiveComplexity/Language.lean b/Complexitylib/DescriptiveComplexity/Language.lean index 75d4442e..0ef94fc1 100644 --- a/Complexitylib/DescriptiveComplexity/Language.lean +++ b/Complexitylib/DescriptiveComplexity/Language.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.DescriptiveComplexity.Encoding -import Complexitylib.DescriptiveComplexity.Query -import Complexitylib.Models.TuringMachine +module + +public import Complexitylib.DescriptiveComplexity.Encoding +public import Complexitylib.DescriptiveComplexity.Query +public import Complexitylib.Models.TuringMachine /-! # The language induced by a Boolean query @@ -24,6 +26,8 @@ ultimately rest on. is in `Q`'s language. -/ +@[expose] public section + namespace Complexity namespace DescriptiveComplexity diff --git a/Complexitylib/DescriptiveComplexity/ModelChecking.lean b/Complexitylib/DescriptiveComplexity/ModelChecking.lean index d3ea5f3d..7b64e166 100644 --- a/Complexitylib/DescriptiveComplexity/ModelChecking.lean +++ b/Complexitylib/DescriptiveComplexity/ModelChecking.lean @@ -3,10 +3,12 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.DescriptiveComplexity.Structure -import Complexitylib.DescriptiveComplexity.Env -import Complexitylib.DescriptiveComplexity.FirstOrder.Semantics -import Mathlib.Data.List.FinRange +module + +public import Complexitylib.DescriptiveComplexity.Structure +public import Complexitylib.DescriptiveComplexity.Env +public import Complexitylib.DescriptiveComplexity.FirstOrder.Semantics +public import Mathlib.Data.List.FinRange /-! # Computable first-order model checking @@ -29,6 +31,8 @@ characterization, and the `FO ⊆ AC⁰` bridge. form. -/ +@[expose] public section + namespace Complexity namespace DescriptiveComplexity diff --git a/Complexitylib/DescriptiveComplexity/Query.lean b/Complexitylib/DescriptiveComplexity/Query.lean index 0d83ffcc..712ae31f 100644 --- a/Complexitylib/DescriptiveComplexity/Query.lean +++ b/Complexitylib/DescriptiveComplexity/Query.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.DescriptiveComplexity.Isomorphism +module + +public import Complexitylib.DescriptiveComplexity.Isomorphism /-! # Boolean Queries @@ -13,6 +15,8 @@ import Complexitylib.DescriptiveComplexity.Isomorphism (Definition 1.16 in Immerman). -/ +@[expose] public section + namespace Complexity namespace DescriptiveComplexity diff --git a/Complexitylib/DescriptiveComplexity/Reduction.lean b/Complexitylib/DescriptiveComplexity/Reduction.lean index d17c858b..cde292c0 100644 --- a/Complexitylib/DescriptiveComplexity/Reduction.lean +++ b/Complexitylib/DescriptiveComplexity/Reduction.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.DescriptiveComplexity.Query -import Complexitylib.DescriptiveComplexity.FirstOrder +module + +public import Complexitylib.DescriptiveComplexity.Query +public import Complexitylib.DescriptiveComplexity.FirstOrder /-! # First-order reductions and projections @@ -36,6 +38,8 @@ string-level FO-reduction (an FO map on encodings) is a further step on track L6 reflexivity/transitivity. -/ +@[expose] public section + namespace Complexity namespace DescriptiveComplexity diff --git a/Complexitylib/DescriptiveComplexity/SecondOrder.lean b/Complexitylib/DescriptiveComplexity/SecondOrder.lean index 5b865397..188814a5 100644 --- a/Complexitylib/DescriptiveComplexity/SecondOrder.lean +++ b/Complexitylib/DescriptiveComplexity/SecondOrder.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.DescriptiveComplexity.SecondOrder.Syntax -import Complexitylib.DescriptiveComplexity.SecondOrder.Semantics -import Complexitylib.DescriptiveComplexity.SecondOrder.Isomorphism +module + +public import Complexitylib.DescriptiveComplexity.SecondOrder.Syntax +public import Complexitylib.DescriptiveComplexity.SecondOrder.Semantics +public import Complexitylib.DescriptiveComplexity.SecondOrder.Isomorphism /-! # Second-order logic over finite structures @@ -14,3 +16,5 @@ Aggregates the second-order logic modules (currently syntax; semantics and isomorphism-invariance to follow), the machinery for Fagin's theorem `NP = ∃SO` on roadmap track L6. -/ + +@[expose] public section diff --git a/Complexitylib/DescriptiveComplexity/SecondOrder/Isomorphism.lean b/Complexitylib/DescriptiveComplexity/SecondOrder/Isomorphism.lean index d6da5348..e4c5654b 100644 --- a/Complexitylib/DescriptiveComplexity/SecondOrder/Isomorphism.lean +++ b/Complexitylib/DescriptiveComplexity/SecondOrder/Isomorphism.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.DescriptiveComplexity.SecondOrder.Semantics -import Complexitylib.DescriptiveComplexity.FirstOrder.Isomorphism +module + +public import Complexitylib.DescriptiveComplexity.SecondOrder.Semantics +public import Complexitylib.DescriptiveComplexity.FirstOrder.Isomorphism /-! # Second-order logic: isomorphism invariance @@ -30,6 +32,8 @@ witnessing relations through the isomorphism. are order-independent. -/ +@[expose] public section + namespace Complexity namespace DescriptiveComplexity diff --git a/Complexitylib/DescriptiveComplexity/SecondOrder/Semantics.lean b/Complexitylib/DescriptiveComplexity/SecondOrder/Semantics.lean index a4d0a5f8..8a89d9b6 100644 --- a/Complexitylib/DescriptiveComplexity/SecondOrder/Semantics.lean +++ b/Complexitylib/DescriptiveComplexity/SecondOrder/Semantics.lean @@ -3,10 +3,12 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.DescriptiveComplexity.SecondOrder.Syntax -import Complexitylib.DescriptiveComplexity.Structure -import Complexitylib.DescriptiveComplexity.Env -import Complexitylib.DescriptiveComplexity.FirstOrder.Semantics +module + +public import Complexitylib.DescriptiveComplexity.SecondOrder.Syntax +public import Complexitylib.DescriptiveComplexity.Structure +public import Complexitylib.DescriptiveComplexity.Env +public import Complexitylib.DescriptiveComplexity.FirstOrder.Semantics /-! # Second-order logic: semantics @@ -30,6 +32,8 @@ so first-order truth is a special case of second-order truth truth-preserving. -/ +@[expose] public section + namespace Complexity namespace DescriptiveComplexity diff --git a/Complexitylib/DescriptiveComplexity/SecondOrder/Syntax.lean b/Complexitylib/DescriptiveComplexity/SecondOrder/Syntax.lean index 2cd94d1c..18c9aa04 100644 --- a/Complexitylib/DescriptiveComplexity/SecondOrder/Syntax.lean +++ b/Complexitylib/DescriptiveComplexity/SecondOrder/Syntax.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.DescriptiveComplexity.FirstOrder.Syntax +module + +public import Complexitylib.DescriptiveComplexity.FirstOrder.Syntax /-! # Second-order logic: syntax @@ -27,6 +29,8 @@ syntax is the one Fagin's theorem characterizes as `NP`. - `SOFormula.size` — the syntactic size. -/ +@[expose] public section + namespace Complexity namespace DescriptiveComplexity diff --git a/Complexitylib/DescriptiveComplexity/Structure.lean b/Complexitylib/DescriptiveComplexity/Structure.lean index c2bd1a06..e1013059 100644 --- a/Complexitylib/DescriptiveComplexity/Structure.lean +++ b/Complexitylib/DescriptiveComplexity/Structure.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.DescriptiveComplexity.Vocabulary +module + +public import Complexitylib.DescriptiveComplexity.Vocabulary /-! # Finite Structures @@ -19,6 +21,8 @@ import Complexitylib.DescriptiveComplexity.Vocabulary structure but computed from the `Fin` ordering (Proviso 1.14). -/ +@[expose] public section + namespace Complexity namespace DescriptiveComplexity diff --git a/Complexitylib/DescriptiveComplexity/Vocabulary.lean b/Complexitylib/DescriptiveComplexity/Vocabulary.lean index 57dfdc0b..16fefff7 100644 --- a/Complexitylib/DescriptiveComplexity/Vocabulary.lean +++ b/Complexitylib/DescriptiveComplexity/Vocabulary.lean @@ -3,6 +3,7 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ +module /-! # Vocabularies (Signatures) @@ -11,7 +12,7 @@ Authors: Samuel Schlesinger signature) is a tuple of relation symbols with arities, plus constant symbols. We represent this finitely: `numRels` relation symbols with arities given by `relArity`, and `numConsts` constant symbols. --/ +-/@[expose] public section namespace Complexity diff --git a/Complexitylib/Encoding/Pairing.lean b/Complexitylib/Encoding/Pairing.lean index 68070786..d5772a01 100644 --- a/Complexitylib/Encoding/Pairing.lean +++ b/Complexitylib/Encoding/Pairing.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Mathlib.Data.List.Basic -import Mathlib.Data.Nat.Init -import Lean.Elab.Tactic.Omega +module + +public import Mathlib.Data.List.Basic +public import Mathlib.Data.Nat.Init +public import Lean.Elab.Tactic.Omega /-! # Pairing binary strings @@ -16,6 +18,8 @@ machine or complexity-class layers, so parsers and encoders can reuse it without introducing an import cycle. -/ +@[expose] public section + namespace Complexity /-- Encode a pair of binary strings as a single binary string. diff --git a/Complexitylib/Languages.lean b/Complexitylib/Languages.lean index e1ba0214..979f2819 100644 --- a/Complexitylib/Languages.lean +++ b/Complexitylib/Languages.lean @@ -3,17 +3,19 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Languages.Trivial -import Complexitylib.Languages.FirstCell -import Complexitylib.Languages.LengthParity -import Complexitylib.Languages.AnBn -import Complexitylib.Languages.ZeroPrefix -import Complexitylib.Languages.Balanced -import Complexitylib.Languages.AllSymbol -import Complexitylib.Languages.Contains -import Complexitylib.Languages.LengthDivBy -import Complexitylib.Languages.LastBit -import Complexitylib.Languages.Palindromes +module + +public import Complexitylib.Languages.Trivial +public import Complexitylib.Languages.FirstCell +public import Complexitylib.Languages.LengthParity +public import Complexitylib.Languages.AnBn +public import Complexitylib.Languages.ZeroPrefix +public import Complexitylib.Languages.Balanced +public import Complexitylib.Languages.AllSymbol +public import Complexitylib.Languages.Contains +public import Complexitylib.Languages.LengthDivBy +public import Complexitylib.Languages.LastBit +public import Complexitylib.Languages.Palindromes /-! # Concrete languages and their complexity — aggregation @@ -54,3 +56,5 @@ worked examples of building TMs from reusable building blocks. by a 1-work-tape TM that copies the input then compares forward against backward. -/ + +@[expose] public section diff --git a/Complexitylib/Languages/AllSymbol.lean b/Complexitylib/Languages/AllSymbol.lean index cab92ea1..880538eb 100644 --- a/Complexitylib/Languages/AllSymbol.lean +++ b/Complexitylib/Languages/AllSymbol.lean @@ -3,10 +3,12 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Languages.Trivial -import Complexitylib.Models.TuringMachine.Combinators -import Complexitylib.Models.TuringMachine.Combinators.Internal.Scanner -import Complexitylib.Models.TuringMachine.Combinators.Internal.Complement +module + +public import Complexitylib.Languages.Trivial +public import Complexitylib.Models.TuringMachine.Combinators +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Scanner +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Complement /-! # `allZeros` and `allOnes`: single-symbol languages @@ -26,6 +28,8 @@ single `Bool` tracking "every bit so far equals target". - `allZeros_mem_P`, `allOnes_mem_P`. -/ +@[expose] public section + namespace Complexity open Complexity diff --git a/Complexitylib/Languages/AnBn.lean b/Complexitylib/Languages/AnBn.lean index 978cd619..685decd2 100644 --- a/Complexitylib/Languages/AnBn.lean +++ b/Complexitylib/Languages/AnBn.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Languages.Trivial -import Complexitylib.Models.TuringMachine.Combinators -import Complexitylib.Models.TuringMachine.Combinators.Internal.Complement +module + +public import Complexitylib.Languages.Trivial +public import Complexitylib.Models.TuringMachine.Combinators +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Complement /-! # `{0ⁿ 1ⁿ : n ≥ 0}`: the canonical push-down language @@ -30,6 +32,8 @@ via the permanently-`▷` cell 0. - `anbn_in_DTIME`, `anbn_mem_P`. -/ +@[expose] public section + namespace Complexity open Complexity diff --git a/Complexitylib/Languages/Balanced.lean b/Complexitylib/Languages/Balanced.lean index 75ba5d27..a9094ce1 100644 --- a/Complexitylib/Languages/Balanced.lean +++ b/Complexitylib/Languages/Balanced.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Languages.Trivial -import Complexitylib.Models.TuringMachine.Combinators -import Complexitylib.Models.TuringMachine.Combinators.Internal.Complement +module + +public import Complexitylib.Languages.Trivial +public import Complexitylib.Models.TuringMachine.Combinators +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Complement /-! # `{x : #false x = #true x}`: equal-count / "balanced" language @@ -35,6 +37,8 @@ Emptiness (`h = 0`) is detected structurally by the work head reading - `balanced_in_DTIME`, `balanced_mem_P`. -/ +@[expose] public section + namespace Complexity open Complexity diff --git a/Complexitylib/Languages/Contains.lean b/Complexitylib/Languages/Contains.lean index 37bfac59..dedbdadb 100644 --- a/Complexitylib/Languages/Contains.lean +++ b/Complexitylib/Languages/Contains.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Languages.Trivial -import Complexitylib.Models.TuringMachine.Combinators -import Complexitylib.Models.TuringMachine.Combinators.Internal.Scanner +module + +public import Complexitylib.Languages.Trivial +public import Complexitylib.Models.TuringMachine.Combinators +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Scanner /-! # `containsZero` and `containsOne`: "contains-a-bit" languages @@ -25,6 +27,8 @@ The strings containing at least one `0`-bit (resp. `1`-bit). Decided by a - `containsZero_mem_P`, `containsOne_mem_P`. -/ +@[expose] public section + namespace Complexity open Complexity diff --git a/Complexitylib/Languages/FirstCell.lean b/Complexitylib/Languages/FirstCell.lean index 137c20d0..c238e610 100644 --- a/Complexitylib/Languages/FirstCell.lean +++ b/Complexitylib/Languages/FirstCell.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Languages.Trivial -import Complexitylib.Models.TuringMachine.Combinators -import Complexitylib.Models.TuringMachine.Combinators.Internal.Complement +module + +public import Complexitylib.Languages.Trivial +public import Complexitylib.Models.TuringMachine.Combinators +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Complement /-! # Languages determined by the first input cell @@ -41,6 +43,8 @@ languages. used to present `nonempty` as a union. -/ +@[expose] public section + namespace Complexity open Complexity diff --git a/Complexitylib/Languages/LastBit.lean b/Complexitylib/Languages/LastBit.lean index 5f2d4c99..5685b7ed 100644 --- a/Complexitylib/Languages/LastBit.lean +++ b/Complexitylib/Languages/LastBit.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Languages.Trivial -import Complexitylib.Models.TuringMachine.Combinators -import Complexitylib.Models.TuringMachine.Combinators.Internal.Scanner +module + +public import Complexitylib.Languages.Trivial +public import Complexitylib.Models.TuringMachine.Combinators +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Scanner /-! # `lastBitOne` and `lastBitZero`: final-symbol languages @@ -25,6 +27,8 @@ is the last bit seen so far, or `none` if no bit has been read. - `lastBitOne_mem_P`, `lastBitZero_mem_P`. -/ +@[expose] public section + namespace Complexity open Complexity diff --git a/Complexitylib/Languages/LengthDivBy.lean b/Complexitylib/Languages/LengthDivBy.lean index 440f06de..d2e72cbb 100644 --- a/Complexitylib/Languages/LengthDivBy.lean +++ b/Complexitylib/Languages/LengthDivBy.lean @@ -3,10 +3,12 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Languages.Trivial -import Complexitylib.Models.TuringMachine.Combinators -import Complexitylib.Models.TuringMachine.Combinators.Internal.Scanner -import Mathlib.Data.ZMod.Basic +module + +public import Complexitylib.Languages.Trivial +public import Complexitylib.Models.TuringMachine.Combinators +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Scanner +public import Mathlib.Data.ZMod.Basic /-! # `lengthDivBy k`: length-divisibility language family @@ -28,6 +30,8 @@ This generalizes `evenLength` (which is `lengthDivBy 2`). - `lengthDivBy_mem_P`. -/ +@[expose] public section + namespace Complexity open Complexity diff --git a/Complexitylib/Languages/LengthParity.lean b/Complexitylib/Languages/LengthParity.lean index a943dbbb..1d840def 100644 --- a/Complexitylib/Languages/LengthParity.lean +++ b/Complexitylib/Languages/LengthParity.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Languages.Trivial -import Complexitylib.Models.TuringMachine.Combinators -import Complexitylib.Models.TuringMachine.Combinators.Internal.Complement +module + +public import Complexitylib.Languages.Trivial +public import Complexitylib.Models.TuringMachine.Combinators +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Complement /-! # Languages determined by the parity of the input length @@ -29,6 +31,8 @@ the input. - `oddLength_eq_compl_evenLength` — explicit Boolean identity. -/ +@[expose] public section + namespace Complexity open Complexity diff --git a/Complexitylib/Languages/Palindromes.lean b/Complexitylib/Languages/Palindromes.lean index 45197bbf..9b63431c 100644 --- a/Complexitylib/Languages/Palindromes.lean +++ b/Complexitylib/Languages/Palindromes.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Languages.Trivial -import Complexitylib.Models.TuringMachine.Combinators -import Complexitylib.Models.TuringMachine.Combinators.Internal.Complement +module + +public import Complexitylib.Languages.Trivial +public import Complexitylib.Models.TuringMachine.Combinators +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Complement /-! # `palindromes`: strings equal to their reverse @@ -40,6 +42,8 @@ Phases (see comments on `PalindromePhase`): 5. `reject`: consume remaining input, then halt with output `0`. -/ +@[expose] public section + namespace Complexity open Complexity diff --git a/Complexitylib/Languages/Trivial.lean b/Complexitylib/Languages/Trivial.lean index b3637a94..5af1be1f 100644 --- a/Complexitylib/Languages/Trivial.lean +++ b/Complexitylib/Languages/Trivial.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.P -import Complexitylib.Classes.Containments -import Complexitylib.Models.TuringMachine.Subroutines.Internal +module + +public import Complexitylib.Classes.P +public import Complexitylib.Classes.Containments +public import Complexitylib.Models.TuringMachine.Subroutines.Internal /-! # Trivial languages: `∅` and `Set.univ` @@ -30,6 +32,8 @@ complexity class. - `empty_mem_EXP`, `univ_mem_EXP` -/ +@[expose] public section + namespace Complexity open Complexity diff --git a/Complexitylib/Languages/ZeroPrefix.lean b/Complexitylib/Languages/ZeroPrefix.lean index d6be63b3..bedeb9ab 100644 --- a/Complexitylib/Languages/ZeroPrefix.lean +++ b/Complexitylib/Languages/ZeroPrefix.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Languages.Trivial -import Complexitylib.Models.TuringMachine.Combinators -import Complexitylib.Models.TuringMachine.Combinators.Internal.Complement +module + +public import Complexitylib.Languages.Trivial +public import Complexitylib.Models.TuringMachine.Combinators +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Complement /-! # `{0ⁿ 1ᵐ : n ≥ m}`: a push-down language with inequality counter @@ -33,6 +35,8 @@ via the permanently-`▷` cell 0. - `zeroPrefix_in_DTIME`, `zeroPrefix_mem_P`. -/ +@[expose] public section + namespace Complexity open Complexity diff --git a/Complexitylib/Mathlib/Digraph.lean b/Complexitylib/Mathlib/Digraph.lean index b938302f..b134ad97 100644 --- a/Complexitylib/Mathlib/Digraph.lean +++ b/Complexitylib/Mathlib/Digraph.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Mathlib.Combinatorics.Digraph.Basic -import Mathlib.Data.Fintype.Prod -import Mathlib.Data.Nat.Lattice +module + +public import Mathlib.Combinatorics.Digraph.Basic +public import Mathlib.Data.Fintype.Prod +public import Mathlib.Data.Nat.Lattice /-! # Digraph extensions for Mathlib @@ -31,6 +33,8 @@ arguments, edge partitions by first-differing bit, etc.) lives in `Complexitylib.Circuits.Internal.Valiant`. -/ +@[expose] public section + namespace Digraph variable {V : Type*} diff --git a/Complexitylib/Mathlib/FinsetPrefixes.lean b/Complexitylib/Mathlib/FinsetPrefixes.lean index f3ae5f15..e987adaf 100644 --- a/Complexitylib/Mathlib/FinsetPrefixes.lean +++ b/Complexitylib/Mathlib/FinsetPrefixes.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Bolton Bailey. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Bolton Bailey -/ -import Mathlib.Data.Finset.Union -import Mathlib.Data.List.Infix +module + +public import Mathlib.Data.Finset.Union +public import Mathlib.Data.List.Infix /-! # Finsets of prefixes and suffixes @@ -20,6 +22,8 @@ type in its home namespace — the sanctioned exception to the `Complexity` root-namespace rule. Its contents are candidates for upstreaming to Mathlib. -/ +@[expose] public section + namespace Finset variable {α : Type*} [DecidableEq α] {S : Finset (List α)} diff --git a/Complexitylib/Mathlib/NatBits.lean b/Complexitylib/Mathlib/NatBits.lean index 83c3d131..79fdb681 100644 --- a/Complexitylib/Mathlib/NatBits.lean +++ b/Complexitylib/Mathlib/NatBits.lean @@ -3,10 +3,12 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Mathlib.Data.Nat.Log -import Mathlib.Data.Nat.Size -import Mathlib.Tactic.Ring -import Mathlib.Tactic.Lemma +module + +public import Mathlib.Data.Nat.Log +public import Mathlib.Data.Nat.Size +public import Mathlib.Tactic.Ring +public import Mathlib.Tactic.Lemma /-! # Fixed-width binary encodings of natural numbers @@ -23,6 +25,8 @@ type in its home (root) namespace — the sanctioned exception to the upstreaming to Mathlib. -/ +@[expose] public section + /-- Encode a natural number as a big-endian binary list of exactly `w` bits. Numbers larger than `2^w - 1` are truncated (mod 2^w). -/ def Nat.toBits : ℕ → ℕ → List Bool diff --git a/Complexitylib/Models.lean b/Complexitylib/Models.lean index 49b039cb..facfabaa 100644 --- a/Complexitylib/Models.lean +++ b/Complexitylib/Models.lean @@ -3,71 +3,73 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine -import Complexitylib.Models.TuringMachine.Trace -import Complexitylib.Models.TuringMachine.SingleTape -import Complexitylib.Models.TuringMachine.Combinators -import Complexitylib.Models.TuringMachine.Combinators.ForBinaryWork -import Complexitylib.Models.TuringMachine.Combinators.ForInput -import Complexitylib.Models.TuringMachine.Combinators.ForWorkOnes -import Complexitylib.Models.TuringMachine.Combinators.RetargetCompute -import Complexitylib.Models.TuringMachine.Combinators.WorkBranch -import Complexitylib.Models.TuringMachine.Combinators.WorkSymbolBranch -import Complexitylib.Models.TuringMachine.Hoare -import Complexitylib.Models.TuringMachine.Hoare.Space -import Complexitylib.Models.TuringMachine.Experimental.Routine -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.InputLength -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.SpaceBounds -import Complexitylib.Models.TuringMachine.Tape.Encoding -import Complexitylib.Models.TuringMachine.Subroutines -import Complexitylib.Models.TuringMachine.Subroutines.BinaryAdd -import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst -import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy -import Complexitylib.Models.TuringMachine.Subroutines.BinaryEq -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub -import Complexitylib.Models.TuringMachine.Subroutines.BinaryShiftMul -import Complexitylib.Models.TuringMachine.Subroutines.BinaryMulAdd -import Complexitylib.Models.TuringMachine.Subroutines.BinaryPolynomial -import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor -import Complexitylib.Models.TuringMachine.Subroutines.BinaryLength -import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc -import Complexitylib.Models.TuringMachine.Subroutines.ClearWork -import Complexitylib.Models.TuringMachine.Subroutines.CopyOutput -import Complexitylib.Models.TuringMachine.Subroutines.CopyWorkOutput -import Complexitylib.Models.TuringMachine.Subroutines.PairEmit -import Complexitylib.Models.TuringMachine.Subroutines.PairValidate -import Complexitylib.Models.TuringMachine.Subroutines.PairSplit -import Complexitylib.Models.TuringMachine.Subroutines.ScanRight -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany -import Complexitylib.Models.TuringMachine.Subroutines.UnaryLength -import Complexitylib.Models.TuringMachine.OutputBounds -import Complexitylib.Models.TuringMachine.SpaceTime -import Complexitylib.Models.TuringMachine.Placement -import Complexitylib.Models.TuringMachine.Composition -import Complexitylib.Models.TuringMachine.Composition.PairWithInput -import Complexitylib.Models.TuringMachine.Deterministic -import Complexitylib.Models.TuringMachine.Lift -import Complexitylib.Models.TuringMachine.Repetition -import Complexitylib.Models.TuringMachine.Repetition.Correctness -import Complexitylib.Models.TuringMachine.UTM.Encoding -import Complexitylib.Models.TuringMachine.UTM.Machine -import Complexitylib.Models.TuringMachine.UTM.Universal -import Complexitylib.Models.TuringMachine.UTM.Clock -import Complexitylib.Models.TuringMachine.UTM.ClockConstructible -import Complexitylib.Models.TuringMachine.UTM.ClockedUtm -import Complexitylib.Models.TuringMachine.UTM.HierarchySupport -import Complexitylib.Models.TuringMachine.UTM.Diagonal -import Complexitylib.Models.RandomAccessMachine -import Complexitylib.Models.RoseTreeMachine.Data -import Complexitylib.Models.RoseTreeMachine.DataEncode -import Complexitylib.Models.RoseTreeMachine.Prog +module + +public import Complexitylib.Models.TuringMachine +public import Complexitylib.Models.TuringMachine.Trace +public import Complexitylib.Models.TuringMachine.SingleTape +public import Complexitylib.Models.TuringMachine.Combinators +public import Complexitylib.Models.TuringMachine.Combinators.ForBinaryWork +public import Complexitylib.Models.TuringMachine.Combinators.ForInput +public import Complexitylib.Models.TuringMachine.Combinators.ForWorkOnes +public import Complexitylib.Models.TuringMachine.Combinators.RetargetCompute +public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch +public import Complexitylib.Models.TuringMachine.Combinators.WorkSymbolBranch +public import Complexitylib.Models.TuringMachine.Hoare +public import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.TuringMachine.Experimental.Routine +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.InputLength +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.SpaceBounds +public import Complexitylib.Models.TuringMachine.Tape.Encoding +public import Complexitylib.Models.TuringMachine.Subroutines +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAdd +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryEq +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryShiftMul +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryMulAdd +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPolynomial +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryLength +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc +public import Complexitylib.Models.TuringMachine.Subroutines.ClearWork +public import Complexitylib.Models.TuringMachine.Subroutines.CopyOutput +public import Complexitylib.Models.TuringMachine.Subroutines.CopyWorkOutput +public import Complexitylib.Models.TuringMachine.Subroutines.PairEmit +public import Complexitylib.Models.TuringMachine.Subroutines.PairValidate +public import Complexitylib.Models.TuringMachine.Subroutines.PairSplit +public import Complexitylib.Models.TuringMachine.Subroutines.ScanRight +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany +public import Complexitylib.Models.TuringMachine.Subroutines.UnaryLength +public import Complexitylib.Models.TuringMachine.OutputBounds +public import Complexitylib.Models.TuringMachine.SpaceTime +public import Complexitylib.Models.TuringMachine.Placement +public import Complexitylib.Models.TuringMachine.Composition +public import Complexitylib.Models.TuringMachine.Composition.PairWithInput +public import Complexitylib.Models.TuringMachine.Deterministic +public import Complexitylib.Models.TuringMachine.Lift +public import Complexitylib.Models.TuringMachine.Repetition +public import Complexitylib.Models.TuringMachine.Repetition.Correctness +public import Complexitylib.Models.TuringMachine.UTM.Encoding +public import Complexitylib.Models.TuringMachine.UTM.Machine +public import Complexitylib.Models.TuringMachine.UTM.Universal +public import Complexitylib.Models.TuringMachine.UTM.Clock +public import Complexitylib.Models.TuringMachine.UTM.ClockConstructible +public import Complexitylib.Models.TuringMachine.UTM.ClockedUtm +public import Complexitylib.Models.TuringMachine.UTM.HierarchySupport +public import Complexitylib.Models.TuringMachine.UTM.Diagonal +public import Complexitylib.Models.RandomAccessMachine +public import Complexitylib.Models.RoseTreeMachine.Data +public import Complexitylib.Models.RoseTreeMachine.DataEncode +public import Complexitylib.Models.RoseTreeMachine.Prog /-! # Computation models @@ -93,3 +95,5 @@ exact-3-CNF syntax instances. Proof-internal modules imported here — they stay in the build through the surface modules and theorem files that need them. -/ + +@[expose] public section diff --git a/Complexitylib/Models/RandomAccessMachine.lean b/Complexitylib/Models/RandomAccessMachine.lean index f55eb819..6ce640c6 100644 --- a/Complexitylib/Models/RandomAccessMachine.lean +++ b/Complexitylib/Models/RandomAccessMachine.lean @@ -3,71 +3,73 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Internal -import Complexitylib.Models.RandomAccessMachine.Soundness -import Complexitylib.Models.RandomAccessMachine.Classes -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Step -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.ABI -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Containment -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore -import +module + +public import Complexitylib.Models.RandomAccessMachine.Internal +public import Complexitylib.Models.RandomAccessMachine.Soundness +public import Complexitylib.Models.RandomAccessMachine.Classes +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Step +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.ABI +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Containment +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.DenseOverlay -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.DenseInputLookup -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Containment -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.AddressEq -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryAppend -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryDecode -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryEncode -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryCleanup -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryLookup -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryLookupRestore -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryMissCopy -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryMatch -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryReplace -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScanStep -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScan -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Containment +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.AddressEq +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryAppend +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryDecode +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryEncode +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryCleanup +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryLookup +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryLookupRestore +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryMissCopy +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryMatch +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryReplace +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScanStep +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScan +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Dense -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Dispatch -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Initialization -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.DenseInit -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.DenseDecision -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.DenseBounds -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Decision -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordDecode -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordEncode -import Complexitylib.Models.TuringMachine.Subroutines.BinaryEq -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub -import Complexitylib.Models.TuringMachine.Subroutines.BinaryShiftMul -import Complexitylib.Models.RandomAccessMachine.Structured -import Complexitylib.Models.RandomAccessMachine.Structured.Switch.Compiled -import Complexitylib.Models.RandomAccessMachine.Structured.Hamming -import Complexitylib.Models.RandomAccessMachine.Structured.GateEval -import Complexitylib.Models.RandomAccessMachine.Structured.GateStep -import Complexitylib.Models.RandomAccessMachine.Structured.GateStreamStep -import Complexitylib.Models.RandomAccessMachine.Structured.Scanner -import Complexitylib.Models.RandomAccessMachine.Structured.PairValidate -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary -import Complexitylib.Models.RandomAccessMachine.Structured.LastBit -import Complexitylib.Models.RandomAccessMachine.Structured.ThreeSATSyntax -import Complexitylib.Models.RandomAccessMachine.Structured.UnaryDecode -import Complexitylib.Asymptotics -import Complexitylib.Classes.Time +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordDecode +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordEncode +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryEq +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryShiftMul +public import Complexitylib.Models.RandomAccessMachine.Structured +public import Complexitylib.Models.RandomAccessMachine.Structured.Switch.Compiled +public import Complexitylib.Models.RandomAccessMachine.Structured.Hamming +public import Complexitylib.Models.RandomAccessMachine.Structured.GateEval +public import Complexitylib.Models.RandomAccessMachine.Structured.GateStep +public import Complexitylib.Models.RandomAccessMachine.Structured.GateStreamStep +public import Complexitylib.Models.RandomAccessMachine.Structured.Scanner +public import Complexitylib.Models.RandomAccessMachine.Structured.PairValidate +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary +public import Complexitylib.Models.RandomAccessMachine.Structured.LastBit +public import Complexitylib.Models.RandomAccessMachine.Structured.ThreeSATSyntax +public import Complexitylib.Models.RandomAccessMachine.Structured.UnaryDecode +public import Complexitylib.Asymptotics +public import Complexitylib.Classes.Time /-! # Random access machines (surface) @@ -306,6 +308,8 @@ transfers every `RAM.P` decider to `P`; together with the fixed sparse forward simulator this proves `RAM.RegisterStore.Machine.RAM_P_eq_P`. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Classes.lean b/Complexitylib/Models/RandomAccessMachine/Classes.lean index 9cda73b5..9fe5b01b 100644 --- a/Complexitylib/Models/RandomAccessMachine/Classes.lean +++ b/Complexitylib/Models/RandomAccessMachine/Classes.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Classes.Defs +module + +public import Complexitylib.Models.RandomAccessMachine.Classes.Defs /-! # Random-access-machine complexity classes @@ -12,6 +14,8 @@ This surface exposes the logarithmic-cost RAM time and space classes and their elementary monotonicity properties. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Classes/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Classes/Defs.lean index 811638a5..cb046418 100644 --- a/Complexitylib/Models/RandomAccessMachine/Classes/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Classes/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Defs -import Complexitylib.Asymptotics +module + +public import Complexitylib.Models.RandomAccessMachine.Defs +public import Complexitylib.Asymptotics /-! # Random-access-machine complexity classes: definitions @@ -14,6 +16,8 @@ This definitions layer places the logarithmic-cost RAM classes over the same independent of either simulation direction. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Defs.lean index e0614799..c55fd16f 100644 --- a/Complexitylib/Models/RandomAccessMachine/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Defs.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Mathlib.Data.Nat.Size -import Mathlib.Algebra.BigOperators.Finprod -import Complexitylib.Models.TuringMachine +module + +public import Mathlib.Data.Nat.Size +public import Mathlib.Algebra.BigOperators.Finprod +public import Complexitylib.Models.TuringMachine /-! # Random access machines: model and cost measures @@ -74,6 +76,8 @@ two-way simulation bounds are recorded in the surface module program, so a program need not end in `halt` and jumps may target the end. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Internal.lean index 8cff8933..7662552d 100644 --- a/Complexitylib/Models/RandomAccessMachine/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Internal.lean @@ -3,7 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Defs +module + +public import Mathlib.Tactic.Ring +public import Complexitylib.Models.RandomAccessMachine.Defs /-! # Random access machines: operational metatheory (proof internals) @@ -28,6 +31,8 @@ Not intended for human audit: the definitions in `Defs.lean` and the theorem statements in the surface module carry the mathematical content. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore.lean index a1ef0306..4bf435f1 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Defs -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Internal +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Defs +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Internal /-! # Sparse RAM register stores on Turing tapes @@ -21,6 +23,8 @@ bit-width at most `w`, a snapshot with `m` entries occupies at most `(m + 1) * (4 * w + 2)` tape cells. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Containment.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Containment.lean index a7c9fc0c..58bf5b67 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Containment.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Containment.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Containment.Internal -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Containment /-! @@ -18,6 +20,8 @@ parametric containment. Together with the sparse TM-to-RAM compiler, these establish machine-model robustness of polynomial time. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Containment/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Containment/Defs.lean index cd1d8bc0..a21dc8bf 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Containment/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Containment/Defs.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Bounds.Defs -import Mathlib.Algebra.Polynomial.Eval.Defs -import Mathlib.Tactic +public import Mathlib.Algebra.Polynomial.Eval.Defs +public import Mathlib.Tactic /-! # RAM-to-TM time-class containment -- definitions @@ -15,6 +17,8 @@ This layer fixes the twenty-work-tape concrete simulator and packages its fourth-degree resource envelope as a natural polynomial. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Containment/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Containment/Internal.lean index d6171cbb..f564a4e9 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Containment/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Containment/Internal.lean @@ -3,17 +3,19 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.P.NormalForm -import Complexitylib.Models.RandomAccessMachine.Classes -import +module + +public import Complexitylib.Classes.P.NormalForm +public import Complexitylib.Models.RandomAccessMachine.Classes +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Containment.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Bounds -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.DenseBounds -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.DenseDecision -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program /-! # RAM-to-TM time-class containment -- proof internals @@ -24,6 +26,8 @@ time. This discharges the quantitative side condition of the checked runtime envelope and lifts the simulation to deterministic polynomial time. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Defs.lean index 9de94006..29a56605 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Defs.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Mathlib.NatBits -import Complexitylib.Models.RandomAccessMachine.Defs -import Mathlib.Data.Finset.Sort +module + +public import Complexitylib.Mathlib.NatBits +public import Complexitylib.Models.RandomAccessMachine.Defs +public import Mathlib.Data.Finset.Sort /-! # Sparse RAM register stores on Turing tapes: definitions @@ -25,6 +27,8 @@ Proofs that the store operations implement functional register reads/writes and that every codec round-trips live in the internal module. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/DenseOverlay.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/DenseOverlay.lean index 4c47d18b..4cd5b06d 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/DenseOverlay.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/DenseOverlay.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.DenseOverlay.Internal /-! @@ -15,6 +17,8 @@ mutable snapshot; positive tags make explicit writes of zero distinguishable from an absent overlay entry. -/ +@[expose] public section + namespace Complexity namespace RAM namespace RegisterStore diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/DenseOverlay/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/DenseOverlay/Defs.lean index e5cbbc75..7382a22f 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/DenseOverlay/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/DenseOverlay/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Defs +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Defs /-! # Dense public input with a sparse mutable overlay -- definitions @@ -19,6 +21,8 @@ an explicit write of zero (`tag = 1`). Absent reads fall through to the dense public-input ABI `RAM.initRegs input`. -/ +@[expose] public section + namespace Complexity namespace RAM namespace RegisterStore diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/DenseOverlay/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/DenseOverlay/Internal.lean index 769f387d..333df923 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/DenseOverlay/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/DenseOverlay/Internal.lean @@ -3,14 +3,18 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.DenseOverlay.Defs -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Internal +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Internal /-! # Dense public input with a sparse mutable overlay -- proof internals -/ +@[expose] public section + namespace Complexity namespace RAM namespace RegisterStore diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Internal.lean index 3fd6a714..acba58b6 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Internal.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Defs -import Complexitylib.Models.RandomAccessMachine.Internal +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Defs +public import Complexitylib.Models.RandomAccessMachine.Internal /-! # Sparse RAM register stores on Turing tapes: proof internals @@ -13,6 +15,8 @@ This module proves the finite-store semantics and codec round trips exposed by the surface module. It is not part of the human-audited definitions layer. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/AddressEq.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/AddressEq.lean index e8bd9fca..f1f7587f 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/AddressEq.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/AddressEq.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.AddressEq.Internal -import Complexitylib.Models.TuringMachine.Hoare.Space -import Complexitylib.Models.TuringMachine.Subroutines.ClearWork +public import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.TuringMachine.Subroutines.ClearWork /-! # Decoded sparse-address equality @@ -15,6 +17,8 @@ This module exposes the framed linear-time semantics of address rewind and comparison used by the concrete sparse register-store scan. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/AddressEq/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/AddressEq/Defs.lean index 1a8f4fa2..af8bee36 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/AddressEq/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/AddressEq/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.BinaryEq.Defs +module + +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryEq.Defs /-! # Decoded sparse-address equality — definitions @@ -13,6 +15,8 @@ rewinds it and compares it against a canonical query address, writing the Boolean result on a third work tape. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/AddressEq/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/AddressEq/Internal.lean index 2b924732..56d81214 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/AddressEq/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/AddressEq/Internal.lean @@ -3,16 +3,20 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.AddressEq.Defs -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordDecode -import Complexitylib.Models.TuringMachine.Combinators.Internal.Seq -import Complexitylib.Models.TuringMachine.Internal -import Complexitylib.Models.TuringMachine.Subroutines.BinaryEq +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.AddressEq.Defs +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordDecode +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Seq +public import Complexitylib.Models.TuringMachine.Internal +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryEq /-! # Decoded sparse-address equality — proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/DenseInputLookup.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/DenseInputLookup.lean index 0567de32..cee54473 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/DenseInputLookup.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/DenseInputLookup.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.DenseInputLookup.Internal /-! @@ -13,6 +15,8 @@ This module exposes the fixed leaves used to look through a sparse tagged overlay into the immutable public-input bank. -/ +@[expose] public section + namespace Complexity namespace RAM namespace RegisterStore diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/DenseInputLookup/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/DenseInputLookup/Defs.lean index a79f5b79..e78bcee4 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/DenseInputLookup/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/DenseInputLookup/Defs.lean @@ -3,12 +3,14 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Defs -import Complexitylib.Models.TuringMachine.Combinators.WorkBranch.Defs -import Complexitylib.Models.TuringMachine.Combinators.ForInput.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred.Defs -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany.Defs +module + +public import Complexitylib.Models.RandomAccessMachine.Defs +public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch.Defs +public import Complexitylib.Models.TuringMachine.Combinators.ForInput.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany.Defs /-! # Dense public-input lookup -- definitions @@ -19,6 +21,8 @@ a binary countdown on a work tape. When that countdown first reaches zero, the preceding input symbol is copied to a canonical Boolean result tape. -/ +@[expose] public section + namespace Complexity namespace RAM namespace RegisterStore diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/DenseInputLookup/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/DenseInputLookup/Internal.lean index b47dba37..84639891 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/DenseInputLookup/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/DenseInputLookup/Internal.lean @@ -3,22 +3,26 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.DenseInputLookup.Defs -import Complexitylib.Models.TuringMachine.Combinators.WorkBranch -import Complexitylib.Models.TuringMachine.Combinators.ForInput.Internal -import Complexitylib.Models.TuringMachine.Registers -import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy -import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc -import Complexitylib.Models.TuringMachine.Subroutines.Internal -import Complexitylib.Models.TuringMachine.Tape.Encoding +public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch +public import Complexitylib.Models.TuringMachine.Combinators.ForInput.Internal +public import Complexitylib.Models.TuringMachine.Registers +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc +public import Complexitylib.Models.TuringMachine.Subroutines.Internal +public import Complexitylib.Models.TuringMachine.Tape.Encoding /-! # Dense public-input lookup -- proof internals -/ +@[expose] public section + namespace Complexity namespace RAM namespace RegisterStore diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryAppend.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryAppend.lean index f9a7cef0..e0ec9336 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryAppend.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryAppend.lean @@ -3,16 +3,20 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryAppend.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryAppend.Internal -import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.TuringMachine.Hoare.Space /-! # Sparse-entry final append -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryAppend/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryAppend/Defs.lean index 5cd5583d..b7f43790 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryAppend/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryAppend/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryReplace.Defs /-! @@ -14,6 +16,8 @@ appended using the preserved query and replacement tapes. Both sources are then restored exactly so the caller retains its canonical work frame. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryAppend/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryAppend/Internal.lean index 57d49ff0..4fdaa942 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryAppend/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryAppend/Internal.lean @@ -3,18 +3,22 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryAppend.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryEncode -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScan -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary /-! # Sparse-entry final append — proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryCleanup.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryCleanup.lean index 32144961..beb4e6cd 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryCleanup.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryCleanup.lean @@ -3,11 +3,13 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryCleanup.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryCleanup.Internal -import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.TuringMachine.Hoare.Space /-! # Sparse-entry miss cleanup @@ -16,6 +18,8 @@ This module exposes the exact invariant-restoring miss branch used by the bounded sparse register-store scan. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryCleanup/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryCleanup/Defs.lean index baad57c6..fa010e60 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryCleanup/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryCleanup/Defs.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryMatch.Defs -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany.Defs -import Mathlib.Data.List.FinRange +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany.Defs +public import Mathlib.Data.List.FinRange /-! # Sparse-entry miss cleanup — definitions @@ -16,6 +18,8 @@ scratch tapes while preserving the consumed source cursor and query address. This restores the exact invariant needed to inspect the next encoded entry. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryCleanup/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryCleanup/Internal.lean index 990386d5..d9fa3b64 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryCleanup/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryCleanup/Internal.lean @@ -3,17 +3,21 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryCleanup.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryMatch -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany -import Mathlib.Tactic.FinCases +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany +public import Mathlib.Tactic.FinCases /-! # Sparse-entry miss cleanup — proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryDecode.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryDecode.lean index b742ba71..f4fc0f09 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryDecode.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryDecode.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryDecode.Defs -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryDecode.Defs +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryDecode.Internal -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryDecode.LinearInternal /-! @@ -16,6 +18,8 @@ This module exposes the exact framed semantics of the concrete two-word sparse address/value decoder. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryDecode/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryDecode/Defs.lean index 1e6442b1..d33fdb20 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryDecode/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryDecode/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Defs -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordDecode.Defs +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Defs +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordDecode.Defs /-! # RAM sparse-entry decoder — definitions @@ -14,6 +16,8 @@ address and value. `entryDecodeTM` gives each word its own target, counter, and width tapes so the two checked word decoders compose without a clearing phase. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryDecode/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryDecode/Internal.lean index 481bf60f..b45dd1f9 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryDecode/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryDecode/Internal.lean @@ -3,15 +3,19 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryDecode.Defs -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordDecode -import Complexitylib.Models.TuringMachine.Combinators.Internal.Seq -import Complexitylib.Models.TuringMachine.Internal +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryDecode.Defs +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordDecode +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Seq +public import Complexitylib.Models.TuringMachine.Internal /-! # RAM sparse-entry decoder — proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryDecode/LinearInternal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryDecode/LinearInternal.lean index 36f9444f..db68ee13 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryDecode/LinearInternal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryDecode/LinearInternal.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryDecode.Defs -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordDecode -import Complexitylib.Models.TuringMachine.Combinators.Internal.Seq -import Complexitylib.Models.TuringMachine.Internal +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryDecode.Defs +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordDecode +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Seq +public import Complexitylib.Models.TuringMachine.Internal /-! # Linear RAM sparse-entry decoder -- proof internals @@ -16,6 +18,8 @@ The established counter tapes become markers, while the width tapes remain framed for compatibility with the existing sparse-store work-tape layout. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryEncode.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryEncode.lean index 5cda9069..940cbf0a 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryEncode.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryEncode.lean @@ -3,17 +3,21 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryEncode.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryEncode.Internal -import Complexitylib.Models.TuringMachine.Hoare.RetargetOutput -import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.TuringMachine.Hoare.RetargetOutput +public import Complexitylib.Models.TuringMachine.Hoare.Space /-! # Sparse entry emission -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryEncode/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryEncode/Defs.lean index a41f3a50..b05cb304 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryEncode/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryEncode/Defs.lean @@ -3,13 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordEncode.Defs /-! # Sparse entry emission — definitions -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryEncode/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryEncode/Internal.lean index 9db9c0b1..f8daaf28 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryEncode/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryEncode/Internal.lean @@ -3,16 +3,20 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryEncode.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordEncode -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary /-! # Sparse entry emission — proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryLookup.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryLookup.lean index 66afca8c..bd897476 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryLookup.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryLookup.lean @@ -3,17 +3,21 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryLookup.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryLookup.Internal -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Source /-! # Sparse register lookup -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryLookup/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryLookup/Defs.lean index 29f20335..a369054a 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryLookup/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryLookup/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScan.Defs /-! @@ -13,6 +15,8 @@ The bounded scanner is already the concrete lookup machine. This module names its semantic endpoint in terms of the pure sparse-store `read` operation. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryLookup/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryLookup/Internal.lean index dd5e4b0e..3105cbde 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryLookup/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryLookup/Internal.lean @@ -3,16 +3,20 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryLookup.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScan -import Mathlib.Data.Nat.Bitwise +public import Mathlib.Data.Nat.Bitwise /-! # Sparse register lookup — proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryLookupRestore.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryLookupRestore.lean index d8bb2158..0237b0c2 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryLookupRestore.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryLookupRestore.lean @@ -3,11 +3,13 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Lookup.Internal.Static -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Lookup.DenseInternal -import Complexitylib.Models.TuringMachine.Subroutines.ClearWork +public import Complexitylib.Models.TuringMachine.Subroutines.ClearWork /-! # Reusable sparse-register operand lookup @@ -18,6 +20,8 @@ semantic value out, resets every scanner-owned tape, rewinds the read-only source, restores the runtime entry count, and returns to the same scanner ABI. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMatch.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMatch.lean index 38282e55..ae1af5a7 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMatch.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMatch.lean @@ -3,11 +3,13 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryMatch.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryMatch.Internal -import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.TuringMachine.Hoare.Space /-! # RAM sparse-entry matching @@ -16,6 +18,8 @@ This module exposes the exact framed semantics of the concrete decode-and-match unit used by a bounded sparse register-store scan. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMatch/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMatch/Defs.lean index 48e830f2..f17e2266 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMatch/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMatch/Defs.lean @@ -3,11 +3,13 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.AddressEq.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryDecode.Defs -import Complexitylib.Models.TuringMachine.Registers +public import Complexitylib.Models.TuringMachine.Registers /-! # RAM sparse-entry matching — definitions @@ -17,6 +19,8 @@ It decodes one address/value entry and compares the decoded address with a preserved canonical query. The result is appended to a dedicated work tape. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMatch/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMatch/Internal.lean index 46b400eb..52c5d2a7 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMatch/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMatch/Internal.lean @@ -3,19 +3,23 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.AddressEq -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryDecode -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryMatch.Defs -import Complexitylib.Models.TuringMachine.Combinators.Internal.Seq -import Complexitylib.Models.TuringMachine.Internal +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Seq +public import Complexitylib.Models.TuringMachine.Internal /-! # RAM sparse-entry matching — proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMissCopy.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMissCopy.lean index 3e94ce1a..c65d0146 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMissCopy.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMissCopy.lean @@ -3,11 +3,13 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryMissCopy.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryMissCopy.Internal -import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.TuringMachine.Hoare.Space /-! # Sparse-entry miss copy @@ -16,6 +18,8 @@ This module exposes the update-scan branch that appends one unmatched entry to the new store and restores the exact invariant needed to inspect the next one. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMissCopy/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMissCopy/Defs.lean index 21d8608e..25142fef 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMissCopy/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMissCopy/Defs.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryCleanup.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryEncode.Defs /-! @@ -16,6 +18,8 @@ emits the decoded address/value pair to the output stream and then restores the ordinary next-entry scan invariant. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMissCopy/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMissCopy/Internal.lean index 165f68e9..81bb1921 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMissCopy/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMissCopy/Internal.lean @@ -3,17 +3,21 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryMissCopy.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryCleanup -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryEncode /-! # Sparse-entry miss copy — proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryReplace.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryReplace.lean index 607218c3..1875b3c1 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryReplace.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryReplace.lean @@ -3,16 +3,20 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryReplace.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryReplace.Internal -import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.TuringMachine.Hoare.Space /-! # Sparse-entry replacement -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryReplace/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryReplace/Defs.lean index f18b7ca2..b9423af4 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryReplace/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryReplace/Defs.lean @@ -3,11 +3,13 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryCleanup.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryEncode.Defs -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary.Defs /-! # Sparse-entry replacement — definitions @@ -17,6 +19,8 @@ canonical new-value tape, rewinds that external value source, and restores the ordinary next-entry scan invariant. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryReplace/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryReplace/Internal.lean index ba2a7716..18f4b814 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryReplace/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryReplace/Internal.lean @@ -3,18 +3,22 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryReplace.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryCleanup -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryEncode -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary /-! # Sparse-entry replacement — proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan.lean index 60a66888..2d6349ab 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan.lean @@ -3,13 +3,15 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScan.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScan.Internal.Sem -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScan.Internal.Bounds -import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.TuringMachine.Hoare.Space /-! # Bounded sparse-entry scan @@ -19,6 +21,8 @@ store scanner. The runtime entry count is read from a canonical binary tape; it is not hardwired into the finite controller. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Defs.lean index e1becb0d..543056ba 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Defs.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScanStep.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred.Defs /-! # Bounded sparse-entry scan — definitions @@ -17,6 +19,8 @@ miss restores scratch, decrements the count, and loops. Count zero halts with the blank miss result. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Internal/Bounds.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Internal/Bounds.lean index 3fc37c03..85ec6a20 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Internal/Bounds.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Internal/Bounds.lean @@ -3,13 +3,15 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryMatch.Internal -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScan.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany /-! # Encoded-length bounds for sparse-entry scans -- proof internals @@ -19,6 +21,8 @@ matching, and cleanup linear in the two words actually traversed. The final scan theorem retains only the separate binary remaining-count charge. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Internal/Ctrl.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Internal/Ctrl.lean index 8c9a21bf..3209d07f 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Internal/Ctrl.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Internal/Ctrl.lean @@ -3,14 +3,18 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScan.Defs -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic /-! # Bounded sparse-entry scan — controller internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Internal/Inv.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Internal/Inv.lean index f2815956..3779f5dc 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Internal/Inv.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Internal/Inv.lean @@ -3,17 +3,21 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScan.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScanStep -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany -import Mathlib.Tactic.FinCases +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany +public import Mathlib.Tactic.FinCases /-! # Bounded sparse-entry scan — invariant internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Internal/Sem.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Internal/Sem.lean index 0c01baa3..2cfd7268 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Internal/Sem.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Internal/Sem.lean @@ -3,17 +3,21 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScan.Internal.Ctrl -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScan.Internal.Inv -import Complexitylib.Models.TuringMachine.Combinators.WorkBranch -import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred +public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred /-! # Bounded sparse-entry scan — semantic internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScanStep.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScanStep.lean index 63993d1c..6320fc81 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScanStep.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScanStep.lean @@ -3,11 +3,13 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScanStep.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScanStep.Internal -import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.TuringMachine.Hoare.Space /-! # One bounded sparse-entry scan iteration @@ -16,6 +18,8 @@ This module exposes the compositional hit-or-next-iteration contract for one encoded sparse register-store entry. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScanStep/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScanStep/Defs.lean index cd856a3f..223cda04 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScanStep/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScanStep/Defs.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryCleanup.Defs -import Complexitylib.Models.TuringMachine.Combinators.WorkSymbolBranch.Defs +public import Complexitylib.Models.TuringMachine.Combinators.WorkSymbolBranch.Defs /-! # One bounded sparse-entry scan iteration — definitions @@ -15,6 +17,8 @@ readable equality flag, preserves the decoded value on a hit, and restores the next-iteration scratch invariant on a miss. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScanStep/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScanStep/Internal.lean index 7d16e700..e3aea645 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScanStep/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScanStep/Internal.lean @@ -3,16 +3,20 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryCleanup -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScanStep.Defs -import Complexitylib.Models.TuringMachine.Combinators.WorkSymbolBranch +public import Complexitylib.Models.TuringMachine.Combinators.WorkSymbolBranch /-! # One bounded sparse-entry scan iteration — proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate.lean index 63e1fc65..5549ebaa 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate.lean @@ -3,18 +3,20 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Internal.Out -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Internal.Sem -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.BoundsInternal -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Source -import Complexitylib.Models.TuringMachine.Hoare.Space -import Complexitylib.Models.TuringMachine.Hoare.RetargetOutput +public import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.TuringMachine.Hoare.RetargetOutput /-! # Bounded encoded sparse-store update @@ -25,6 +27,8 @@ copies misses, replaces or deletes the unique hit, and appends a fresh nonzero entry exactly when the address was absent. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/BoundsInternal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/BoundsInternal.lean index 3a578da1..58196b6e 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/BoundsInternal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/BoundsInternal.lean @@ -3,13 +3,15 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryMatch.Internal -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany /-! # Encoded-length sparse-update bounds -- proof internals @@ -19,6 +21,8 @@ at each iteration. With unary-marker decoding, each such reservation is still linear in the current entry and the instruction's query/replacement widths. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Defs.lean index 2392901c..83568fe5 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Defs.lean @@ -3,12 +3,14 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryAppend.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryMissCopy.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs /-! # Bounded encoded sparse-store update — controller definitions @@ -19,6 +21,8 @@ appending a fresh nonzero entry only when the old count is exhausted without a match. A second count tape tracks the output-store cardinality. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Ctrl.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Ctrl.lean index 25e729c7..6752ec60 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Ctrl.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Ctrl.lean @@ -3,14 +3,18 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Defs -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic /-! # Bounded encoded sparse-store update — controller internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/End.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/End.lean index b8442e7c..c5606754 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/End.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/End.lean @@ -3,13 +3,15 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Internal.Loop -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Internal.Out -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Internal.Time -import Complexitylib.Models.TuringMachine.Combinators.WorkBranch +public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch /-! # Bounded encoded sparse-store update -- terminal loop case @@ -19,6 +21,8 @@ previous hit and an absent zero write halt immediately; an absent nonzero write runs the checked append and result-count successor subroutines. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Hit.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Hit.lean index ba7119d6..bd398354 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Hit.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Hit.lean @@ -3,23 +3,25 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryCleanup -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryMatch -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryReplace -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Internal.Ctrl -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Internal.Inv -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Internal.Loop -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Internal.Out -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Internal.Time -import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred /-! # Bounded encoded sparse-store update -- matching iterations @@ -29,6 +31,8 @@ subroutines for the two branches in which the current old entry has the requested address. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Inv.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Inv.lean index 4bd0febe..16880ac8 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Inv.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Inv.lean @@ -3,12 +3,14 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Internal.Ctrl -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScan.Internal.Inv -import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc /-! # Bounded encoded sparse-store update — invariant internals @@ -18,6 +20,8 @@ particular, this file isolates the only controller-local mutation: changing the canonical zero-valued `found` tape to canonical one after a hit. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Loop.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Loop.lean index d8ba5696..081844c5 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Loop.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Loop.lean @@ -3,15 +3,19 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Progress -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Internal.Inv /-! # Bounded encoded sparse-store update — loop invariant internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Miss.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Miss.lean index 5a708836..9b744789 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Miss.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Miss.lean @@ -3,25 +3,29 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryMatch -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryMissCopy -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Internal.Ctrl -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Internal.Loop -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Internal.Out -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Internal.Time -import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred -import Mathlib.Data.Nat.Bitwise +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred +public import Mathlib.Data.Nat.Bitwise /-! # Bounded encoded sparse-store update -- unmatched entry iteration -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Out.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Out.lean index ba7faefa..4ad92791 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Out.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Out.lean @@ -3,16 +3,18 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryAppend -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryMissCopy -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryReplace -import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc /-! # Bounded encoded sparse-store update — output safety internals @@ -22,6 +24,8 @@ one-way-output machine. Its own dispatch transitions either read back or leave the output head idle, so the complete controller remains a transducer. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Sem.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Sem.lean index 4e26fe21..0d078e82 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Sem.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Sem.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Internal.Step -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Internal.End /-! @@ -17,6 +19,8 @@ store, while the loop invariant carries the processed prefix and emitted output needed to connect the concrete controller to `RegisterStore.write`. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Step.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Step.lean index 0483ac74..10512299 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Step.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Step.lean @@ -3,15 +3,19 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Internal.Hit -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Internal.Miss /-! # Bounded encoded sparse-store update -- one positive iteration -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Time.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Time.lean index b60d07f2..94ce1b6f 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Time.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Time.lean @@ -3,16 +3,18 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryMissCopy -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryReplace -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScan.Internal.Inv -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc /-! # Bounded encoded sparse-store update — static runtime bounds @@ -23,6 +25,8 @@ boundary: a ready loop invariant fixes every owned starting head, while a readable match bounds the one cursor whose endpoint is intentionally in-place. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Progress.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Progress.lean index e846efc0..1df36334 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Progress.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Progress.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Defs /-! @@ -15,6 +17,8 @@ entries already emitted by the machine, independently of the tape-level simulation proof. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Source.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Source.lean index 69a3cb5b..5f803849 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Source.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Source.lean @@ -3,12 +3,14 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScan.Defs -import Complexitylib.Models.TuringMachine.Combinators.WorkSymbolBranch.Defs -import Complexitylib.Models.TuringMachine.WorkReadOnly +public import Complexitylib.Models.TuringMachine.Combinators.WorkSymbolBranch.Defs +public import Complexitylib.Models.TuringMachine.WorkReadOnly /-! # Sparse-store update source preservation @@ -18,6 +20,8 @@ source cells. This file packages that local transition fact as a reusable read-only certificate. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Tagged.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Tagged.lean index 08ac9657..fde81efc 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Tagged.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Tagged.lean @@ -3,13 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.TaggedProof /-! # Positive-tag sparse updates -/ +@[expose] public section + namespace Complexity namespace RAM namespace RegisterStore diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/TaggedDefs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/TaggedDefs.lean index 2bd19c76..9a6f5309 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/TaggedDefs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/TaggedDefs.lean @@ -3,11 +3,13 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.DenseOverlay.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs /-! # Positive-tag sparse updates @@ -17,6 +19,8 @@ value `v + 1`. This module packages successor followed by the existing sparse update controller as one reusable write-side kernel. -/ +@[expose] public section + namespace Complexity namespace RAM namespace RegisterStore diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/TaggedProof.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/TaggedProof.lean index 734248bf..013f46c5 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/TaggedProof.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/TaggedProof.lean @@ -3,16 +3,20 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.TaggedDefs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc /-! # Positive-tag sparse updates -- proof internals -/ +@[expose] public section + namespace Complexity namespace RAM namespace RegisterStore diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction.lean index 4816e4be..cd621a4f 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction.lean @@ -3,21 +3,23 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Internal -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Direct -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Load -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Immediate -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Store -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Control -import Complexitylib.Models.TuringMachine.Hoare.RetargetOutput +public import Complexitylib.Models.TuringMachine.Hoare.RetargetOutput /-! # Concrete sparse-store arithmetic instruction kernel @@ -28,6 +30,8 @@ binary machine and the result is committed by the fixed encoded-store update controller. A redirected form writes the new store to a fresh work buffer. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Control.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Control.lean index 5edda91f..5ff8be97 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Control.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Control.lean @@ -3,14 +3,16 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryLookupRestore -import Complexitylib.Models.TuringMachine.Combinators.WorkBranch -import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary +public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary /-! # Sparse-store control instructions @@ -20,6 +22,8 @@ over the reusable sparse-lookup ABI and a disjoint canonical binary program- counter tape. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Defs.lean index 9535a8a6..1a7cbf90 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Defs.lean @@ -3,17 +3,19 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Lookup.Defs -import Complexitylib.Models.TuringMachine.Combinators.WorkBranch.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryShiftMul.Defs -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary.Defs -import Mathlib.Tactic.FinCases +public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryShiftMul.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary.Defs +public import Mathlib.Tactic.FinCases /-! # Concrete sparse-store arithmetic instruction kernel @@ -25,6 +27,8 @@ controller's replacement tape, so no value-sized bridge is hidden between the two phases. -/ +@[expose] public section + namespace Complexity namespace RAM @@ -137,7 +141,7 @@ def lhsLookupSlot (i : Fin 14) : Fin 18 := | 12 => 13 | _ => 11 -private theorem lhsLookupSlot_injective : Function.Injective lhsLookupSlot := by +theorem lhsLookupSlot_injective : Function.Injective lhsLookupSlot := by intro i j h fin_cases i <;> fin_cases j <;> simp [lhsLookupSlot] at h ⊢ @@ -165,7 +169,7 @@ def rhsLookupSlot (i : Fin 14) : Fin 18 := | 12 => 14 | _ => 11 -private theorem rhsLookupSlot_injective : Function.Injective rhsLookupSlot := by +theorem rhsLookupSlot_injective : Function.Injective rhsLookupSlot := by intro i j h fin_cases i <;> fin_cases j <;> simp [rhsLookupSlot] at h ⊢ @@ -274,7 +278,7 @@ def indirectLoadLookupSlot (i : Fin 14) : Fin 18 := | 12 => 10 | _ => 11 -private theorem indirectLoadLookupSlot_injective : +theorem indirectLoadLookupSlot_injective : Function.Injective indirectLoadLookupSlot := by intro i j h fin_cases i <;> fin_cases j <;> simp [indirectLoadLookupSlot] at h ⊢ @@ -316,7 +320,7 @@ def mulSlot (i : Fin 6) : Fin 18 := | 4 => 16 | _ => 17 -private theorem mulSlot_injective : Function.Injective mulSlot := by +theorem mulSlot_injective : Function.Injective mulSlot := by intro i j hij fin_cases i <;> fin_cases j <;> simp [mulSlot] at hij ⊢ diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Dense.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Dense.lean index 6c2c0b66..a819bf68 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Dense.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Dense.lean @@ -3,15 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.DenseControl -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.DenseDirect -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.DenseImm -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.DenseLoad -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.DenseStore /-! @@ -20,3 +22,5 @@ import This module collects the concrete positive-tag instruction simulators and their exact Hoare/time contracts. -/ + +@[expose] public section diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseControl.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseControl.lean index 688607fa..c92c24ea 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseControl.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseControl.lean @@ -3,15 +3,19 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.DenseDefs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Control /-! # Dense-overlay control instructions -/ +@[expose] public section + namespace Complexity namespace RAM namespace RegisterStore diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseCtrlSim.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseCtrlSim.lean index 1005277e..07178c32 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseCtrlSim.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseCtrlSim.lean @@ -3,17 +3,21 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.DenseControl -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.DenseSimDefs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Sim.Control /-! # Dense-overlay control-instruction simulation -/ +@[expose] public section + namespace Complexity namespace RAM namespace RegisterStore diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseDefs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseDefs.lean index 19627964..454fce7e 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseDefs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseDefs.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.TaggedDefs /-! @@ -16,6 +18,8 @@ the immutable public input in place. Reads use the dense-overlay lookup and writes successor-tag their actual value before sparse update. -/ +@[expose] public section + namespace Complexity namespace RAM namespace RegisterStore diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseDirect.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseDirect.lean index 37caacd4..95623282 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseDirect.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseDirect.lean @@ -3,17 +3,21 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.DenseDefs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Direct -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Tagged /-! # Dense-overlay direct arithmetic instructions -/ +@[expose] public section + namespace Complexity namespace RAM namespace RegisterStore diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseDispatch.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseDispatch.lean index 2362af4f..43e65013 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseDispatch.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseDispatch.lean @@ -3,20 +3,24 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.DenseSim -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.DenseOverlay -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.DenseOverlay +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Sim.Internal -import Complexitylib.Models.TuringMachine.Combinators.WorkBranch -import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy -import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary +public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary /-! # Fixed-program dense-overlay dispatch -/ +@[expose] public section + namespace Complexity namespace RAM namespace RegisterStore diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseImm.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseImm.lean index 81249a26..029421ca 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseImm.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseImm.lean @@ -3,17 +3,21 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.DenseDefs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Immediate -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Tagged /-! # Dense-overlay immediate instruction -/ +@[expose] public section + namespace Complexity namespace RAM namespace RegisterStore diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseLoad.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseLoad.lean index 4031382f..dedfaf59 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseLoad.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseLoad.lean @@ -3,17 +3,21 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.DenseDefs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Load -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Tagged /-! # Dense-overlay indirect load -/ +@[expose] public section + namespace Complexity namespace RAM namespace RegisterStore diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseSim.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseSim.lean index b72c4689..561ef5a5 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseSim.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseSim.lean @@ -3,15 +3,19 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.DenseCtrlSim -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.DenseSimData /-! # Dense-overlay instruction simulation -/ +@[expose] public section + namespace Complexity namespace RAM namespace RegisterStore diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseSimData.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseSimData.lean index 864bfde6..3692314d 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseSimData.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseSimData.lean @@ -3,17 +3,21 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Dense -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.DenseSimDefs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Sim.Data /-! # Dense-overlay data-instruction simulation -/ +@[expose] public section + namespace Complexity namespace RAM namespace RegisterStore @@ -229,7 +233,7 @@ theorem denseExecuteInstructionTM_imm_hoareTime_frame /-- Instruction constructor corresponding to a dense direct arithmetic kernel. -/ -private def denseDirectInstruction (op : BinaryInstrOp) +def denseDirectInstruction (op : BinaryInstrOp) (destination source₀ source₁ : ℕ) : Instr := match op with | .add => .add destination source₀ source₁ diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseSimDefs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseSimDefs.lean index 43ecf8bd..5e9d9d0d 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseSimDefs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseSimDefs.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.DenseDefs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Sim.Defs /-! @@ -15,6 +17,8 @@ These definitions connect the dense instruction kernels to the existing fixed-program selector and representation-independent buffered cleanup pass. -/ +@[expose] public section + namespace Complexity namespace RAM namespace RegisterStore diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseStore.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseStore.lean index 393d56a7..972d3e43 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseStore.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseStore.lean @@ -3,14 +3,18 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.DenseDirect -import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy /-! # Dense-overlay indirect store -/ +@[expose] public section + namespace Complexity namespace RAM namespace RegisterStore diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Direct.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Direct.lean index 229a4d2f..614a4be5 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Direct.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Direct.lean @@ -3,16 +3,20 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Internal -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryLookupRestore -import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst /-! # Direct sparse-store arithmetic instructions -- proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Dispatch.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Dispatch.lean index c2fec7c2..53cc4c72 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Dispatch.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Dispatch.lean @@ -3,20 +3,22 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Sim.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Sim.Control -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Sim.Data -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Sim.Internal -import Complexitylib.Models.TuringMachine.Combinators.WorkBranch -import Complexitylib.Models.TuringMachine.Hoare.Space -import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy -import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred +public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch +public import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred /-! # Fixed-program sparse RAM dispatch @@ -28,6 +30,8 @@ all-prefix space certificates; semantic selection is proved in the internal execution layer. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Immediate.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Immediate.lean index c98f1465..d07440f6 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Immediate.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Immediate.lean @@ -3,14 +3,18 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Internal -import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst /-! # Immediate sparse-store instructions -- proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Internal.lean index 200ad5c0..e2d8f143 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Internal.lean @@ -3,18 +3,22 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub -import Complexitylib.Models.TuringMachine.Subroutines.BinaryShiftMul +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryShiftMul /-! # Concrete sparse-store arithmetic instruction kernel -- proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Load.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Load.lean index 89b06ba0..3f5cc179 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Load.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Load.lean @@ -3,16 +3,20 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Internal -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryLookupRestore -import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst /-! # Indirect sparse-store load instructions -- proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Sim/Control.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Sim/Control.lean index d307c630..65d700a1 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Sim/Control.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Sim/Control.lean @@ -3,16 +3,20 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Sim.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction -import Complexitylib.Models.TuringMachine.Subroutines.CopyWorkOutput +public import Complexitylib.Models.TuringMachine.Subroutines.CopyWorkOutput /-! # Uniform next-store buffering for control instructions -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Sim/Data.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Sim/Data.lean index 4d1e3bb1..67820de8 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Sim/Data.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Sim/Data.lean @@ -3,16 +3,20 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Sim.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction -import Complexitylib.Models.TuringMachine.Hoare.RetargetOutput +public import Complexitylib.Models.TuringMachine.Hoare.RetargetOutput /-! # Uniform next-store buffering for data instructions -/ +@[expose] public section + namespace Complexity namespace RAM @@ -543,7 +547,7 @@ private theorem retargetDataKernel_hoareTime_frame_internal dataTM dataTime Result hready hbase hresult /-- Instruction constructor corresponding to a direct arithmetic kernel. -/ -private def directInstruction (op : BinaryInstrOp) (destination source₀ +def directInstruction (op : BinaryInstrOp) (destination source₀ source₁ : ℕ) : Instr := match op with | .add => .add destination source₀ source₁ diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Sim/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Sim/Defs.lean index 80701640..f878db02 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Sim/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Sim/Defs.lean @@ -3,14 +3,16 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Defs -import Complexitylib.Models.TuringMachine.Combinators.WorkBranch.Defs -import Complexitylib.Models.TuringMachine.Lift -import Complexitylib.Models.TuringMachine.Subroutines -import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred.Defs -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany.Defs +public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch.Defs +public import Complexitylib.Models.TuringMachine.Lift +public import Complexitylib.Models.TuringMachine.Subroutines +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany.Defs /-! # Fixed-program sparse RAM instruction dispatch -- definitions @@ -21,6 +23,8 @@ store there. A binary copy of the program counter is then decremented through a fixed finite branch tree, so the resulting TM depends only on the RAM program. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Sim/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Sim/Internal.lean index 16b88a10..746c5e9f 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Sim/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Sim/Internal.lean @@ -3,21 +3,25 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Sim.Defs -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore -import Complexitylib.Models.TuringMachine.Combinators.WorkBranch -import Complexitylib.Models.TuringMachine.Hoare.Space -import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy -import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore +public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch +public import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany /-! # Fixed-program dispatch -- proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Store.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Store.lean index 58ff3418..16aff0be 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Store.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Store.lean @@ -3,14 +3,18 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Direct -import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy /-! # Indirect sparse-store instructions -- proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Defs.lean index 9071701c..c36716b0 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Defs.lean @@ -3,17 +3,19 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryLookup.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.DenseInputLookup.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.DenseOverlay.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst.Defs -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary.Defs -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany.Defs -import Mathlib.Tactic.FinCases +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany.Defs +public import Mathlib.Tactic.FinCases /-! # Reusable sparse-register operand lookup -- definitions @@ -24,6 +26,8 @@ canonical source, scans the encoded store, copies out the decoded value, resets all scanner scratch, rewinds the source, and restores the runtime entry count. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/DenseInternal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/DenseInternal.lean index e0475dad..ed9d853a 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/DenseInternal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/DenseInternal.lean @@ -3,16 +3,20 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Lookup.Internal.Static -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.DenseInputLookup.Internal -import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred /-! # Dense overlay lookup -- proof internals -/ +@[expose] public section + namespace Complexity namespace RAM namespace RegisterStore diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Assemble.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Assemble.lean index 9cd0c534..ad063740 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Assemble.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Assemble.lean @@ -3,15 +3,19 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Lookup.Internal.Prepare -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Lookup.Internal.Restore /-! # Reusable sparse-register lookup -- phase assembly -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Bounds.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Bounds.lean index a5aebcaf..dbd5d3e2 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Bounds.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Bounds.lean @@ -3,13 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Lookup.Defs /-! # Reusable sparse-register lookup -- reset bounds -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Prepare.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Prepare.lean index 89a58a33..1f228f4e 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Prepare.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Prepare.lean @@ -3,14 +3,18 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Lookup.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy /-! # Reusable sparse-register lookup -- query preparation -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Reset.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Reset.lean index ab0356b6..8faa1ac8 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Reset.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Reset.lean @@ -3,16 +3,20 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryLookup -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Lookup.Internal.Bounds -import Mathlib.Tactic.FinCases +public import Mathlib.Tactic.FinCases /-! # Reusable sparse-register lookup -- reset certificates -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Restore.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Restore.lean index ca46d557..af4ddc05 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Restore.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Restore.lean @@ -3,14 +3,18 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Lookup.Internal.Value -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany /-! # Reusable sparse-register lookup -- scanner restoration -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Scan.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Scan.lean index 80dca499..5c9e1671 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Scan.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Scan.lean @@ -3,15 +3,19 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryLookup -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Lookup.Internal.Reset /-! # Reusable sparse-register lookup -- bounded scan phase -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Static.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Static.lean index 3a121611..e348d969 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Static.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Static.lean @@ -3,15 +3,19 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Lookup.Internal.Assemble -import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary /-! # Fixed-address sparse-register lookup -- proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Value.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Value.lean index da2deb2e..e2c33686 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Value.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Value.lean @@ -3,14 +3,18 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Lookup.Internal.Scan -import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy /-! # Reusable sparse-register lookup -- value rewind and copy -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program.lean index f09fe595..308fd42e 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Internal /-! @@ -16,6 +18,8 @@ finite decrementing selector, restores its scratch, and writes `1` exactly when the selected instruction is `halt`. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Bounds.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Bounds.lean index f8e4fbe2..5f9c2170 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Bounds.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Bounds.lean @@ -3,15 +3,19 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Bounds.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Bounds.Internal /-! # Sparse RAM decision-machine resource bounds -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Bounds/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Bounds/Defs.lean index d5791708..24e3788d 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Bounds/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Bounds/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Decision.Defs /-! @@ -18,6 +20,8 @@ class-transfer theorem independent of low-level controller constants while still recording a genuine polynomial simulation. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Bounds/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Bounds/Internal.lean index 38895eab..6bfb6aea 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Bounds/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Bounds/Internal.lean @@ -3,17 +3,21 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Bounds.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Decision -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany -import Mathlib.Tactic.Linarith +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany +public import Mathlib.Tactic.Linarith /-! # Sparse RAM decision-machine resource-bound proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Decision.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Decision.lean index c265bd81..ca24bc3d 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Decision.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Decision.lean @@ -3,15 +3,19 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Decision.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.DecisionInternal /-! # Complete sparse RAM decision machine -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Decision/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Decision/Defs.lean index 540e4175..ebf2ae1d 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Decision/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Decision/Defs.lean @@ -3,13 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Init.Defs /-! # Complete sparse RAM decision machine -- definitions -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DecisionInternal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DecisionInternal.lean index 7f2b069f..d942f44a 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DecisionInternal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DecisionInternal.lean @@ -3,15 +3,19 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Decision.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Init.Internal /-! # Complete sparse RAM decision-machine proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Defs.lean index b33026fb..11bd47b2 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Defs.lean @@ -3,12 +3,14 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Sim.Defs -import Complexitylib.Models.TuringMachine.Combinators.WorkBranch.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred.Defs -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary.Defs +public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary.Defs /-! # Sparse RAM program controller -- definitions @@ -19,6 +21,8 @@ walks the same decrementing finite branch tree as instruction dispatch, and writes `1` exactly for a selected `halt`; every continuing branch writes blank. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Dense.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Dense.lean index df70378a..309c1527 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Dense.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Dense.lean @@ -3,15 +3,19 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.DenseDefs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.DenseInternal /-! # Dense-overlay RAM program controller -/ +@[expose] public section + namespace Complexity namespace RAM namespace RegisterStore diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseBounds.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseBounds.lean index cc21c3e6..b10d2fac 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseBounds.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseBounds.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.DenseBoundsDefs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.DenseBoundsProof /-! @@ -16,6 +18,8 @@ quadratic loop bound, and the complete quadratic decision bound for the optimized dense-input RAM simulator. -/ +@[expose] public section + namespace Complexity namespace RAM namespace RegisterStore diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseBoundsDefs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseBoundsDefs.lean index b683112f..e0f1a16c 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseBoundsDefs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseBoundsDefs.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Bounds.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.DenseDecisionDefs /-! @@ -16,6 +18,8 @@ width charged by the instruction actually selected at the current program counter. This is the local product that sums quadratically over a run. -/ +@[expose] public section + namespace Complexity namespace RAM namespace RegisterStore diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseBoundsProof.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseBoundsProof.lean index ff60c0a5..45990b01 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseBoundsProof.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseBoundsProof.lean @@ -3,23 +3,27 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.DenseBoundsDefs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Bounds -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScan -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.DenseInputLookup -import Mathlib.Algebra.Order.BigOperators.Group.Finset -import Mathlib.Tactic.Linarith +public import Mathlib.Algebra.Order.BigOperators.Group.Finset +public import Mathlib.Tactic.Linarith /-! # Dense-overlay RAM decision-machine resource-bound proof internals -/ +@[expose] public section + namespace Complexity namespace RAM namespace RegisterStore diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseDecision.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseDecision.lean index 5eee257f..5dcd53ce 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseDecision.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseDecision.lean @@ -3,15 +3,19 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.DenseDecisionDefs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.DenseDecisionProof /-! # Complete dense-overlay RAM decision machine -/ +@[expose] public section + namespace Complexity namespace RAM namespace RegisterStore diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseDecisionDefs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseDecisionDefs.lean index db11c39c..b97b4df1 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseDecisionDefs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseDecisionDefs.lean @@ -3,15 +3,19 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.DenseDefs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.DenseInitDefs /-! # Complete dense-overlay RAM decision machine -- definitions -/ +@[expose] public section + namespace Complexity namespace RAM namespace RegisterStore diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseDecisionProof.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseDecisionProof.lean index 3d2fedfb..25ed472f 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseDecisionProof.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseDecisionProof.lean @@ -3,17 +3,21 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.DenseDecisionDefs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.DenseInitProof -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.DenseInternal /-! # Complete dense-overlay RAM decision-machine proof internals -/ +@[expose] public section + namespace Complexity namespace RAM namespace RegisterStore diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseDefs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseDefs.lean index af6a3419..6f39db03 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseDefs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseDefs.lean @@ -3,15 +3,19 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.DenseDispatch -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Defs /-! # Dense-overlay RAM program controller -- definitions -/ +@[expose] public section + namespace Complexity namespace RAM namespace RegisterStore diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseInit.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseInit.lean index 72ab6cfa..6fb11e7c 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseInit.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseInit.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.DenseInitDefs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.DenseInitProof /-! @@ -16,6 +18,8 @@ materializes only the positive-tagged length register, installs the reusable program ABI, and rewinds the input for dense fallback reads. -/ +@[expose] public section + namespace Complexity namespace RAM namespace RegisterStore diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseInitDefs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseInitDefs.lean index f31f3fa3..2d86479b 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseInitDefs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseInitDefs.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Init.Defs -import Complexitylib.Models.TuringMachine.Subroutines +public import Complexitylib.Models.TuringMachine.Subroutines /-! # Dense-overlay public-input initialization -- definitions @@ -15,6 +17,8 @@ the tagged `R₀` overlay entry. It then installs the ordinary sparse scanner AB and rewinds the real input for dense fallback reads. -/ +@[expose] public section + namespace Complexity namespace RAM namespace RegisterStore diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseInitProof.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseInitProof.lean index 277f89c1..22222e73 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseInitProof.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseInitProof.lean @@ -3,16 +3,20 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.DenseInitDefs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Init.Internal -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.DenseOverlay +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.DenseOverlay /-! # Dense-overlay public-input initialization -- proofs -/ +@[expose] public section + namespace Complexity namespace RAM namespace RegisterStore diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseInternal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseInternal.lean index 1f8d28b7..fcf1db2d 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseInternal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseInternal.lean @@ -3,15 +3,19 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.DenseDefs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program /-! # Dense-overlay RAM program controller -- proof internals -/ +@[expose] public section + namespace Complexity namespace RAM namespace RegisterStore diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Init/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Init/Defs.lean index 6ae55b52..5fb92031 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Init/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Init/Defs.lean @@ -3,16 +3,18 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryEncode.Defs -import Complexitylib.Models.TuringMachine.Combinators.WorkBranch.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary.Defs -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany.Defs +public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany.Defs /-! # Sparse RAM public-input initialization definitions @@ -24,6 +26,8 @@ appends the nonzero length register `R₀`. The resulting order need not equal RAM register file. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Init/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Init/Internal.lean index 12327e53..c9f271f1 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Init/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Init/Internal.lean @@ -3,27 +3,31 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Init.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryEncode -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Internal -import Complexitylib.Models.TuringMachine.Combinators.WorkBranch -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -import Complexitylib.Models.TuringMachine.Hoare.RetargetOutput -import Complexitylib.Models.TuringMachine.Internal -import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy -import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany -import Complexitylib.Models.TuringMachine.Subroutines.Internal +public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +public import Complexitylib.Models.TuringMachine.Hoare.RetargetOutput +public import Complexitylib.Models.TuringMachine.Internal +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany +public import Complexitylib.Models.TuringMachine.Subroutines.Internal /-! # Sparse RAM public-input initialization -- proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Initialization.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Initialization.lean index 25b52fa0..34460c01 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Initialization.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Initialization.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Init.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Init.Internal /-! @@ -16,6 +18,8 @@ sparse store, installs the optional length register, and produces the exact clean work-tape image consumed by the reusable RAM program controller. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Internal.lean index a3c5c86a..4020dc88 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Internal.lean @@ -3,19 +3,23 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Dispatch -import Complexitylib.Models.TuringMachine.Combinators.WorkBranch -import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy -import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary +public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary /-! # Sparse RAM program controller -- proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordDecode.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordDecode.lean index 1a0590ed..97f72247 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordDecode.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordDecode.lean @@ -3,12 +3,14 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordDecode.Defs -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordDecode.Internal -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordDecode.Defs +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordDecode.Internal +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordDecode.LinearInternal -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Defs -import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Defs +public import Complexitylib.Models.TuringMachine.Hoare.Space /-! # RAM snapshot word-width decoder @@ -19,6 +21,8 @@ zero separator and leaves the unary-prefix length as a canonical binary natural on a separate work tape. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordDecode/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordDecode/Defs.lean index 0606fe6d..5c8ad3dc 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordDecode/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordDecode/Defs.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.ForWorkOnes.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs +module + +public import Complexitylib.Models.TuringMachine.Combinators.ForWorkOnes.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs /-! # RAM snapshot word-width decoder — definitions @@ -17,6 +19,8 @@ per `1`. The source head stops on the zero separator, ready for the payload copy phase. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordDecode/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordDecode/Internal.lean index f20e8e2d..58e2f125 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordDecode/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordDecode/Internal.lean @@ -3,12 +3,14 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordDecode.Defs -import Complexitylib.Models.TuringMachine.Combinators.ForWorkOnes.Internal -import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc -import Complexitylib.Models.TuringMachine.Subroutines.Internal -import Mathlib.Tactic.Linarith +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordDecode.Defs +public import Complexitylib.Models.TuringMachine.Combinators.ForWorkOnes.Internal +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc +public import Complexitylib.Models.TuringMachine.Subroutines.Internal +public import Mathlib.Tactic.Linarith /-! # RAM snapshot word-width decoder — proof internals @@ -18,6 +20,8 @@ needed by `TM.ForWorkOnesLoopSpec`. The only changed tapes are the source cursor and the canonical binary width counter. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordDecode/LinearInternal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordDecode/LinearInternal.lean index c69d70f3..0dde1aeb 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordDecode/LinearInternal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordDecode/LinearInternal.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordDecode.Defs -import Complexitylib.Models.TuringMachine.Internal -import Complexitylib.Models.TuringMachine.Tape.Encoding +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordDecode.Defs +public import Complexitylib.Models.TuringMachine.Internal +public import Complexitylib.Models.TuringMachine.Tape.Encoding /-! # Linear RAM snapshot word decoder — proof internals @@ -15,6 +17,8 @@ the unary width to a marker tape, rewind those markers, then consume one marker while copying one payload bit. Each pass is linear in the encoded word width. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordEncode.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordEncode.lean index acb81347..6b0deb72 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordEncode.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordEncode.lean @@ -3,16 +3,20 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordEncode.Defs -import +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordEncode.Internal -import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.TuringMachine.Hoare.Space /-! # Self-delimiting word emission -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordEncode/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordEncode/Defs.lean index 24057cf5..76847a7a 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordEncode/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordEncode/Defs.lean @@ -3,12 +3,14 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Defs -import Complexitylib.Models.TuringMachine.Combinators -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary.Defs -import Complexitylib.Models.TuringMachine.Tape.Encoding +public import Complexitylib.Models.TuringMachine.Combinators +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary.Defs +public import Complexitylib.Models.TuringMachine.Tape.Encoding /-! # Self-delimiting word emission — definitions @@ -18,6 +20,8 @@ work-tape pass either emits one unary width mark per source bit or copies the payload bits themselves. `wordEncodeTM` composes those passes around a rewind. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordEncode/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordEncode/Internal.lean index 40a3dd83..d70b52c6 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordEncode/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordEncode/Internal.lean @@ -3,16 +3,20 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordEncode.Defs -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -import Complexitylib.Models.TuringMachine.Hoare -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +public import Complexitylib.Models.TuringMachine.Hoare +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary /-! # Self-delimiting word emission — proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig.lean index 39aed6c8..c1b1a3da 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Defs -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Internal +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Defs +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Internal /-! # Bounded Turing-machine configurations in RAM registers @@ -15,6 +17,8 @@ simulation. The register layout is explicit, blank cells use value zero, and information. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Defs.lean index e5c75410..cf82a9eb 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Defs.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Defs -import Mathlib.Data.Fintype.Sum -import Mathlib.Logic.Equiv.Fin.Basic +module + +public import Complexitylib.Models.RandomAccessMachine.Defs +public import Mathlib.Data.Fintype.Sum +public import Mathlib.Logic.Equiv.Fin.Basic /-! # Bounded Turing-machine configurations in RAM registers @@ -19,6 +21,8 @@ Blank symbols use code zero. Consequently registers outside the representation and blank cells inside it agree with the RAM's finite-support convention. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Internal.lean index dfbed1e5..3d7bf3d7 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Internal.lean @@ -3,12 +3,16 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Defs +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Defs /-! # Bounded Turing-machine configuration encoding -- proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse.lean index d209dc71..74e225fc 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Defs -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Internal +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Defs +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Internal /-! # Sparse unbounded TM configurations in RAM registers @@ -14,6 +16,8 @@ simulation. Unlike the bounded dense layout, its addresses do not depend on an input length or running-time bound. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI.lean index 45cb00ef..18fe41c2 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.ABI.Defs -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.ABI.Internal.Resources +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.ABI.Defs +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.ABI.Internal.Resources /-! # Public RAM ABI for the fixed sparse TM simulator @@ -17,6 +19,8 @@ the fixed sparse simulator to a halted TM configuration and returns a public Boolean verdict in `R₀`. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Defs.lean index 586888f4..6c329dc1 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Defs +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Defs /-! # Public RAM input/output ABI for the sparse TM simulator @@ -16,6 +18,8 @@ old prefix, repairs those six statically remembered bits, and initializes the state, heads, and left-end markers. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Capture.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Capture.lean index be856645..d223d6e8 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Capture.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Capture.lean @@ -3,13 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.ABI.Defs -import Complexitylib.Models.RandomAccessMachine.Structured.Internal +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.ABI.Defs +public import Complexitylib.Models.RandomAccessMachine.Structured.Internal /-! # Capturing raw-input scratch bits in finite control -- proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Decision.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Decision.lean index 968abac4..5dd84e0d 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Decision.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Decision.lean @@ -3,14 +3,18 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.ABI.Internal.Marshal -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal.Iteration -import Complexitylib.Models.RandomAccessMachine.Structured +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.ABI.Internal.Marshal +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal.Iteration +public import Complexitylib.Models.RandomAccessMachine.Structured /-! # End-to-end public-ABI sparse simulation -- proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Loop.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Loop.lean index b4bb43b2..99b8f77e 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Loop.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Loop.lean @@ -3,13 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.ABI.Internal.Capture -import Complexitylib.Models.RandomAccessMachine.Structured.Internal.Resources +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.ABI.Internal.Capture +public import Complexitylib.Models.RandomAccessMachine.Structured.Internal.Resources /-! # Backward public-input copy -- proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Marshal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Marshal.lean index 3028c838..9deff6c1 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Marshal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Marshal.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.ABI.Internal.Loop -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Internal +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.ABI.Internal.Loop +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Internal /-! # Public-input marshalling correctness -- proof internals @@ -14,6 +16,8 @@ the finitely many captured scratch positions, and establishes the complete sparse representation of the Turing machine's initial configuration. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Resources.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Resources.lean index 051f5b35..5a03cd96 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Resources.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Resources.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.ABI.Internal.Decision -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal.Resources +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.ABI.Internal.Decision +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal.Resources /-! # Resource bounds for the public sparse-simulator ABI -- proof internals @@ -16,6 +18,8 @@ support. The first captured-position repair reloads that scratch register from the sparse data region, returning to the core envelope before simulation. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Containment.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Containment.lean index ba425001..1cadb11a 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Containment.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Containment.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Containment.Internal +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Containment.Internal /-! # TM-to-RAM time-class containment @@ -13,6 +15,8 @@ logarithmic-cost RAM deciders through the public input/output ABI. Polynomial Turing time is therefore contained in polynomial RAM time. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Containment/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Containment/Internal.lean index 3024b9c5..68049fad 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Containment/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Containment/Internal.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.P.NormalForm -import Complexitylib.Models.RandomAccessMachine.Classes.Defs -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.ABI +module + +public import Complexitylib.Classes.P.NormalForm +public import Complexitylib.Models.RandomAccessMachine.Classes.Defs +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.ABI /-! # TM-to-RAM time-class containment -- proof internals @@ -15,6 +17,8 @@ to deciders and then discharges the polynomial-bound arithmetic needed for the forward machine-model robustness theorem. -/ +@[expose] public section + namespace Complexity namespace RAM @@ -58,7 +62,7 @@ theorem mem_DTIME_of_decidesInTime_internal compiledDecision_decidesInTime_internal hdecides, BigO.refl _⟩ /-- Pointwise domination by the evaluation of a natural polynomial. -/ -private def PolyBound (f : ℕ → ℕ) : Prop := +def PolyBound (f : ℕ → ℕ) : Prop := ∃ p : Polynomial ℕ, ∀ inputLength, f inputLength ≤ p.eval inputLength namespace PolyBound @@ -99,7 +103,7 @@ theorem eval (p : Polynomial ℕ) : PolyBound (fun inputLength => p.eval inputLength) := ⟨p, fun _ => le_rfl⟩ -private theorem size_le_self (value : ℕ) : value.size ≤ value := by +theorem size_le_self (value : ℕ) : value.size ≤ value := by rw [Nat.size_le] exact Nat.lt_pow_self (by decide) diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Defs.lean index a6da0c23..d0e08c6c 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Defs -import Complexitylib.Models.RandomAccessMachine.Structured.Defs +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Defs +public import Complexitylib.Models.RandomAccessMachine.Structured.Defs /-! # Sparse unbounded TM configurations in RAM registers @@ -17,6 +19,8 @@ compute every cell address using multiplication and addition while allocating new tape positions on demand. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Internal.lean index 1dd780e6..18f2e80d 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Internal.lean @@ -3,13 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Defs -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Internal +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Defs +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Internal /-! # Sparse unbounded TM configuration encoding -- proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step.lean index d7db5944..933e7b6e 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Defs -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal -import Complexitylib.Models.RandomAccessMachine.Structured -import Complexitylib.Asymptotics +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Defs +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal +public import Complexitylib.Models.RandomAccessMachine.Structured +public import Complexitylib.Asymptotics /-! # A fixed sparse-RAM block for one Turing-machine transition @@ -19,6 +21,8 @@ RAM execution are checked. The separate `Sparse.ABI` surface supplies the public input/output marshalling layer. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Defs.lean index edbf417b..7d6c0042 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Defs -import Complexitylib.Models.RandomAccessMachine.Structured.Switch.Defs +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Defs +public import Complexitylib.Models.RandomAccessMachine.Structured.Switch.Defs /-! # A fixed sparse-RAM block for one Turing-machine transition @@ -15,6 +17,8 @@ It computes an interleaved tape-cell address as an unbounded computation. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal.lean index ce32ba38..25e14870 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal.lean @@ -3,12 +3,14 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal.Layout -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal.Load -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal.Action -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal.Dispatch -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal.Iteration -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal.Resources +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal.Layout +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal.Load +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal.Action +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal.Dispatch +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal.Iteration +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal.Resources /-! # Fixed sparse TM-transition block -- proof internals @@ -16,3 +18,5 @@ import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step. This aggregation module collects the checked semantic and resource layers of the uniform sparse transition block. -/ + +@[expose] public section diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Action.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Action.lean index 932d726f..d726ed72 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Action.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Action.lean @@ -3,13 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal.Load -import Complexitylib.Models.RandomAccessMachine.Structured.Internal.Resources +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal.Load +public import Complexitylib.Models.RandomAccessMachine.Structured.Internal.Resources /-! # Selected sparse TM transition actions -- proof internals -/ +@[expose] public section + namespace Complexity namespace RAM @@ -28,7 +32,7 @@ private theorem execList_append (first second : List Structured.Basic) | cons op rest ih => simp [Structured.Basic.execList, ih] /-- Representation restricted to one named sparse tape. -/ -private def RepresentsTape (slot : Fin (n + 2)) +def RepresentsTape (slot : Fin (n + 2)) (tape : Tape) (store : Structured.Store) : Prop := store (headReg slot) = tape.head ∧ ∀ position, store (cellReg n slot position) = @@ -332,7 +336,7 @@ theorem writeMoveOps_otherTape_internal {tm : TM n} hcellWritten] exact hother.2 position -private theorem RepresentsTape.stateUpdate (slot : Fin (n + 2)) +theorem RepresentsTape.stateUpdate (slot : Fin (n + 2)) (tape : Tape) (store : Structured.Store) (state : ℕ) (hrepresents : RepresentsTape slot tape store) : RepresentsTape slot tape @@ -803,11 +807,13 @@ theorem actionOps_represents_internal {tm : TM n} initialized, afterInput, afterWork, final, execList_append, Structured.Basic.execList, List.append_assoc] using hfinalRepresents -private abbrev ResourceEnvelope (tm : TM n) (bound : ℕ) := +@[nolint docBlame] +abbrev ResourceEnvelope (tm : TM n) (bound : ℕ) := Structured.Internal.StoreEnvelope (registerBound n (bound + 1)) (wordBound tm bound) -private abbrev ResourceEnvelopeChain (tm : TM n) (bound : ℕ) := +@[nolint docBlame] +abbrev ResourceEnvelopeChain (tm : TM n) (bound : ℕ) := Structured.Internal.Basic.EnvelopeChain (registerBound n (bound + 1)) (wordBound tm bound) diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Dispatch.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Dispatch.lean index 492f7fb7..a0a64dca 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Dispatch.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Dispatch.lean @@ -3,13 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal.Action -import Complexitylib.Models.RandomAccessMachine.Structured.Switch +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal.Action +public import Complexitylib.Models.RandomAccessMachine.Structured.Switch /-! # Nested finite dispatch for the fixed sparse TM transition -- proof internals -/ +@[expose] public section + namespace Complexity namespace RAM @@ -19,7 +23,7 @@ namespace TMConfig namespace Sparse -private theorem cleared_represents {tm : TM n} {test : ℕ} +theorem cleared_represents {tm : TM n} {test : ℕ} {cfg : Complexity.Cfg n tm.Q} {store : Structured.Store} (hrepresents : Represents tm cfg store) (hlow : n + 3 ≤ test) (hhigh : test < cellBase n) : @@ -31,14 +35,14 @@ private theorem cleared_apply_of_ne (store : Structured.Store) {test reg : ℕ} Structured.Switch.cleared store test reg = store reg := by simp [Structured.Switch.cleared, Function.update_of_ne hne] -private theorem symbolReg_injective (n : ℕ) : +theorem symbolReg_injective (n : ℕ) : Function.Injective (symbolReg n) := by intro first second heq apply Fin.ext simp [symbolReg] at heq omega -private theorem symbolReg_ne_one (n : ℕ) (tape : Fin (n + 2)) : +theorem symbolReg_ne_one (n : ℕ) (tape : Fin (n + 2)) : symbolReg n tape ≠ oneReg n := by simp [symbolReg, oneReg] omega @@ -47,13 +51,13 @@ private theorem stateScratchReg_ne_one (n : ℕ) : stateScratchReg n ≠ oneReg n := by simp [stateScratchReg, oneReg] -private theorem stateScratchReg_ne_symbolReg (n : ℕ) +theorem stateScratchReg_ne_symbolReg (n : ℕ) (tape : Fin (n + 2)) : symbolReg n tape ≠ stateScratchReg n := by simp [symbolReg, stateScratchReg] omega -private theorem stateCode_lt_internal (tm : TM n) (state : tm.Q) : +theorem stateCode_lt_internal (tm : TM n) (state : tm.Q) : stateCode tm state < Fintype.card tm.Q := by exact (Fintype.equivFin tm.Q state).isLt @@ -245,16 +249,12 @@ theorem program_exec_internal {tm : TM n} hfinalRepresents⟩ simpa [program, stepCount, loaded] using Structured.Exec.seq hloadExec hdispatch -private abbrev ResourceEnvelope (tm : TM n) (bound : ℕ) := - Structured.Internal.StoreEnvelope (registerBound n (bound + 1)) - (wordBound tm bound) - private theorem control_lt_registerBound (n bound : ℕ) : cellBase n < registerBound n (bound + 1) := by simp [registerBound, cellReg, outputTape] omega -private theorem cleared_envelope {tm : TM n} {bound test : ℕ} +theorem cleared_envelope {tm : TM n} {bound test : ℕ} {store : Structured.Store} (henvelope : ResourceEnvelope tm bound store) (htest : test < registerBound n (bound + 1)) : ResourceEnvelope tm bound (Structured.Switch.cleared store test) := by diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Iteration.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Iteration.lean index d50fd464..1b3a89f5 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Iteration.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Iteration.lean @@ -3,12 +3,16 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal.Dispatch +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal.Dispatch /-! # Iterating the fixed sparse TM transition -- proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Layout.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Layout.lean index a4ea0962..0847639a 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Layout.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Layout.lean @@ -3,13 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Defs +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Defs /-! # Sparse TM-step address and loading layout -- proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Load.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Load.lean index a0ce1484..f5a2a355 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Load.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Load.lean @@ -3,12 +3,16 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal.Layout +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal.Layout /-! # Loading sparse TM states and head symbols -- proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Resources.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Resources.lean index 1f29520d..36591de0 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Resources.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Resources.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal.Iteration -import Complexitylib.Models.RandomAccessMachine.Structured.Internal.Resources +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal.Iteration +public import Complexitylib.Models.RandomAccessMachine.Structured.Internal.Resources /-! # Resource envelopes for the fixed sparse TM simulator -- proof internals @@ -14,6 +16,8 @@ This layer supplies the uniform finite-store envelope needed to turn those measurements into explicit bounds depending only on input length and TM steps. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step.lean index f708dfe8..39e35bac 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Step.Defs -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Step.Internal -import Complexitylib.Models.RandomAccessMachine.Structured +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Step.Defs +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Step.Internal +public import Complexitylib.Models.RandomAccessMachine.Structured /-! # Fixed RAM transition blocks for bounded Turing-machine configurations @@ -16,6 +18,8 @@ structured program has exact one-step source semantics; its common resource envelope and compiled-RAM transfer are the next M6 layer. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Defs.lean index a6696870..f7630c1f 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Defs -import Complexitylib.Models.RandomAccessMachine.Structured.Switch.Defs +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Defs +public import Complexitylib.Models.RandomAccessMachine.Structured.Switch.Defs /-! # A fixed structured-RAM block for one Turing-machine transition @@ -18,6 +20,8 @@ The construction is fixed once `tm` and the cell-window bound are fixed. It does not install or consult an untrusted transition-table oracle. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal.lean index cda80fd1..9bc21d34 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal.lean @@ -3,11 +3,13 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Step.Internal.Layout -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Step.Internal.Load -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Step.Internal.Action -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Step.Internal.Dispatch -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Step.Internal.Resources +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Step.Internal.Layout +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Step.Internal.Load +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Step.Internal.Action +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Step.Internal.Dispatch +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Step.Internal.Resources /-! # One-step TM-to-RAM simulation -- proof internals @@ -16,3 +18,5 @@ This aggregation module contains the checked layout, head-symbol loading, selected transition-action, nested finite-dispatch, and source-resource layers. The public surface transfers the resulting measured execution to compiled RAM. -/ + +@[expose] public section diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Action.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Action.lean index 9b0a421f..7f5b3fd2 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Action.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Action.lean @@ -3,12 +3,16 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Step.Internal.Load +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Step.Internal.Load /-! # Selected TM transition actions -- proof internals -/ +@[expose] public section + namespace Complexity namespace RAM @@ -27,7 +31,7 @@ private theorem execList_append (first second : List Structured.Basic) | cons op rest ih => simp [Structured.Basic.execList, ih] /-- Representation restricted to one named tape block. -/ -private def RepresentsTape (bound : ℕ) (slot : Fin (n + 2)) +def RepresentsTape (bound : ℕ) (slot : Fin (n + 2)) (tape : Tape) (store : Structured.Store) : Prop := store (headReg slot) = tape.head ∧ ∀ position : Fin (bound + 1), @@ -387,7 +391,7 @@ theorem writeMoveOps_otherTape_internal (n bound : ℕ) rw [writeMoveOps, execList_append, hmoveCell, hwriteCell] exact hother.2 position -private theorem RepresentsTape.stateUpdate (bound : ℕ) (slot : Fin (n + 2)) +theorem RepresentsTape.stateUpdate (bound : ℕ) (slot : Fin (n + 2)) (tape : Tape) (store : Structured.Store) (state : ℕ) (hrepresents : RepresentsTape bound slot tape store) : RepresentsTape bound slot tape @@ -836,10 +840,12 @@ theorem actionOps_represents_internal {tm : TM n} {bound : ℕ} Structured.Basic.execList, List.append_assoc] using hfinalRepresents -private abbrev StepEnvelope (tm : TM n) (bound : ℕ) := +@[nolint docBlame] +abbrev StepEnvelope (tm : TM n) (bound : ℕ) := Structured.Internal.StoreEnvelope (registerLimit n bound) (wordBound tm bound) -private abbrev StepEnvelopeChain (tm : TM n) (bound : ℕ) := +@[nolint docBlame] +abbrev StepEnvelopeChain (tm : TM n) (bound : ℕ) := Structured.Internal.Basic.EnvelopeChain (registerLimit n bound) (wordBound tm bound) private theorem registerCount_lt_registerLimit' (n bound : ℕ) : diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Dispatch.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Dispatch.lean index aea18b3d..ad8b317c 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Dispatch.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Dispatch.lean @@ -3,13 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Step.Internal.Action -import Complexitylib.Models.RandomAccessMachine.Structured.Switch +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Step.Internal.Action +public import Complexitylib.Models.RandomAccessMachine.Structured.Switch /-! # Nested finite dispatch for one TM transition -- proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Layout.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Layout.lean index e4900137..6cf6fbab 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Layout.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Layout.lean @@ -3,13 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Step.Defs +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Step.Defs /-! # TM-to-RAM step layout -- proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Load.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Load.lean index cedf2c53..b2e21d6c 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Load.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Load.lean @@ -3,13 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Step.Internal.Layout -import Complexitylib.Models.RandomAccessMachine.Structured.Internal.Resources +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Step.Internal.Layout +public import Complexitylib.Models.RandomAccessMachine.Structured.Internal.Resources /-! # Loading represented TM states and head symbols -- proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Resources.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Resources.lean index 307942c5..c11145c6 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Resources.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Resources.lean @@ -3,12 +3,16 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Step.Internal.Dispatch +module + +public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Step.Internal.Dispatch /-! # Resource bounds for one TM-to-RAM transition -- proof internals -/ +@[expose] public section + namespace Complexity namespace RAM @@ -18,37 +22,34 @@ namespace TMConfig namespace Step -private abbrev StepEnvelope (tm : TM n) (bound : ℕ) := - Structured.Internal.StoreEnvelope (registerLimit n bound) (wordBound tm bound) - -private theorem cleared_envelope {tm : TM n} {bound test : ℕ} +theorem cleared_envelope {tm : TM n} {bound test : ℕ} {store : Structured.Store} (henvelope : StepEnvelope tm bound store) (htest : test < registerLimit n bound) : StepEnvelope tm bound (Structured.Switch.cleared store test) := by exact henvelope.update htest (by simp) -private theorem cleared_apply_of_ne' (store : Structured.Store) {test reg : ℕ} +theorem cleared_apply_of_ne' (store : Structured.Store) {test reg : ℕ} (hne : reg ≠ test) : Structured.Switch.cleared store test reg = store reg := by simp [Structured.Switch.cleared, Function.update_of_ne hne] -private theorem symbolReg_injective' (n bound : ℕ) : +theorem symbolReg_injective' (n bound : ℕ) : Function.Injective (symbolReg n bound) := by intro first second heq apply Fin.ext simp [symbolReg] at heq omega -private theorem symbolReg_ne_one' (n bound : ℕ) (tape : Fin (n + 2)) : +theorem symbolReg_ne_one' (n bound : ℕ) (tape : Fin (n + 2)) : symbolReg n bound tape ≠ oneReg n bound := by simp [symbolReg, oneReg] omega -private theorem stateScratchReg_ne_one' (n bound : ℕ) : +theorem stateScratchReg_ne_one' (n bound : ℕ) : stateScratchReg n bound ≠ oneReg n bound := by simp [stateScratchReg, oneReg] -private theorem stateScratchReg_ne_symbolReg' (n bound : ℕ) +theorem stateScratchReg_ne_symbolReg' (n bound : ℕ) (tape : Fin (n + 2)) : symbolReg n bound tape ≠ stateScratchReg n bound := by simp [symbolReg, stateScratchReg] diff --git a/Complexitylib/Models/RandomAccessMachine/Soundness.lean b/Complexitylib/Models/RandomAccessMachine/Soundness.lean index 218e5c95..c48521ec 100644 --- a/Complexitylib/Models/RandomAccessMachine/Soundness.lean +++ b/Complexitylib/Models/RandomAccessMachine/Soundness.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Internal +module + +public import Complexitylib.Models.RandomAccessMachine.Internal /-! # Why the RAM must use logarithmic cost: a formal soundness theorem @@ -26,6 +28,8 @@ convention but the boundary between a sound Turing-equivalent model and a "reward-hacked" one that decides more than it should in polynomial time. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Structured.lean b/Complexitylib/Models/RandomAccessMachine/Structured.lean index afe7355a..2cb19228 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Structured.Defs -import Complexitylib.Models.RandomAccessMachine.Structured.Internal -import Complexitylib.Models.RandomAccessMachine.Structured.Switch +module + +public import Complexitylib.Models.RandomAccessMachine.Structured.Defs +public import Complexitylib.Models.RandomAccessMachine.Structured.Internal +public import Complexitylib.Models.RandomAccessMachine.Structured.Switch /-! # Structured logarithmic-cost RAM programs @@ -24,6 +26,8 @@ Turing-machine transition compiler. Its branch selection has exact step accounting and preserves explicit logarithmic-cost and space envelopes. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Structured/Defs.lean index e564170b..ee7a3e33 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Defs +module + +public import Complexitylib.Models.RandomAccessMachine.Defs /-! # Structured logarithmic-cost RAM programs — definitions @@ -20,6 +22,8 @@ The compiler appends no hidden data operations: source and target executions therefore have equal register effects, logarithmic cost, and peak register space. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/GateEval.lean b/Complexitylib/Models/RandomAccessMachine/Structured/GateEval.lean index a8c9e390..34462f6a 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/GateEval.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/GateEval.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Structured.GateEval.Defs -import Complexitylib.Models.RandomAccessMachine.Structured.GateEval.Internal -import Complexitylib.Asymptotics +module + +public import Complexitylib.Models.RandomAccessMachine.Structured.GateEval.Defs +public import Complexitylib.Models.RandomAccessMachine.Structured.GateEval.Internal +public import Complexitylib.Asymptotics /-! # Verified structured RAM decoded-gate evaluator @@ -16,6 +18,8 @@ indirect memo reads, evaluates the gate with branch-free Boolean arithmetic, and indirectly appends the result in exactly twenty RAM transitions. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/GateEval/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Structured/GateEval/Defs.lean index 7cefb830..7c0a292f 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/GateEval/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/GateEval/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Structured.Defs -import Complexitylib.Circuits.Encoding.Defs +module + +public import Complexitylib.Models.RandomAccessMachine.Structured.Defs +public import Complexitylib.Circuits.Encoding.Defs /-! # Structured RAM decoded-gate evaluator — definitions @@ -15,6 +17,8 @@ append the result. Boolean negation, AND, and OR are implemented arithmetically, so the instruction count is independent of the gate and wire values. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/GateEval/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Structured/GateEval/Internal.lean index b4cc6390..fe7a7e3c 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/GateEval/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/GateEval/Internal.lean @@ -3,14 +3,18 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Structured -import Complexitylib.Models.RandomAccessMachine.Structured.GateEval.Defs -import Complexitylib.Models.RandomAccessMachine.Structured.Internal.Resources +module + +public import Complexitylib.Models.RandomAccessMachine.Structured +public import Complexitylib.Models.RandomAccessMachine.Structured.GateEval.Defs +public import Complexitylib.Models.RandomAccessMachine.Structured.Internal.Resources /-! # Structured RAM decoded-gate evaluator — proof internals -/ +@[expose] public section + namespace Complexity namespace RAM @@ -21,20 +25,23 @@ namespace GateEval open Internal -private abbrev StoreBound (wireCount : ℕ) (store : Store) : Prop := +@[nolint docBlame] +abbrev StoreBound (wireCount : ℕ) (store : Store) : Prop := StoreEnvelope (wireCount + wireBase + 1) (wireCount + wireBase + 1) store -private abbrev width (wireCount : ℕ) : ℕ := +@[nolint docBlame] +abbrev width (wireCount : ℕ) : ℕ := valueWidth (wireCount + wireBase + 1) -private abbrev resourceSpace (wireCount : ℕ) : ℕ := +@[nolint docBlame] +abbrev resourceSpace (wireCount : ℕ) : ℕ := envelopeSpace (wireCount + wireBase + 1) (wireCount + wireBase + 1) -private theorem envelopeSpace_eq_spaceBound (wireCount : ℕ) : +theorem envelopeSpace_eq_spaceBound (wireCount : ℕ) : resourceSpace wireCount = spaceBound wireCount := by simp [resourceSpace, envelopeSpace, spaceBound, two_mul] -private theorem inputStore_bound (gate : CircuitCode.RawGate) (wires : List Bool) +theorem inputStore_bound (gate : CircuitCode.RawGate) (wires : List Bool) (hgate : gate.WellFormedAt wires.length) : StoreBound wires.length (inputStore gate wires) := by have hbits : StoreBound wires.length @@ -70,13 +77,15 @@ private theorem inputStore_bound (gate : CircuitCode.RawGate) (wires : List Bool private def addressed0 (gate : CircuitCode.RawGate) (wires : List Bool) : Store := (Basic.add address0Reg address0Reg baseReg).exec (inputStore gate wires) -private def addressed (gate : CircuitCode.RawGate) (wires : List Bool) : Store := +@[nolint docBlame] +def addressed (gate : CircuitCode.RawGate) (wires : List Bool) : Store := Basic.execList addressOps (inputStore gate wires) private def loaded0 (gate : CircuitCode.RawGate) (wires : List Bool) : Store := (Basic.load value0Reg address0Reg).exec (addressed gate wires) -private def loaded (gate : CircuitCode.RawGate) (wires : List Bool) : Store := +@[nolint docBlame] +def loaded (gate : CircuitCode.RawGate) (wires : List Bool) : Store := Basic.execList loadOps (addressed gate wires) private def negated0Sum (gate : CircuitCode.RawGate) (wires : List Bool) : Store := @@ -88,7 +97,8 @@ private def negated0Product (gate : CircuitCode.RawGate) (wires : List Bool) : S private def negated0Twice (gate : CircuitCode.RawGate) (wires : List Bool) : Store := (Basic.add scratchReg scratchReg scratchReg).exec (negated0Product gate wires) -private def negated0 (gate : CircuitCode.RawGate) (wires : List Bool) : Store := +@[nolint docBlame] +def negated0 (gate : CircuitCode.RawGate) (wires : List Bool) : Store := Basic.execList (xorOps value0Reg negated0Reg) (loaded gate wires) private def negated1Sum (gate : CircuitCode.RawGate) (wires : List Bool) : Store := @@ -100,7 +110,8 @@ private def negated1Product (gate : CircuitCode.RawGate) (wires : List Bool) : S private def negated1Twice (gate : CircuitCode.RawGate) (wires : List Bool) : Store := (Basic.add scratchReg scratchReg scratchReg).exec (negated1Product gate wires) -private def negated1 (gate : CircuitCode.RawGate) (wires : List Bool) : Store := +@[nolint docBlame] +def negated1 (gate : CircuitCode.RawGate) (wires : List Bool) : Store := Basic.execList (xorOps value1Reg negated1Reg) (negated0 gate wires) private def evalProduct (gate : CircuitCode.RawGate) (wires : List Bool) : Store := @@ -118,34 +129,43 @@ private def evalDelta (gate : CircuitCode.RawGate) (wires : List Bool) : Store : private def evalSelected (gate : CircuitCode.RawGate) (wires : List Bool) : Store := (Basic.mul address0Reg opReg address0Reg).exec (evalDelta gate wires) -private def evaluated (gate : CircuitCode.RawGate) (wires : List Bool) : Store := +@[nolint docBlame] +def evaluated (gate : CircuitCode.RawGate) (wires : List Bool) : Store := Basic.execList evalOps (negated1 gate wires) -private def appendAddressed (gate : CircuitCode.RawGate) (wires : List Bool) : Store := +@[nolint docBlame] +def appendAddressed (gate : CircuitCode.RawGate) (wires : List Bool) : Store := (Basic.add address1Reg baseReg wireCountReg).exec (evaluated gate wires) -private def finalStore (gate : CircuitCode.RawGate) (wires : List Bool) : Store := +@[nolint docBlame] +def finalStore (gate : CircuitCode.RawGate) (wires : List Bool) : Store := (Basic.store address1Reg outputReg).exec (appendAddressed gate wires) -private def routineAddressed (store : Store) : Store := +@[nolint docBlame] +def routineAddressed (store : Store) : Store := Basic.execList addressOps store -private def routineLoaded (store : Store) : Store := +@[nolint docBlame] +def routineLoaded (store : Store) : Store := Basic.execList loadOps (routineAddressed store) -private def routineNegated0 (store : Store) : Store := +@[nolint docBlame] +def routineNegated0 (store : Store) : Store := Basic.execList (xorOps value0Reg negated0Reg) (routineLoaded store) -private def routineNegated1 (store : Store) : Store := +@[nolint docBlame] +def routineNegated1 (store : Store) : Store := Basic.execList (xorOps value1Reg negated1Reg) (routineNegated0 store) -private def routineEvaluated (store : Store) : Store := +@[nolint docBlame] +def routineEvaluated (store : Store) : Store := Basic.execList evalOps (routineNegated1 store) -private def routineFinal (store : Store) : Store := +@[nolint docBlame] +def routineFinal (store : Store) : Store := Basic.execList appendOps (routineEvaluated store) -private theorem inputStore_wire (gate : CircuitCode.RawGate) (wires : List Bool) +theorem inputStore_wire (gate : CircuitCode.RawGate) (wires : List Bool) (index : ℕ) : inputStore gate wires (wireBase + index) = match wires[index]? with @@ -162,26 +182,26 @@ private theorem inputStore_wire (gate : CircuitCode.RawGate) (wires : List Bool) address1Reg, baseReg] rfl -private theorem addressed_address0 (gate : CircuitCode.RawGate) +theorem addressed_address0 (gate : CircuitCode.RawGate) (wires : List Bool) : addressed gate wires address0Reg = gate.input₀ + wireBase := by simp [addressed, addressOps, Basic.execList, Basic.exec, inputStore, address0Reg, address1Reg, baseReg, wireBase] -private theorem addressed_address1 (gate : CircuitCode.RawGate) +theorem addressed_address1 (gate : CircuitCode.RawGate) (wires : List Bool) : addressed gate wires address1Reg = gate.input₁ + wireBase := by simp [addressed, addressOps, Basic.execList, Basic.exec, inputStore, address0Reg, address1Reg, baseReg, wireBase] -private theorem addressed_apply_of_ne (gate : CircuitCode.RawGate) +theorem addressed_apply_of_ne (gate : CircuitCode.RawGate) (wires : List Bool) (index : ℕ) (h0 : index ≠ address0Reg) (h1 : index ≠ address1Reg) : addressed gate wires index = inputStore gate wires index := by simp [addressed, addressOps, Basic.execList, Basic.exec, Function.update_of_ne, h0, h1] -private theorem loaded_value0 (gate : CircuitCode.RawGate) (wires : List Bool) +theorem loaded_value0 (gate : CircuitCode.RawGate) (wires : List Bool) (value : Bool) (hvalue : wires[gate.input₀]? = some value) : loaded gate wires value0Reg = Input.bitValue value := by have hwire := inputStore_wire gate wires gate.input₀ @@ -200,7 +220,7 @@ private theorem loaded_value0 (gate : CircuitCode.RawGate) (wires : List Bool) simp [loaded, loadOps, Basic.execList, Basic.exec, value0Reg, value1Reg, address0Reg, address1Reg, haddress, hread] -private theorem loaded_value1 (gate : CircuitCode.RawGate) (wires : List Bool) +theorem loaded_value1 (gate : CircuitCode.RawGate) (wires : List Bool) (value : Bool) (hvalue : wires[gate.input₁]? = some value) : loaded gate wires value1Reg = Input.bitValue value := by have hwire := inputStore_wire gate wires gate.input₁ @@ -219,24 +239,24 @@ private theorem loaded_value1 (gate : CircuitCode.RawGate) (wires : List Bool) simp [loaded, loadOps, Basic.execList, Basic.exec, value0Reg, value1Reg, address0Reg, address1Reg, haddress, hread] -private theorem inputStore_op (gate : CircuitCode.RawGate) (wires : List Bool) : +theorem inputStore_op (gate : CircuitCode.RawGate) (wires : List Bool) : inputStore gate wires opReg = Input.bitValue gate.opBit := by simp [inputStore, opReg, negated0Reg, negated1Reg, address0Reg, address1Reg, baseReg, Input.bitValue] -private theorem inputStore_negated0 (gate : CircuitCode.RawGate) +theorem inputStore_negated0 (gate : CircuitCode.RawGate) (wires : List Bool) : inputStore gate wires negated0Reg = Input.bitValue gate.negated₀ := by simp [inputStore, opReg, negated0Reg, negated1Reg, address0Reg, address1Reg, baseReg, Input.bitValue] -private theorem inputStore_negated1 (gate : CircuitCode.RawGate) +theorem inputStore_negated1 (gate : CircuitCode.RawGate) (wires : List Bool) : inputStore gate wires negated1Reg = Input.bitValue gate.negated₁ := by simp [inputStore, opReg, negated0Reg, negated1Reg, address0Reg, address1Reg, baseReg, Input.bitValue] -private theorem address_measured (gate : CircuitCode.RawGate) (wires : List Bool) +theorem address_measured (gate : CircuitCode.RawGate) (wires : List Bool) (hgate : gate.WellFormedAt wires.length) : MeasuredRuns (.basics addressOps) (inputStore gate wires) (addressed gate wires) 2 (8 * width wires.length) @@ -272,7 +292,7 @@ private theorem address_measured (gate : CircuitCode.RawGate) (wires : List Bool convert hrun using 1 ring -private theorem load_measured (gate : CircuitCode.RawGate) (wires : List Bool) +theorem load_measured (gate : CircuitCode.RawGate) (wires : List Bool) (hgate : gate.WellFormedAt wires.length) : MeasuredRuns (.basics loadOps) (addressed gate wires) (loaded gate wires) 2 (8 * width wires.length) (resourceSpace wires.length) ∧ @@ -301,7 +321,7 @@ private theorem load_measured (gate : CircuitCode.RawGate) (wires : List Bool) convert hrun using 1 ring -private theorem negated0_measured (gate : CircuitCode.RawGate) (wires : List Bool) +theorem negated0_measured (gate : CircuitCode.RawGate) (wires : List Bool) (value : Bool) (hvalue : wires[gate.input₀]? = some value) (hgate : gate.WellFormedAt wires.length) : MeasuredRuns (.basics (xorOps value0Reg negated0Reg)) (loaded gate wires) @@ -368,7 +388,7 @@ private theorem negated0_measured (gate : CircuitCode.RawGate) (wires : List Boo convert hrun using 1 ring -private theorem loaded_apply_of_ne (gate : CircuitCode.RawGate) (wires : List Bool) +theorem loaded_apply_of_ne (gate : CircuitCode.RawGate) (wires : List Bool) (index : ℕ) (h0 : index ≠ value0Reg) (h1 : index ≠ value1Reg) (ha0 : index ≠ address0Reg) (ha1 : index ≠ address1Reg) : loaded gate wires index = inputStore gate wires index := by @@ -377,7 +397,7 @@ private theorem loaded_apply_of_ne (gate : CircuitCode.RawGate) (wires : List Bo h0, h1]] exact addressed_apply_of_ne gate wires index ha0 ha1 -private theorem negated0_value (gate : CircuitCode.RawGate) (wires : List Bool) +theorem negated0_value (gate : CircuitCode.RawGate) (wires : List Bool) (value : Bool) (hvalue : wires[gate.input₀]? = some value) : negated0 gate wires value0Reg = Input.bitValue (gate.negated₀.xor value) := by @@ -400,14 +420,14 @@ private theorem negated0_value (gate : CircuitCode.RawGate) (wires : List Bool) value0Reg, outputReg, scratchReg, negated0Reg, hnegated, hloadedValue', hloadedNegated'] -private theorem negated0_apply_of_ne (gate : CircuitCode.RawGate) +theorem negated0_apply_of_ne (gate : CircuitCode.RawGate) (wires : List Bool) (index : ℕ) (hvalue : index ≠ value0Reg) (houtput : index ≠ outputReg) (hscratch : index ≠ scratchReg) : negated0 gate wires index = loaded gate wires index := by simp [negated0, xorOps, Basic.execList, Basic.exec, Function.update_of_ne, hvalue, houtput, hscratch] -private theorem negated1_value (gate : CircuitCode.RawGate) (wires : List Bool) +theorem negated1_value (gate : CircuitCode.RawGate) (wires : List Bool) (value : Bool) (hvalue : wires[gate.input₁]? = some value) : negated1 gate wires value1Reg = Input.bitValue (gate.negated₁.xor value) := by @@ -443,7 +463,7 @@ private theorem negated1_value (gate : CircuitCode.RawGate) (wires : List Bool) value1Reg, outputReg, scratchReg, negated1Reg, hnegated, hnegated0Value', hnegatedBit'] -private theorem negated1_measured (gate : CircuitCode.RawGate) (wires : List Bool) +theorem negated1_measured (gate : CircuitCode.RawGate) (wires : List Bool) (value0 value1 : Bool) (hvalue0 : wires[gate.input₀]? = some value0) (hvalue1 : wires[gate.input₁]? = some value1) (hgate : gate.WellFormedAt wires.length) : @@ -523,7 +543,7 @@ private theorem negated1_measured (gate : CircuitCode.RawGate) (wires : List Boo convert hrun using 1 ring -private theorem negated1_value0 (gate : CircuitCode.RawGate) (wires : List Bool) +theorem negated1_value0 (gate : CircuitCode.RawGate) (wires : List Bool) (value : Bool) (hvalue : wires[gate.input₀]? = some value) : negated1 gate wires value0Reg = Input.bitValue (gate.negated₀.xor value) := by @@ -532,14 +552,14 @@ private theorem negated1_value0 (gate : CircuitCode.RawGate) (wires : List Bool) outputReg, scratchReg]] exact negated0_value gate wires value hvalue -private theorem negated1_apply_of_ne (gate : CircuitCode.RawGate) +theorem negated1_apply_of_ne (gate : CircuitCode.RawGate) (wires : List Bool) (index : ℕ) (hvalue : index ≠ value1Reg) (houtput : index ≠ outputReg) (hscratch : index ≠ scratchReg) : negated1 gate wires index = negated0 gate wires index := by simp [negated1, xorOps, Basic.execList, Basic.exec, Function.update_of_ne, hvalue, houtput, hscratch] -private theorem negated1_op (gate : CircuitCode.RawGate) (wires : List Bool) : +theorem negated1_op (gate : CircuitCode.RawGate) (wires : List Bool) : negated1 gate wires opReg = Input.bitValue gate.opBit := by rw [negated1_apply_of_ne gate wires] · rw [negated0_apply_of_ne gate wires] @@ -556,7 +576,7 @@ private theorem negated1_op (gate : CircuitCode.RawGate) (wires : List Bool) : · simp [opReg, outputReg] · simp [opReg, scratchReg] -private theorem evaluated_output (gate : CircuitCode.RawGate) (wires : List Bool) +theorem evaluated_output (gate : CircuitCode.RawGate) (wires : List Bool) (value0 value1 : Bool) (hvalue0 : wires[gate.input₀]? = some value0) (hvalue1 : wires[gate.input₁]? = some value1) : evaluated gate wires outputReg = Input.bitValue (gate.eval value0 value1) := by @@ -578,7 +598,7 @@ private theorem evaluated_output (gate : CircuitCode.RawGate) (wires : List Bool CircuitCode.RawGate.eval, CircuitCode.RawGate.opBit, opReg, value0Reg, value1Reg, outputReg, scratchReg, address0Reg, hvalue0'', hvalue1'', hop'] -private theorem eval_measured (gate : CircuitCode.RawGate) (wires : List Bool) +theorem eval_measured (gate : CircuitCode.RawGate) (wires : List Bool) (value0 value1 : Bool) (hvalue0 : wires[gate.input₀]? = some value0) (hvalue1 : wires[gate.input₁]? = some value1) (hgate : gate.WellFormedAt wires.length) : @@ -669,23 +689,23 @@ private theorem eval_measured (gate : CircuitCode.RawGate) (wires : List Bool) convert hrun using 1 ring -private theorem evaluated_apply_of_ne (gate : CircuitCode.RawGate) +theorem evaluated_apply_of_ne (gate : CircuitCode.RawGate) (wires : List Bool) (index : ℕ) (haddress : index ≠ address0Reg) (houtput : index ≠ outputReg) (hscratch : index ≠ scratchReg) : evaluated gate wires index = negated1 gate wires index := by simp [evaluated, evalOps, Basic.execList, Basic.exec, Function.update_of_ne, haddress, houtput, hscratch] -private theorem inputStore_wireCount (gate : CircuitCode.RawGate) +theorem inputStore_wireCount (gate : CircuitCode.RawGate) (wires : List Bool) : inputStore gate wires wireCountReg = wires.length := by simp [inputStore, opReg, negated0Reg, negated1Reg, address0Reg, address1Reg, wireCountReg, baseReg, wireBase, Input.bitStore] -private theorem inputStore_base (gate : CircuitCode.RawGate) (wires : List Bool) : +theorem inputStore_base (gate : CircuitCode.RawGate) (wires : List Bool) : inputStore gate wires baseReg = wireBase := by simp [inputStore, baseReg] -private theorem evaluated_stable (gate : CircuitCode.RawGate) (wires : List Bool) +theorem evaluated_stable (gate : CircuitCode.RawGate) (wires : List Bool) (index : ℕ) (ha0 : index ≠ address0Reg) (ha1 : index ≠ address1Reg) (hv0 : index ≠ value0Reg) (hv1 : index ≠ value1Reg) (hout : index ≠ outputReg) (hscratch : index ≠ scratchReg) : @@ -695,7 +715,7 @@ private theorem evaluated_stable (gate : CircuitCode.RawGate) (wires : List Bool rw [negated0_apply_of_ne gate wires index hv0 hout hscratch] exact loaded_apply_of_ne gate wires index hv0 hv1 ha0 ha1 -private theorem evaluated_wireCount (gate : CircuitCode.RawGate) +theorem evaluated_wireCount (gate : CircuitCode.RawGate) (wires : List Bool) : evaluated gate wires wireCountReg = wires.length := by rw [evaluated_stable gate wires] · exact inputStore_wireCount gate wires @@ -706,7 +726,7 @@ private theorem evaluated_wireCount (gate : CircuitCode.RawGate) · simp [wireCountReg, outputReg] · simp [wireCountReg, scratchReg] -private theorem evaluated_base (gate : CircuitCode.RawGate) (wires : List Bool) : +theorem evaluated_base (gate : CircuitCode.RawGate) (wires : List Bool) : evaluated gate wires baseReg = wireBase := by rw [evaluated_stable gate wires] · exact inputStore_base gate wires @@ -717,7 +737,7 @@ private theorem evaluated_base (gate : CircuitCode.RawGate) (wires : List Bool) · simp [baseReg, outputReg] · simp [baseReg, scratchReg] -private theorem finalStore_output (gate : CircuitCode.RawGate) (wires : List Bool) +theorem finalStore_output (gate : CircuitCode.RawGate) (wires : List Bool) (value0 value1 : Bool) (hvalue0 : wires[gate.input₀]? = some value0) (hvalue1 : wires[gate.input₁]? = some value1) : finalStore gate wires outputReg = Input.bitValue (gate.eval value0 value1) := by @@ -743,7 +763,7 @@ private theorem finalStore_output (gate : CircuitCode.RawGate) (wires : List Boo rw [Function.update_of_ne (by omega : 8 ≠ 11 + wires.length)] exact happendOutput -private theorem finalStore_appended (gate : CircuitCode.RawGate) (wires : List Bool) +theorem finalStore_appended (gate : CircuitCode.RawGate) (wires : List Bool) (value0 value1 : Bool) (hvalue0 : wires[gate.input₀]? = some value0) (hvalue1 : wires[gate.input₁]? = some value1) : finalStore gate wires (wireBase + wires.length) = @@ -767,7 +787,7 @@ private theorem finalStore_appended (gate : CircuitCode.RawGate) (wires : List B (appendAddressed gate wires outputReg) (wireBase + wires.length) = _ rw [haddress, hsource, Function.update_self] -private theorem finalStore_wire (gate : CircuitCode.RawGate) (wires : List Bool) +theorem finalStore_wire (gate : CircuitCode.RawGate) (wires : List Bool) (index : ℕ) (hindex : index < wires.length) : finalStore gate wires (wireBase + index) = Input.bitValue wires[index] := by have hbase' : evaluated gate wires 10 = 11 := by @@ -799,7 +819,7 @@ private theorem finalStore_wire (gate : CircuitCode.RawGate) (wires : List Bool) outputReg, scratchReg] all_goals omega -private theorem append_measured (gate : CircuitCode.RawGate) (wires : List Bool) +theorem append_measured (gate : CircuitCode.RawGate) (wires : List Bool) (value0 value1 : Bool) (hvalue0 : wires[gate.input₀]? = some value0) (hvalue1 : wires[gate.input₁]? = some value1) (hgate : gate.WellFormedAt wires.length) : @@ -837,25 +857,25 @@ private theorem append_measured (gate : CircuitCode.RawGate) (wires : List Bool) convert hrun using 1 ring -private theorem routineAddressed_address0 {base : ℕ} {gate : CircuitCode.RawGate} +theorem routineAddressed_address0 {base : ℕ} {gate : CircuitCode.RawGate} {wires : List Bool} {store : Store} (hready : ReadyAt base gate wires store) : routineAddressed store address0Reg = gate.input₀ + base := by change store address0Reg + store baseReg = gate.input₀ + base rw [hready.address0_eq, hready.base_eq] -private theorem routineAddressed_address1 {base : ℕ} {gate : CircuitCode.RawGate} +theorem routineAddressed_address1 {base : ℕ} {gate : CircuitCode.RawGate} {wires : List Bool} {store : Store} (hready : ReadyAt base gate wires store) : routineAddressed store address1Reg = gate.input₁ + base := by change store address1Reg + store baseReg = gate.input₁ + base rw [hready.address1_eq, hready.base_eq] -private theorem routineAddressed_apply_of_ne (store : Store) (index : ℕ) +theorem routineAddressed_apply_of_ne (store : Store) (index : ℕ) (h0 : index ≠ address0Reg) (h1 : index ≠ address1Reg) : routineAddressed store index = store index := by simp [routineAddressed, addressOps, Basic.execList, Basic.exec, Function.update_of_ne, h0, h1] -private theorem routineLoaded_value0 {base : ℕ} {gate : CircuitCode.RawGate} +theorem routineLoaded_value0 {base : ℕ} {gate : CircuitCode.RawGate} {wires : List Bool} {store : Store} (hready : ReadyAt base gate wires store) (value : Bool) (hvalue : wires[gate.input₀]? = some value) : routineLoaded store value0Reg = Input.bitValue value := by @@ -879,7 +899,7 @@ private theorem routineLoaded_value0 {base : ℕ} {gate : CircuitCode.RawGate} simp [routineLoaded, loadOps, Basic.execList, Basic.exec, value0Reg, value1Reg, address0Reg, address1Reg, haddress', hphysical'] -private theorem routineLoaded_value1 {base : ℕ} {gate : CircuitCode.RawGate} +theorem routineLoaded_value1 {base : ℕ} {gate : CircuitCode.RawGate} {wires : List Bool} {store : Store} (hready : ReadyAt base gate wires store) (value : Bool) (hvalue : wires[gate.input₁]? = some value) : routineLoaded store value1Reg = Input.bitValue value := by @@ -912,7 +932,7 @@ private theorem routineLoaded_value1 {base : ℕ} {gate : CircuitCode.RawGate} Input.bitValue value simp [Basic.exec, hafterAddress, hafterPhysical] -private theorem routineLoaded_apply_of_ne (store : Store) (index : ℕ) +theorem routineLoaded_apply_of_ne (store : Store) (index : ℕ) (h0 : index ≠ value0Reg) (h1 : index ≠ value1Reg) (ha0 : index ≠ address0Reg) (ha1 : index ≠ address1Reg) : routineLoaded store index = store index := by @@ -921,7 +941,7 @@ private theorem routineLoaded_apply_of_ne (store : Store) (index : ℕ) Function.update_of_ne, h0, h1]] exact routineAddressed_apply_of_ne store index ha0 ha1 -private theorem xor_measured {bound value negated : ℕ} {store : Store} +theorem xor_measured {bound value negated : ℕ} {store : Store} (hstore : StoreEnvelope bound bound store) (hbound : 2 ≤ bound) (hvalue : value < bound) (houtput : outputReg < bound) (hscratch : scratchReg < bound) @@ -980,7 +1000,7 @@ private theorem xor_measured {bound value negated : ℕ} {store : Store} convert hrun using 1 ring -private theorem routineNegated0_value {base : ℕ} {gate : CircuitCode.RawGate} +theorem routineNegated0_value {base : ℕ} {gate : CircuitCode.RawGate} {wires : List Bool} {store : Store} (hready : ReadyAt base gate wires store) (value : Bool) (hvalue : wires[gate.input₀]? = some value) : routineNegated0 store value0Reg = @@ -1005,14 +1025,14 @@ private theorem routineNegated0_value {base : ℕ} {gate : CircuitCode.RawGate} value0Reg, outputReg, scratchReg, negated0Reg, hnegated, hloadedValue', hloadedNegated'] -private theorem routineNegated0_apply_of_ne (store : Store) (index : ℕ) +theorem routineNegated0_apply_of_ne (store : Store) (index : ℕ) (hvalue : index ≠ value0Reg) (houtput : index ≠ outputReg) (hscratch : index ≠ scratchReg) : routineNegated0 store index = routineLoaded store index := by simp [routineNegated0, xorOps, Basic.execList, Basic.exec, Function.update_of_ne, hvalue, houtput, hscratch] -private theorem routineNegated1_value {base : ℕ} {gate : CircuitCode.RawGate} +theorem routineNegated1_value {base : ℕ} {gate : CircuitCode.RawGate} {wires : List Bool} {store : Store} (hready : ReadyAt base gate wires store) (value : Bool) (hvalue : wires[gate.input₁]? = some value) : routineNegated1 store value1Reg = @@ -1049,14 +1069,14 @@ private theorem routineNegated1_value {base : ℕ} {gate : CircuitCode.RawGate} value1Reg, outputReg, scratchReg, negated1Reg, hnegatedEq, hvalue', hnegated'] -private theorem routineNegated1_apply_of_ne (store : Store) (index : ℕ) +theorem routineNegated1_apply_of_ne (store : Store) (index : ℕ) (hvalue : index ≠ value1Reg) (houtput : index ≠ outputReg) (hscratch : index ≠ scratchReg) : routineNegated1 store index = routineNegated0 store index := by simp [routineNegated1, xorOps, Basic.execList, Basic.exec, Function.update_of_ne, hvalue, houtput, hscratch] -private theorem routineNegated1_value0 {base : ℕ} {gate : CircuitCode.RawGate} +theorem routineNegated1_value0 {base : ℕ} {gate : CircuitCode.RawGate} {wires : List Bool} {store : Store} (hready : ReadyAt base gate wires store) (value : Bool) (hvalue : wires[gate.input₀]? = some value) : routineNegated1 store value0Reg = @@ -1067,7 +1087,7 @@ private theorem routineNegated1_value0 {base : ℕ} {gate : CircuitCode.RawGate} · simp [value0Reg, outputReg] · simp [value0Reg, scratchReg] -private theorem routineNegated1_op {base : ℕ} {gate : CircuitCode.RawGate} +theorem routineNegated1_op {base : ℕ} {gate : CircuitCode.RawGate} {wires : List Bool} {store : Store} (hready : ReadyAt base gate wires store) : routineNegated1 store opReg = Input.bitValue gate.opBit := by rw [routineNegated1_apply_of_ne] @@ -1085,7 +1105,7 @@ private theorem routineNegated1_op {base : ℕ} {gate : CircuitCode.RawGate} · simp [opReg, outputReg] · simp [opReg, scratchReg] -private theorem routineEvaluated_output {base : ℕ} {gate : CircuitCode.RawGate} +theorem routineEvaluated_output {base : ℕ} {gate : CircuitCode.RawGate} {wires : List Bool} {store : Store} (hready : ReadyAt base gate wires store) (value0 value1 : Bool) (hvalue0 : wires[gate.input₀]? = some value0) (hvalue1 : wires[gate.input₁]? = some value1) : @@ -1109,7 +1129,7 @@ private theorem routineEvaluated_output {base : ℕ} {gate : CircuitCode.RawGate CircuitCode.RawGate.eval, CircuitCode.RawGate.opBit, opReg, value0Reg, value1Reg, outputReg, scratchReg, address0Reg, hvalue0'', hvalue1'', hop'] -private theorem routineEvaluated_stable (store : Store) (index : ℕ) +theorem routineEvaluated_stable (store : Store) (index : ℕ) (ha0 : index ≠ address0Reg) (ha1 : index ≠ address1Reg) (hv0 : index ≠ value0Reg) (hv1 : index ≠ value1Reg) (hout : index ≠ outputReg) (hscratch : index ≠ scratchReg) : @@ -1121,7 +1141,7 @@ private theorem routineEvaluated_stable (store : Store) (index : ℕ) rw [routineNegated0_apply_of_ne store index hv0 hout hscratch] exact routineLoaded_apply_of_ne store index hv0 hv1 ha0 ha1 -private theorem routineEvaluated_wireCount {base : ℕ} +theorem routineEvaluated_wireCount {base : ℕ} {gate : CircuitCode.RawGate} {wires : List Bool} {store : Store} (hready : ReadyAt base gate wires store) : routineEvaluated store wireCountReg = wires.length := by @@ -1130,7 +1150,7 @@ private theorem routineEvaluated_wireCount {base : ℕ} all_goals simp [wireCountReg, address0Reg, address1Reg, value0Reg, value1Reg, outputReg, scratchReg] -private theorem routineEvaluated_base {base : ℕ} {gate : CircuitCode.RawGate} +theorem routineEvaluated_base {base : ℕ} {gate : CircuitCode.RawGate} {wires : List Bool} {store : Store} (hready : ReadyAt base gate wires store) : routineEvaluated store baseReg = base := by rw [routineEvaluated_stable] @@ -1138,7 +1158,7 @@ private theorem routineEvaluated_base {base : ℕ} {gate : CircuitCode.RawGate} all_goals simp [baseReg, address0Reg, address1Reg, value0Reg, value1Reg, outputReg, scratchReg] -private theorem routineEvaluated_wire {base : ℕ} {gate : CircuitCode.RawGate} +theorem routineEvaluated_wire {base : ℕ} {gate : CircuitCode.RawGate} {wires : List Bool} {store : Store} (hready : ReadyAt base gate wires store) (index : ℕ) (hindex : index < wires.length) : routineEvaluated store (base + index) = @@ -1152,7 +1172,7 @@ private theorem routineEvaluated_wire {base : ℕ} {gate : CircuitCode.RawGate} outputReg, scratchReg] at hbase ⊢ all_goals omega -private theorem routineFinal_output {base : ℕ} {gate : CircuitCode.RawGate} +theorem routineFinal_output {base : ℕ} {gate : CircuitCode.RawGate} {wires : List Bool} {store : Store} (hready : ReadyAt base gate wires store) (value0 value1 : Bool) (hvalue0 : wires[gate.input₀]? = some value0) (hvalue1 : wires[gate.input₁]? = some value1) : @@ -1181,7 +1201,7 @@ private theorem routineFinal_output {base : ℕ} {gate : CircuitCode.RawGate} simp only [outputReg, wireBase] at hbaseGe ⊢ omega -private theorem routineFinal_appended {base : ℕ} {gate : CircuitCode.RawGate} +theorem routineFinal_appended {base : ℕ} {gate : CircuitCode.RawGate} {wires : List Bool} {store : Store} (hready : ReadyAt base gate wires store) (value0 value1 : Bool) (hvalue0 : wires[gate.input₀]? = some value0) (hvalue1 : wires[gate.input₁]? = some value1) : @@ -1207,7 +1227,7 @@ private theorem routineFinal_appended {base : ℕ} {gate : CircuitCode.RawGate} (addressed outputReg) (base + wires.length) = _ rw [haddress, hsource, Function.update_self] -private theorem routineFinal_wire {base : ℕ} {gate : CircuitCode.RawGate} +theorem routineFinal_wire {base : ℕ} {gate : CircuitCode.RawGate} {wires : List Bool} {store : Store} (hready : ReadyAt base gate wires store) (index : ℕ) (hindex : index < wires.length) : routineFinal store (base + index) = Input.bitValue wires[index] := by @@ -1237,7 +1257,7 @@ private theorem routineFinal_wire {base : ℕ} {gate : CircuitCode.RawGate} (addressed outputReg) (base + index) = _ rw [haddress, Function.update_of_ne hne, hpreserved, hwire] -private theorem routineFinal_base {base : ℕ} {gate : CircuitCode.RawGate} +theorem routineFinal_base {base : ℕ} {gate : CircuitCode.RawGate} {wires : List Bool} {store : Store} (hready : ReadyAt base gate wires store) : routineFinal store baseReg = base := by have hbase := routineEvaluated_base hready @@ -1256,7 +1276,7 @@ private theorem routineFinal_base {base : ℕ} {gate : CircuitCode.RawGate} simp only [baseReg, wireBase] at hbaseGe ⊢ omega -private theorem routineFinal_wireCount {base : ℕ} {gate : CircuitCode.RawGate} +theorem routineFinal_wireCount {base : ℕ} {gate : CircuitCode.RawGate} {wires : List Bool} {store : Store} (hready : ReadyAt base gate wires store) : routineFinal store wireCountReg = wires.length := by have hbase := routineEvaluated_base hready @@ -1277,7 +1297,7 @@ private theorem routineFinal_wireCount {base : ℕ} {gate : CircuitCode.RawGate} simp only [wireCountReg, wireBase] at hbaseGe ⊢ omega -private theorem routineFinal_frame {base : ℕ} {gate : CircuitCode.RawGate} +theorem routineFinal_frame {base : ℕ} {gate : CircuitCode.RawGate} {wires : List Bool} {store : Store} (hready : ReadyAt base gate wires store) (index : ℕ) (hhigh : wireBase ≤ index) (happend : index ≠ base + wires.length) : diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/GateStep.lean b/Complexitylib/Models/RandomAccessMachine/Structured/GateStep.lean index 1583ec6b..5aace314 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/GateStep.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/GateStep.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Structured.GateStep.Defs -import Complexitylib.Models.RandomAccessMachine.Structured.GateStep.Internal +module + +public import Complexitylib.Models.RandomAccessMachine.Structured.GateStep.Defs +public import Complexitylib.Models.RandomAccessMachine.Structured.GateStep.Internal /-! # Verified structured RAM serialized-gate step @@ -15,6 +17,8 @@ invokes the same cursor loop for both unary references, discovers the following memo base at runtime, evaluates the decoded gate, and appends its result. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/GateStep/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Structured/GateStep/Defs.lean index ab90b0a7..09517657 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/GateStep/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/GateStep/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Structured.GateEval.Defs -import Complexitylib.Models.RandomAccessMachine.Structured.UnaryDecode.Defs +module + +public import Complexitylib.Models.RandomAccessMachine.Structured.GateEval.Defs +public import Complexitylib.Models.RandomAccessMachine.Structured.UnaryDecode.Defs /-! # Structured RAM serialized-gate step — definitions @@ -16,6 +18,8 @@ the two references are decoded by two calls to the same loop, and the resulting gate is evaluated and appended without specializing the program to the input. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/GateStep/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Structured/GateStep/Internal.lean index d180c2eb..74f8e219 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/GateStep/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/GateStep/Internal.lean @@ -3,16 +3,20 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Internal.Codec -import Complexitylib.Models.RandomAccessMachine.Structured.GateEval.Internal -import Complexitylib.Models.RandomAccessMachine.Structured.GateStep.Defs -import Complexitylib.Models.RandomAccessMachine.Structured.UnaryDecode.Internal -import Mathlib.Tactic.IntervalCases +module + +public import Complexitylib.Circuits.Encoding.Internal.Codec +public import Complexitylib.Models.RandomAccessMachine.Structured.GateEval.Internal +public import Complexitylib.Models.RandomAccessMachine.Structured.GateStep.Defs +public import Complexitylib.Models.RandomAccessMachine.Structured.UnaryDecode.Internal +public import Mathlib.Tactic.IntervalCases /-! # Structured RAM serialized-gate step — proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/GateStreamStep.lean b/Complexitylib/Models/RandomAccessMachine/Structured/GateStreamStep.lean index 75736122..7e0c8e69 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/GateStreamStep.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/GateStreamStep.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Structured.GateStreamStep.Defs -import Complexitylib.Models.RandomAccessMachine.Structured.GateStreamStep.Internal +module + +public import Complexitylib.Models.RandomAccessMachine.Structured.GateStreamStep.Defs +public import Complexitylib.Models.RandomAccessMachine.Structured.GateStreamStep.Internal /-! # Verified structured RAM iterable serialized-gate step @@ -14,6 +16,8 @@ experiment. Code and mutable memo occupy disjoint regions, so the exact same routine can be invoked again at the returned cursor. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/GateStreamStep/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Structured/GateStreamStep/Defs.lean index 9996e092..169c225e 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/GateStreamStep/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/GateStreamStep/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Structured.GateEval.Defs -import Complexitylib.Models.RandomAccessMachine.Structured.UnaryDecode.Defs +module + +public import Complexitylib.Models.RandomAccessMachine.Structured.GateEval.Defs +public import Complexitylib.Models.RandomAccessMachine.Structured.UnaryDecode.Defs /-! # Structured RAM iterable serialized-gate step — definitions @@ -17,6 +19,8 @@ and the memo, so cursor state survives gate evaluation without aliasing either mutable wires or unread code. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/GateStreamStep/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Structured/GateStreamStep/Internal.lean index b627d535..ef1d0f2a 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/GateStreamStep/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/GateStreamStep/Internal.lean @@ -3,16 +3,20 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Internal.Codec -import Complexitylib.Models.RandomAccessMachine.Structured.GateEval.Internal -import Complexitylib.Models.RandomAccessMachine.Structured.GateStreamStep.Defs -import Complexitylib.Models.RandomAccessMachine.Structured.UnaryDecode.Internal -import Mathlib.Tactic.IntervalCases +module + +public import Complexitylib.Circuits.Encoding.Internal.Codec +public import Complexitylib.Models.RandomAccessMachine.Structured.GateEval.Internal +public import Complexitylib.Models.RandomAccessMachine.Structured.GateStreamStep.Defs +public import Complexitylib.Models.RandomAccessMachine.Structured.UnaryDecode.Internal +public import Mathlib.Tactic.IntervalCases /-! # Structured RAM iterable serialized-gate step — proof internals -/ +@[expose] public section + namespace Complexity namespace RAM @@ -23,10 +27,12 @@ namespace GateStreamStep open Internal -private def marshalStore (store : Store) : Store := +@[nolint docBlame] +def marshalStore (store : Store) : Store := Basic.execList marshalOps store -private def marshalPrefix (store : Store) : Store := +@[nolint docBlame] +def marshalPrefix (store : Store) : Store := Basic.execList [.add GateEval.wireCountReg wireCountMetaReg UnaryDecode.activeReg, .imm wireCountMetaReg spillPointerReg, @@ -39,26 +45,31 @@ private def marshalPrefix (store : Store) : Store := .imm wireCountMetaReg 1] store -private def loadedOp (store : Store) : Store := +@[nolint docBlame] +def loadedOp (store : Store) : Store := (Basic.load GateEval.opReg gateStartReg).exec (marshalPrefix store) -private def advanced0 (store : Store) : Store := +@[nolint docBlame] +def advanced0 (store : Store) : Store := (Basic.add gateStartReg gateStartReg wireCountMetaReg).exec (loadedOp store) -private def loadedNegated0 (store : Store) : Store := +@[nolint docBlame] +def loadedNegated0 (store : Store) : Store := (Basic.load GateEval.negated0Reg gateStartReg).exec (advanced0 store) -private def advanced1 (store : Store) : Store := +@[nolint docBlame] +def advanced1 (store : Store) : Store := (Basic.add gateStartReg gateStartReg wireCountMetaReg).exec (loadedNegated0 store) -private def loadedNegated1 (store : Store) : Store := +@[nolint docBlame] +def loadedNegated1 (store : Store) : Store := (Basic.load GateEval.negated1Reg gateStartReg).exec (advanced1 store) -private theorem marshalStore_eq (store : Store) : +theorem marshalStore_eq (store : Store) : marshalStore store = loadedNegated1 store := by rfl -private theorem marshalPrefix_high (store : Store) (index : ℕ) +theorem marshalPrefix_high (store : Store) (index : ℕ) (hindex : spillRemainingReg < index) : marshalPrefix store index = store index := by simp only [spillRemainingReg] at hindex @@ -67,7 +78,7 @@ private theorem marshalPrefix_high (store : Store) (index : ℕ) GateEval.wireCountReg, GateEval.baseReg, memoBaseReg, wireCountMetaReg, savedInput0Reg, spillPointerReg, spillRemainingReg] -private theorem marshal_high (store : Store) (index : ℕ) +theorem marshal_high (store : Store) (index : ℕ) (hindex : spillRemainingReg < index) : marshalStore store index = store index := by simp only [spillRemainingReg] at hindex @@ -108,7 +119,7 @@ private theorem marshal_high (store : Store) (index : ℕ) Function.update_of_ne, h0, h1, h2, h3, h4, h5, h8, h9, h10, h11, h12] -private theorem marshal_wireCount {gateStart nextPointer remaining base : ℕ} +theorem marshal_wireCount {gateStart nextPointer remaining base : ℕ} {gate : CircuitCode.RawGate} {wires : List Bool} {store : Store} (h : Parsed gateStart nextPointer remaining base gate wires store) : marshalStore store GateEval.wireCountReg = wires.length := by @@ -123,7 +134,7 @@ private theorem marshal_wireCount {gateStart nextPointer remaining base : ℕ} savedInput0Reg, spillPointerReg, spillRemainingReg, UnaryDecode.activeReg, hcount, hactive] -private theorem marshal_address1 {gateStart nextPointer remaining base : ℕ} +theorem marshal_address1 {gateStart nextPointer remaining base : ℕ} {gate : CircuitCode.RawGate} {wires : List Bool} {store : Store} (h : Parsed gateStart nextPointer remaining base gate wires store) : marshalStore store GateEval.address1Reg = gate.input₁ := by @@ -138,7 +149,7 @@ private theorem marshal_address1 {gateStart nextPointer remaining base : ℕ} savedInput0Reg, spillPointerReg, spillRemainingReg, UnaryDecode.valueReg, UnaryDecode.activeReg, hvalue, hactive] -private theorem marshal_address0 {gateStart nextPointer remaining base : ℕ} +theorem marshal_address0 {gateStart nextPointer remaining base : ℕ} {gate : CircuitCode.RawGate} {wires : List Bool} {store : Store} (h : Parsed gateStart nextPointer remaining base gate wires store) : marshalStore store GateEval.address0Reg = gate.input₀ := by @@ -153,7 +164,7 @@ private theorem marshal_address0 {gateStart nextPointer remaining base : ℕ} savedInput0Reg, spillPointerReg, spillRemainingReg, UnaryDecode.activeReg, hinput0, hactive] -private theorem marshal_base {gateStart nextPointer remaining base : ℕ} +theorem marshal_base {gateStart nextPointer remaining base : ℕ} {gate : CircuitCode.RawGate} {wires : List Bool} {store : Store} (h : Parsed gateStart nextPointer remaining base gate wires store) : marshalStore store GateEval.baseReg = base := by @@ -168,7 +179,7 @@ private theorem marshal_base {gateStart nextPointer remaining base : ℕ} savedInput0Reg, spillPointerReg, spillRemainingReg, UnaryDecode.activeReg, hbase, hactive] -private theorem marshal_spillPointer +theorem marshal_spillPointer {gateStart nextPointer remaining base : ℕ} {gate : CircuitCode.RawGate} {wires : List Bool} {store : Store} (h : Parsed gateStart nextPointer remaining base gate wires store) : @@ -182,7 +193,7 @@ private theorem marshal_spillPointer savedInput0Reg, spillPointerReg, spillRemainingReg, UnaryDecode.pointerReg, hpointer] -private theorem marshal_spillRemaining +theorem marshal_spillRemaining {gateStart nextPointer remaining base : ℕ} {gate : CircuitCode.RawGate} {wires : List Bool} {store : Store} (h : Parsed gateStart nextPointer remaining base gate wires store) : @@ -196,7 +207,7 @@ private theorem marshal_spillRemaining savedInput0Reg, spillPointerReg, spillRemainingReg, UnaryDecode.remainingReg, hremaining] -private theorem marshal_op {gateStart nextPointer remaining base : ℕ} +theorem marshal_op {gateStart nextPointer remaining base : ℕ} {gate : CircuitCode.RawGate} {wires : List Bool} {store : Store} (h : Parsed gateStart nextPointer remaining base gate wires store) : marshalStore store GateEval.opReg = Input.bitValue gate.opBit := by @@ -220,7 +231,7 @@ private theorem marshal_op {gateStart nextPointer remaining base : ℕ} Function.update_of_ne, GateEval.opReg, GateEval.negated0Reg, GateEval.negated1Reg, gateStartReg] using hloaded -private theorem marshal_negated0 {gateStart nextPointer remaining base : ℕ} +theorem marshal_negated0 {gateStart nextPointer remaining base : ℕ} {gate : CircuitCode.RawGate} {wires : List Bool} {store : Store} (h : Parsed gateStart nextPointer remaining base gate wires store) : marshalStore store GateEval.negated0Reg = @@ -271,7 +282,7 @@ private theorem marshal_negated0 {gateStart nextPointer remaining base : ℕ} simpa [loadedNegated1, advanced1, Basic.exec, Function.update_of_ne, GateEval.negated0Reg, GateEval.negated1Reg, gateStartReg] using hloaded -private theorem marshal_negated1 {gateStart nextPointer remaining base : ℕ} +theorem marshal_negated1 {gateStart nextPointer remaining base : ℕ} {gate : CircuitCode.RawGate} {wires : List Bool} {store : Store} (h : Parsed gateStart nextPointer remaining base gate wires store) : marshalStore store GateEval.negated1Reg = @@ -361,42 +372,50 @@ theorem marshal_ready_internal {gateStart nextPointer remaining base : ℕ} · have hbase := hparsed.base_ge omega -private def setupStore (store : Store) : Store := +@[nolint docBlame] +def setupStore (store : Store) : Store := Basic.execList setupOps store -private def headerStore (store : Store) : Store := +@[nolint docBlame] +def headerStore (store : Store) : Store := Basic.execList headerOps (setupStore store) -private def saveRestartStore (store : Store) : Store := +@[nolint docBlame] +def saveRestartStore (store : Store) : Store := Basic.execList saveRestartOps store -private def restoreStore (store : Store) : Store := +@[nolint docBlame] +def restoreStore (store : Store) : Store := Basic.execList restoreOps store -private def firstRemaining (gate : CircuitCode.RawGate) +@[nolint docBlame] +def firstRemaining (gate : CircuitCode.RawGate) (tail : List Bool) : List Bool := CircuitCode.NatCode.encode gate.input₀ ++ CircuitCode.NatCode.encode gate.input₁ ++ tail -private def secondRemaining (gate : CircuitCode.RawGate) +@[nolint docBlame] +def secondRemaining (gate : CircuitCode.RawGate) (tail : List Bool) : List Bool := CircuitCode.NatCode.encode gate.input₁ ++ tail -private def firstOffset (gateStart : ℕ) : ℕ := +@[nolint docBlame] +def firstOffset (gateStart : ℕ) : ℕ := gateStart - UnaryDecode.inputBase + 3 -private def secondOffset (gateStart : ℕ) +@[nolint docBlame] +def secondOffset (gateStart : ℕ) (gate : CircuitCode.RawGate) : ℕ := gateStart - UnaryDecode.inputBase + 4 + gate.input₀ -private theorem setup_high (store : Store) (index : ℕ) (hindex : 10 < index) : +theorem setup_high (store : Store) (index : ℕ) (hindex : 10 < index) : setupStore store index = store index := by simp (disch := omega) [setupStore, setupOps, Basic.execList, Basic.exec, Function.update_of_ne, gateStartReg, UnaryDecode.verdictReg, UnaryDecode.valueReg, UnaryDecode.pointerReg, UnaryDecode.oneReg, UnaryDecode.activeReg] -private theorem header_high (store : Store) (index : ℕ) (hindex : 10 < index) : +theorem header_high (store : Store) (index : ℕ) (hindex : 10 < index) : headerStore store index = store index := by rw [headerStore] have hsetup := setup_high store index hindex @@ -404,7 +423,7 @@ private theorem header_high (store : Store) (index : ℕ) (hindex : 10 < index) Function.update_of_ne, UnaryDecode.pointerReg, UnaryDecode.remainingReg] using hsetup -private theorem first_ready {gateStart base : ℕ} {gate : CircuitCode.RawGate} +theorem first_ready {gateStart base : ℕ} {gate : CircuitCode.RawGate} {tail : List Bool} {wires : List Bool} {store : Store} (hready : Ready gateStart base gate tail wires store) : UnaryDecode.CursorReady (cursorLength gateStart gate tail) @@ -465,7 +484,7 @@ private theorem first_ready {gateStart base : ℕ} {gate : CircuitCode.RawGate} simp only [spillRemainingReg] at hbase omega -private theorem header_bound {gateStart base : ℕ} +theorem header_bound {gateStart base : ℕ} {gate : CircuitCode.RawGate} {tail wires : List Bool} {store : Store} (hready : Ready gateStart base gate tail wires store) (hbound : Internal.StoreEnvelope (codeEnd gateStart gate tail) @@ -511,14 +530,14 @@ private theorem header_bound {gateStart base : ℕ} · rw [header_high store index (by omega)] exact hbound.value_le index -private theorem saveRestart_high (store : Store) (index : ℕ) +theorem saveRestart_high (store : Store) (index : ℕ) (hindex : 10 < index) : saveRestartStore store index = store index := by simp (disch := omega) [saveRestartStore, saveRestartOps, Basic.execList, Basic.exec, Function.update_of_ne, savedInput0Reg, UnaryDecode.verdictReg, UnaryDecode.valueReg, UnaryDecode.activeReg] -private theorem saveRestart_apply_of_ne (store : Store) (index : ℕ) +theorem saveRestart_apply_of_ne (store : Store) (index : ℕ) (hsaved : index ≠ savedInput0Reg) (hverdict : index ≠ UnaryDecode.verdictReg) (hvalue : index ≠ UnaryDecode.valueReg) @@ -527,7 +546,7 @@ private theorem saveRestart_apply_of_ne (store : Store) (index : ℕ) simp [saveRestartStore, saveRestartOps, Basic.execList, Basic.exec, Function.update_of_ne, hsaved, hverdict, hvalue, hactive] -private theorem saveRestart_bound {bound : ℕ} {store : Store} +theorem saveRestart_bound {bound : ℕ} {store : Store} (hbound : Internal.StoreEnvelope bound bound store) (hlarge : 10 < bound) (hactive : store UnaryDecode.activeReg = 0) : Internal.StoreEnvelope bound bound (saveRestartStore store) := by @@ -550,7 +569,7 @@ private theorem saveRestart_bound {bound : ℕ} {store : Store} (by simp [Basic.writeValue]; omega) simpa [saveRestartStore, saveRestartOps, Basic.execList, saved0] using h3 -private theorem header_op {gateStart base : ℕ} {gate : CircuitCode.RawGate} +theorem header_op {gateStart base : ℕ} {gate : CircuitCode.RawGate} {tail wires : List Bool} {store : Store} (hready : Ready gateStart base gate tail wires store) : headerStore store gateStart = Input.bitValue gate.opBit := by @@ -563,7 +582,7 @@ private theorem header_op {gateStart base : ℕ} {gate : CircuitCode.RawGate} have hcode := hready.code_eq 0 simpa [codeBits, CircuitCode.RawGate.encode] using hcode -private theorem header_negated0 {gateStart base : ℕ} +theorem header_negated0 {gateStart base : ℕ} {gate : CircuitCode.RawGate} {tail wires : List Bool} {store : Store} (hready : Ready gateStart base gate tail wires store) : headerStore store (gateStart + 1) = @@ -576,7 +595,7 @@ private theorem header_negated0 {gateStart base : ℕ} rw [header_high store (gateStart + 1) hlarge, hready.code_eq 1] simp [codeBits, CircuitCode.RawGate.encode] -private theorem header_negated1 {gateStart base : ℕ} +theorem header_negated1 {gateStart base : ℕ} {gate : CircuitCode.RawGate} {tail wires : List Bool} {store : Store} (hready : Ready gateStart base gate tail wires store) : headerStore store (gateStart + 2) = @@ -872,7 +891,7 @@ theorem decoders_internal {gateStart base : ℕ} {gate : CircuitCode.RawGate} secondSpace, hfirst, rfl, hsecond, hparsed, hsecondCode, ?_⟩ simpa [hcursorEnd] using hsecondBound -private theorem restore_high (store : Store) (index : ℕ) +theorem restore_high (store : Store) (index : ℕ) (hindex : spillRemainingReg < index) : restoreStore store index = store index := by simp only [spillRemainingReg] at hindex diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/Hamming.lean b/Complexitylib/Models/RandomAccessMachine/Structured/Hamming.lean index b9b19ca9..41afc262 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/Hamming.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/Hamming.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Structured.Hamming.Defs -import Complexitylib.Models.RandomAccessMachine.Structured.Hamming.Internal -import Complexitylib.Asymptotics +module + +public import Complexitylib.Models.RandomAccessMachine.Structured.Hamming.Defs +public import Complexitylib.Models.RandomAccessMachine.Structured.Hamming.Internal +public import Complexitylib.Asymptotics /-! # Verified structured RAM Hamming weight @@ -18,6 +20,8 @@ RAM with an exact transition count, explicit length-indexed budgets, and quasilinear asymptotic corollaries. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/Hamming/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Structured/Hamming/Defs.lean index 359aef92..2048f3c4 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/Hamming/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/Hamming/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Structured.Defs +module + +public import Complexitylib.Models.RandomAccessMachine.Structured.Defs /-! # Structured RAM Hamming-weight program — definitions @@ -13,6 +15,8 @@ hold loop state and input bits start at `R₅`. This avoids the existing raw RAM input convention's overlap between an unbounded input and fixed scratch registers. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/Hamming/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Structured/Hamming/Internal.lean index 75cb802f..0e0a64b5 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/Hamming/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/Hamming/Internal.lean @@ -3,14 +3,18 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Structured -import Complexitylib.Models.RandomAccessMachine.Structured.Hamming.Defs -import Complexitylib.Models.RandomAccessMachine.Structured.Internal.Resources +module + +public import Complexitylib.Models.RandomAccessMachine.Structured +public import Complexitylib.Models.RandomAccessMachine.Structured.Hamming.Defs +public import Complexitylib.Models.RandomAccessMachine.Structured.Internal.Resources /-! # Structured RAM Hamming-weight program — proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Structured/Internal.lean index a2b1880b..f329261d 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/Internal.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Internal -import Complexitylib.Models.RandomAccessMachine.Structured.Defs +module + +public import Complexitylib.Models.RandomAccessMachine.Internal +public import Complexitylib.Models.RandomAccessMachine.Structured.Defs /-! # Structured logarithmic-cost RAM programs — proof internals @@ -13,6 +15,8 @@ This file proves that absolute-jump lowering preserves the independent source semantics exactly: final registers, logarithmic cost, and peak register space. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/Internal/Resources.lean b/Complexitylib/Models/RandomAccessMachine/Structured/Internal/Resources.lean index 19805e64..e44ec4ab 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/Internal/Resources.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/Internal/Resources.lean @@ -3,7 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Structured.Defs +module + +public import Mathlib.Algebra.Order.BigOperators.Group.Finset +public import Mathlib.Tactic.Ring +public import Complexitylib.Models.RandomAccessMachine.Structured.Defs /-! # Resource-proof infrastructure for structured RAM programs @@ -14,6 +18,8 @@ finite register envelopes, their induced `finsum` space bounds, and compositiona source executions carrying exact steps with upper bounds on time and space. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/LastBit.lean b/Complexitylib/Models/RandomAccessMachine/Structured/LastBit.lean index 94226faf..754999c7 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/LastBit.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/LastBit.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Structured.LastBit.Defs -import Complexitylib.Models.RandomAccessMachine.Structured.Scanner -import Complexitylib.Languages.LastBit +module + +public import Complexitylib.Models.RandomAccessMachine.Structured.LastBit.Defs +public import Complexitylib.Models.RandomAccessMachine.Structured.Scanner +public import Complexitylib.Languages.LastBit /-! # Verified structured RAM last-bit scanner @@ -15,6 +17,8 @@ and resource bounds. This module adds only agreement with the existing `Language.lastBitZero` and `Language.lastBitOne` specifications. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/LastBit/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Structured/LastBit/Defs.lean index d6244ac5..2ae991e6 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/LastBit/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/LastBit/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Structured.Scanner.Defs -import Mathlib.Data.FinEnum.Option +module + +public import Complexitylib.Models.RandomAccessMachine.Structured.Scanner.Defs +public import Mathlib.Data.FinEnum.Option /-! # Structured RAM last-bit scanner — definitions @@ -13,6 +15,8 @@ This is a second consumer of the typed finite-state scanner API. Its state is `Option Bool`: `none` before any input and `some bit` thereafter. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/PairValidate.lean b/Complexitylib/Models/RandomAccessMachine/Structured/PairValidate.lean index b3abed16..f23c775e 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/PairValidate.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/PairValidate.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Structured.PairValidate.Defs -import Complexitylib.Models.RandomAccessMachine.Structured.PairValidate.Internal -import Complexitylib.Models.RandomAccessMachine.Structured.Scanner -import Complexitylib.Models.TuringMachine.Subroutines.PairValidate +module + +public import Complexitylib.Models.RandomAccessMachine.Structured.PairValidate.Defs +public import Complexitylib.Models.RandomAccessMachine.Structured.PairValidate.Internal +public import Complexitylib.Models.RandomAccessMachine.Structured.Scanner +public import Complexitylib.Models.TuringMachine.Subroutines.PairValidate /-! # Verified structured RAM pair validator @@ -17,6 +19,8 @@ logarithmic-cost time and peak-space budgets, and an end-to-end compiled-RAM correctness theorem for the canonical pair-encoding language. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/PairValidate/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Structured/PairValidate/Defs.lean index 0c1461bd..80985bab 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/PairValidate/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/PairValidate/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Structured.Scanner.Defs -import Complexitylib.Models.TuringMachine.Subroutines.PairValidate.Defs +module + +public import Complexitylib.Models.RandomAccessMachine.Structured.Scanner.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.PairValidate.Defs /-! # Structured RAM pair-encoding validator — definitions @@ -14,6 +16,8 @@ same five-state automaton used by `TM.pairValidateTM`. The generic scanner compiler supplies the table-driven structured RAM program. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/PairValidate/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Structured/PairValidate/Internal.lean index 8d718f54..7c804e03 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/PairValidate/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/PairValidate/Internal.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Structured.PairValidate.Defs -import Complexitylib.Models.RandomAccessMachine.Structured.Scanner.Internal +module + +public import Complexitylib.Models.RandomAccessMachine.Structured.PairValidate.Defs +public import Complexitylib.Models.RandomAccessMachine.Structured.Scanner.Internal /-! # Structured RAM pair validator — proof internals @@ -13,6 +15,8 @@ The benchmark supplies only its typed scanner specification. State encoding, execution, correctness, and resource proofs are all in the generic scanner layer. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/Scanner.lean b/Complexitylib/Models/RandomAccessMachine/Structured/Scanner.lean index b9a68be6..61ebfee6 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/Scanner.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/Scanner.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Structured.Scanner.Defs -import Complexitylib.Models.RandomAccessMachine.Structured.Scanner.Internal -import Complexitylib.Asymptotics +module + +public import Complexitylib.Models.RandomAccessMachine.Structured.Scanner.Defs +public import Complexitylib.Models.RandomAccessMachine.Structured.Scanner.Internal +public import Complexitylib.Asymptotics /-! # Verified finite-state structured RAM scanners @@ -16,6 +18,8 @@ count and explicit logarithmic-time and peak-space bounds, all transferred to the concrete compiled RAM. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/Scanner/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Structured/Scanner/Defs.lean index 59dc439c..b5299319 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/Scanner/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/Scanner/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Structured.Defs -import Mathlib.Data.FinEnum +module + +public import Complexitylib.Models.RandomAccessMachine.Structured.Defs +public import Mathlib.Data.FinEnum /-! # Finite-state scanners for the structured RAM frontend @@ -15,6 +17,8 @@ bound and transition-closure fields are the complete trusted interface needed by the generic correctness and resource proof. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/Scanner/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Structured/Scanner/Internal.lean index b80b457e..c5984fd1 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/Scanner/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/Scanner/Internal.lean @@ -3,14 +3,18 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Structured -import Complexitylib.Models.RandomAccessMachine.Structured.Internal.Resources -import Complexitylib.Models.RandomAccessMachine.Structured.Scanner.Defs +module + +public import Complexitylib.Models.RandomAccessMachine.Structured +public import Complexitylib.Models.RandomAccessMachine.Structured.Internal.Resources +public import Complexitylib.Models.RandomAccessMachine.Structured.Scanner.Defs /-! # Finite-state structured RAM scanners — proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/Switch.lean b/Complexitylib/Models/RandomAccessMachine/Structured/Switch.lean index bd9b872c..676b328f 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/Switch.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/Switch.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Structured.Switch.Defs -import Complexitylib.Models.RandomAccessMachine.Structured.Switch.Internal +module + +public import Complexitylib.Models.RandomAccessMachine.Structured.Switch.Defs +public import Complexitylib.Models.RandomAccessMachine.Structured.Switch.Internal /-! # Verified finite numeric switches for structured RAM programs @@ -13,6 +15,8 @@ The theorem in this module gives exact source step accounting and explicit logarithmic-cost and peak-space bounds for a finite numeric switch. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/Switch/Compiled.lean b/Complexitylib/Models/RandomAccessMachine/Structured/Switch/Compiled.lean index a849d4b9..a7636330 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/Switch/Compiled.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/Switch/Compiled.lean @@ -3,12 +3,16 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Structured +module + +public import Complexitylib.Models.RandomAccessMachine.Structured /-! # Compilation theorem for finite numeric structured-RAM switches -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/Switch/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Structured/Switch/Defs.lean index 60b040ba..f216e936 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/Switch/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/Switch/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Structured.Defs +module + +public import Complexitylib.Models.RandomAccessMachine.Structured.Defs /-! # Finite numeric switches for structured RAM programs @@ -13,6 +15,8 @@ tree. A valid numeric code in `test` selects the corresponding branch. The register `one` must contain one and be distinct from `test`. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/Switch/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Structured/Switch/Internal.lean index 1aaabc1c..b3053b4f 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/Switch/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/Switch/Internal.lean @@ -3,13 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Structured.Internal.Resources -import Complexitylib.Models.RandomAccessMachine.Structured.Switch.Defs +module + +public import Complexitylib.Models.RandomAccessMachine.Structured.Internal.Resources +public import Complexitylib.Models.RandomAccessMachine.Structured.Switch.Defs /-! # Finite numeric structured-RAM switches -- proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/ThreeSATSyntax.lean b/Complexitylib/Models/RandomAccessMachine/Structured/ThreeSATSyntax.lean index 49459868..c58bea99 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/ThreeSATSyntax.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/ThreeSATSyntax.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Structured.ThreeSATSyntax.Defs -import Complexitylib.Models.RandomAccessMachine.Structured.Scanner +module + +public import Complexitylib.Models.RandomAccessMachine.Structured.ThreeSATSyntax.Defs +public import Complexitylib.Models.RandomAccessMachine.Structured.Scanner /-! # Verified structured RAM exact-3-CNF syntax scanner @@ -13,6 +15,8 @@ The generic typed-scanner compiler supplies the entire implementation proof and resource analysis for the existing 27-state `SAT.ThreeSAT.Syntax` automaton. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/ThreeSATSyntax/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Structured/ThreeSATSyntax/Defs.lean index 9c95a3bb..60269b5f 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/ThreeSATSyntax/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/ThreeSATSyntax/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Structured.Scanner.Defs -import Complexitylib.SAT.ThreeSAT.Syntax +module + +public import Complexitylib.Models.RandomAccessMachine.Structured.Scanner.Defs +public import Complexitylib.SAT.ThreeSAT.Syntax /-! # Structured RAM exact-3-CNF syntax scanner — definitions @@ -14,6 +16,8 @@ This is the larger typed-scanner benchmark: the existing 27-state bit-level table or benchmark-specific execution invariant. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/UnaryDecode.lean b/Complexitylib/Models/RandomAccessMachine/Structured/UnaryDecode.lean index a3c9ee59..506d83cc 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/UnaryDecode.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/UnaryDecode.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Structured.UnaryDecode.Defs -import Complexitylib.Models.RandomAccessMachine.Structured.UnaryDecode.Internal -import Complexitylib.Asymptotics +module + +public import Complexitylib.Models.RandomAccessMachine.Structured.UnaryDecode.Defs +public import Complexitylib.Models.RandomAccessMachine.Structured.UnaryDecode.Internal +public import Complexitylib.Asymptotics /-! # Verified structured RAM terminated-unary decoder @@ -16,6 +18,8 @@ and input exhaustion, and compilation preserves its exact transition count, logarithmic cost, peak space, decoded value, and suffix cursor. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/UnaryDecode/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Structured/UnaryDecode/Defs.lean index 07f405c9..a9c9f3c7 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/UnaryDecode/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/UnaryDecode/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Structured.Defs -import Complexitylib.Circuits.Encoding.Defs +module + +public import Complexitylib.Models.RandomAccessMachine.Structured.Defs +public import Complexitylib.Circuits.Encoding.Defs /-! # Structured RAM terminated-unary cursor decoder — definitions @@ -15,6 +17,8 @@ the loop can exit either successfully at a zero terminator or unsuccessfully at the end of the available array. -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/UnaryDecode/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Structured/UnaryDecode/Internal.lean index ce542455..f895dc09 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/UnaryDecode/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/UnaryDecode/Internal.lean @@ -3,14 +3,18 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.RandomAccessMachine.Structured -import Complexitylib.Models.RandomAccessMachine.Structured.Internal.Resources -import Complexitylib.Models.RandomAccessMachine.Structured.UnaryDecode.Defs +module + +public import Complexitylib.Models.RandomAccessMachine.Structured +public import Complexitylib.Models.RandomAccessMachine.Structured.Internal.Resources +public import Complexitylib.Models.RandomAccessMachine.Structured.UnaryDecode.Defs /-! # Structured RAM terminated-unary decoder — proof internals -/ +@[expose] public section + namespace Complexity namespace RAM diff --git a/Complexitylib/Models/TuringMachine.lean b/Complexitylib/Models/TuringMachine.lean index e1087d8c..0545de2d 100644 --- a/Complexitylib/Models/TuringMachine.lean +++ b/Complexitylib/Models/TuringMachine.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Mathlib.Logic.Relation -import Mathlib.Data.Fintype.Pi -import Mathlib.Data.Rat.Defs +module + +public import Mathlib.Logic.Relation +public import Mathlib.Data.Fintype.Pi +public import Mathlib.Data.Rat.Defs /-! # Turing machines @@ -55,6 +57,8 @@ Arora–Barak (*Computational Complexity: A Modern Approach*, Definitions - **NTM execution**: Defined via `trace` (a fixed choice sequence), not a relational step. -/ +@[expose] public section + namespace Complexity /-- The tape alphabet Γ = {0, 1, □, ▷}. -/ diff --git a/Complexitylib/Models/TuringMachine/Combinators.lean b/Complexitylib/Models/TuringMachine/Combinators.lean index 0ec5b375..170d0ec1 100644 --- a/Complexitylib/Models/TuringMachine/Combinators.lean +++ b/Complexitylib/Models/TuringMachine/Combinators.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine -import Mathlib.Data.Fintype.Sum +module + +public import Complexitylib.Models.TuringMachine +public import Mathlib.Data.Fintype.Sum /-! # TM Combinators @@ -53,6 +55,8 @@ The union machine has three phases: between Phase 1 and Phase 2. -/ +@[expose] public section + namespace Complexity variable {n₁ n₂ : ℕ} diff --git a/Complexitylib/Models/TuringMachine/Combinators/ForBinaryWork.lean b/Complexitylib/Models/TuringMachine/Combinators/ForBinaryWork.lean index 0a48b940..8f0f4f59 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/ForBinaryWork.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/ForBinaryWork.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.ForBinaryWork.Defs -import Complexitylib.Models.TuringMachine.Combinators.ForBinaryWork.Internal +module + +public import Complexitylib.Models.TuringMachine.Combinators.ForBinaryWork.Defs +public import Complexitylib.Models.TuringMachine.Combinators.ForBinaryWork.Internal /-! # Binary work-tape loop combinator @@ -23,6 +25,8 @@ for bitwise algorithms without iterating over the represented numeric value. - `TM.IsTransducer.forBinaryWorkTM` preserves one-way output safety. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Combinators/ForBinaryWork/Defs.lean b/Complexitylib/Models/TuringMachine/Combinators/ForBinaryWork/Defs.lean index 7412fe06..4830e8e9 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/ForBinaryWork/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/ForBinaryWork/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators +module + +public import Complexitylib.Models.TuringMachine.Combinators /-! # Binary work-tape loop combinator -- definitions @@ -15,6 +17,8 @@ width-driven control needed by bitwise algorithms such as schoolbook multiplication, without a numeric-value counter. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Combinators/ForBinaryWork/Internal.lean b/Complexitylib/Models/TuringMachine/Combinators/ForBinaryWork/Internal.lean index bc8b8ec1..732dfe74 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/ForBinaryWork/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/ForBinaryWork/Internal.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.ForBinaryWork.Defs -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -import Complexitylib.Models.TuringMachine.Internal -import Complexitylib.Models.TuringMachine.SpaceTime.Internal.Reachability +module + +public import Complexitylib.Models.TuringMachine.Combinators.ForBinaryWork.Defs +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +public import Complexitylib.Models.TuringMachine.Internal +public import Complexitylib.Models.TuringMachine.SpaceTime.Internal.Reachability /-! # Binary work-tape loop combinator -- proof internals @@ -15,6 +17,8 @@ This module proves exact body embedding, bit/blank scanner transitions, the advancing loopback seam, certified finite iteration, and transducer closure. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Combinators/ForInput.lean b/Complexitylib/Models/TuringMachine/Combinators/ForInput.lean index 18527800..57f9c4f1 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/ForInput.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/ForInput.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.ForInput.Defs -import Complexitylib.Models.TuringMachine.Combinators.ForInput.Internal +module + +public import Complexitylib.Models.TuringMachine.Combinators.ForInput.Defs +public import Complexitylib.Models.TuringMachine.Combinators.ForInput.Internal /-! # Read-only-input loop combinator @@ -22,6 +24,8 @@ counterpart of the unary-work-register loop `TM.forRegTM`. loop run respects the certified auxiliary-space budget. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Combinators/ForInput/Defs.lean b/Complexitylib/Models/TuringMachine/Combinators/ForInput/Defs.lean index 3dbfbee8..dea1fd2a 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/ForInput/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/ForInput/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators +module + +public import Complexitylib.Models.TuringMachine.Combinators /-! # Read-only-input loop combinator — definitions @@ -14,6 +16,8 @@ invocation per original input bit. The input itself is the loop fuel, so the combinator does not materialize a linear-size unary counter on an auxiliary tape. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Combinators/ForInput/Internal.lean b/Complexitylib/Models/TuringMachine/Combinators/ForInput/Internal.lean index 6deb5cf4..c67253ca 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/ForInput/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/ForInput/Internal.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.ForInput.Defs -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -import Complexitylib.Models.TuringMachine.Internal -import Complexitylib.Models.TuringMachine.SpaceTime.Internal.Reachability +module + +public import Complexitylib.Models.TuringMachine.Combinators.ForInput.Defs +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +public import Complexitylib.Models.TuringMachine.Internal +public import Complexitylib.Models.TuringMachine.SpaceTime.Internal.Reachability /-! # Read-only-input loop combinator — proof internals @@ -15,6 +17,8 @@ This module supplies the exact body-simulation embedding and the structural one-way-output proof for `TM.forInputTM`. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Combinators/ForWorkOnes.lean b/Complexitylib/Models/TuringMachine/Combinators/ForWorkOnes.lean index 8b2e1567..7ddd79df 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/ForWorkOnes.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/ForWorkOnes.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.ForWorkOnes.Defs -import Complexitylib.Models.TuringMachine.Combinators.ForWorkOnes.Internal +module + +public import Complexitylib.Models.TuringMachine.Combinators.ForWorkOnes.Defs +public import Complexitylib.Models.TuringMachine.Combinators.ForWorkOnes.Internal /-! # One-prefix work-tape loop combinator @@ -21,6 +23,8 @@ the RAM snapshot word decoder. - `TM.IsTransducer.forWorkOnesTM` preserves one-way output safety. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Combinators/ForWorkOnes/Defs.lean b/Complexitylib/Models/TuringMachine/Combinators/ForWorkOnes/Defs.lean index 0d17f94c..38dc7612 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/ForWorkOnes/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/ForWorkOnes/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators +module + +public import Complexitylib.Models.TuringMachine.Combinators /-! # One-prefix work-tape loop combinator — definitions @@ -19,6 +21,8 @@ driver tape and head. The combinator itself is a concrete `TM`; loop certificates and proofs live in the adjacent internal and surface modules. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Combinators/ForWorkOnes/Internal.lean b/Complexitylib/Models/TuringMachine/Combinators/ForWorkOnes/Internal.lean index 54124f31..349d3ff2 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/ForWorkOnes/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/ForWorkOnes/Internal.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.ForWorkOnes.Defs -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -import Complexitylib.Models.TuringMachine.Internal +module + +public import Complexitylib.Models.TuringMachine.Combinators.ForWorkOnes.Defs +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +public import Complexitylib.Models.TuringMachine.Internal /-! # One-prefix work-tape loop combinator — proof internals @@ -14,6 +16,8 @@ This module proves exact body embedding, driver transitions, certified loop execution, and one-way-output preservation for `TM.forWorkOnesTM`. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Combinators/Internal.lean b/Complexitylib/Models/TuringMachine/Combinators/Internal.lean index 972152e9..5fcbba08 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/Internal.lean @@ -3,14 +3,16 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.Internal.Complement -import Complexitylib.Models.TuringMachine.Combinators.Internal.Seq -import Complexitylib.Models.TuringMachine.Combinators.Internal.If -import Complexitylib.Models.TuringMachine.Combinators.Internal.Loop -import Complexitylib.Models.TuringMachine.Combinators.Internal.Retarget -import Complexitylib.Models.TuringMachine.Combinators.Internal.Scanner -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -import Complexitylib.Models.TuringMachine.Combinators.Internal.Union +module + +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Complement +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Seq +public import Complexitylib.Models.TuringMachine.Combinators.Internal.If +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Loop +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Retarget +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Scanner +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Union /-! # Combinator proof internals (aggregation) @@ -21,3 +23,5 @@ combinators (`Complement`, `Seq`, `If`, `Loop`, `Retarget`, `Scanner`, that the surface module `Combinators.lean` can pull in all combinator proof internals with a single import. -/ + +@[expose] public section diff --git a/Complexitylib/Models/TuringMachine/Combinators/Internal/Complement.lean b/Complexitylib/Models/TuringMachine/Combinators/Internal/Complement.lean index 1f9ed40d..5c7a2fae 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/Internal/Complement.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/Internal/Complement.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -import Complexitylib.Models.TuringMachine.Internal +module + +public import Complexitylib.Models.TuringMachine.Combinators +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +public import Complexitylib.Models.TuringMachine.Internal /-! # Complement TM: proof internals @@ -14,6 +16,8 @@ This file provides the simulation lemmas for `TM.complementTM`, showing that the complement machine correctly flips the output of the original TM. -/ +@[expose] public section + namespace Complexity variable {n : ℕ} diff --git a/Complexitylib/Models/TuringMachine/Combinators/Internal/Generic.lean b/Complexitylib/Models/TuringMachine/Combinators/Internal/Generic.lean index 80f2994d..a0f43e33 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/Internal/Generic.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/Internal/Generic.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators +module + +public import Complexitylib.Models.TuringMachine.Combinators /-! # Generic proof tools for TM combinators @@ -37,6 +39,8 @@ and `ComplementInternal`. These lemmas were previously duplicated across multiple Internal files. -/ +@[expose] public section + namespace Complexity variable {n : ℕ} diff --git a/Complexitylib/Models/TuringMachine/Combinators/Internal/If.lean b/Complexitylib/Models/TuringMachine/Combinators/Internal/If.lean index ff258729..99a47e8d 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/Internal/If.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/Internal/If.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +module + +public import Complexitylib.Models.TuringMachine.Combinators +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic /-! # ifTM simulation — proof internals @@ -18,6 +20,8 @@ This file contains the simulation lemmas for `ifTM tmTest tmThen tmElse`. - `ifElseWrap` — embed a `tmElse` config into the `ifTM` config space -/ +@[expose] public section + namespace Complexity variable {n : ℕ} diff --git a/Complexitylib/Models/TuringMachine/Combinators/Internal/Loop.lean b/Complexitylib/Models/TuringMachine/Combinators/Internal/Loop.lean index 0582db29..5087f275 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/Internal/Loop.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/Internal/Loop.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +module + +public import Complexitylib.Models.TuringMachine.Combinators +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic /-! # loopTM simulation — proof internals @@ -18,6 +20,8 @@ This file contains the simulation lemmas for `loopTM tmBody tmTest`. - Tape transformations use the shared `transitionTape` / `transitionInput` -/ +@[expose] public section + namespace Complexity variable {n : ℕ} diff --git a/Complexitylib/Models/TuringMachine/Combinators/Internal/Retarget.lean b/Complexitylib/Models/TuringMachine/Combinators/Internal/Retarget.lean index 02bc0167..1113141a 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/Internal/Retarget.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/Internal/Retarget.lean @@ -3,12 +3,14 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -import Complexitylib.Models.TuringMachine.Internal -import Complexitylib.Models.TuringMachine.Hoare.Defs -import Complexitylib.Models.TuringMachine.Subroutines.Counter -import Complexitylib.Models.TuringMachine.Subroutines.Internal +module + +public import Complexitylib.Models.TuringMachine.Combinators +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +public import Complexitylib.Models.TuringMachine.Internal +public import Complexitylib.Models.TuringMachine.Hoare.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.Counter +public import Complexitylib.Models.TuringMachine.Subroutines.Internal /-! # retargetInput simulation — proof internals @@ -67,6 +69,8 @@ cell 0 are no-ops) — captured by `Tape.StartInvariant` below and preserved across `TM.step` by `Tape.StartInvariant.step`. -/ +@[expose] public section + namespace Complexity variable {k : ℕ} diff --git a/Complexitylib/Models/TuringMachine/Combinators/Internal/Scanner.lean b/Complexitylib/Models/TuringMachine/Combinators/Internal/Scanner.lean index b1be1c09..08a90300 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/Internal/Scanner.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/Internal/Scanner.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +module + +public import Complexitylib.Models.TuringMachine.Combinators +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic /-! # Correctness of the generic finite-state scanner @@ -20,6 +22,8 @@ Proofs that `TM.scannerTM` correctly implements a left-to-right fold with characterized by `x ∈ L ↔ finalOutput (x.foldl scanStep s₀) = Γw.one`. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Combinators/Internal/Seq.lean b/Complexitylib/Models/TuringMachine/Combinators/Internal/Seq.lean index 1ccff397..183ecdce 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/Internal/Seq.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/Internal/Seq.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +module + +public import Complexitylib.Models.TuringMachine.Combinators +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic /-! # seqTM simulation — proof internals @@ -18,6 +20,8 @@ This file contains the simulation lemmas for `seqTM tm₁ tm₂`. - Tape transformations use the shared `transitionTape` / `transitionInput` -/ +@[expose] public section + namespace Complexity variable {n : ℕ} diff --git a/Complexitylib/Models/TuringMachine/Combinators/Internal/Union.lean b/Complexitylib/Models/TuringMachine/Combinators/Internal/Union.lean index 61016784..c44dac78 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/Internal/Union.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/Internal/Union.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators -import Complexitylib.Models.TuringMachine.Internal -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +module + +public import Complexitylib.Models.TuringMachine.Combinators +public import Complexitylib.Models.TuringMachine.Internal +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic /-! # unionTM simulation — proof internals @@ -33,6 +35,8 @@ The proof proceeds in three phases: - `unionPhase1Cfg` — embedding of a tm₁ config into the union machine's config space -/ +@[expose] public section + namespace Complexity variable {n₁ n₂ : ℕ} diff --git a/Complexitylib/Models/TuringMachine/Combinators/RetargetCompute.lean b/Complexitylib/Models/TuringMachine/Combinators/RetargetCompute.lean index 7ba48c9f..9771a23e 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/RetargetCompute.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/RetargetCompute.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.RetargetCompute.Defs -import Complexitylib.Models.TuringMachine.Combinators.RetargetCompute.Internal +module + +public import Complexitylib.Models.TuringMachine.Combinators.RetargetCompute.Defs +public import Complexitylib.Models.TuringMachine.Combinators.RetargetCompute.Internal /-! # Retargeted-input computation seams @@ -28,6 +30,8 @@ positive advertised time bound. - `TM.placeWorkTM_retargetInputStarted_decidesVirtual` — placed decision seam -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Combinators/RetargetCompute/Defs.lean b/Complexitylib/Models/TuringMachine/Combinators/RetargetCompute/Defs.lean index df8aed8b..c8e95465 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/RetargetCompute/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/RetargetCompute/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators +module + +public import Complexitylib.Models.TuringMachine.Combinators /-! # Retargeted-input computation seams @@ -21,6 +23,8 @@ sentinel transition while reading its input from the last work tape. - `TM.retargetInputStartedCfg` — canonical entry configuration for a virtual input -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Combinators/RetargetCompute/Internal.lean b/Complexitylib/Models/TuringMachine/Combinators/RetargetCompute/Internal.lean index 151031ee..885aa6b6 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/RetargetCompute/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/RetargetCompute/Internal.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.RetargetCompute.Defs -import Complexitylib.Models.TuringMachine.Combinators.Internal.Retarget -import Complexitylib.Models.TuringMachine.Hoare.Defs -import Complexitylib.Models.TuringMachine.Placement.Internal +module + +public import Complexitylib.Models.TuringMachine.Combinators.RetargetCompute.Defs +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Retarget +public import Complexitylib.Models.TuringMachine.Hoare.Defs +public import Complexitylib.Models.TuringMachine.Placement.Internal /-! # Retargeted-input computation seam internals @@ -17,6 +19,8 @@ separately: such a machine can compute only the empty output, and the wrapper therefore halts immediately on its parked blank output tape. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Combinators/WorkBranch.lean b/Complexitylib/Models/TuringMachine/Combinators/WorkBranch.lean index 7f1db144..9d38c529 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/WorkBranch.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/WorkBranch.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.WorkBranch.Defs -import Complexitylib.Models.TuringMachine.Combinators.WorkBranch.Internal +module + +public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch.Defs +public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch.Internal /-! # Direct work-symbol branch combinator @@ -30,6 +32,8 @@ heads reading `▷` must move right. - `TM.IsTransducer.branchWorkBlankTM` preserves one-way output behavior. -/ +@[expose] public section + namespace Complexity namespace Tape diff --git a/Complexitylib/Models/TuringMachine/Combinators/WorkBranch/Defs.lean b/Complexitylib/Models/TuringMachine/Combinators/WorkBranch/Defs.lean index 73c7837d..22bfed7c 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/WorkBranch/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/WorkBranch/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators +module + +public import Complexitylib.Models.TuringMachine.Combinators /-! # Direct work-symbol branch combinator -- definitions @@ -14,6 +16,8 @@ dispatcher uses the ordinary read-back action on every tape and never uses the output tape as control storage. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Combinators/WorkBranch/Internal.lean b/Complexitylib/Models/TuringMachine/Combinators/WorkBranch/Internal.lean index aea156c0..1c99ba91 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/WorkBranch/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/WorkBranch/Internal.lean @@ -3,17 +3,21 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Mathlib.NatBits -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -import Complexitylib.Models.TuringMachine.Combinators.WorkBranch.Defs -import Complexitylib.Models.TuringMachine.Hoare.Space -import Complexitylib.Models.TuringMachine.SpaceTime.Internal.Reachability -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs +module + +public import Complexitylib.Mathlib.NatBits +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch.Defs +public import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.TuringMachine.SpaceTime.Internal.Reachability +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs /-! # Direct work-symbol branch combinator -- proof internals -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Combinators/WorkSymbolBranch.lean b/Complexitylib/Models/TuringMachine/Combinators/WorkSymbolBranch.lean index 722098d1..1303b430 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/WorkSymbolBranch.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/WorkSymbolBranch.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.WorkSymbolBranch.Defs -import Complexitylib.Models.TuringMachine.Combinators.WorkSymbolBranch.Internal -import Complexitylib.Models.TuringMachine.Hoare.Space +module + +public import Complexitylib.Models.TuringMachine.Combinators.WorkSymbolBranch.Defs +public import Complexitylib.Models.TuringMachine.Combinators.WorkSymbolBranch.Internal +public import Complexitylib.Models.TuringMachine.Hoare.Space /-! # Direct work-symbol branch combinator @@ -15,6 +17,8 @@ arbitrary work-tape symbol. It is the direct controller primitive used to branch on the readable sparse-entry equality flag. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Combinators/WorkSymbolBranch/Defs.lean b/Complexitylib/Models/TuringMachine/Combinators/WorkSymbolBranch/Defs.lean index a86f5973..f5dd874f 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/WorkSymbolBranch/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/WorkSymbolBranch/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.WorkBranch.Defs +module + +public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch.Defs /-! # Direct work-symbol branch combinator — definitions @@ -13,6 +15,8 @@ and runs `onEqual` exactly when the current symbol equals `symbol`. This is the generic controller branch used by the sparse RAM lookup scan. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Combinators/WorkSymbolBranch/Internal.lean b/Complexitylib/Models/TuringMachine/Combinators/WorkSymbolBranch/Internal.lean index d9c5d1fd..9cc9905b 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/WorkSymbolBranch/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/WorkSymbolBranch/Internal.lean @@ -3,13 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -import Complexitylib.Models.TuringMachine.Combinators.WorkSymbolBranch.Defs +module + +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +public import Complexitylib.Models.TuringMachine.Combinators.WorkSymbolBranch.Defs /-! # Direct work-symbol branch combinator — proof internals -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Composition.lean b/Complexitylib/Models/TuringMachine/Composition.lean index 2a23ffcf..f8a28643 100644 --- a/Complexitylib/Models/TuringMachine/Composition.lean +++ b/Complexitylib/Models/TuringMachine/Composition.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Composition.Defs -import Complexitylib.Models.TuringMachine.Composition.Internal +module + +public import Complexitylib.Models.TuringMachine.Composition.Defs +public import Complexitylib.Models.TuringMachine.Composition.Internal /-! # Sequential composition after function computation @@ -21,6 +23,8 @@ first delimiter. - `TM.compositionTM_decidesInTime` — function computation followed by a decider -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Composition/Defs.lean b/Complexitylib/Models/TuringMachine/Composition/Defs.lean index 79eb0068..2f081ef5 100644 --- a/Complexitylib/Models/TuringMachine/Composition/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Composition/Defs.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.RetargetCompute.Defs -import Complexitylib.Models.TuringMachine.Lift -import Complexitylib.Models.TuringMachine.Placement.Defs -import Complexitylib.Models.TuringMachine.Subroutines +module + +public import Complexitylib.Models.TuringMachine.Combinators.RetargetCompute.Defs +public import Complexitylib.Models.TuringMachine.Lift +public import Complexitylib.Models.TuringMachine.Placement.Defs +public import Complexitylib.Models.TuringMachine.Subroutines /-! # Sequential composition after function computation @@ -28,6 +30,8 @@ The raw output is rewound and copied to the fresh virtual-input tape before `tmG` resumes after its compulsory first transition off the left-end markers. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Composition/Internal.lean b/Complexitylib/Models/TuringMachine/Composition/Internal.lean index db10e91f..658ac04f 100644 --- a/Complexitylib/Models/TuringMachine/Composition/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Composition/Internal.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Composition.Internal.FirstPhase -import Complexitylib.Models.TuringMachine.Composition.Internal.Tail -import Complexitylib.Models.TuringMachine.OutputBounds +module + +public import Complexitylib.Models.TuringMachine.Composition.Internal.FirstPhase +public import Complexitylib.Models.TuringMachine.Composition.Internal.Tail +public import Complexitylib.Models.TuringMachine.OutputBounds /-! # Sequential composition correctness — proof internals @@ -15,6 +17,8 @@ boundary to the normalization tail. It derives coarse monotone time bounds for both function composition and preprocessing followed by a language decider. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Composition/Internal/FirstPhase.lean b/Complexitylib/Models/TuringMachine/Composition/Internal/FirstPhase.lean index 661b7013..77d7fea1 100644 --- a/Complexitylib/Models/TuringMachine/Composition/Internal/FirstPhase.lean +++ b/Complexitylib/Models/TuringMachine/Composition/Internal/FirstPhase.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Composition.Defs -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -import Complexitylib.Models.TuringMachine.Placement.Internal +module + +public import Complexitylib.Models.TuringMachine.Composition.Defs +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +public import Complexitylib.Models.TuringMachine.Placement.Internal /-! # Function composition: first-phase boundary @@ -15,6 +17,8 @@ raw-output work tape, places that run in the composite layout, and exposes the exact tape facts required by the normalization tail. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Composition/Internal/Tail.lean b/Complexitylib/Models/TuringMachine/Composition/Internal/Tail.lean index 6c425f77..819b1a56 100644 --- a/Complexitylib/Models/TuringMachine/Composition/Internal/Tail.lean +++ b/Complexitylib/Models/TuringMachine/Composition/Internal/Tail.lean @@ -3,11 +3,13 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Composition.Defs -import Complexitylib.Models.TuringMachine.Subroutines.CopyWorkOutput -import Complexitylib.Models.TuringMachine.Combinators.RetargetCompute -import Complexitylib.Models.TuringMachine.Hoare -import Complexitylib.Models.TuringMachine.Tape.Encoding +module + +public import Complexitylib.Models.TuringMachine.Composition.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.CopyWorkOutput +public import Complexitylib.Models.TuringMachine.Combinators.RetargetCompute +public import Complexitylib.Models.TuringMachine.Hoare +public import Complexitylib.Models.TuringMachine.Tape.Encoding /-! # Sequential-composition tail pipeline @@ -24,6 +26,8 @@ The phase-expanded bound is which simplifies to `B + 2 * |y| + 9 + G(|y|)`. -/ +@[expose] public section + namespace Complexity namespace TM @@ -43,7 +47,7 @@ private theorem transitionTape_eq_of_startInvariant {t : Tape} transitionTape_eq_self (read_ne_start_of_startInvariant hinv hhead) /-- Boundary contract consumed only by the proof-internal composition tail. -/ -private def CompositionTailPre (nf ng : ℕ) (y : List Bool) (B : ℕ) +def CompositionTailPre (nf ng : ℕ) (y : List Bool) (B : ℕ) (inp : Tape) (work : Fin (compositionTapeCount nf ng) → Tape) (out : Tape) : Prop := (work (compositionRawOutputIdx nf ng)).HasOutput y ∧ diff --git a/Complexitylib/Models/TuringMachine/Composition/PairWithInput.lean b/Complexitylib/Models/TuringMachine/Composition/PairWithInput.lean index 4ca7ad31..a6279e8f 100644 --- a/Complexitylib/Models/TuringMachine/Composition/PairWithInput.lean +++ b/Complexitylib/Models/TuringMachine/Composition/PairWithInput.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Composition.PairWithInput.Defs -import Complexitylib.Models.TuringMachine.Composition.PairWithInput.Internal +module + +public import Complexitylib.Models.TuringMachine.Composition.PairWithInput.Defs +public import Complexitylib.Models.TuringMachine.Composition.PairWithInput.Internal /-! # Pair a computed value with the original input @@ -18,6 +20,8 @@ retaining a concrete polynomial-preserving time bound. - `TM.pairWithInputTM_computesInTime` — computation paired with original input -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Composition/PairWithInput/Defs.lean b/Complexitylib/Models/TuringMachine/Composition/PairWithInput/Defs.lean index bbb01e33..804a15df 100644 --- a/Complexitylib/Models/TuringMachine/Composition/PairWithInput/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Composition/PairWithInput/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Composition.Defs -import Complexitylib.Models.TuringMachine.Subroutines.PairEmit.Defs +module + +public import Complexitylib.Models.TuringMachine.Composition.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.PairEmit.Defs /-! # Pair a computed value with the original input @@ -16,6 +18,8 @@ directly to the real output. Only the first raw-output delimiter is semantic; later cells may contain arbitrary non-`▷` junk. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Composition/PairWithInput/Internal.lean b/Complexitylib/Models/TuringMachine/Composition/PairWithInput/Internal.lean index b375de17..b05a6878 100644 --- a/Complexitylib/Models/TuringMachine/Composition/PairWithInput/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Composition/PairWithInput/Internal.lean @@ -3,12 +3,14 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Composition.Internal.FirstPhase -import Complexitylib.Models.TuringMachine.Composition.PairWithInput.Defs -import Complexitylib.Models.TuringMachine.Hoare -import Complexitylib.Models.TuringMachine.OutputBounds -import Complexitylib.Models.TuringMachine.Subroutines.Internal -import Complexitylib.Models.TuringMachine.Subroutines.PairEmit +module + +public import Complexitylib.Models.TuringMachine.Composition.Internal.FirstPhase +public import Complexitylib.Models.TuringMachine.Composition.PairWithInput.Defs +public import Complexitylib.Models.TuringMachine.Hoare +public import Complexitylib.Models.TuringMachine.OutputBounds +public import Complexitylib.Models.TuringMachine.Subroutines.Internal +public import Complexitylib.Models.TuringMachine.Subroutines.PairEmit /-! # Pair a computed value with the original input — proof internals @@ -17,6 +19,8 @@ This module verifies the generic fanout pipeline defined in `Composition.PairWithInput.Defs`. -/ +@[expose] public section + namespace Complexity namespace TM @@ -26,7 +30,7 @@ variable {nf : ℕ} /-- Boundary contract after the source computation has redirected its output. Both source heads remain within `B`, every tape is safely parked away from the left marker, and the real output is fresh for pair emission. -/ -private def PairWithInputTailPre (nf : ℕ) (first second : List Bool) (B : ℕ) +def PairWithInputTailPre (nf : ℕ) (first second : List Bool) (B : ℕ) (inp : Tape) (work : Fin (pairWithInputTapeCount nf) → Tape) (out : Tape) : Prop := let raw := pairWithInputRawOutputIdx nf diff --git a/Complexitylib/Models/TuringMachine/Deterministic.lean b/Complexitylib/Models/TuringMachine/Deterministic.lean index a0bc7000..89c2b323 100644 --- a/Complexitylib/Models/TuringMachine/Deterministic.lean +++ b/Complexitylib/Models/TuringMachine/Deterministic.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Internal -import Complexitylib.Models.TuringMachine.SingleTape +module + +public import Complexitylib.Models.TuringMachine.Internal +public import Complexitylib.Models.TuringMachine.SingleTape /-! # Deterministic NTMs → DTMs @@ -30,6 +32,8 @@ deterministic machines: `singleTapeSimTime k T = fun n => 16 * (k + 1) * (T n + n + 1) ^ 2`. -/ +@[expose] public section + namespace Complexity namespace NTM diff --git a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine.lean b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine.lean index 349faffa..fe7644da 100644 --- a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine.lean +++ b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Defs -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Internal +module + +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Defs +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Internal /-! # Proof-carrying binary stream routines @@ -32,6 +34,8 @@ this initial layer. - `BinaryRoutine.emitRawGateStep_sound` adapts one streaming raw gate. -/ +@[expose] public section + namespace Complexity namespace BinaryRoutine diff --git a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Arithmetic.lean b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Arithmetic.lean index 878b7826..2ef4364d 100644 --- a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Arithmetic.lean +++ b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Arithmetic.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic.Defs -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic.Internal +module + +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic.Defs +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic.Internal /-! # Arithmetic leaves for proof-carrying binary routines @@ -22,6 +24,8 @@ word, time bound, and all-prefix space bound to its concrete Turing machine. - `emitNatCode_sound` and `emitRawGate_sound` cover the two encoding leaves. -/ +@[expose] public section + namespace Complexity namespace BinaryRoutine diff --git a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Arithmetic/Defs.lean b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Arithmetic/Defs.lean index 4f51a952..2f957871 100644 --- a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Arithmetic/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Arithmetic/Defs.lean @@ -3,14 +3,16 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Machine.NatCode.Defs -import Complexitylib.Circuits.Encoding.Machine.RawGate.Defs -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryAdd.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryMulAdd.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryPolynomial.Defs -import Complexitylib.Models.TuringMachine.Subroutines.ClearWork.Defs +module + +public import Complexitylib.Circuits.Encoding.Machine.NatCode.Defs +public import Complexitylib.Circuits.Encoding.Machine.RawGate.Defs +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAdd.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryMulAdd.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPolynomial.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.ClearWork.Defs /-! # Arithmetic leaves for proof-carrying binary routines -- definitions @@ -20,6 +22,8 @@ pure value-vector interface. Static index separation and reusable-zero requirements remain explicit in `BinaryRoutine.requires`. -/ +@[expose] public section + namespace Complexity namespace BinaryRoutine diff --git a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Arithmetic/Internal.lean b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Arithmetic/Internal.lean index e23e2567..39d3c344 100644 --- a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Arithmetic/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Arithmetic/Internal.lean @@ -3,20 +3,24 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Machine.NatCode -import Complexitylib.Circuits.Encoding.Machine.RawGate -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryAdd -import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst -import Complexitylib.Models.TuringMachine.Subroutines.BinaryMulAdd -import Complexitylib.Models.TuringMachine.Subroutines.BinaryPolynomial -import Complexitylib.Models.TuringMachine.Subroutines.ClearWork +module + +public import Complexitylib.Circuits.Encoding.Machine.NatCode +public import Complexitylib.Circuits.Encoding.Machine.RawGate +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAdd +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryMulAdd +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPolynomial +public import Complexitylib.Models.TuringMachine.Subroutines.ClearWork /-! # Arithmetic leaves for proof-carrying binary routines -- proof internals -/ +@[expose] public section + namespace Complexity namespace BinaryRoutine diff --git a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Control.lean b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Control.lean index 0a8c048b..d484d837 100644 --- a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Control.lean +++ b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Control.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control.Defs -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control.Internal +module + +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control.Defs +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control.Internal /-! # Proof-carrying binary routine control @@ -26,6 +28,8 @@ Thus many iterations can retain logarithmic auxiliary space. - `TM.BinaryForSegmentSpaceSpec.prefix_withinAuxSpace` covers all prefixes. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Control/Defs.lean b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Control/Defs.lean index 3008ccb8..d2990a7d 100644 --- a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Control/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Control/Defs.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.WorkBranch.Defs -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Defs +module + +public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch.Defs +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Defs /-! # Proof-carrying binary routine control -- definitions @@ -20,6 +22,8 @@ bounded iteration witnesses because `BinaryRoutine.Sound` advertises an upper bound rather than an exact runtime. Comparisons and endpoints remain exact. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Control/Internal.lean b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Control/Internal.lean index 7b65655f..b8d6ad72 100644 --- a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Control/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Control/Internal.lean @@ -3,18 +3,22 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.WorkBranch -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control.Defs -import Complexitylib.Models.TuringMachine.Hoare.Space -import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor -import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Internal.Control -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc +module + +public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control.Defs +public import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Internal.Control +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc /-! # Proof-carrying binary routine control -- proof internals -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Defs.lean b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Defs.lean index 6d0e9a8e..bb32af1e 100644 --- a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Defs.lean @@ -3,12 +3,14 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Machine.GateStream.Defs -import Complexitylib.Models.TuringMachine.Hoare.Space.Defs -import Complexitylib.Models.TuringMachine.Registers.Emit -import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs +module + +public import Complexitylib.Circuits.Encoding.Machine.GateStream.Defs +public import Complexitylib.Models.TuringMachine.Hoare.Space.Defs +public import Complexitylib.Models.TuringMachine.Registers.Emit +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs /-! # Proof-carrying binary stream routines -- definitions @@ -20,6 +22,8 @@ supports honest partial leaves such as positive predecessor and zero-scratch copying without weakening the canonical state model. -/ +@[expose] public section + namespace Complexity /-- Pure values represented by all work tapes of a binary routine. -/ diff --git a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/InputLength.lean b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/InputLength.lean index 1da66970..1fdce186 100644 --- a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/InputLength.lean +++ b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/InputLength.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.InputLength.Defs -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.InputLength.Internal +module + +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.InputLength.Defs +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.InputLength.Internal /-! # Fresh-input entry for proof-carrying binary routines @@ -20,6 +22,8 @@ the resulting routine inherits a total all-prefix `ComputesInSpace` contract. transducer. -/ +@[expose] public section + namespace Complexity namespace BinaryRoutine diff --git a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/InputLength/Defs.lean b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/InputLength/Defs.lean index 909254cd..8ca7136c 100644 --- a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/InputLength/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/InputLength/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryLength.Defs +module + +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryLength.Defs /-! # Fresh-input entry for proof-carrying binary routines -- definitions @@ -14,6 +16,8 @@ binary work-vector discipline. It first counts the unary input length into one designated work tape, then runs a proof-carrying binary routine. -/ +@[expose] public section + namespace Complexity namespace BinaryRoutine diff --git a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/InputLength/Internal.lean b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/InputLength/Internal.lean index 9e88fe4c..edf7b9b8 100644 --- a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/InputLength/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/InputLength/Internal.lean @@ -3,15 +3,19 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.InputLength.Defs -import Complexitylib.Models.TuringMachine.Hoare.Space -import Complexitylib.Models.TuringMachine.Subroutines.BinaryLength +module + +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.InputLength.Defs +public import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryLength /-! # Fresh-input entry for proof-carrying binary routines -- proof internals -/ +@[expose] public section + namespace Complexity namespace BinaryRoutine diff --git a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Internal.lean b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Internal.lean index cb05a5ae..a6dc3a91 100644 --- a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Internal.lean @@ -3,12 +3,14 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Circuits.Encoding.Machine.GateStream -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Defs -import Complexitylib.Models.TuringMachine.Hoare.Space -import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy -import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc +module + +public import Complexitylib.Circuits.Encoding.Machine.GateStream +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Defs +public import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc /-! # Proof-carrying binary stream routines -- proof internals @@ -18,6 +20,8 @@ frames, lifts frame-oriented arithmetic contracts through an arbitrary output accumulator, and composes routines across the parked `seqTM` phase boundary. -/ +@[expose] public section + namespace Complexity namespace BinaryRoutine diff --git a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/List.lean b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/List.lean index bc0e160a..ff23ccf1 100644 --- a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/List.lean +++ b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/List.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List.Defs -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List.Internal +module + +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List.Defs +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List.Internal /-! # Finite composition of proof-carrying binary routines @@ -14,6 +16,8 @@ unrolled into ordinary lists. This module proves their composition sound once, leaving only genuinely input-dependent ranges to the binary loop adapter. -/ +@[expose] public section + namespace Complexity namespace BinaryRoutine diff --git a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/List/Defs.lean b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/List/Defs.lean index cae14a9c..79962be3 100644 --- a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/List/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/List/Defs.lean @@ -3,12 +3,16 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Defs +module + +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Defs /-! # Finite composition of proof-carrying binary routines -- definitions -/ +@[expose] public section + namespace Complexity namespace BinaryRoutine diff --git a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/List/Internal.lean b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/List/Internal.lean index c4f38829..978f87e0 100644 --- a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/List/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/List/Internal.lean @@ -3,13 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List.Defs +module + +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List.Defs /-! # Finite composition of proof-carrying binary routines -- proof internals -/ +@[expose] public section + namespace Complexity namespace BinaryRoutine diff --git a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/SpaceBounds.lean b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/SpaceBounds.lean index 9434f6bf..25978ff8 100644 --- a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/SpaceBounds.lean +++ b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/SpaceBounds.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.SpaceBounds.Defs -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.SpaceBounds.Internal +module + +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.SpaceBounds.Defs +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.SpaceBounds.Internal /-! # Compositional width bounds for binary routines @@ -17,6 +19,8 @@ resulting auxiliary-space bound. A final polynomial width bound converts the composed certificate to logarithmic space. -/ +@[expose] public section + namespace Complexity namespace BinaryRoutine diff --git a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/SpaceBounds/Defs.lean b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/SpaceBounds/Defs.lean index 4a2d6c66..5777da72 100644 --- a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/SpaceBounds/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/SpaceBounds/Defs.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Asymptotics -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control.Defs -import Mathlib.Data.Nat.Pairing +module + +public import Complexitylib.Asymptotics +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control.Defs +public import Mathlib.Data.Nat.Pairing /-! # Compositional width bounds for binary routines -- definitions @@ -16,6 +18,8 @@ while `BinaryForSpaceEnvelope` bounds an input-dependent loop by one envelope covering every reachable comparison, body invocation, and successor. -/ +@[expose] public section + namespace Complexity namespace BinaryRoutine diff --git a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/SpaceBounds/Internal.lean b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/SpaceBounds/Internal.lean index aa79ed28..37a30128 100644 --- a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/SpaceBounds/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/SpaceBounds/Internal.lean @@ -3,15 +3,19 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.SpaceBounds.Defs -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic -import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc +module + +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.SpaceBounds.Defs +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic +public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc /-! # Compositional width bounds for binary routines -- proof internals -/ +@[expose] public section + namespace Complexity namespace BinaryRoutine diff --git a/Complexitylib/Models/TuringMachine/Experimental/EmitSpec.lean b/Complexitylib/Models/TuringMachine/Experimental/EmitSpec.lean index b146c2dd..8f20e2d1 100644 --- a/Complexitylib/Models/TuringMachine/Experimental/EmitSpec.lean +++ b/Complexitylib/Models/TuringMachine/Experimental/EmitSpec.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Registers.Emit +module + +public import Complexitylib.Models.TuringMachine.Registers.Emit /-! # Experimental effect contracts for emitter machines @@ -24,6 +26,8 @@ indexed list fold with one uniform per-stage bound, while `EmitSpec` handles short heterogeneous machine trees and retains each stage's structural bound. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Experimental/Routine.lean b/Complexitylib/Models/TuringMachine/Experimental/Routine.lean index 1f54e9ae..f135f4a4 100644 --- a/Complexitylib/Models/TuringMachine/Experimental/Routine.lean +++ b/Complexitylib/Models/TuringMachine/Experimental/Routine.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Experimental.Routine.Defs -import Complexitylib.Models.TuringMachine.Experimental.Routine.Internal +module + +public import Complexitylib.Models.TuringMachine.Experimental.Routine.Defs +public import Complexitylib.Models.TuringMachine.Experimental.Routine.Internal /-! # Experimental first-order Turing-machine routines @@ -27,6 +29,8 @@ experimental until a second independent construction validates the interface. lower to transducers. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Experimental/Routine/Defs.lean b/Complexitylib/Models/TuringMachine/Experimental/Routine/Defs.lean index 442cc0b6..0e27f8ba 100644 --- a/Complexitylib/Models/TuringMachine/Experimental/Routine/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Experimental/Routine/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.ForInput.Defs +module + +public import Complexitylib.Models.TuringMachine.Combinators.ForInput.Defs /-! # Experimental first-order Turing-machine routines — definitions @@ -19,6 +21,8 @@ obeys the one-way-output discipline. Its name deliberately does not suggest input preservation, termination, or resource safety. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Experimental/Routine/Internal.lean b/Complexitylib/Models/TuringMachine/Experimental/Routine/Internal.lean index cdb921c7..cf23d283 100644 --- a/Complexitylib/Models/TuringMachine/Experimental/Routine/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Experimental/Routine/Internal.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.ForInput -import Complexitylib.Models.TuringMachine.Experimental.Routine.Defs -import Complexitylib.Models.TuringMachine.Hoare.Space +module + +public import Complexitylib.Models.TuringMachine.Combinators.ForInput +public import Complexitylib.Models.TuringMachine.Experimental.Routine.Defs +public import Complexitylib.Models.TuringMachine.Hoare.Space /-! # Experimental first-order Turing-machine routines — proof internals @@ -14,6 +16,8 @@ This module proves that the structural `Routine.TransducerSafe` certificate is preserved by lowering through sequential composition and read-only-input loops. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Hoare.lean b/Complexitylib/Models/TuringMachine/Hoare.lean index 89819b74..5d98b2d6 100644 --- a/Complexitylib/Models/TuringMachine/Hoare.lean +++ b/Complexitylib/Models/TuringMachine/Hoare.lean @@ -3,11 +3,13 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Hoare.Defs -import Complexitylib.Models.TuringMachine.Combinators.Internal.Seq -import Complexitylib.Models.TuringMachine.Combinators.Internal.If -import Complexitylib.Models.TuringMachine.Combinators.Internal.Loop -import Complexitylib.Models.TuringMachine.Combinators.Internal.Complement +module + +public import Complexitylib.Models.TuringMachine.Hoare.Defs +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Seq +public import Complexitylib.Models.TuringMachine.Combinators.Internal.If +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Loop +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Complement /-! # Hoare-style composition rules for TM combinators @@ -31,6 +33,8 @@ parked tapes, or `AllTapesWF` together with positive-head facts, provide common stronger certificates. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Hoare/Defs.lean b/Complexitylib/Models/TuringMachine/Hoare/Defs.lean index 9ebc10e9..17cb5c3b 100644 --- a/Complexitylib/Models/TuringMachine/Hoare/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Hoare/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine -import Complexitylib.Models.TuringMachine.Internal +module + +public import Complexitylib.Models.TuringMachine +public import Complexitylib.Models.TuringMachine.Internal /-! # Hoare-style specifications for Turing machines @@ -30,6 +32,8 @@ The precondition must imply that the starting configuration has the machine's `qstart` state. The postcondition holds at halting. -/ +@[expose] public section + namespace Complexity /-- A predicate on the tape configuration: input tape, work tapes, output tape. -/ diff --git a/Complexitylib/Models/TuringMachine/Hoare/RetargetOutput.lean b/Complexitylib/Models/TuringMachine/Hoare/RetargetOutput.lean index 7b8f089f..77ea960a 100644 --- a/Complexitylib/Models/TuringMachine/Hoare/RetargetOutput.lean +++ b/Complexitylib/Models/TuringMachine/Hoare/RetargetOutput.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Hoare.Defs -import Complexitylib.Models.TuringMachine.Lift +module + +public import Complexitylib.Models.TuringMachine.Hoare.Defs +public import Complexitylib.Models.TuringMachine.Lift /-! # Hoare contracts for output redirection @@ -14,6 +16,8 @@ source output as the fresh last work tape while pinning the real output to the standard parked blank tape. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Hoare/Space.lean b/Complexitylib/Models/TuringMachine/Hoare/Space.lean index afdfaab3..563cb4cc 100644 --- a/Complexitylib/Models/TuringMachine/Hoare/Space.lean +++ b/Complexitylib/Models/TuringMachine/Hoare/Space.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Hoare.Space.Defs -import Complexitylib.Models.TuringMachine.Hoare.Space.Internal +module + +public import Complexitylib.Models.TuringMachine.Hoare.Space.Defs +public import Complexitylib.Models.TuringMachine.Hoare.Space.Internal /-! # Space-aware Hoare specifications @@ -28,6 +30,8 @@ closure, and a fresh-start computation bridge. - `TM.computesInSpace_of_hoareTimeSpace` — package per-input contracts. -/ +@[expose] public section + namespace Complexity namespace Cfg diff --git a/Complexitylib/Models/TuringMachine/Hoare/Space/Defs.lean b/Complexitylib/Models/TuringMachine/Hoare/Space/Defs.lean index 6cfc0ec8..8986dba7 100644 --- a/Complexitylib/Models/TuringMachine/Hoare/Space/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Hoare/Space/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Hoare.Defs +module + +public import Complexitylib.Models.TuringMachine.Hoare.Defs /-! # Space-aware Hoare specifications — definitions @@ -13,6 +15,8 @@ computation requires a bound on every reachable configuration. This module pairs those two obligations in one compositional contract. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Hoare/Space/Internal.lean b/Complexitylib/Models/TuringMachine/Hoare/Space/Internal.lean index 491d8f03..37cd9eb7 100644 --- a/Complexitylib/Models/TuringMachine/Hoare/Space/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Hoare/Space/Internal.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Hoare.Space.Defs -import Complexitylib.Models.TuringMachine.Hoare -import Complexitylib.Models.TuringMachine.SpaceTime.Internal.Reachability +module + +public import Complexitylib.Models.TuringMachine.Hoare.Space.Defs +public import Complexitylib.Models.TuringMachine.Hoare +public import Complexitylib.Models.TuringMachine.SpaceTime.Internal.Reachability /-! # Space-aware Hoare specifications — proof internals @@ -14,6 +16,8 @@ This module supplies structural rules, sequential composition, and the bridge from fresh-start contracts to `TM.ComputesInSpace`. -/ +@[expose] public section + namespace Complexity namespace Cfg diff --git a/Complexitylib/Models/TuringMachine/Internal.lean b/Complexitylib/Models/TuringMachine/Internal.lean index 7e164c7e..9f19a446 100644 --- a/Complexitylib/Models/TuringMachine/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Internal.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine -import Mathlib.Data.Finset.Lattice.Fold +module + +public import Complexitylib.Models.TuringMachine +public import Mathlib.Data.Finset.Lattice.Fold /-! # TM–NTM embedding: proof internals @@ -13,6 +15,8 @@ Helper lemmas for `TM.toNTM_accepts_iff`, showing that the DTM step function and the NTM trace on `toNTM` compute the same thing. -/ +@[expose] public section + namespace Complexity variable {n : ℕ} diff --git a/Complexitylib/Models/TuringMachine/Internal/OutputBounds.lean b/Complexitylib/Models/TuringMachine/Internal/OutputBounds.lean index 94089e5f..8aa63ba2 100644 --- a/Complexitylib/Models/TuringMachine/Internal/OutputBounds.lean +++ b/Complexitylib/Models/TuringMachine/Internal/OutputBounds.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Internal +module + +public import Complexitylib.Models.TuringMachine.Internal /-! # Output-length bounds — proof internals @@ -16,6 +18,8 @@ unchanged. Public statements are in `Complexitylib.Models.TuringMachine.OutputBounds`. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Lift.lean b/Complexitylib/Models/TuringMachine/Lift.lean index 4a710bd9..4819f4a6 100644 --- a/Complexitylib/Models/TuringMachine/Lift.lean +++ b/Complexitylib/Models/TuringMachine/Lift.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators +module + +public import Complexitylib.Models.TuringMachine.Combinators /-! # Tape-layout combinators: extra work tapes and output retargeting @@ -36,6 +38,8 @@ The time bounds are preserved *exactly* (no `+ 1`): the dummy-tape bounce happens during the simulated machine's own first step. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/OutputBounds.lean b/Complexitylib/Models/TuringMachine/OutputBounds.lean index 0c75787f..fa42315b 100644 --- a/Complexitylib/Models/TuringMachine/OutputBounds.lean +++ b/Complexitylib/Models/TuringMachine/OutputBounds.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Internal.OutputBounds +module + +public import Complexitylib.Models.TuringMachine.Internal.OutputBounds /-! # Output-length bounds @@ -19,6 +21,8 @@ produce at most `t` output bits. - `TM.ComputesInTime.output_length_le` — a time bound also bounds output length -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Placement.lean b/Complexitylib/Models/TuringMachine/Placement.lean index c7de471f..4d94ece9 100644 --- a/Complexitylib/Models/TuringMachine/Placement.lean +++ b/Complexitylib/Models/TuringMachine/Placement.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Placement.Defs -import Complexitylib.Models.TuringMachine.Placement.Internal +module + +public import Complexitylib.Models.TuringMachine.Placement.Defs +public import Complexitylib.Models.TuringMachine.Placement.Internal /-! # Work-tape placement @@ -22,6 +24,8 @@ are parked away from the left-end marker. - `TM.placeWorkTM_computesInTime` — same-time preservation of computation -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Placement/Defs.lean b/Complexitylib/Models/TuringMachine/Placement/Defs.lean index b1da0875..33e313b2 100644 --- a/Complexitylib/Models/TuringMachine/Placement/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Placement/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators +module + +public import Complexitylib.Models.TuringMachine.Combinators /-! # Work-tape placement @@ -23,6 +25,8 @@ source machine. - `TM.placeWorkParkedCfg` — the canonical embedding with parked blank extras -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Placement/Internal.lean b/Complexitylib/Models/TuringMachine/Placement/Internal.lean index 989aad48..2749d32e 100644 --- a/Complexitylib/Models/TuringMachine/Placement/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Placement/Internal.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Placement.Defs -import Complexitylib.Models.TuringMachine.Internal +module + +public import Complexitylib.Models.TuringMachine.Placement.Defs +public import Complexitylib.Models.TuringMachine.Internal /-! # Work-tape placement correctness internals @@ -15,6 +17,8 @@ extra-tape frame by its prescribed idle action. Stable frames and the canonical parked frame are fixed points of that action. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Registers.lean b/Complexitylib/Models/TuringMachine/Registers.lean index bd92219b..fce63417 100644 --- a/Complexitylib/Models/TuringMachine/Registers.lean +++ b/Complexitylib/Models/TuringMachine/Registers.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.Counter +module + +public import Complexitylib.Models.TuringMachine.Subroutines.Counter /-! # Unary registers @@ -29,6 +31,8 @@ actions and stable under the combinator phase transitions. - `TM.reg_zero_init_bumped` — a freshly bumped blank tape is `IsReg 0` -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Registers/Arith.lean b/Complexitylib/Models/TuringMachine/Registers/Arith.lean index 496ec7e1..43f992e0 100644 --- a/Complexitylib/Models/TuringMachine/Registers/Arith.lean +++ b/Complexitylib/Models/TuringMachine/Registers/Arith.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Registers.ForReg +module + +public import Complexitylib.Models.TuringMachine.Registers.ForReg /-! # Derived register arithmetic @@ -17,6 +19,8 @@ Time bounds are deliberately loose (rounded up via `HoareTime.mono_bound`); only their polynomial shape matters downstream. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Registers/DecReg.lean b/Complexitylib/Models/TuringMachine/Registers/DecReg.lean index 4e0c330a..d577d203 100644 --- a/Complexitylib/Models/TuringMachine/Registers/DecReg.lean +++ b/Complexitylib/Models/TuringMachine/Registers/DecReg.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Registers.MixedRadix +module + +public import Complexitylib.Models.TuringMachine.Registers.MixedRadix /-! # decRegTM: decrement a register @@ -17,6 +19,8 @@ pairwise at-most-one families iterate over shrinking suffixes. Mirror of `incRegTM` (`RegisterOps.lean`) with an erase phase. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Registers/Emit.lean b/Complexitylib/Models/TuringMachine/Registers/Emit.lean index b5baa8be..c0f12a59 100644 --- a/Complexitylib/Models/TuringMachine/Registers/Emit.lean +++ b/Complexitylib/Models/TuringMachine/Registers/Emit.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines -import Complexitylib.Models.TuringMachine.Registers -import Complexitylib.Models.TuringMachine.Hoare +module + +public import Complexitylib.Models.TuringMachine.Subroutines +public import Complexitylib.Models.TuringMachine.Registers +public import Complexitylib.Models.TuringMachine.Hoare /-! # Output-emission subroutines @@ -43,6 +45,8 @@ This layer is the foundation for the Cook–Levin reduction emitter - `TM.emitBitsTM_isTransducer` — fixed-word emission never moves output left -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Registers/EmitSeq.lean b/Complexitylib/Models/TuringMachine/Registers/EmitSeq.lean index 5ed5bd1a..950c1436 100644 --- a/Complexitylib/Models/TuringMachine/Registers/EmitSeq.lean +++ b/Complexitylib/Models/TuringMachine/Registers/EmitSeq.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Registers.InputLen +module + +public import Complexitylib.Models.TuringMachine.Registers.InputLen /-! # Sequencing emitter stages @@ -15,6 +17,8 @@ to `(W (k+1), Y (k+1))`. All the finite-tuple folds of the reduction emitter transition family) are instances of this single rule. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Registers/ForReg.lean b/Complexitylib/Models/TuringMachine/Registers/ForReg.lean index b9b698da..83698b52 100644 --- a/Complexitylib/Models/TuringMachine/Registers/ForReg.lean +++ b/Complexitylib/Models/TuringMachine/Registers/ForReg.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Registers.RegisterOps +module + +public import Complexitylib.Models.TuringMachine.Registers.RegisterOps /-! # forRegTM: the register-fueled loop combinator @@ -23,6 +25,8 @@ The Hoare rule `forRegTM_hoareTime` threads an iteration-indexed family of ghost work-tape functions and output words through the loop. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Registers/Horner.lean b/Complexitylib/Models/TuringMachine/Registers/Horner.lean index 547f852e..d0fbacfe 100644 --- a/Complexitylib/Models/TuringMachine/Registers/Horner.lean +++ b/Complexitylib/Models/TuringMachine/Registers/Horner.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Registers.EmitSeq -import Mathlib.Algebra.Polynomial.Eval.Defs -import Mathlib.Algebra.Polynomial.Eval.Degree +module + +public import Complexitylib.Models.TuringMachine.Registers.EmitSeq +public import Mathlib.Algebra.Polynomial.Eval.Defs +public import Mathlib.Algebra.Polynomial.Eval.Degree /-! # Horner layers: polynomial register evaluation @@ -34,6 +36,8 @@ are deliberately loose. - the `_hoareTime` specification of each machine -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Registers/InputLen.lean b/Complexitylib/Models/TuringMachine/Registers/InputLen.lean index c9168b89..507733a8 100644 --- a/Complexitylib/Models/TuringMachine/Registers/InputLen.lean +++ b/Complexitylib/Models/TuringMachine/Registers/InputLen.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Registers.Arith +module + +public import Complexitylib.Models.TuringMachine.Registers.Arith /-! # Input length into a register @@ -16,6 +18,8 @@ besides the start-clause emitter, and the last hand-rolled machine of the campaign (`docs/A5-ReductionEmitter.md`). -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Registers/MixedRadix.lean b/Complexitylib/Models/TuringMachine/Registers/MixedRadix.lean index d2d51a6d..71fc8fc3 100644 --- a/Complexitylib/Models/TuringMachine/Registers/MixedRadix.lean +++ b/Complexitylib/Models/TuringMachine/Registers/MixedRadix.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Registers.Horner +module + +public import Complexitylib.Models.TuringMachine.Registers.Horner /-! # Mixed-radix variable loading and literal emission @@ -21,6 +23,8 @@ a clause is a `bigSeqTM` of `emitVarLitTM`s followed by the clause separator. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Registers/Probe.lean b/Complexitylib/Models/TuringMachine/Registers/Probe.lean index 13344cd9..526969f3 100644 --- a/Complexitylib/Models/TuringMachine/Registers/Probe.lean +++ b/Complexitylib/Models/TuringMachine/Registers/Probe.lean @@ -3,7 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Registers.MixedRadix +module + +public import Mathlib.Tactic.FinCases +public import Complexitylib.Models.TuringMachine.Registers.MixedRadix /-! # symProbeTM: read the input symbol at a register-indexed position @@ -18,6 +21,8 @@ clauses of the tableau pin the input cells, so their symbol digits are read off the input tape position by position. -/ +@[expose] public section + namespace Complexity namespace TM @@ -220,7 +225,7 @@ section Probe variable {f : Γ → Fin 4} {r q : Fin n} -private theorem symProbeTM_ne_halt {s : ProbePhase} (h : s ≠ .done) +theorem symProbeTM_ne_halt {s : ProbePhase} (h : s ≠ .done) {c : Cfg n (symProbeTM f r q).Q} (hst : c.state = s) : ¬ c.state = (symProbeTM f r q).qhalt := by rw [hst] @@ -228,10 +233,10 @@ private theorem symProbeTM_ne_halt {s : ProbePhase} (h : s ≠ .done) exact h /-- Well-formed cells: `▷` exactly at cell 0. -/ -private def StartInvariant (t : Tape) : Prop := +def StartInvariant (t : Tape) : Prop := t.cells 0 = Γ.start ∧ ∀ j, 1 ≤ j → t.cells j ≠ Γ.start -private theorem StartInvariant.read_start_iff {t : Tape} (h : StartInvariant t) : +theorem StartInvariant.read_start_iff {t : Tape} (h : StartInvariant t) : t.read = Γ.start ↔ t.head = 0 := by constructor · intro hr @@ -242,7 +247,7 @@ private theorem StartInvariant.read_start_iff {t : Tape} (h : StartInvariant t) exact h.1 /-- `pre`: step the input head left off cell 1. -/ -private theorem symProbeTM_step_pre (c : Cfg n (symProbeTM f r q).Q) +theorem symProbeTM_step_pre (c : Cfg n (symProbeTM f r q).Q) (hst : c.state = .pre) (hi : c.input.read ≠ Γ.start) (hwork : ∀ i, Parked (c.work i)) (hout : Parked c.output) : (symProbeTM f r q).step c = some @@ -256,7 +261,7 @@ private theorem symProbeTM_step_pre (c : Cfg n (symProbeTM f r q).Q) · exact hout.writeAndMove_readBack_idle /-- `walk` over a mark: both heads advance. -/ -private theorem symProbeTM_step_walk_one (c : Cfg n (symProbeTM f r q).Q) +theorem symProbeTM_step_walk_one (c : Cfg n (symProbeTM f r q).Q) (hst : c.state = .walk) (hone : (c.work r).read = Γ.one) (hwork : ∀ i, i ≠ r → Parked (c.work i)) (hout : Parked c.output) : (symProbeTM f r q).step c = some @@ -277,7 +282,7 @@ private theorem symProbeTM_step_walk_one (c : Cfg n (symProbeTM f r q).Q) /-- `walk` at the first blank: record the input symbol, start rewinding the input; the register head stays. -/ -private theorem symProbeTM_step_walk_blank (c : Cfg n (symProbeTM f r q).Q) +theorem symProbeTM_step_walk_blank (c : Cfg n (symProbeTM f r q).Q) (hst : c.state = .walk) (hblank : (c.work r).read = Γ.blank) (hwork : ∀ i, i ≠ r → Parked (c.work i)) (hout : Parked c.output) : (symProbeTM f r q).step c = some @@ -298,7 +303,7 @@ private theorem symProbeTM_step_walk_blank (c : Cfg n (symProbeTM f r q).Q) · exact hout.writeAndMove_readBack_idle /-- `backI` off the sentinel: keep rewinding the input. -/ -private theorem symProbeTM_step_backI_left {k : Fin 4} +theorem symProbeTM_step_backI_left {k : Fin 4} (c : Cfg n (symProbeTM f r q).Q) (hst : c.state = .backI k) (hi : c.input.read ≠ Γ.start) (hwork : ∀ i, Parked (c.work i)) (hout : Parked c.output) : @@ -313,7 +318,7 @@ private theorem symProbeTM_step_backI_left {k : Fin 4} · exact hout.writeAndMove_readBack_idle /-- `backI` on the sentinel: step the input right to cell 1. -/ -private theorem symProbeTM_step_backI_start {k : Fin 4} +theorem symProbeTM_step_backI_start {k : Fin 4} (c : Cfg n (symProbeTM f r q).Q) (hst : c.state = .backI k) (hi : c.input.read = Γ.start) (hwork : ∀ i, Parked (c.work i)) (hout : Parked c.output) : @@ -328,7 +333,7 @@ private theorem symProbeTM_step_backI_start {k : Fin 4} · exact hout.writeAndMove_readBack_idle /-- `backR` off the sentinel: keep rewinding the register. -/ -private theorem symProbeTM_step_backR_left {k : Fin 4} +theorem symProbeTM_step_backR_left {k : Fin 4} (c : Cfg n (symProbeTM f r q).Q) (hst : c.state = .backR k) (hns : (c.work r).read ≠ Γ.start) (hinp : Parked c.input) @@ -350,7 +355,7 @@ private theorem symProbeTM_step_backR_left {k : Fin 4} · exact hout.writeAndMove_readBack_idle /-- `backR` on the sentinel: park the register head at cell 1. -/ -private theorem symProbeTM_step_backR_start {k : Fin 4} +theorem symProbeTM_step_backR_start {k : Fin 4} (c : Cfg n (symProbeTM f r q).Q) (hst : c.state = .backR k) (hs : (c.work r).read = Γ.start) (hcr : ∀ j, 1 ≤ j → (c.work r).cells j ≠ Γ.start) @@ -379,7 +384,7 @@ private theorem symProbeTM_step_backR_start {k : Fin 4} · exact hout.writeAndMove_readBack_idle /-- `scanQ` over a mark. -/ -private theorem symProbeTM_step_scanQ_one {k : Fin 4} +theorem symProbeTM_step_scanQ_one {k : Fin 4} (c : Cfg n (symProbeTM f r q).Q) (hst : c.state = .scanQ k) (hone : (c.work q).read = Γ.one) (hinp : Parked c.input) @@ -402,7 +407,7 @@ private theorem symProbeTM_step_scanQ_one {k : Fin 4} · exact hout.writeAndMove_readBack_idle /-- `scanQ 0` at the first blank: turn onto the last mark. -/ -private theorem symProbeTM_step_scanQ_blank_zero +theorem symProbeTM_step_scanQ_blank_zero (c : Cfg n (symProbeTM f r q).Q) (hst : c.state = .scanQ 0) (hblank : (c.work q).read = Γ.blank) (hinp : Parked c.input) @@ -425,7 +430,7 @@ private theorem symProbeTM_step_scanQ_blank_zero · exact hout.writeAndMove_readBack_idle /-- `scanQ (k+1)` at the first blank: write a mark and continue scanning. -/ -private theorem symProbeTM_step_scanQ_blank_succ {k : Fin 4} +theorem symProbeTM_step_scanQ_blank_succ {k : Fin 4} (c : Cfg n (symProbeTM f r q).Q) (hk : k ≠ 0) (hst : c.state = .scanQ k) (hblank : (c.work q).read = Γ.blank) (hinp : Parked c.input) @@ -448,7 +453,7 @@ private theorem symProbeTM_step_scanQ_blank_succ {k : Fin 4} · exact hout.writeAndMove_readBack_idle /-- `backQ` off the sentinel. -/ -private theorem symProbeTM_step_backQ_left (c : Cfg n (symProbeTM f r q).Q) +theorem symProbeTM_step_backQ_left (c : Cfg n (symProbeTM f r q).Q) (hst : c.state = .backQ) (hns : (c.work q).read ≠ Γ.start) (hinp : Parked c.input) (hwork : ∀ i, i ≠ q → Parked (c.work i)) (hout : Parked c.output) : @@ -469,7 +474,7 @@ private theorem symProbeTM_step_backQ_left (c : Cfg n (symProbeTM f r q).Q) · exact hout.writeAndMove_readBack_idle /-- `backQ` on the sentinel: park. -/ -private theorem symProbeTM_step_backQ_start (c : Cfg n (symProbeTM f r q).Q) +theorem symProbeTM_step_backQ_start (c : Cfg n (symProbeTM f r q).Q) (hst : c.state = .backQ) (hs : (c.work q).read = Γ.start) (hcr : ∀ j, 1 ≤ j → (c.work q).cells j ≠ Γ.start) (hinp : Parked c.input) @@ -497,7 +502,7 @@ private theorem symProbeTM_step_backQ_start (c : Cfg n (symProbeTM f r q).Q) · exact hout.writeAndMove_readBack_idle /-- `park`: one idle step into `done`. -/ -private theorem symProbeTM_step_park (c : Cfg n (symProbeTM f r q).Q) +theorem symProbeTM_step_park (c : Cfg n (symProbeTM f r q).Q) (hst : c.state = .park) (hinp : Parked c.input) (hwork : ∀ i, Parked (c.work i)) (hout : Parked c.output) : (symProbeTM f r q).step c = some @@ -513,7 +518,7 @@ private theorem symProbeTM_step_park (c : Cfg n (symProbeTM f r q).Q) /-- The lockstep walk: register head and input head advance together. -/ -private theorem symProbeTM_walk_run (pos : ℕ) : ∀ (m k : ℕ), pos = k + m → +theorem symProbeTM_walk_run (pos : ℕ) : ∀ (m k : ℕ), pos = k + m → ∀ c : Cfg n (symProbeTM f r q).Q, c.state = .walk → (∀ i, i ≠ r → Parked (c.work i)) → Parked c.output → (c.work r).cells = regCells pos → (c.work r).head = k + 1 → @@ -566,7 +571,7 @@ private theorem symProbeTM_walk_run (pos : ℕ) : ∀ (m k : ℕ), pos = k + m rw [Function.update_of_ne hi] /-- The input rewind: from head `h` back to cell 1, entering `backR`. -/ -private theorem symProbeTM_backI_run {k : Fin 4} : ∀ (h : ℕ), +theorem symProbeTM_backI_run {k : Fin 4} : ∀ (h : ℕ), ∀ c : Cfg n (symProbeTM f r q).Q, c.state = .backI k → StartInvariant c.input → c.input.head = h → (∀ i, Parked (c.work i)) → Parked c.output → @@ -598,7 +603,7 @@ private theorem symProbeTM_backI_run {k : Fin 4} : ∀ (h : ℕ), hwork', hout'⟩ /-- The register rewind: from head `h` back to cell 1, entering `scanQ`. -/ -private theorem symProbeTM_backR_run {k : Fin 4} : ∀ (h : ℕ), +theorem symProbeTM_backR_run {k : Fin 4} : ∀ (h : ℕ), ∀ c : Cfg n (symProbeTM f r q).Q, c.state = .backR k → Parked c.input → (∀ i, i ≠ r → Parked (c.work i)) → Parked c.output → (c.work r).cells 0 = Γ.start → @@ -661,7 +666,7 @@ private theorem symProbeTM_backR_run {k : Fin 4} : ∀ (h : ℕ), · rw [hcells', hupd] /-- The target scan: walk `q`'s head over its marks. -/ -private theorem symProbeTM_scanQ_run {k : Fin 4} (d : ℕ) : +theorem symProbeTM_scanQ_run {k : Fin 4} (d : ℕ) : ∀ (m j : ℕ), d = j + m → ∀ c : Cfg n (symProbeTM f r q).Q, c.state = .scanQ k → Parked c.input → (∀ i, i ≠ q → Parked (c.work i)) → Parked c.output → @@ -708,7 +713,7 @@ private theorem symProbeTM_scanQ_run {k : Fin 4} (d : ℕ) : rw [Function.update_of_ne hi] /-- The write run: append `k.val` marks to `q`, counting the state down. -/ -private theorem symProbeTM_write_run : ∀ (kv : ℕ) (k : Fin 4), k.val = kv → +theorem symProbeTM_write_run : ∀ (kv : ℕ) (k : Fin 4), k.val = kv → ∀ (e : ℕ) (c : Cfg n (symProbeTM f r q).Q), c.state = .scanQ k → Parked c.input → (∀ i, i ≠ q → Parked (c.work i)) → Parked c.output → (c.work q).cells = regCells e → (c.work q).head = e + 1 → @@ -777,7 +782,7 @@ private theorem symProbeTM_write_run : ∀ (kv : ℕ) (k : Fin 4), k.val = kv rw [Function.update_of_ne hi] /-- The final rewind: `q` back to cell 1, park, halt. -/ -private theorem symProbeTM_backQ_run : ∀ (h : ℕ), +theorem symProbeTM_backQ_run : ∀ (h : ℕ), ∀ c : Cfg n (symProbeTM f r q).Q, c.state = .backQ → Parked c.input → (∀ i, i ≠ q → Parked (c.work i)) → Parked c.output → (c.work q).cells 0 = Γ.start → diff --git a/Complexitylib/Models/TuringMachine/Registers/RegisterOps.lean b/Complexitylib/Models/TuringMachine/Registers/RegisterOps.lean index 8cf95dca..69b41387 100644 --- a/Complexitylib/Models/TuringMachine/Registers/RegisterOps.lean +++ b/Complexitylib/Models/TuringMachine/Registers/RegisterOps.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Registers.Emit +module + +public import Complexitylib.Models.TuringMachine.Registers.Emit /-! # Register operations @@ -19,6 +21,8 @@ Specs are in the ghost-parametrized `EmitPred` style: registers are the canonical tapes `regTape v`, and posts are `Function.update` equations. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Repetition.lean b/Complexitylib/Models/TuringMachine/Repetition.lean index cbc3b45c..4d4c6666 100644 --- a/Complexitylib/Models/TuringMachine/Repetition.lean +++ b/Complexitylib/Models/TuringMachine/Repetition.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Repetition.Internal.ScheduleArithmetic +module + +public import Complexitylib.Models.TuringMachine.Repetition.Internal.ScheduleArithmetic /-! # Fixed-time probabilistic-machine repetition @@ -22,6 +24,8 @@ simulation invariants proved in the internal correctness layer. - `NTM.repeatRandomSeed_apply_repeatChoiceIdx` — compact and machine schedules align -/ +@[expose] public section + namespace Complexity namespace NTM diff --git a/Complexitylib/Models/TuringMachine/Repetition/Correctness.lean b/Complexitylib/Models/TuringMachine/Repetition/Correctness.lean index 568c53db..5e330cc0 100644 --- a/Complexitylib/Models/TuringMachine/Repetition/Correctness.lean +++ b/Complexitylib/Models/TuringMachine/Repetition/Correctness.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.EventProb -import Complexitylib.Models.TuringMachine.Repetition.Internal.Correctness +module + +public import Complexitylib.Classes.EventProb +public import Complexitylib.Models.TuringMachine.Repetition.Internal.Correctness /-! # Correctness and amplification for fixed-time repetition @@ -26,6 +28,8 @@ The source machine need only halt on every `T`-step path for the fixed input. - `NTM.repeatAtTime_acceptProb_le_two_pow` — no-instance amplification -/ +@[expose] public section + namespace Complexity namespace NTM diff --git a/Complexitylib/Models/TuringMachine/Repetition/Defs.lean b/Complexitylib/Models/TuringMachine/Repetition/Defs.lean index 5b2dae86..762c6945 100644 --- a/Complexitylib/Models/TuringMachine/Repetition/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Repetition/Defs.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.FiniteCounting -import Complexitylib.Models.TuringMachine.Combinators -import Mathlib.Logic.Equiv.Fin.Basic +module + +public import Complexitylib.Classes.FiniteCounting +public import Complexitylib.Models.TuringMachine.Combinators +public import Mathlib.Logic.Equiv.Fin.Basic /-! # Fixed-time repetition of probabilistic Turing machines @@ -39,6 +41,8 @@ zero-step run votes according to the initial configuration of `tm`. - `NTM.repeatAtTime` — the repeated majority-vote machine -/ +@[expose] public section + namespace Complexity namespace NTM diff --git a/Complexitylib/Models/TuringMachine/Repetition/Internal.lean b/Complexitylib/Models/TuringMachine/Repetition/Internal.lean index e9649c77..c048f7aa 100644 --- a/Complexitylib/Models/TuringMachine/Repetition/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Repetition/Internal.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Repetition.Defs -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -import Complexitylib.Models.TuringMachine.Trace +module + +public import Complexitylib.Models.TuringMachine.Repetition.Defs +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +public import Complexitylib.Models.TuringMachine.Trace /-! # Correctness internals for fixed-time repetition @@ -14,6 +16,8 @@ This file proves the local simulation and fixed-rewind invariants used by the public correctness theorems for `NTM.repeatAtTime`. -/ +@[expose] public section + namespace Complexity namespace NTM diff --git a/Complexitylib/Models/TuringMachine/Repetition/Internal/Boundary.lean b/Complexitylib/Models/TuringMachine/Repetition/Internal/Boundary.lean index 95c1aa98..95313dd2 100644 --- a/Complexitylib/Models/TuringMachine/Repetition/Internal/Boundary.lean +++ b/Complexitylib/Models/TuringMachine/Repetition/Internal/Boundary.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Repetition.Internal.Schedule +module + +public import Complexitylib.Models.TuringMachine.Repetition.Internal.Schedule /-! # Exact trial-boundary trace decomposition @@ -21,6 +23,8 @@ lemmas keep all dependent casts out of the outer correctness induction. - `NTM.repeatStrideChoices_trace_split_three` — complete three-phase split -/ +@[expose] public section + namespace Complexity namespace NTM diff --git a/Complexitylib/Models/TuringMachine/Repetition/Internal/Correctness.lean b/Complexitylib/Models/TuringMachine/Repetition/Internal/Correctness.lean index 5b5e2f9d..c4f5e955 100644 --- a/Complexitylib/Models/TuringMachine/Repetition/Internal/Correctness.lean +++ b/Complexitylib/Models/TuringMachine/Repetition/Internal/Correctness.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Repetition.Internal.Boundary -import Complexitylib.Models.TuringMachine.Repetition.Internal.Setup +module + +public import Complexitylib.Models.TuringMachine.Repetition.Internal.Boundary +public import Complexitylib.Models.TuringMachine.Repetition.Internal.Setup /-! # Pathwise correctness of fixed-time repetition @@ -20,6 +22,8 @@ and the final trial writes their strict majority. - `NTM.repeatAtTime_trace_correct_internal` — final full-trace majority theorem -/ +@[expose] public section + namespace Complexity namespace NTM diff --git a/Complexitylib/Models/TuringMachine/Repetition/Internal/Finish.lean b/Complexitylib/Models/TuringMachine/Repetition/Internal/Finish.lean index 096d236f..1576c6c5 100644 --- a/Complexitylib/Models/TuringMachine/Repetition/Internal/Finish.lean +++ b/Complexitylib/Models/TuringMachine/Repetition/Internal/Finish.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Repetition.Internal +module + +public import Complexitylib.Models.TuringMachine.Repetition.Internal /-! # Setup and finish phases for fixed-time repetition @@ -12,6 +14,8 @@ Correctness lemmas for the zero-time setup path and the final majority-writing transition of `NTM.repeatAtTime`. -/ +@[expose] public section + namespace Complexity namespace NTM diff --git a/Complexitylib/Models/TuringMachine/Repetition/Internal/Frame.lean b/Complexitylib/Models/TuringMachine/Repetition/Internal/Frame.lean index ad7c12d4..db81b3cf 100644 --- a/Complexitylib/Models/TuringMachine/Repetition/Internal/Frame.lean +++ b/Complexitylib/Models/TuringMachine/Repetition/Internal/Frame.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Repetition.Internal +module + +public import Complexitylib.Models.TuringMachine.Repetition.Internal /-! # Fresh-bank frame invariants for fixed-time repetition @@ -21,6 +23,8 @@ initial configuration. - `NTM.RepeatFrame.finish_next_project` — exact next-trial initialization -/ +@[expose] public section + namespace Complexity namespace NTM diff --git a/Complexitylib/Models/TuringMachine/Repetition/Internal/Parked.lean b/Complexitylib/Models/TuringMachine/Repetition/Internal/Parked.lean index 4b7b562b..2eae2661 100644 --- a/Complexitylib/Models/TuringMachine/Repetition/Internal/Parked.lean +++ b/Complexitylib/Models/TuringMachine/Repetition/Internal/Parked.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Repetition.Internal.Frame -import Complexitylib.Models.TuringMachine.Repetition.Internal.Rewind +module + +public import Complexitylib.Models.TuringMachine.Repetition.Internal.Frame +public import Complexitylib.Models.TuringMachine.Repetition.Internal.Rewind /-! # Parked tape banks for fixed-time repetition @@ -27,6 +29,8 @@ next active bank. - `NTM.RepeatOtherParked.finish` — a nonfinal finish transfers it to the next bank -/ +@[expose] public section + namespace Complexity namespace NTM diff --git a/Complexitylib/Models/TuringMachine/Repetition/Internal/Rewind.lean b/Complexitylib/Models/TuringMachine/Repetition/Internal/Rewind.lean index 7b207f13..0282f409 100644 --- a/Complexitylib/Models/TuringMachine/Repetition/Internal/Rewind.lean +++ b/Complexitylib/Models/TuringMachine/Repetition/Internal/Rewind.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Repetition.Internal +module + +public import Complexitylib.Models.TuringMachine.Repetition.Internal /-! # Fixed-time rewind correctness for PTM repetition @@ -27,6 +29,8 @@ this administrative phase. - `NTM.repeatAtTime_trace_rewind_bound` — finish state, parked active tapes, frame -/ +@[expose] public section + namespace Complexity namespace NTM diff --git a/Complexitylib/Models/TuringMachine/Repetition/Internal/Schedule.lean b/Complexitylib/Models/TuringMachine/Repetition/Internal/Schedule.lean index 0eb20ef8..c599bb0a 100644 --- a/Complexitylib/Models/TuringMachine/Repetition/Internal/Schedule.lean +++ b/Complexitylib/Models/TuringMachine/Repetition/Internal/Schedule.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Repetition.Defs -import Complexitylib.Models.TuringMachine.Repetition.Internal.Parked -import Complexitylib.Models.TuringMachine.Repetition.Internal.ScheduleArithmetic -import Complexitylib.Models.TuringMachine.Repetition.Internal.VoteStep +module + +public import Complexitylib.Models.TuringMachine.Repetition.Defs +public import Complexitylib.Models.TuringMachine.Repetition.Internal.Parked +public import Complexitylib.Models.TuringMachine.Repetition.Internal.ScheduleArithmetic +public import Complexitylib.Models.TuringMachine.Repetition.Internal.VoteStep /-! # Outer schedule and boundary assertions for fixed-time repetition @@ -28,6 +30,8 @@ index algebra, choice slices, vote bookkeeping, and target predicate. - `NTM.RepeatBoundary`, `RepeatOuterClaim` — outer-induction specification -/ +@[expose] public section + namespace Complexity namespace NTM diff --git a/Complexitylib/Models/TuringMachine/Repetition/Internal/ScheduleArithmetic.lean b/Complexitylib/Models/TuringMachine/Repetition/Internal/ScheduleArithmetic.lean index 53c5ccde..249c10ea 100644 --- a/Complexitylib/Models/TuringMachine/Repetition/Internal/ScheduleArithmetic.lean +++ b/Complexitylib/Models/TuringMachine/Repetition/Internal/ScheduleArithmetic.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Repetition.Defs +module + +public import Complexitylib.Models.TuringMachine.Repetition.Defs /-! # Schedule arithmetic internals for fixed-time repetition @@ -14,6 +16,8 @@ proofs below the public surface prevents internal correctness modules from depending on `Complexitylib.Models.TuringMachine.Repetition`. -/ +@[expose] public section + namespace Complexity namespace NTM diff --git a/Complexitylib/Models/TuringMachine/Repetition/Internal/Setup.lean b/Complexitylib/Models/TuringMachine/Repetition/Internal/Setup.lean index c2919352..51afeb31 100644 --- a/Complexitylib/Models/TuringMachine/Repetition/Internal/Setup.lean +++ b/Complexitylib/Models/TuringMachine/Repetition/Internal/Setup.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Repetition.Internal.Schedule -import Complexitylib.Models.TuringMachine.Repetition.Internal.Trial +module + +public import Complexitylib.Models.TuringMachine.Repetition.Internal.Schedule +public import Complexitylib.Models.TuringMachine.Repetition.Internal.Trial /-! # Setup boundary for fixed-time repetition @@ -20,6 +22,8 @@ machine, whose setup immediately halts with the empty majority verdict. - `NTM.repeatAtTime_trace_zero_repetitions` — the `k = 0` endpoint -/ +@[expose] public section + namespace Complexity namespace NTM diff --git a/Complexitylib/Models/TuringMachine/Repetition/Internal/Trial.lean b/Complexitylib/Models/TuringMachine/Repetition/Internal/Trial.lean index 99e5427a..f0a93a3e 100644 --- a/Complexitylib/Models/TuringMachine/Repetition/Internal/Trial.lean +++ b/Complexitylib/Models/TuringMachine/Repetition/Internal/Trial.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Repetition.Internal.Parked +module + +public import Complexitylib.Models.TuringMachine.Repetition.Internal.Parked /-! # Complete trials for fixed-time repetition @@ -21,6 +23,8 @@ zero-time path, and packages the finish-state facts needed by the vote step. - `NTM.repeatAtTime_trace_trial` — the combined trial theorem for every `T` -/ +@[expose] public section + namespace Complexity namespace NTM diff --git a/Complexitylib/Models/TuringMachine/Repetition/Internal/VoteStep.lean b/Complexitylib/Models/TuringMachine/Repetition/Internal/VoteStep.lean index da9cd8a2..ac2af90d 100644 --- a/Complexitylib/Models/TuringMachine/Repetition/Internal/VoteStep.lean +++ b/Complexitylib/Models/TuringMachine/Repetition/Internal/VoteStep.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Repetition.Internal.Finish -import Complexitylib.Models.TuringMachine.Repetition.Internal.Frame -import Complexitylib.Models.TuringMachine.Repetition.Internal.Votes +module + +public import Complexitylib.Models.TuringMachine.Repetition.Internal.Finish +public import Complexitylib.Models.TuringMachine.Repetition.Internal.Frame +public import Complexitylib.Models.TuringMachine.Repetition.Internal.Votes /-! # Finish-step vote semantics for fixed-time repetition @@ -23,6 +25,8 @@ source configuration, and specializes the final finish theorem to `repeatVotes`. - `NTM.repeatAtTime_trace_finish_last_votes` — final majority in source-vote form -/ +@[expose] public section + namespace Complexity namespace NTM diff --git a/Complexitylib/Models/TuringMachine/Repetition/Internal/Votes.lean b/Complexitylib/Models/TuringMachine/Repetition/Internal/Votes.lean index a928899a..2002116e 100644 --- a/Complexitylib/Models/TuringMachine/Repetition/Internal/Votes.lean +++ b/Complexitylib/Models/TuringMachine/Repetition/Internal/Votes.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Repetition.Internal +module + +public import Complexitylib.Models.TuringMachine.Repetition.Internal /-! # Vote bookkeeping for fixed-time repetition @@ -13,6 +15,8 @@ block-event majority API and provides the update invariant used by the outer trial induction. -/ +@[expose] public section + namespace Complexity namespace NTM diff --git a/Complexitylib/Models/TuringMachine/Repetition/Validation.lean b/Complexitylib/Models/TuringMachine/Repetition/Validation.lean index 242d84a9..ae1d2dfc 100644 --- a/Complexitylib/Models/TuringMachine/Repetition/Validation.lean +++ b/Complexitylib/Models/TuringMachine/Repetition/Validation.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Repetition +module + +public import Complexitylib.Models.TuringMachine.Repetition /-! # Executable validation for fixed-time repetition @@ -14,6 +16,8 @@ repetition wrapper and checks that the selected simulation bit becomes the final majority verdict. -/ +@[expose] public section + namespace Complexity namespace NTM.RepetitionValidation diff --git a/Complexitylib/Models/TuringMachine/SingleTape.lean b/Complexitylib/Models/TuringMachine/SingleTape.lean index ddad8c68..798b385d 100644 --- a/Complexitylib/Models/TuringMachine/SingleTape.lean +++ b/Complexitylib/Models/TuringMachine/SingleTape.lean @@ -3,13 +3,15 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine -import Complexitylib.Models.TuringMachine.SingleTape.Internal.Pad -import Complexitylib.Models.TuringMachine.SingleTape.Internal -import Complexitylib.Models.TuringMachine.SingleTape.Internal.Sim -import Complexitylib.Models.TuringMachine.SingleTape.Internal.Delta -import Complexitylib.Models.TuringMachine.SingleTape.Internal.Correctness -import Complexitylib.Asymptotics +module + +public import Complexitylib.Models.TuringMachine +public import Complexitylib.Models.TuringMachine.SingleTape.Internal.Pad +public import Complexitylib.Models.TuringMachine.SingleTape.Internal +public import Complexitylib.Models.TuringMachine.SingleTape.Internal.Sim +public import Complexitylib.Models.TuringMachine.SingleTape.Internal.Delta +public import Complexitylib.Models.TuringMachine.SingleTape.Internal.Correctness +public import Complexitylib.Asymptotics /-! # Multi-tape → single-tape simulation @@ -40,6 +42,8 @@ This is a reusable robustness lemma: `singleTapeSim_decidesInTime` and `exists_singleTape_decidesInTime` are assembled from these. -/ +@[expose] public section + namespace Complexity open Complexity diff --git a/Complexitylib/Models/TuringMachine/SingleTape/Internal.lean b/Complexitylib/Models/TuringMachine/SingleTape/Internal.lean index b737b1cd..384e30e4 100644 --- a/Complexitylib/Models/TuringMachine/SingleTape/Internal.lean +++ b/Complexitylib/Models/TuringMachine/SingleTape/Internal.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine +module + +public import Complexitylib.Models.TuringMachine /-! # Single-tape simulation — encoding internals @@ -17,6 +19,8 @@ layout. Proof internals only — correctness of the full simulation is established downstream. -/ +@[expose] public section + namespace Complexity namespace NTM.SingleTape diff --git a/Complexitylib/Models/TuringMachine/SingleTape/Internal/Correctness.lean b/Complexitylib/Models/TuringMachine/SingleTape/Internal/Correctness.lean index 668fbc44..0d1df3a4 100644 --- a/Complexitylib/Models/TuringMachine/SingleTape/Internal/Correctness.lean +++ b/Complexitylib/Models/TuringMachine/SingleTape/Internal/Correctness.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.SingleTape.Internal.Delta -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -import Complexitylib.Models.TuringMachine.Internal +module + +public import Complexitylib.Models.TuringMachine.SingleTape.Internal.Delta +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +public import Complexitylib.Models.TuringMachine.Internal /-! # Single-tape simulation — correctness internals @@ -19,6 +21,8 @@ iterating `corr_macroStep` over `N`'s computation and translating acceptance. See `docs/A4-SingleTapeSimulation.md`. Proof internals only. -/ +@[expose] public section + namespace Complexity namespace NTM diff --git a/Complexitylib/Models/TuringMachine/SingleTape/Internal/Delta.lean b/Complexitylib/Models/TuringMachine/SingleTape/Internal/Delta.lean index 11491494..4e6567d2 100644 --- a/Complexitylib/Models/TuringMachine/SingleTape/Internal/Delta.lean +++ b/Complexitylib/Models/TuringMachine/SingleTape/Internal/Delta.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.SingleTape.Internal.Sim -import Complexitylib.Models.TuringMachine.Combinators +module + +public import Complexitylib.Models.TuringMachine.SingleTape.Internal.Sim +public import Complexitylib.Models.TuringMachine.Combinators /-! # Single-tape simulation — transition function @@ -27,6 +29,8 @@ backward-chaining characterizations of `gather` and `run` predecessors. See `docs/A4-SingleTapeSimulation.md`. -/ +@[expose] public section + namespace Complexity namespace NTM.SingleTape diff --git a/Complexitylib/Models/TuringMachine/SingleTape/Internal/Pad.lean b/Complexitylib/Models/TuringMachine/SingleTape/Internal/Pad.lean index 5e1ddbe2..e655c1b0 100644 --- a/Complexitylib/Models/TuringMachine/SingleTape/Internal/Pad.lean +++ b/Complexitylib/Models/TuringMachine/SingleTape/Internal/Pad.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine +module + +public import Complexitylib.Models.TuringMachine /-! # Padding a 0-work-tape NTM with a dummy work tape @@ -19,6 +21,8 @@ This closes the `k = 0` case of the single-tape reduction one work tape, while a padded machine *is* already single-work-tape. -/ +@[expose] public section + namespace Complexity namespace NTM diff --git a/Complexitylib/Models/TuringMachine/SingleTape/Internal/Sim.lean b/Complexitylib/Models/TuringMachine/SingleTape/Internal/Sim.lean index a52df7b8..69ae97be 100644 --- a/Complexitylib/Models/TuringMachine/SingleTape/Internal/Sim.lean +++ b/Complexitylib/Models/TuringMachine/SingleTape/Internal/Sim.lean @@ -3,11 +3,13 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.SingleTape.Internal -import Mathlib.Data.Fintype.Prod -import Mathlib.Data.Fintype.Sum -import Mathlib.Data.Finite.Prod -import Mathlib.Data.Finite.Sum +module + +public import Complexitylib.Models.TuringMachine.SingleTape.Internal +public import Mathlib.Data.Fintype.Prod +public import Mathlib.Data.Fintype.Sum +public import Mathlib.Data.Finite.Prod +public import Mathlib.Data.Finite.Sum /-! # Single-tape simulation — simulator state type @@ -23,6 +25,8 @@ product/`Pi` synthesis-size limit. `Finite` is a `Prop` and composes with no such limit, so we route through it (`Fintype.ofFinite` / `Classical.decEq`). -/ +@[expose] public section + namespace Complexity namespace NTM.SingleTape diff --git a/Complexitylib/Models/TuringMachine/SingleTape/Validation.lean b/Complexitylib/Models/TuringMachine/SingleTape/Validation.lean index 2f944d01..cc9a83c4 100644 --- a/Complexitylib/Models/TuringMachine/SingleTape/Validation.lean +++ b/Complexitylib/Models/TuringMachine/SingleTape/Validation.lean @@ -3,7 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.SingleTape.Internal.Delta +module + +public import Complexitylib.Models.TuringMachine.SingleTape.Internal.Delta +meta import Complexitylib.Models.TuringMachine.SingleTape.Internal.Delta /-! # Single-tape simulation — executable validation (regression suite) @@ -24,6 +27,8 @@ hand-off. They cover off-0 moves, right/left moves with writes, repeated materialization, distant writes read back, and `k = 2` tape interleaving. -/ +@[expose] public section + namespace Complexity namespace NTM.SingleTape.Validation diff --git a/Complexitylib/Models/TuringMachine/SpaceTime.lean b/Complexitylib/Models/TuringMachine/SpaceTime.lean index 367affd7..69e9098c 100644 --- a/Complexitylib/Models/TuringMachine/SpaceTime.lean +++ b/Complexitylib/Models/TuringMachine/SpaceTime.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.SpaceTime.Defs -import Complexitylib.Models.TuringMachine.SpaceTime.Internal.RunBound +module + +public import Complexitylib.Models.TuringMachine.SpaceTime.Defs +public import Complexitylib.Models.TuringMachine.SpaceTime.Internal.RunBound /-! # Time bounds from deterministic transducer space bounds @@ -22,6 +24,8 @@ explicit time bound. - `TM.DecidesInSpace.decidesInTime_configBound` — decision-space bound gives time -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/SpaceTime/Defs.lean b/Complexitylib/Models/TuringMachine/SpaceTime/Defs.lean index 0eeed53b..af9e2d0f 100644 --- a/Complexitylib/Models/TuringMachine/SpaceTime/Defs.lean +++ b/Complexitylib/Models/TuringMachine/SpaceTime/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine -import Mathlib.Data.Fintype.BigOperators +module + +public import Complexitylib.Models.TuringMachine +public import Mathlib.Data.Fintype.BigOperators /-! # Finite observations of space-bounded transducer configurations @@ -25,6 +27,8 @@ the symbol currently under the head can affect future execution. - `TM.transducerConfigBound` — the number of possible transducer snapshots -/ +@[expose] public section + namespace Complexity namespace Γ diff --git a/Complexitylib/Models/TuringMachine/SpaceTime/Internal/Observation.lean b/Complexitylib/Models/TuringMachine/SpaceTime/Internal/Observation.lean index dc693527..aa878237 100644 --- a/Complexitylib/Models/TuringMachine/SpaceTime/Internal/Observation.lean +++ b/Complexitylib/Models/TuringMachine/SpaceTime/Internal/Observation.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.SpaceTime.Defs +module + +public import Complexitylib.Models.TuringMachine.SpaceTime.Defs /-! # Bounded-observation extensionality — proof internals @@ -15,6 +17,8 @@ equal after applying the same write and move, provided both successor heads remain inside the observed window. -/ +@[expose] public section + namespace Complexity namespace Tape diff --git a/Complexitylib/Models/TuringMachine/SpaceTime/Internal/OutputFrontier.lean b/Complexitylib/Models/TuringMachine/SpaceTime/Internal/OutputFrontier.lean index c77276ae..ce3c8ddc 100644 --- a/Complexitylib/Models/TuringMachine/SpaceTime/Internal/OutputFrontier.lean +++ b/Complexitylib/Models/TuringMachine/SpaceTime/Internal/OutputFrontier.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine +module + +public import Complexitylib.Models.TuringMachine /-! # Output-frontier invariants — proof internals @@ -13,6 +15,8 @@ initial output tape is blank strictly beyond its head, and a transducer step preserves that property because its output head never moves left. -/ +@[expose] public section + namespace Complexity namespace Tape diff --git a/Complexitylib/Models/TuringMachine/SpaceTime/Internal/Reachability.lean b/Complexitylib/Models/TuringMachine/SpaceTime/Internal/Reachability.lean index eae79b46..4efb264c 100644 --- a/Complexitylib/Models/TuringMachine/SpaceTime/Internal/Reachability.lean +++ b/Complexitylib/Models/TuringMachine/SpaceTime/Internal/Reachability.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine +module + +public import Complexitylib.Models.TuringMachine /-! # Exact-run decomposition — proof internals @@ -13,6 +15,8 @@ indices. They support the finite reduced-configuration argument without adding execution choices to the machine model. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/SpaceTime/Internal/RunBound.lean b/Complexitylib/Models/TuringMachine/SpaceTime/Internal/RunBound.lean index 911dbd85..8a20e339 100644 --- a/Complexitylib/Models/TuringMachine/SpaceTime/Internal/RunBound.lean +++ b/Complexitylib/Models/TuringMachine/SpaceTime/Internal/RunBound.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.SpaceTime.Internal.Reachability -import Complexitylib.Models.TuringMachine.SpaceTime.Internal.Snapshot +module + +public import Complexitylib.Models.TuringMachine.SpaceTime.Internal.Reachability +public import Complexitylib.Models.TuringMachine.SpaceTime.Internal.Snapshot /-! # Finite-configuration run bounds — proof internals @@ -15,6 +17,8 @@ earlier time. The run's time indices therefore inject into the finite snapshot type. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/SpaceTime/Internal/Snapshot.lean b/Complexitylib/Models/TuringMachine/SpaceTime/Internal/Snapshot.lean index 213ef49c..b201a7ba 100644 --- a/Complexitylib/Models/TuringMachine/SpaceTime/Internal/Snapshot.lean +++ b/Complexitylib/Models/TuringMachine/SpaceTime/Internal/Snapshot.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.SpaceTime.Internal.Observation -import Complexitylib.Models.TuringMachine.SpaceTime.Internal.OutputFrontier -import Complexitylib.Models.TuringMachine.Internal +module + +public import Complexitylib.Models.TuringMachine.SpaceTime.Internal.Observation +public import Complexitylib.Models.TuringMachine.SpaceTime.Internal.OutputFrontier +public import Complexitylib.Models.TuringMachine.Internal /-! # Reduced transducer snapshot dynamics — proof internals @@ -15,6 +17,8 @@ by the finite snapshot from `SpaceTime.Defs`, once the shared read-only input contents are fixed. -/ +@[expose] public section + namespace Complexity namespace Tape diff --git a/Complexitylib/Models/TuringMachine/Subroutines.lean b/Complexitylib/Models/TuringMachine/Subroutines.lean index c332383c..78633ddd 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators +module + +public import Complexitylib.Models.TuringMachine.Combinators /-! # TM Subroutines @@ -29,6 +31,8 @@ statements are re-exported by focused surface modules when needed. - `TM.compareWorkTapesTM` — compare two work tapes cell by cell -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryAdd.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryAdd.lean index 330557e6..fc509c21 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryAdd.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryAdd.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.BinaryAdd.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryAdd.Internal +module + +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAdd.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAdd.Internal /-! # Canonical binary addition @@ -26,6 +28,8 @@ width-based rather than derived from total loop runtime. - `binaryAddIntoTM_isTransducer` proves append-only-output safety. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryAdd/Defs.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryAdd/Defs.lean index c7a71fb0..d5564720 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryAdd/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryAdd/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Defs -import Complexitylib.Models.TuringMachine.Subroutines.ClearWork.Defs +module + +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.ClearWork.Defs /-! # Canonical binary addition — definitions @@ -15,6 +17,8 @@ once per source value, and a distinct scratch counter records loop progress. After the loop, the scratch tape is cleared back to canonical zero. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryAdd/Internal.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryAdd/Internal.lean index 84bc50e3..34f04a5b 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryAdd/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryAdd/Internal.lean @@ -3,13 +3,15 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.Internal.Seq -import Complexitylib.Models.TuringMachine.Hoare.Space -import Complexitylib.Models.TuringMachine.Subroutines.BinaryAdd.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Internal.Control -import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc -import Complexitylib.Models.TuringMachine.Subroutines.ClearWork +module + +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Seq +public import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAdd.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Internal.Control +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc +public import Complexitylib.Models.TuringMachine.Subroutines.ClearWork /-! # Canonical binary addition — proof internals @@ -21,6 +23,8 @@ about one comparison or one iteration at a time, avoiding any dependence on the total number of loop iterations. -/ +@[expose] public section + namespace Complexity namespace TM @@ -28,7 +32,7 @@ namespace TM variable {n : ℕ} /-- The standard parked tape for one canonical binary natural. -/ -private def binaryAddNatTape (value : ℕ) : Tape := +def binaryAddNatTape (value : ℕ) : Tape := (Tape.init (value.bits.map Γ.ofBool)).move Dir3.right private theorem binaryAddNatTape_hasBinaryNat (value : ℕ) : @@ -45,7 +49,7 @@ private theorem binaryAddNatTape_parked (value : ℕ) : binaryAddHasBinaryNat_parked (binaryAddNatTape_hasBinaryNat value) /-- Work tapes after `current` completed addition iterations. -/ -private def binaryAddWorkAt (work : Fin n → Tape) +def binaryAddWorkAt (work : Fin n → Tape) (dstIdx counterIdx : Fin n) (dstValue current : ℕ) : Fin n → Tape := Function.update (Function.update work dstIdx (binaryAddNatTape (dstValue + current))) @@ -209,7 +213,8 @@ private theorem binaryAddWorkAt_clear_eq simp [binaryAddWorkAt, hne] · simp [binaryAddWorkAt, hic, hid] -private abbrev binaryAddFramePred +@[nolint docBlame] +abbrev binaryAddFramePred (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) : TapePred n := fun inp work out => inp = inp₀ ∧ work = work₀ ∧ out = out₀ diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryAddConst.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryAddConst.lean index 6ba0c588..acecb0d5 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryAddConst.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryAddConst.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst.Internal +module + +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst.Internal /-! # Addition of a fixed natural to a canonical binary tape @@ -20,6 +22,8 @@ sequence of binary successors compiled from a hardwired natural constant. - `binaryAddConstTM_isTransducer` proves append-only-output safety. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryAddConst/Defs.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryAddConst/Defs.lean index 9fa3373c..861181e0 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryAddConst/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryAddConst/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Registers.RegisterOps -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs +module + +public import Complexitylib.Models.TuringMachine.Registers.RegisterOps +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs /-! # Addition of a fixed natural to a canonical binary tape — definitions @@ -14,6 +16,8 @@ canonical binary successor. No work tape is needed for the hardwired value, so the construction preserves every tape except its destination. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryAddConst/Internal.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryAddConst/Internal.lean index 6e88c31a..06372834 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryAddConst/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryAddConst/Internal.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.Internal.Seq -import Complexitylib.Models.TuringMachine.Hoare.Space -import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc +module + +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Seq +public import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc /-! # Addition of a fixed natural to a canonical binary tape — proof internals @@ -16,13 +18,16 @@ compose through `seqTM`; the all-prefix space induction uses the largest destination width rather than the total successor-chain runtime. -/ +@[expose] public section + namespace Complexity namespace TM variable {n : ℕ} -private def binaryAddConstNatTape (value : ℕ) : Tape := +@[nolint docBlame] +def binaryAddConstNatTape (value : ℕ) : Tape := (Tape.init (value.bits.map Γ.ofBool)).move Dir3.right private theorem binaryAddConstNatTape_hasBinaryNat (value : ℕ) : @@ -107,7 +112,8 @@ private theorem binaryAddConstInitialWork_parked exact binaryAddConstHasBinaryNat_parked hdst · exact hother i hi -private abbrev binaryAddConstFramePred +@[nolint docBlame] +abbrev binaryAddConstFramePred (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) : TapePred n := fun inp work out => inp = inp₀ ∧ work = work₀ ∧ out = out₀ diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryCopy.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryCopy.lean index 0c6a51eb..5c0b06a3 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryCopy.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryCopy.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy.Internal +module + +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy.Internal /-! # Copying canonical binary naturals @@ -21,6 +23,8 @@ destination becomes an exact copy, and the zero scratch is restored literally. - `TM.binaryCopyIntoTM_isTransducer` proves append-only-output safety. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryCopy/Defs.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryCopy/Defs.lean index 738f1326..789a1f54 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryCopy/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryCopy/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Defs -import Complexitylib.Models.TuringMachine.Subroutines.ClearWork.Defs +module + +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.ClearWork.Defs /-! # Copying canonical binary naturals @@ -14,6 +16,8 @@ binary addition. The source and zero scratch tapes are preserved, while the destination is replaced by an exact copy of the source. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryCopy/Internal.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryCopy/Internal.lean index 5c6b1503..c29e6dd5 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryCopy/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryCopy/Internal.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Hoare.Space -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd -import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy.Defs -import Complexitylib.Models.TuringMachine.Subroutines.ClearWork +module + +public import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.ClearWork /-! # Copying canonical binary naturals -- proof internals @@ -17,29 +19,32 @@ proofs compose the public literal-frame and all-prefix contracts of both phases, then recover the original literal copy frame from canonicality. -/ +@[expose] public section + namespace Complexity namespace TM variable {n : ℕ} -private def binaryCopyNatTape (value : ℕ) : Tape := +@[nolint docBlame] +def binaryCopyNatTape (value : ℕ) : Tape := (Tape.init (value.bits.map Γ.ofBool)).move Dir3.right -private theorem binaryCopyNatTape_hasBinaryNat (value : ℕ) : +theorem binaryCopyNatTape_hasBinaryNat (value : ℕ) : (binaryCopyNatTape value).HasBinaryNat value := Tape.init_move_right_hasBinaryNat value -private theorem binaryCopyHasBinaryNat_parked {t : Tape} {value : ℕ} +theorem binaryCopyHasBinaryNat_parked {t : Tape} {value : ℕ} (h : t.HasBinaryNat value) : Parked t := by refine ⟨by rw [h.2.1], ?_⟩ exact Tape.HasBinaryContent.cells_ne_start h.2.2 -private theorem binaryCopyNatTape_parked (value : ℕ) : +theorem binaryCopyNatTape_parked (value : ℕ) : Parked (binaryCopyNatTape value) := binaryCopyHasBinaryNat_parked (binaryCopyNatTape_hasBinaryNat value) -private theorem binaryCopyInitialWork_parked +theorem binaryCopyInitialWork_parked (srcIdx dstIdx counterIdx : Fin n) (srcValue dstValue : ℕ) (work₀ : Fin n → Tape) (hsrc : (work₀ srcIdx).HasBinaryNat srcValue) @@ -60,11 +65,12 @@ private theorem binaryCopyInitialWork_parked exact binaryCopyHasBinaryNat_parked hcounter exact hother i hsrcIdx hdstIdx hcounterIdx -private def binaryCopyMidWork (work₀ : Fin n → Tape) (dstIdx : Fin n) : +@[nolint docBlame] +def binaryCopyMidWork (work₀ : Fin n → Tape) (dstIdx : Fin n) : Fin n → Tape := Function.update work₀ dstIdx (binaryCopyNatTape 0) -private theorem binaryCopyMidWork_parked +theorem binaryCopyMidWork_parked (work₀ : Fin n → Tape) (dstIdx : Fin n) (hwork : ∀ i, Parked (work₀ i)) : ∀ i, Parked (binaryCopyMidWork work₀ dstIdx i) := by @@ -76,7 +82,7 @@ private theorem binaryCopyMidWork_parked · rw [binaryCopyMidWork, Function.update_of_ne hi] exact hwork i -private theorem binaryCopyFrame_transition +theorem binaryCopyFrame_transition (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) (hinp : Parked inp₀) (hwork : ∀ i, Parked (work₀ i)) (hout : Parked out₀) : @@ -90,14 +96,14 @@ private theorem binaryCopyFrame_transition funext i exact (hwork i).transitionTape_eq_self -private theorem binaryCopyDistinct +theorem binaryCopyDistinct (srcIdx dstIdx counterIdx : Fin n) (hsrcDst : srcIdx ≠ dstIdx) (hsrcCounter : srcIdx ≠ counterIdx) (hdstCounter : dstIdx ≠ counterIdx) : BinaryRippleAddDistinct srcIdx counterIdx dstIdx := ⟨hsrcCounter, hsrcDst, hdstCounter.symm⟩ -private theorem binaryCopyRipplePost_eq +theorem binaryCopyRipplePost_eq (srcIdx dstIdx counterIdx : Fin n) (hsrcDst : srcIdx ≠ dstIdx) (hdstCounter : dstIdx ≠ counterIdx) (srcValue : ℕ) (work₀ work : Fin n → Tape) diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryEq.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryEq.lean index 8b86414c..a8944456 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryEq.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryEq.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.BinaryEq.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryEq.Internal -import Complexitylib.Models.TuringMachine.Hoare.Space +module + +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryEq.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryEq.Internal +public import Complexitylib.Models.TuringMachine.Hoare.Space /-! # Binary work-tape equality @@ -14,6 +16,8 @@ This module exposes a framed linear-time correctness theorem for the concrete binary equality routine used by RAM register-store scans. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryEq/Defs.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryEq/Defs.lean index a9eefb2c..f331e952 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryEq/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryEq/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines -import Complexitylib.Models.TuringMachine.Tape.Encoding +module + +public import Complexitylib.Models.TuringMachine.Subroutines +public import Complexitylib.Models.TuringMachine.Tape.Encoding /-! # Binary work-tape equality — definitions @@ -14,6 +16,8 @@ result on a third work tape. Unlike the legacy output-oriented comparator, it preserves the public output tape and every unrelated work tape. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryEq/Internal.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryEq/Internal.lean index 2d2bc858..1179b578 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryEq/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryEq/Internal.lean @@ -3,13 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.BinaryEq.Defs -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +module + +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryEq.Defs +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic /-! # Binary work-tape equality — proof internals -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor.lean index f6a91bcf..ddc1a65e 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Internal +module + +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Internal /-! # Canonical binary count-up loops @@ -30,6 +32,8 @@ limit, or tape frames. Clients record those endpoint facts in - `IsTransducer.binaryForTM` preserves one-way output safety. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor/Defs.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor/Defs.lean index cb3657a4..ce1cc191 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs +module + +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs /-! # Canonical binary count-up loops — definitions @@ -25,6 +27,8 @@ The wrapper-free certificate structures at the end of the file separate the executable controller from later correctness and all-prefix space proofs. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor/Internal.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor/Internal.lean index b9e342bd..a9cb66a5 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor/Internal.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Internal.Comparison -import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Internal.Loop +module + +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Internal.Comparison +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Internal.Loop /-! # Canonical binary count-up loops — internal proofs @@ -12,3 +14,5 @@ import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Internal.Loop Aggregation module for the comparison controller, certified loop induction, all-prefix space bound, and transducer proof. -/ + +@[expose] public section diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor/Internal/Comparison.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor/Internal/Comparison.lean index 409c7f49..7e069302 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor/Internal/Comparison.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor/Internal/Comparison.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Internal.Control -import Complexitylib.Mathlib.NatBits +module + +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Internal.Control +public import Complexitylib.Mathlib.NatBits /-! # Canonical binary count-up loops — comparison internals @@ -17,6 +19,8 @@ the loop invariant `value ≤ limitValue`, the run takes exactly iteration precisely below the limit, or to `done` precisely at equality. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor/Internal/Control.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor/Internal/Control.lean index 9378368f..3d2dd78b 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor/Internal/Control.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor/Internal/Control.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Defs +module + +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Defs /-! # Canonical binary count-up loops — control proofs @@ -18,6 +20,8 @@ The canonical multi-step comparison run and loop induction are intentionally left to later proof layers. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor/Internal/Loop.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor/Internal/Loop.lean index 7a462281..3407e8cd 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor/Internal/Loop.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor/Internal/Loop.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Internal -import Complexitylib.Models.TuringMachine.SpaceTime.Internal.Reachability -import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Internal +module + +public import Complexitylib.Models.TuringMachine.Internal +public import Complexitylib.Models.TuringMachine.SpaceTime.Internal.Reachability +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Internal /-! # Canonical binary count-up loops — proof internals @@ -17,6 +19,8 @@ that the binary loop driver preserves the one-way-output discipline of its body. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryLength.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryLength.lean index c8895f58..1f104c51 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryLength.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryLength.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Experimental.Routine -import Complexitylib.Models.TuringMachine.Subroutines.BinaryLength.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryLength.Internal +module + +public import Complexitylib.Models.TuringMachine.Experimental.Routine +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryLength.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryLength.Internal /-! # Binary input-length counter @@ -29,6 +31,8 @@ reuses the local successor bound at each iteration and is formally `O(log n)`. - `TM.binaryLengthTM_isTransducer` — the output head never moves left. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryLength/Defs.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryLength/Defs.lean index afad94af..34d6c319 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryLength/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryLength/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Experimental.Routine.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs +module + +public import Complexitylib.Models.TuringMachine.Experimental.Routine.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs /-! # Binary input-length counter — definitions @@ -14,6 +16,8 @@ The input region supplies unary loop fuel without being copied into auxiliary space; the designated work tape holds the growing canonical `Nat.bits` counter. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryLength/Internal.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryLength/Internal.lean index 4775c123..a2472703 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryLength/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryLength/Internal.lean @@ -3,13 +3,15 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Asymptotics -import Complexitylib.Mathlib.NatBits -import Complexitylib.Models.TuringMachine.Combinators.ForInput.Internal -import Complexitylib.Models.TuringMachine.Hoare.Space -import Complexitylib.Models.TuringMachine.Experimental.Routine.Internal -import Complexitylib.Models.TuringMachine.Subroutines.BinaryLength.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc +module + +public import Complexitylib.Asymptotics +public import Complexitylib.Mathlib.NatBits +public import Complexitylib.Models.TuringMachine.Combinators.ForInput.Internal +public import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.TuringMachine.Experimental.Routine.Internal +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryLength.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc /-! # Binary input-length counter — proof internals @@ -19,23 +21,29 @@ The exact run proof scans the read-only input and lifts one proved reachable driver/body phase so input length is never charged as work space. -/ +@[expose] public section + namespace Complexity namespace TM variable {n : ℕ} {counterIdx : Fin n} -private def binaryLengthStartedBlank : Tape := +@[nolint docBlame] +def binaryLengthStartedBlank : Tape := (Tape.init []).move Dir3.right -private def binaryLengthInput (x : List Bool) (head : ℕ) : Tape := +@[nolint docBlame] +def binaryLengthInput (x : List Bool) (head : ℕ) : Tape := { head := head cells := (Tape.init (x.map Γ.ofBool)).cells } -private def binaryLengthCounterTape (value : ℕ) : Tape := +@[nolint docBlame] +def binaryLengthCounterTape (value : ℕ) : Tape := (Tape.init (value.bits.map Γ.ofBool)).move Dir3.right -private def binaryLengthWork (counterIdx : Fin n) (value : ℕ) : Fin n → Tape := +@[nolint docBlame] +def binaryLengthWork (counterIdx : Fin n) (value : ℕ) : Fin n → Tape := Function.update (fun _ => binaryLengthStartedBlank) counterIdx (binaryLengthCounterTape value) @@ -60,7 +68,8 @@ private def binaryLengthBodyDoneCfg (x : List Bool) (counterIdx : Fin n) work := binaryLengthWork counterIdx (value + 1) output := binaryLengthStartedBlank } -private def binaryLengthDoneCfg (x : List Bool) (counterIdx : Fin n) : +@[nolint docBlame] +def binaryLengthDoneCfg (x : List Bool) (counterIdx : Fin n) : Cfg n (binaryLengthTM counterIdx).Q := { state := .inl .done input := binaryLengthInput x (x.length + 1) diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryMulAdd.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryMulAdd.lean index 47ad88b7..d71d9601 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryMulAdd.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryMulAdd.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.BinaryMulAdd.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryMulAdd.Internal +module + +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryMulAdd.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryMulAdd.Internal /-! # Canonical binary multiply-add @@ -21,6 +23,8 @@ zero. The resource contract gives a width-based all-prefix space bound. - `binaryMulAddIntoTM_isTransducer` proves append-only-output safety. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryMulAdd/Defs.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryMulAdd/Defs.lean index 6b8a3caa..1e5789c4 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryMulAdd/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryMulAdd/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.BinaryAdd.Defs +module + +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAdd.Defs /-! # Canonical binary multiply-add — definitions @@ -15,6 +17,8 @@ accumulator, an outer multiplication counter, and the addition routine's private counter. Both counters are restored to canonical zero. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryMulAdd/Internal.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryMulAdd/Internal.lean index 51ca9a9c..7fc82aef 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryMulAdd/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryMulAdd/Internal.lean @@ -3,15 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.Internal.Seq -import Complexitylib.Models.TuringMachine.Hoare.Space -import Complexitylib.Models.TuringMachine.SpaceTime.Internal.Reachability -import Complexitylib.Models.TuringMachine.Subroutines.BinaryAdd -import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Internal.Control -import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor -import Complexitylib.Models.TuringMachine.Subroutines.BinaryMulAdd.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc -import Complexitylib.Models.TuringMachine.Subroutines.ClearWork +module + +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Seq +public import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.TuringMachine.SpaceTime.Internal.Reachability +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAdd +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Internal.Control +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryMulAdd.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc +public import Complexitylib.Models.TuringMachine.Subroutines.ClearWork /-! # Canonical binary multiply-add — proof internals @@ -24,30 +26,33 @@ formula. Space is proved compositionally for each repeated-addition iteration, so it depends on binary widths rather than on the number of loop steps. -/ +@[expose] public section + namespace Complexity namespace TM variable {n : ℕ} -private def binaryMulAddNatTape (value : ℕ) : Tape := +@[nolint docBlame] +def binaryMulAddNatTape (value : ℕ) : Tape := (Tape.init (value.bits.map Γ.ofBool)).move Dir3.right -private theorem binaryMulAddNatTape_hasBinaryNat (value : ℕ) : +theorem binaryMulAddNatTape_hasBinaryNat (value : ℕ) : (binaryMulAddNatTape value).HasBinaryNat value := Tape.init_move_right_hasBinaryNat value -private theorem binaryMulAddHasBinaryNat_parked {t : Tape} {value : ℕ} +theorem binaryMulAddHasBinaryNat_parked {t : Tape} {value : ℕ} (h : t.HasBinaryNat value) : Parked t := by refine ⟨by rw [h.2.1], ?_⟩ exact Tape.HasBinaryContent.cells_ne_start h.2.2 -private theorem binaryMulAddNatTape_parked (value : ℕ) : +theorem binaryMulAddNatTape_parked (value : ℕ) : Parked (binaryMulAddNatTape value) := binaryMulAddHasBinaryNat_parked (binaryMulAddNatTape_hasBinaryNat value) /-- Work tapes after `current` completed outer iterations. -/ -private def binaryMulAddWorkAt (work : Fin n → Tape) +def binaryMulAddWorkAt (work : Fin n → Tape) (accIdx mulCounterIdx : Fin n) (leftValue accValue current : ℕ) : Fin n → Tape := Function.update @@ -57,14 +62,14 @@ private def binaryMulAddWorkAt (work : Fin n → Tape) /-- Work tapes after the addition body but before incrementing the outer counter in iteration `current`. -/ -private def binaryMulAddMidWorkAt (work : Fin n → Tape) +def binaryMulAddMidWorkAt (work : Fin n → Tape) (accIdx mulCounterIdx : Fin n) (leftValue accValue current : ℕ) : Fin n → Tape := Function.update (binaryMulAddWorkAt work accIdx mulCounterIdx leftValue accValue current) accIdx (binaryMulAddNatTape (accValue + leftValue * (current + 1))) -private theorem binaryMulAddWorkAt_counter +theorem binaryMulAddWorkAt_counter (work : Fin n → Tape) (accIdx mulCounterIdx : Fin n) (leftValue accValue current : ℕ) : binaryMulAddWorkAt work accIdx mulCounterIdx leftValue accValue current @@ -72,7 +77,7 @@ private theorem binaryMulAddWorkAt_counter binaryMulAddNatTape current := by simp [binaryMulAddWorkAt] -private theorem binaryMulAddWorkAt_acc +theorem binaryMulAddWorkAt_acc (work : Fin n → Tape) {accIdx mulCounterIdx : Fin n} (hne : accIdx ≠ mulCounterIdx) (leftValue accValue current : ℕ) : binaryMulAddWorkAt work accIdx mulCounterIdx leftValue accValue current @@ -80,7 +85,7 @@ private theorem binaryMulAddWorkAt_acc binaryMulAddNatTape (accValue + leftValue * current) := by simp [binaryMulAddWorkAt, hne] -private theorem binaryMulAddWorkAt_other +theorem binaryMulAddWorkAt_other (work : Fin n → Tape) {accIdx mulCounterIdx i : Fin n} (hia : i ≠ accIdx) (him : i ≠ mulCounterIdx) (leftValue accValue current : ℕ) : @@ -88,7 +93,7 @@ private theorem binaryMulAddWorkAt_other work i := by simp [binaryMulAddWorkAt, hia, him] -private theorem binaryMulAddWorkAt_counter_hasBinaryNat +theorem binaryMulAddWorkAt_counter_hasBinaryNat (work : Fin n → Tape) (accIdx mulCounterIdx : Fin n) (leftValue accValue current : ℕ) : Tape.HasBinaryNat @@ -97,7 +102,7 @@ private theorem binaryMulAddWorkAt_counter_hasBinaryNat rw [binaryMulAddWorkAt_counter] exact binaryMulAddNatTape_hasBinaryNat current -private theorem binaryMulAddWorkAt_acc_hasBinaryNat +theorem binaryMulAddWorkAt_acc_hasBinaryNat (work : Fin n → Tape) {accIdx mulCounterIdx : Fin n} (hne : accIdx ≠ mulCounterIdx) (leftValue accValue current : ℕ) : Tape.HasBinaryNat @@ -106,7 +111,7 @@ private theorem binaryMulAddWorkAt_acc_hasBinaryNat rw [binaryMulAddWorkAt_acc work hne] exact binaryMulAddNatTape_hasBinaryNat _ -private theorem binaryMulAddWorkAt_parked +theorem binaryMulAddWorkAt_parked (work : Fin n → Tape) (accIdx mulCounterIdx : Fin n) (leftValue accValue current : ℕ) (hwork : ∀ i, Parked (work i)) : ∀ i, Parked @@ -125,7 +130,7 @@ private theorem binaryMulAddWorkAt_parked · rw [binaryMulAddWorkAt_other work hia him] exact hwork i -private theorem binaryMulAddMidWorkAt_parked +theorem binaryMulAddMidWorkAt_parked (work : Fin n → Tape) (accIdx mulCounterIdx : Fin n) (leftValue accValue current : ℕ) (hwork : ∀ i, Parked (work i)) : ∀ i, Parked @@ -141,7 +146,7 @@ private theorem binaryMulAddMidWorkAt_parked exact binaryMulAddWorkAt_parked work accIdx mulCounterIdx leftValue accValue current hwork i -private theorem binaryMulAddMidWorkAt_counter_hasBinaryNat +theorem binaryMulAddMidWorkAt_counter_hasBinaryNat (work : Fin n → Tape) {accIdx mulCounterIdx : Fin n} (hne : accIdx ≠ mulCounterIdx) (leftValue accValue current : ℕ) : Tape.HasBinaryNat @@ -151,7 +156,7 @@ private theorem binaryMulAddMidWorkAt_counter_hasBinaryNat exact binaryMulAddWorkAt_counter_hasBinaryNat work accIdx mulCounterIdx leftValue accValue current -private theorem binaryMulAddBodyUpdate_eq +theorem binaryMulAddBodyUpdate_eq (work : Fin n → Tape) (accIdx mulCounterIdx : Fin n) (leftValue accValue current : ℕ) : Function.update @@ -165,7 +170,7 @@ private theorem binaryMulAddBodyUpdate_eq congr 2 simp [Nat.mul_succ, Nat.add_assoc] -private theorem binaryMulAddCounterUpdate_eq +theorem binaryMulAddCounterUpdate_eq (work : Fin n → Tape) {accIdx mulCounterIdx : Fin n} (hne : accIdx ≠ mulCounterIdx) (leftValue accValue current : ℕ) : Function.update @@ -183,7 +188,7 @@ private theorem binaryMulAddCounterUpdate_eq simp [binaryMulAddMidWorkAt, binaryMulAddWorkAt, hne] · simp [binaryMulAddMidWorkAt, binaryMulAddWorkAt, him, hia] -private theorem binaryMulAddInitialWork_parked +theorem binaryMulAddInitialWork_parked (leftIdx rightIdx accIdx mulCounterIdx addCounterIdx : Fin n) (work : Fin n → Tape) {leftValue rightValue accValue : ℕ} (hleft : (work leftIdx).HasBinaryNat leftValue) @@ -207,7 +212,7 @@ private theorem binaryMulAddInitialWork_parked · subst i; exact binaryMulAddHasBinaryNat_parked haddCounter · exact hother i hil hir hia him hic -private theorem binaryMulAddWorkAt_zero_eq +theorem binaryMulAddWorkAt_zero_eq (work : Fin n → Tape) {accIdx mulCounterIdx : Fin n} (hne : accIdx ≠ mulCounterIdx) (leftValue accValue : ℕ) (hacc : (work accIdx).HasBinaryNat accValue) @@ -225,7 +230,7 @@ private theorem binaryMulAddWorkAt_zero_eq simpa [binaryMulAddNatTape] using hacc.eq_init_move_right.symm · exact binaryMulAddWorkAt_other work hia him leftValue accValue 0 -private theorem binaryMulAddWorkAt_clear_eq +theorem binaryMulAddWorkAt_clear_eq (work : Fin n → Tape) {accIdx mulCounterIdx : Fin n} (hne : accIdx ≠ mulCounterIdx) (leftValue rightValue accValue : ℕ) (hcounter : (work mulCounterIdx).HasBinaryNat 0) : @@ -245,11 +250,13 @@ private theorem binaryMulAddWorkAt_clear_eq simp [binaryMulAddWorkAt, hne] · simp [binaryMulAddWorkAt, him, hia] -private abbrev binaryMulAddFramePred +@[nolint docBlame] +abbrev binaryMulAddFramePred (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) : TapePred n := fun inp work out => inp = inp₀ ∧ work = work₀ ∧ out = out₀ -private def binaryMulAddScanCfg +@[nolint docBlame] +def binaryMulAddScanCfg (leftIdx rightIdx accIdx mulCounterIdx addCounterIdx : Fin n) (inp : Tape) (work : Fin n → Tape) (out : Tape) (leftValue accValue current : ℕ) : @@ -261,7 +268,8 @@ private def binaryMulAddScanCfg current output := out } -private def binaryMulAddIterationStartCfg +@[nolint docBlame] +def binaryMulAddIterationStartCfg (leftIdx rightIdx accIdx mulCounterIdx addCounterIdx : Fin n) (inp : Tape) (work : Fin n → Tape) (out : Tape) (leftValue accValue current : ℕ) : @@ -275,7 +283,8 @@ private def binaryMulAddIterationStartCfg current output := out } -private def binaryMulAddIterationDoneCfg +@[nolint docBlame] +def binaryMulAddIterationDoneCfg (leftIdx rightIdx accIdx mulCounterIdx addCounterIdx : Fin n) (inp : Tape) (work : Fin n → Tape) (out : Tape) (leftValue accValue current : ℕ) : @@ -289,7 +298,8 @@ private def binaryMulAddIterationDoneCfg (current + 1) output := out } -private def binaryMulAddDoneCfg +@[nolint docBlame] +def binaryMulAddDoneCfg (leftIdx rightIdx accIdx mulCounterIdx addCounterIdx : Fin n) (inp : Tape) (work : Fin n → Tape) (out : Tape) (leftValue rightValue accValue : ℕ) : @@ -301,7 +311,7 @@ private def binaryMulAddDoneCfg rightValue output := out } -private theorem binaryMulAddBody_exists +theorem binaryMulAddBody_exists (leftIdx rightIdx accIdx mulCounterIdx addCounterIdx : Fin n) (hdistinct : BinaryMulAddDistinct leftIdx rightIdx accIdx mulCounterIdx addCounterIdx) @@ -367,7 +377,8 @@ private theorem binaryMulAddBody_exists Cfg.ext hhalt hinput hworkEq' houtput exact ⟨time, htime, by simpa [hc'] using hreach⟩ -private noncomputable def binaryMulAddBodyActualTime +@[nolint docBlame] +noncomputable def binaryMulAddBodyActualTime (leftIdx rightIdx accIdx mulCounterIdx addCounterIdx : Fin n) (hdistinct : BinaryMulAddDistinct leftIdx rightIdx accIdx mulCounterIdx addCounterIdx) @@ -381,7 +392,7 @@ private noncomputable def binaryMulAddBodyActualTime mulCounterIdx addCounterIdx hdistinct leftValue accValue current inp work out hleft haddCounter hinp hwork hout) -private theorem binaryMulAddBodyActualTime_spec +theorem binaryMulAddBodyActualTime_spec (leftIdx rightIdx accIdx mulCounterIdx addCounterIdx : Fin n) (hdistinct : BinaryMulAddDistinct leftIdx rightIdx accIdx mulCounterIdx addCounterIdx) @@ -410,7 +421,8 @@ private theorem binaryMulAddBodyActualTime_spec mulCounterIdx addCounterIdx hdistinct leftValue accValue current inp work out hleft haddCounter hinp hwork hout) -private noncomputable def binaryMulAddBodyTimeFn +@[nolint docBlame] +noncomputable def binaryMulAddBodyTimeFn (leftIdx rightIdx accIdx mulCounterIdx addCounterIdx : Fin n) (hdistinct : BinaryMulAddDistinct leftIdx rightIdx accIdx mulCounterIdx addCounterIdx) @@ -424,7 +436,7 @@ private noncomputable def binaryMulAddBodyTimeFn mulCounterIdx addCounterIdx hdistinct leftValue accValue current inp work out hleft haddCounter hinp hwork hout -private theorem binaryMulAddSuccCanonical_reachesIn +theorem binaryMulAddSuccCanonical_reachesIn (idx : Fin n) (value : ℕ) (inp : Tape) (work : Fin n → Tape) (out : Tape) (hvalue : (work idx).HasBinaryNat value) @@ -462,7 +474,7 @@ private theorem binaryMulAddSuccCanonical_reachesIn Cfg.ext hhalt hinput hworkEq houtput simpa [hc'] using hreach -private theorem binaryMulAddOuterCounter_reachesIn +theorem binaryMulAddOuterCounter_reachesIn (accIdx mulCounterIdx : Fin n) (hne : accIdx ≠ mulCounterIdx) (leftValue accValue current : ℕ) (inp : Tape) (work : Fin n → Tape) (out : Tape) @@ -491,7 +503,7 @@ private theorem binaryMulAddOuterCounter_reachesIn rw [binaryMulAddCounterUpdate_eq work hne leftValue accValue current] at hrun exact hrun -private theorem binaryMulAddIteration_reachesIn +theorem binaryMulAddIteration_reachesIn (leftIdx rightIdx accIdx mulCounterIdx addCounterIdx : Fin n) (hdistinct : BinaryMulAddDistinct leftIdx rightIdx accIdx mulCounterIdx addCounterIdx) @@ -554,7 +566,7 @@ private theorem binaryMulAddIteration_reachesIn binaryForIterationTime, binaryForIterationTM, binaryForIterationWrap, phase1Wrap, phase2Wrap] using hlift -private theorem binaryMulAddLoopback_step +theorem binaryMulAddLoopback_step (leftIdx rightIdx accIdx mulCounterIdx addCounterIdx : Fin n) (leftValue accValue current : ℕ) (inp : Tape) (work : Fin n → Tape) (out : Tape) @@ -580,7 +592,7 @@ private theorem binaryMulAddLoopback_step simpa [body, c, binaryMulAddLoopTM, binaryMulAddIterationDoneCfg, binaryMulAddScanCfg, binaryForIterationWrap] using hstep -private theorem binaryMulAddTest_reachesIn +theorem binaryMulAddTest_reachesIn (leftIdx rightIdx accIdx mulCounterIdx addCounterIdx : Fin n) (hdistinct : BinaryMulAddDistinct leftIdx rightIdx accIdx mulCounterIdx addCounterIdx) @@ -617,7 +629,7 @@ private theorem binaryMulAddTest_reachesIn simpa [binaryMulAddLoopTM, binaryMulAddScanCfg, binaryMulAddIterationStartCfg] using hrun -private theorem binaryMulAddDone_reachesIn +theorem binaryMulAddDone_reachesIn (leftIdx rightIdx accIdx mulCounterIdx addCounterIdx : Fin n) (hdistinct : BinaryMulAddDistinct leftIdx rightIdx accIdx mulCounterIdx addCounterIdx) @@ -693,7 +705,7 @@ private noncomputable def binaryMulAddLoopSpec addCounterIdx hdistinct rightValue leftValue accValue inp work out hright hinp hwork hout -private theorem binaryForLoopTime_mono +theorem binaryForLoopTime_mono (bodyTime₁ bodyTime₂ : ℕ → ℕ) (limit value count : ℕ) (hle : ∀ current, bodyTime₁ current ≤ bodyTime₂ current) : @@ -708,7 +720,7 @@ private theorem binaryForLoopTime_mono simp only [binaryForIterationTime] at ⊢ omega -private theorem binaryMulAddLoopTM_hoareTime +theorem binaryMulAddLoopTM_hoareTime (leftIdx rightIdx accIdx mulCounterIdx addCounterIdx : Fin n) (hdistinct : BinaryMulAddDistinct leftIdx rightIdx accIdx mulCounterIdx addCounterIdx) @@ -781,7 +793,7 @@ private theorem binaryMulAddLoopTM_hoareTime simpa [spec, binaryMulAddLoopSpec, binaryMulAddDoneCfg, bodyTime, binaryMulAddLoopTM, binaryForTM] using hrun -private theorem binaryMulAddWorkAt_cfg_withinAuxSpace +theorem binaryMulAddWorkAt_cfg_withinAuxSpace {Q : Type} (state : Q) (inp : Tape) (work : Fin n → Tape) (out : Tape) (accIdx mulCounterIdx : Fin n) (leftValue accValue current inputLength initialSpace : ℕ) @@ -815,7 +827,7 @@ private theorem binaryMulAddWorkAt_cfg_withinAuxSpace exact hworkSpace i · exact hinputSpace -private theorem binaryMulAddMidWorkAt_cfg_withinAuxSpace +theorem binaryMulAddMidWorkAt_cfg_withinAuxSpace {Q : Type} (state : Q) (inp : Tape) (work : Fin n → Tape) (out : Tape) (accIdx mulCounterIdx : Fin n) (leftValue accValue current inputLength initialSpace : ℕ) @@ -849,7 +861,7 @@ private theorem binaryMulAddMidWorkAt_cfg_withinAuxSpace exact hworkSpace i · exact hinputSpace -private theorem binaryMulAddBody_hoareTimeSpace +theorem binaryMulAddBody_hoareTimeSpace (leftIdx rightIdx accIdx mulCounterIdx addCounterIdx : Fin n) (hdistinct : BinaryMulAddDistinct leftIdx rightIdx accIdx mulCounterIdx addCounterIdx) @@ -910,7 +922,7 @@ private theorem binaryMulAddBody_hoareTimeSpace exact binaryMulAddBodyUpdate_eq work accIdx mulCounterIdx leftValue accValue current -private theorem binaryMulAddCounter_hoareTimeSpace +theorem binaryMulAddCounter_hoareTimeSpace (accIdx mulCounterIdx : Fin n) (hne : accIdx ≠ mulCounterIdx) (leftValue accValue current inputLength initialSpace : ℕ) (inp : Tape) (work : Fin n → Tape) (out : Tape) @@ -972,7 +984,7 @@ private theorem binaryMulAddCounter_hoareTimeSpace rw [hworkEq, binaryMulAddCounterUpdate_eq work hne leftValue accValue current] -private theorem binaryMulAddIteration_hoareTimeSpace +theorem binaryMulAddIteration_hoareTimeSpace (leftIdx rightIdx accIdx mulCounterIdx addCounterIdx : Fin n) (hdistinct : BinaryMulAddDistinct leftIdx rightIdx accIdx mulCounterIdx addCounterIdx) @@ -1023,7 +1035,7 @@ private theorem binaryMulAddIteration_hoareTimeSpace (by simp [binaryForIterationTime]) le_rfl ?_ simp -private theorem binaryMulAddIterationInner_reachesIn +theorem binaryMulAddIterationInner_reachesIn (leftIdx rightIdx accIdx mulCounterIdx addCounterIdx : Fin n) (hdistinct : BinaryMulAddDistinct leftIdx rightIdx accIdx mulCounterIdx addCounterIdx) @@ -1093,7 +1105,7 @@ private theorem binaryMulAddIterationInner_reachesIn simpa [body, succ, binaryMulAddBodyTimeFn, binaryForIterationTime, binaryForIterationTM, phase1Wrap, phase2Wrap] using hseq -private theorem binaryAddSpace_mono_destination +theorem binaryAddSpace_mono_destination (initialSpace leftValue dst₁ dst₂ : ℕ) (hle : dst₁ ≤ dst₂) : binaryAddSpace initialSpace leftValue dst₁ ≤ binaryAddSpace initialSpace leftValue dst₂ := by @@ -1216,7 +1228,7 @@ private noncomputable def binaryMulAddLoopSpaceSpec rw [hc] simpa [binaryForIterationWrap] using hd.mono le_rfl hspace -private theorem binaryMulAddLoopTM_hoareSpace +theorem binaryMulAddLoopTM_hoareSpace (leftIdx rightIdx accIdx mulCounterIdx addCounterIdx : Fin n) (hdistinct : BinaryMulAddDistinct leftIdx rightIdx accIdx mulCounterIdx addCounterIdx) @@ -1283,7 +1295,7 @@ private theorem binaryMulAddLoopTM_hoareSpace exact spaceSpec.prefix_withinAuxSpace rightValue 0 time c (by omega) (by simpa [spaceSpec, spec] using hreachSpec) htime -private theorem binaryMulAddLoopTM_hoareTimeSpace +theorem binaryMulAddLoopTM_hoareTimeSpace (leftIdx rightIdx accIdx mulCounterIdx addCounterIdx : Fin n) (hdistinct : BinaryMulAddDistinct leftIdx rightIdx accIdx mulCounterIdx addCounterIdx) @@ -1316,7 +1328,7 @@ private theorem binaryMulAddLoopTM_hoareTimeSpace initialSpace inp₀ work₀ out₀ hleft hright hacc hmulCounter haddCounter hinp hother hout hworkSpace hinputSpace) -private theorem binaryMulAddFrame_transition +theorem binaryMulAddFrame_transition (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) (hinp : Parked inp₀) (hwork : ∀ i, Parked (work₀ i)) (hout : Parked out₀) : @@ -1329,7 +1341,7 @@ private theorem binaryMulAddFrame_transition funext i exact (hwork i).transitionTape_eq_self -private theorem clearBinaryMulAddCounter_hoareTime +theorem clearBinaryMulAddCounter_hoareTime (accIdx mulCounterIdx : Fin n) (hne : accIdx ≠ mulCounterIdx) (leftValue rightValue accValue : ℕ) (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) @@ -1365,7 +1377,7 @@ private theorem clearBinaryMulAddCounter_hoareTime binaryMulAddWorkAt_clear_eq work₀ hne leftValue rightValue accValue hmulCounter) -private theorem clearBinaryMulAddCounter_hoareTimeSpace +theorem clearBinaryMulAddCounter_hoareTimeSpace (accIdx mulCounterIdx : Fin n) (hne : accIdx ≠ mulCounterIdx) (leftValue rightValue accValue inputLength initialSpace : ℕ) (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryPolynomial.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryPolynomial.lean index b617d028..d2c81d17 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryPolynomial.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryPolynomial.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.BinaryPolynomial.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryPolynomial.Internal +module + +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPolynomial.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPolynomial.Internal /-! # Canonical binary evaluation of a fixed natural polynomial @@ -24,6 +26,8 @@ not runtime, and is logarithmic in the input value for every fixed polynomial. - `binaryPolynomialEvalTM_isTransducer` proves append-only-output safety. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryPolynomial/Defs.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryPolynomial/Defs.lean index 5bd1e0ab..51201801 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryPolynomial/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryPolynomial/Defs.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Mathlib.Algebra.Polynomial.Eval.Degree -import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryMulAdd.Defs -import Complexitylib.Models.TuringMachine.Subroutines.ClearWork.Defs +module + +public import Mathlib.Algebra.Polynomial.Eval.Degree +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryMulAdd.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.ClearWork.Defs /-! # Canonical binary evaluation of a fixed natural polynomial — definitions @@ -18,6 +20,8 @@ The initial orientation is chosen from coefficient-list parity so the designated result tape holds the final value and the other accumulator is zero. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryPolynomial/Internal.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryPolynomial/Internal.lean index b903ee6f..21720269 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryPolynomial/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryPolynomial/Internal.lean @@ -3,12 +3,14 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Asymptotics -import Complexitylib.Models.TuringMachine.Hoare.Space -import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst -import Complexitylib.Models.TuringMachine.Subroutines.BinaryMulAdd -import Complexitylib.Models.TuringMachine.Subroutines.BinaryPolynomial.Defs -import Complexitylib.Models.TuringMachine.Subroutines.ClearWork +module + +public import Complexitylib.Asymptotics +public import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryMulAdd +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPolynomial.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.ClearWork /-! # Canonical binary evaluation of a fixed natural polynomial — proof internals @@ -20,35 +22,39 @@ one width-based space budget independent of their (potentially much larger) running time. -/ +@[expose] public section + namespace Complexity namespace TM variable {n : ℕ} -private def binaryPolynomialNatTape (value : ℕ) : Tape := +@[nolint docBlame] +def binaryPolynomialNatTape (value : ℕ) : Tape := (Tape.init (value.bits.map Γ.ofBool)).move Dir3.right -private theorem binaryPolynomialNatTape_hasBinaryNat (value : ℕ) : +theorem binaryPolynomialNatTape_hasBinaryNat (value : ℕ) : (binaryPolynomialNatTape value).HasBinaryNat value := Tape.init_move_right_hasBinaryNat value -private theorem binaryPolynomialHasBinaryNat_parked {t : Tape} {value : ℕ} +theorem binaryPolynomialHasBinaryNat_parked {t : Tape} {value : ℕ} (h : t.HasBinaryNat value) : Parked t := by refine ⟨by rw [h.2.1], ?_⟩ exact Tape.HasBinaryContent.cells_ne_start h.2.2 -private theorem binaryPolynomialNatTape_parked (value : ℕ) : +theorem binaryPolynomialNatTape_parked (value : ℕ) : Parked (binaryPolynomialNatTape value) := binaryPolynomialHasBinaryNat_parked (binaryPolynomialNatTape_hasBinaryNat value) -private abbrev binaryPolynomialFramePred +@[nolint docBlame] +abbrev binaryPolynomialFramePred (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) : TapePred n := fun inp work out => inp = inp₀ ∧ work = work₀ ∧ out = out₀ /-- Literal work frame after one Horner layer. -/ -private def binaryHornerLayerWork (work : Fin n → Tape) +def binaryHornerLayerWork (work : Fin n → Tape) (sourceIdx targetIdx : Fin n) (inputValue accValue coeff : ℕ) : Fin n → Tape := Function.update @@ -57,7 +63,7 @@ private def binaryHornerLayerWork (work : Fin n → Tape) sourceIdx (binaryPolynomialNatTape 0) /-- Literal work frame after a list of alternating Horner layers. -/ -private def binaryHornerWork (work : Fin n → Tape) +def binaryHornerWork (work : Fin n → Tape) (sourceIdx targetIdx : Fin n) (inputValue : ℕ) : List ℕ → ℕ → Fin n → Tape | [], _ => work @@ -68,7 +74,8 @@ private def binaryHornerWork (work : Fin n → Tape) targetIdx sourceIdx inputValue coeffs (accValue * inputValue + coeff) -private def swapBinaryMulAddDistinct +@[nolint defLemma docBlame] +def swapBinaryMulAddDistinct {leftIdx rightIdx accIdx mulCounterIdx addCounterIdx : Fin n} (h : BinaryMulAddDistinct leftIdx rightIdx accIdx mulCounterIdx addCounterIdx) : @@ -84,7 +91,8 @@ private def swapBinaryMulAddDistinct acc_ne_addCounter := h.left_ne_addCounter mulCounter_ne_addCounter := h.mulCounter_ne_addCounter } -private def resultSourceDistinct +@[nolint defLemma docBlame] +def resultSourceDistinct {inputIdx resultIdx scratchIdx mulCounterIdx addCounterIdx : Fin n} (h : BinaryPolynomialDistinct inputIdx resultIdx scratchIdx mulCounterIdx addCounterIdx) : @@ -101,7 +109,8 @@ private def resultSourceDistinct acc_ne_addCounter := h.scratch_ne_addCounter mulCounter_ne_addCounter := h.mulCounter_ne_addCounter } -private def scratchSourceDistinct +@[nolint defLemma docBlame] +def scratchSourceDistinct {inputIdx resultIdx scratchIdx mulCounterIdx addCounterIdx : Fin n} (h : BinaryPolynomialDistinct inputIdx resultIdx scratchIdx mulCounterIdx addCounterIdx) : @@ -109,7 +118,7 @@ private def scratchSourceDistinct addCounterIdx := swapBinaryMulAddDistinct (resultSourceDistinct h) -private theorem binaryHornerLayerWork_parked +theorem binaryHornerLayerWork_parked (work : Fin n → Tape) (sourceIdx targetIdx : Fin n) (inputValue accValue coeff : ℕ) (hwork : ∀ i, Parked (work i)) : ∀ i, Parked @@ -128,7 +137,7 @@ private theorem binaryHornerLayerWork_parked · simp [binaryHornerLayerWork, his, hit] exact hwork i -private theorem updatedWork_heads_le +theorem updatedWork_heads_le (work : Fin n → Tape) (idx : Fin n) (value initialSpace : ℕ) (hbase : ∀ i, (work i).head ≤ initialSpace) (hone : 1 ≤ initialSpace) : @@ -143,7 +152,7 @@ private theorem updatedWork_heads_le · rw [Function.update_of_ne hi] exact hbase i -private theorem binaryHornerLayerWork_heads_le +theorem binaryHornerLayerWork_heads_le (work : Fin n → Tape) (sourceIdx targetIdx : Fin n) (inputValue accValue coeff initialSpace : ℕ) (hbase : ∀ i, (work i).head ≤ initialSpace) @@ -155,7 +164,7 @@ private theorem binaryHornerLayerWork_heads_le initialSpace hbase hone) hone -private theorem binaryPolynomialFrame_transition +theorem binaryPolynomialFrame_transition (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) (hinp : Parked inp₀) (hwork : ∀ i, Parked (work₀ i)) (hout : Parked out₀) : @@ -168,7 +177,7 @@ private theorem binaryPolynomialFrame_transition funext i exact (hwork i).transitionTape_eq_self -private theorem binaryHornerLayerTM_hoareTimeSpace +theorem binaryHornerLayerTM_hoareTimeSpace (inputIdx sourceIdx targetIdx mulCounterIdx addCounterIdx : Fin n) (hdistinct : BinaryMulAddDistinct sourceIdx inputIdx targetIdx mulCounterIdx addCounterIdx) @@ -306,7 +315,7 @@ theorem binaryHornerFold_cons_internal binaryHornerFold x (coeff :: coeffs) acc = binaryHornerFold x coeffs (acc * x + coeff) := rfl -private theorem binaryHornerFold_reverse_range (f : ℕ → ℕ) (x : ℕ) : +theorem binaryHornerFold_reverse_range (f : ℕ → ℕ) (x : ℕ) : ∀ (k acc : ℕ), binaryHornerFold x ((List.range k).map f).reverse acc = acc * x ^ k + ∑ i ∈ Finset.range k, f i * x ^ i := by @@ -328,7 +337,7 @@ theorem binaryHornerFold_polyCoeffs_internal Polynomial.eval_eq_sum_range] simp -private theorem binaryHornerFold_le (x : ℕ) : +theorem binaryHornerFold_le (x : ℕ) : ∀ (coeffs : List ℕ) (acc : ℕ), binaryHornerFold x coeffs acc ≤ (acc + coeffs.sum) * (x + 1) ^ coeffs.length := by @@ -363,7 +372,7 @@ theorem binaryPolynomial_eval_le_valueCap_internal have h := binaryHornerFold_le x (binaryPolynomialCoeffs p) 0 exact le_trans h (Nat.mul_le_mul_right _ (by omega)) -private theorem binaryHornerFold_take_le +theorem binaryHornerFold_take_le (x : ℕ) (coeffs : List ℕ) (k : ℕ) : binaryHornerFold x (coeffs.take k) 0 ≤ (coeffs.sum + 1) * (x + 1) ^ coeffs.length := by @@ -377,7 +386,7 @@ private theorem binaryHornerFold_take_le Nat.pow_le_pow_right (by omega) (by rw [List.length_take]; omega) exact Nat.mul_le_mul (by omega) hpow -private theorem binaryPolynomial_input_le_cap +theorem binaryPolynomial_input_le_cap (p : Polynomial ℕ) (inputValue : ℕ) : inputValue ≤ binaryPolynomialValueCap p inputValue := by have hlen : 0 < (binaryPolynomialCoeffs p).length := by @@ -391,7 +400,7 @@ private theorem binaryPolynomial_input_le_cap have : 0 < (binaryPolynomialCoeffs p).sum + 1 := by omega exact this)) -private theorem binaryHornerLayerSpace_le_polynomialSpace +theorem binaryHornerLayerSpace_le_polynomialSpace (initialSpace inputValue accValue coeff cap : ℕ) (hinput : inputValue ≤ cap) (hacc : accValue ≤ cap) (hnext : accValue * inputValue + coeff ≤ cap) : @@ -411,7 +420,7 @@ private theorem binaryHornerLayerSpace_le_polynomialSpace binaryAddConstSpace, clearWorkTimeBound] at ⊢ omega -private theorem binaryHornerLayerWork_source_hasBinaryNat +theorem binaryHornerLayerWork_source_hasBinaryNat (work : Fin n → Tape) (sourceIdx targetIdx : Fin n) (inputValue accValue coeff : ℕ) : (binaryHornerLayerWork work sourceIdx targetIdx inputValue accValue coeff @@ -419,7 +428,7 @@ private theorem binaryHornerLayerWork_source_hasBinaryNat simp [binaryHornerLayerWork] exact binaryPolynomialNatTape_hasBinaryNat 0 -private theorem binaryHornerLayerWork_target_hasBinaryNat +theorem binaryHornerLayerWork_target_hasBinaryNat (work : Fin n → Tape) {sourceIdx targetIdx : Fin n} (hne : sourceIdx ≠ targetIdx) (inputValue accValue coeff : ℕ) : (binaryHornerLayerWork work sourceIdx targetIdx inputValue accValue coeff @@ -427,7 +436,7 @@ private theorem binaryHornerLayerWork_target_hasBinaryNat simp [binaryHornerLayerWork, Ne.symm hne] exact binaryPolynomialNatTape_hasBinaryNat _ -private theorem binaryHornerLayerWork_other +theorem binaryHornerLayerWork_other (work : Fin n → Tape) {sourceIdx targetIdx i : Fin n} (his : i ≠ sourceIdx) (hit : i ≠ targetIdx) (inputValue accValue coeff : ℕ) : @@ -435,7 +444,7 @@ private theorem binaryHornerLayerWork_other work i := by simp [binaryHornerLayerWork, his, hit] -private theorem binaryHornerLayersTM_hoareTimeSpace +theorem binaryHornerLayersTM_hoareTimeSpace (inputIdx sourceIdx targetIdx mulCounterIdx addCounterIdx : Fin n) (hdistinct : BinaryMulAddDistinct sourceIdx inputIdx targetIdx mulCounterIdx addCounterIdx) @@ -571,7 +580,7 @@ private theorem binaryHornerLayersTM_hoareTimeSpace simpa [binaryHornerLayersTM, binaryHornerLayersTime, binaryHornerWork, work₁] using hrun -private theorem update_binaryZero_eq +theorem update_binaryZero_eq (work : Fin n → Tape) (idx : Fin n) (hzero : (work idx).HasBinaryNat 0) : Function.update work idx (binaryPolynomialNatTape 0) = work := by @@ -582,7 +591,7 @@ private theorem update_binaryZero_eq simpa [binaryPolynomialNatTape] using hzero.eq_init_move_right.symm · rw [Function.update_of_ne hi] -private theorem binaryHornerWork_endpoint +theorem binaryHornerWork_endpoint (work : Fin n → Tape) (sourceIdx targetIdx : Fin n) (hne : sourceIdx ≠ targetIdx) (inputValue accValue : ℕ) (coeffs : List ℕ) @@ -656,7 +665,7 @@ private theorem binaryHornerWork_endpoint binaryHornerFold_cons_internal] · simp [work₁, binaryHornerLayerWork, his, hit] -private theorem binaryHornerLayerTM_isTransducer +theorem binaryHornerLayerTM_isTransducer (inputIdx sourceIdx targetIdx mulCounterIdx addCounterIdx : Fin n) (coeff : ℕ) : (binaryHornerLayerTM inputIdx sourceIdx targetIdx mulCounterIdx @@ -667,7 +676,7 @@ private theorem binaryHornerLayerTM_isTransducer (binaryAddConstTM_isTransducer targetIdx coeff)).seqTM (clearWorkTM_isTransducer sourceIdx) -private theorem binaryHornerLayersTM_isTransducer +theorem binaryHornerLayersTM_isTransducer (inputIdx sourceIdx targetIdx mulCounterIdx addCounterIdx : Fin n) (coeffs : List ℕ) : (binaryHornerLayersTM inputIdx sourceIdx targetIdx mulCounterIdx @@ -681,7 +690,7 @@ private theorem binaryHornerLayersTM_isTransducer (binaryHornerLayerTM_isTransducer inputIdx sourceIdx targetIdx mulCounterIdx addCounterIdx coeff).seqTM (ih targetIdx sourceIdx) -private theorem binaryPolynomialInitialWork_parked +theorem binaryPolynomialInitialWork_parked (inputIdx resultIdx scratchIdx mulCounterIdx addCounterIdx : Fin n) (work : Fin n → Tape) {inputValue : ℕ} (hinput : (work inputIdx).HasBinaryNat inputValue) diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryPred.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryPred.lean index 21cf4cb8..c5e027d5 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryPred.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryPred.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred.Internal +module + +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred.Internal /-! # Little-endian binary predecessor @@ -27,6 +29,8 @@ represent `value + 1`; they make no underflow claim. - `TM.binaryPredTM_isTransducer` — the output head never moves left. -/ +@[expose] public section + namespace Complexity namespace BinaryPred diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryPred/Defs.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryPred/Defs.lean index 9bfea08d..71f42202 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryPred/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryPred/Defs.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs -import Mathlib.Data.Nat.Size +module + +public import Complexitylib.Models.TuringMachine.Combinators +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs +public import Mathlib.Data.Nat.Size /-! # Little-endian binary predecessor — definitions @@ -21,6 +23,8 @@ representation. Public correctness theorems intentionally start from `value + 1`, so no underflow behavior is claimed. -/ +@[expose] public section + namespace Complexity namespace BinaryPred diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryPred/Internal.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryPred/Internal.lean index 4a887d72..facd7e8f 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryPred/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryPred/Internal.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Mathlib.NatBits -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -import Complexitylib.Models.TuringMachine.Hoare.Space -import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred.Defs +module + +public import Complexitylib.Mathlib.NatBits +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +public import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred.Defs /-! # Little-endian binary predecessor — proof internals @@ -17,6 +19,8 @@ low-order prefix independently of the target head, including the canonical high-bit erasure needed when decrementing a power of two. -/ +@[expose] public section + namespace Complexity namespace BinaryPred diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd.lean index a1fce936..8d33cb51 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Internal +module + +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Internal /-! # Linear-time canonical binary addition @@ -19,6 +21,8 @@ routine; complexity-sensitive RAM simulation should use this width-linear machine instead. -/ +@[expose] public section + namespace Complexity namespace BinaryRippleAdd diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Defs.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Defs.lean index 597a945e..4a4bf559 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines -import Mathlib.Data.Nat.Size +module + +public import Complexitylib.Models.TuringMachine.Subroutines +public import Mathlib.Data.Nat.Size /-! # Linear-time canonical binary addition -- definitions @@ -14,6 +16,8 @@ little-endian binary work tapes. Each scan step appends one sum bit to a fresh result tape. A composed wrapper then rewinds all three owned tapes. -/ +@[expose] public section + namespace Complexity namespace BinaryRippleAdd diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal.lean index ce53af5d..c49e303b 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal.lean @@ -3,12 +3,14 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Internal.Bounds -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Internal.Out -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Internal.Pure -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Internal.Rewind -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Internal.Scan -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Internal.Sem +module + +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Internal.Bounds +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Internal.Out +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Internal.Pure +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Internal.Rewind +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Internal.Scan +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Internal.Sem /-! # Linear-time canonical binary addition -- proof internals @@ -16,3 +18,5 @@ import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Internal.S This aggregation module collects the pure arithmetic, scan, rewind, resource, and output-discipline proofs used by the public surface. -/ + +@[expose] public section diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Bounds.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Bounds.lean index 83ab219a..3093b00c 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Bounds.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Bounds.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Defs +module + +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Defs /-! # Linear binary addition -- resource-bound internals @@ -12,6 +14,8 @@ This file relates the concrete scan and composed-machine bounds to the standard binary widths of the two operands. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Out.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Out.lean index 0531e1ac..5bba6adb 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Out.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Out.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Defs -import Complexitylib.Models.TuringMachine.Subroutines.ClearWork.Internal +module + +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.ClearWork.Internal /-! # Linear-time canonical binary addition -- output discipline @@ -14,6 +16,8 @@ machines satisfy the transducer discipline required by space-bounded function computation. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Pure.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Pure.lean index 94525438..f574b960 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Pure.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Pure.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Defs +module + +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Defs /-! # Linear-time canonical binary addition -- pure proofs @@ -13,6 +15,8 @@ canonical little-endian `Nat.bits`. The generalized theorem includes an incoming carry so that its induction follows the recurrence exactly. -/ +@[expose] public section + namespace Complexity namespace BinaryRippleAdd diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Rewind.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Rewind.lean index 1b0d0a59..c3ef26fe 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Rewind.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Rewind.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Defs -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary.Internal +module + +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary.Internal /-! # Linear-time canonical binary addition -- rewind proof internals @@ -13,11 +15,14 @@ This module packages the three-rewind tail of `binaryRippleAddTM` into one framed Hoare-time contract. -/ +@[expose] public section + namespace Complexity namespace TM -private def binaryRippleAddCanonicalTape (bits : List Bool) : Tape := +@[nolint docBlame] +def binaryRippleAddCanonicalTape (bits : List Bool) : Tape := (Tape.init (bits.map Γ.ofBool)).move Dir3.right private theorem binaryRippleAddCanonicalTape_parked (bits : List Bool) : diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Scan.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Scan.lean index 9c7d7999..44ec8ae7 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Scan.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Scan.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Internal.Pure -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -import Complexitylib.Models.TuringMachine.Tape.Encoding +module + +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Internal.Pure +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +public import Complexitylib.Models.TuringMachine.Tape.Encoding /-! # Linear-time canonical binary addition -- scan proof @@ -16,6 +18,8 @@ scan. Rewinding and the complete canonical-natural interface are composed in later internal layers. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Sem.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Sem.lean index e73e0748..b887e8a3 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Sem.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Sem.lean @@ -3,12 +3,14 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Hoare.Space -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Internal.Bounds -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Internal.Pure -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Internal.Rewind -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Internal.Scan -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc +module + +public import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Internal.Bounds +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Internal.Pure +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Internal.Rewind +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Internal.Scan +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc /-! # Linear-time canonical binary addition -- composed semantics @@ -19,6 +21,8 @@ sum, preserves the complete external tape frame, and carries explicit time and all-prefix auxiliary-space bounds. -/ +@[expose] public section + namespace Complexity namespace TM @@ -41,7 +45,8 @@ private def binaryRippleAddScanPost {n : ℕ} work i = work₀ i) ∧ out = out₀ -private def binaryRippleAddPost {n : ℕ} +@[nolint docBlame] +def binaryRippleAddPost {n : ℕ} (lhsIdx rhsIdx resultIdx : Fin n) (lhs rhs : ℕ) (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) : TapePred n := fun inp work out => diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub.lean index b318197c..5829dad6 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Internal.Sem -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Internal.Out +module + +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Internal.Sem +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Internal.Out /-! # Linear-time canonical binary subtraction @@ -17,6 +19,8 @@ and preserves the complete external tape frame. Its running time is linear in the operand bit widths. -/ +@[expose] public section + namespace Complexity namespace BinaryRippleSub diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Defs.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Defs.lean index 9ecec291..ca6e2e52 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Defs.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines -import Complexitylib.Models.TuringMachine.Tape.Encoding -import Mathlib.Data.Nat.Size +module + +public import Complexitylib.Models.TuringMachine.Subroutines +public import Complexitylib.Models.TuringMachine.Tape.Encoding +public import Mathlib.Data.Nat.Size /-! # Linear-time canonical binary subtraction -- definitions @@ -16,6 +18,8 @@ A single backward pass then erases the complete result on underflow or removes only its redundant high zeros, while returning the result head to cell one. -/ +@[expose] public section + namespace Complexity namespace BinaryRippleSub diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Backward.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Backward.lean index e4b7d1ea..42620bfe 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Backward.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Backward.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Internal.Pure +module + +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Internal.Pure /-! # Linear-time canonical binary subtraction -- backward cleanup @@ -16,6 +18,8 @@ high one, and returns the result head to cell one. All other tapes are framed literally throughout the run. -/ +@[expose] public section + namespace Complexity namespace Tape diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Out.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Out.lean index 20c427fd..8615e0aa 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Out.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Out.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Defs -import Complexitylib.Models.TuringMachine.Subroutines.ClearWork.Internal +module + +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.ClearWork.Internal /-! # Linear-time canonical binary subtraction -- output discipline @@ -13,6 +15,8 @@ The borrow scan, backward cleanup, and operand rewinds leave the public output tape one-way, so the core and complete machines are safe transducers. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Pure.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Pure.lean index c85ef130..7eac5e03 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Pure.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Pure.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Mathlib.NatBits -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Defs +module + +public import Complexitylib.Mathlib.NatBits +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Defs /-! # Linear-time canonical binary subtraction -- pure proofs @@ -14,11 +16,14 @@ final borrow decides underflow, while trimming is proved to recover the canonical `Nat.bits` representation of the raw fixed-width value. -/ +@[expose] public section + namespace Complexity namespace BinaryRippleSub -private def boolValue (bit : Bool) : ℕ := +@[nolint docBlame] +def boolValue (bit : Bool) : ℕ := if bit then 1 else 0 private theorem fullSub_value (borrow lhs rhs : Bool) : diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Rewind.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Rewind.lean index 90f6460a..e1e7c090 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Rewind.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Rewind.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Defs -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary.Internal +module + +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary.Internal /-! # Linear-time canonical binary subtraction -- operand rewind internals @@ -13,11 +15,14 @@ The subtraction core already returns its result to cell one. This module packages the two remaining operand rewinds into one exact framed contract. -/ +@[expose] public section + namespace Complexity namespace TM -private def binaryRippleSubCanonicalTape (bits : List Bool) : Tape := +@[nolint docBlame] +def binaryRippleSubCanonicalTape (bits : List Bool) : Tape := (Tape.init (bits.map Γ.ofBool)).move Dir3.right private theorem binaryRippleSubCanonicalTape_parked (bits : List Bool) : diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Scan.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Scan.lean index 5765f215..529d9b2a 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Scan.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Scan.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Internal.Pure -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +module + +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Internal.Pure +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic /-! # Linear-time canonical binary subtraction -- forward scan proof @@ -15,6 +17,8 @@ including its final turn into backward cleanup. Cleanup itself is proved in a separate internal layer. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Sem.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Sem.lean index b8df34fb..3e6c5dd1 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Sem.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Sem.lean @@ -3,11 +3,13 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Hoare.Space -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Internal.Backward -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Internal.Rewind -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Internal.Scan -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc +module + +public import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Internal.Backward +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Internal.Rewind +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Internal.Scan +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc /-! # Linear-time canonical binary subtraction -- composed semantics @@ -19,11 +21,14 @@ preserves the external tape frame literally, and carries explicit time and all-prefix auxiliary-space bounds. -/ +@[expose] public section + namespace Complexity namespace TM -private def binaryRippleSubCorePost {n : ℕ} +@[nolint docBlame] +def binaryRippleSubCorePost {n : ℕ} (lhsIdx rhsIdx resultIdx : Fin n) (lhs rhs : ℕ) (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) : TapePred n := fun inp work out => @@ -39,7 +44,8 @@ private def binaryRippleSubCorePost {n : ℕ} work i = work₀ i) ∧ out = out₀ -private def binaryRippleSubPost {n : ℕ} +@[nolint docBlame] +def binaryRippleSubPost {n : ℕ} (lhsIdx rhsIdx resultIdx : Fin n) (lhs rhs : ℕ) (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) : TapePred n := fun inp work out => diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryShiftMul.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryShiftMul.lean index 03218db4..f7149099 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryShiftMul.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryShiftMul.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.BinaryShiftMul.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryShiftMul.Internal.Out -import Complexitylib.Models.TuringMachine.Subroutines.BinaryShiftMul.Internal.Pure -import Complexitylib.Models.TuringMachine.Subroutines.BinaryShiftMul.Internal.Sem +module + +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryShiftMul.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryShiftMul.Internal.Out +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryShiftMul.Internal.Pure +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryShiftMul.Internal.Sem /-! # Width-driven binary shift-and-add multiplication @@ -18,6 +20,8 @@ and preserves the complete external tape frame. Its running time is quadratic in the combined operand width. -/ +@[expose] public section + namespace Complexity namespace BinaryShiftMul diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryShiftMul/Defs.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryShiftMul/Defs.lean index 8f9e2013..0555f756 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryShiftMul/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryShiftMul/Defs.lean @@ -3,11 +3,13 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.ForBinaryWork.Defs -import Complexitylib.Models.TuringMachine.Combinators.WorkSymbolBranch.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy.Defs -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany.Defs -import Complexitylib.Mathlib.NatBits +module + +public import Complexitylib.Models.TuringMachine.Combinators.ForBinaryWork.Defs +public import Complexitylib.Models.TuringMachine.Combinators.WorkSymbolBranch.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany.Defs +public import Complexitylib.Mathlib.NatBits /-! # Width-driven binary shift-and-add multiplication -- definitions @@ -18,6 +20,8 @@ preserved, the accumulator receives their product, and three scratch tapes are returned to canonical zero. -/ +@[expose] public section + namespace Complexity namespace BinaryShiftMul diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryShiftMul/Internal/Out.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryShiftMul/Internal/Out.lean index 1a86d91e..ce386ca2 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryShiftMul/Internal/Out.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryShiftMul/Internal/Out.lean @@ -3,12 +3,14 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.ForBinaryWork -import Complexitylib.Models.TuringMachine.Combinators.WorkSymbolBranch -import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd -import Complexitylib.Models.TuringMachine.Subroutines.BinaryShiftMul.Defs -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany +module + +public import Complexitylib.Models.TuringMachine.Combinators.ForBinaryWork +public import Complexitylib.Models.TuringMachine.Combinators.WorkSymbolBranch +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryShiftMul.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany /-! # Width-driven binary shift-and-add multiplication -- output safety @@ -16,6 +18,8 @@ import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany This file composes the transducer certificates of every multiplication phase. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryShiftMul/Internal/Pure.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryShiftMul/Internal/Pure.lean index d85fbe61..8983e296 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryShiftMul/Internal/Pure.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryShiftMul/Internal/Pure.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.BinaryShiftMul.Defs +module + +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryShiftMul.Defs /-! # Width-driven binary shift-and-add multiplication -- pure proofs @@ -13,6 +15,8 @@ shift-and-add fold, its multiplication specialization, and width bounds for every partial accumulator and shifted multiplicand. -/ +@[expose] public section + namespace Complexity namespace BinaryShiftMul diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryShiftMul/Internal/Sem.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryShiftMul/Internal/Sem.lean index 26044b05..39efaa1c 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryShiftMul/Internal/Sem.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryShiftMul/Internal/Sem.lean @@ -3,12 +3,14 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.ForBinaryWork -import Complexitylib.Models.TuringMachine.Combinators.WorkSymbolBranch -import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy -import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd -import Complexitylib.Models.TuringMachine.Subroutines.BinaryShiftMul.Internal.Pure -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany +module + +public import Complexitylib.Models.TuringMachine.Combinators.ForBinaryWork +public import Complexitylib.Models.TuringMachine.Combinators.WorkSymbolBranch +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd +public import Complexitylib.Models.TuringMachine.Subroutines.BinaryShiftMul.Internal.Pure +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany /-! # Width-driven binary shift-and-add multiplication -- composed semantics @@ -18,22 +20,25 @@ bit-driven work-tape loop. The multiplier cursor is preserved by every body phase and advanced only by the loopback seam. -/ +@[expose] public section + namespace Complexity namespace TM -private def binaryShiftMulNatTape (value : ℕ) : Tape := +@[nolint docBlame] +def binaryShiftMulNatTape (value : ℕ) : Tape := (Tape.init (value.bits.map Γ.ofBool)).move Dir3.right -private theorem binaryShiftMulNatTape_hasBinaryNat (value : ℕ) : +theorem binaryShiftMulNatTape_hasBinaryNat (value : ℕ) : (binaryShiftMulNatTape value).HasBinaryNat value := by simpa [binaryShiftMulNatTape] using Tape.init_move_right_hasBinaryNat value -private theorem hasBinaryNat_parked {t : Tape} {value : ℕ} +theorem hasBinaryNat_parked {t : Tape} {value : ℕ} (h : t.HasBinaryNat value) : Parked t := ⟨by rw [h.2.1], h.2.hasBinaryContent.cells_ne_start⟩ -private theorem binaryShiftMulExactFrame_transition {n : ℕ} +theorem binaryShiftMulExactFrame_transition {n : ℕ} (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) (hinput : Parked inp₀) (hwork : ∀ i, Parked (work₀ i)) (houtput : Parked out₀) : @@ -50,12 +55,14 @@ private theorem binaryShiftMulExactFrame_transition {n : ℕ} exact phaseTransition_eq_self_of_reads_ne_start hinput.read_ne_start (fun i => (hwork i).read_ne_start) houtput.read_ne_start -private def binaryShiftMulUpdateTime (acc shift : ℕ) : ℕ := +@[nolint docBlame] +def binaryShiftMulUpdateTime (acc shift : ℕ) : ℕ := binaryRippleAddTime acc shift + 1 + binaryCopyTime (acc + shift) acc + 1 + resetBinaryWorkTime 1 (acc + shift).size -private def binaryShiftMulUpdatePost {n : ℕ} (abi : BinaryShiftMulABI n) +@[nolint docBlame] +def binaryShiftMulUpdatePost {n : ℕ} (abi : BinaryShiftMulABI n) (acc shift : ℕ) (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) : TapePred n := fun inp work out => @@ -68,7 +75,7 @@ private def binaryShiftMulUpdatePost {n : ℕ} (abi : BinaryShiftMulABI n) work i = work₀ i) ∧ out = out₀ -private theorem binaryShiftMulUpdateTM_hoareTime_frame {n : ℕ} +theorem binaryShiftMulUpdateTM_hoareTime_frame {n : ℕ} (abi : BinaryShiftMulABI n) (acc shift : ℕ) (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) (hacc : (work₀ abi.acc).HasBinaryNat acc) @@ -219,14 +226,16 @@ private theorem binaryShiftMulUpdateTM_hoareTime_frame {n : ℕ} simpa [binaryShiftMulUpdateTM, binaryShiftMulUpdateTime, Nat.add_assoc] using hrun -private def binaryShiftMulDoubleTime (shift : ℕ) : ℕ := +@[nolint docBlame] +def binaryShiftMulDoubleTime (shift : ℕ) : ℕ := binaryCopyTime shift 0 + 1 + binaryRippleAddTime shift shift + 1 + resetBinaryWorkTime 1 shift.size + 1 + binaryCopyTime (shift + shift) shift + 1 + resetBinaryWorkTime 1 (shift + shift).size -private def binaryShiftMulDoublePost {n : ℕ} (abi : BinaryShiftMulABI n) +@[nolint docBlame] +def binaryShiftMulDoublePost {n : ℕ} (abi : BinaryShiftMulABI n) (shift : ℕ) (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) : TapePred n := fun inp work out => @@ -238,7 +247,7 @@ private def binaryShiftMulDoublePost {n : ℕ} (abi : BinaryShiftMulABI n) work i = work₀ i) ∧ out = out₀ -private theorem binaryShiftMulDoubleTM_hoareTime_frame {n : ℕ} +theorem binaryShiftMulDoubleTM_hoareTime_frame {n : ℕ} (abi : BinaryShiftMulABI n) (shift : ℕ) (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) (hshift : (work₀ abi.shift).HasBinaryNat shift) @@ -446,10 +455,12 @@ private theorem binaryShiftMulDoubleTM_hoareTime_frame {n : ℕ} simpa [binaryShiftMulDoubleTM, binaryShiftMulDoubleTime, Nat.add_assoc] using hrun -private def binaryShiftMulOneTime (acc shift : ℕ) : ℕ := +@[nolint docBlame] +def binaryShiftMulOneTime (acc shift : ℕ) : ℕ := binaryShiftMulUpdateTime acc shift + 1 + binaryShiftMulDoubleTime shift -private def binaryShiftMulOnePost {n : ℕ} (abi : BinaryShiftMulABI n) +@[nolint docBlame] +def binaryShiftMulOnePost {n : ℕ} (abi : BinaryShiftMulABI n) (acc shift : ℕ) (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) : TapePred n := fun inp work out => @@ -462,7 +473,7 @@ private def binaryShiftMulOnePost {n : ℕ} (abi : BinaryShiftMulABI n) work i = work₀ i) ∧ out = out₀ -private theorem binaryShiftMulOneTM_hoareTime_frame {n : ℕ} +theorem binaryShiftMulOneTM_hoareTime_frame {n : ℕ} (abi : BinaryShiftMulABI n) (acc shift : ℕ) (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) (hacc : (work₀ abi.acc).HasBinaryNat acc) @@ -548,11 +559,12 @@ private theorem binaryShiftMulOneTM_hoareTime_frame {n : ℕ} (binaryShiftMulDoubleTM abi) hupdate htransition hdouble simpa [binaryShiftMulOneTM, binaryShiftMulOneTime] using hrun -private def binaryShiftMulBodyTime (bit : Bool) (acc shift : ℕ) : ℕ := +@[nolint docBlame] +def binaryShiftMulBodyTime (bit : Bool) (acc shift : ℕ) : ℕ := (if bit then binaryShiftMulOneTime acc shift else binaryShiftMulDoubleTime shift) + 1 -private theorem binaryShiftMulUpdateTime_le (acc shift width : ℕ) +theorem binaryShiftMulUpdateTime_le (acc shift width : ℕ) (hacc : acc.size ≤ width) (hshift : shift.size ≤ width) : binaryShiftMulUpdateTime acc shift ≤ 13 * width + 50 := by have haddSize := binaryRippleAdd_sum_size_le acc shift @@ -564,7 +576,7 @@ private theorem binaryShiftMulUpdateTime_le (acc shift width : ℕ) clearWorkTimeBound] omega -private theorem binaryShiftMulDoubleTime_le (shift width : ℕ) +theorem binaryShiftMulDoubleTime_le (shift width : ℕ) (hshift : shift.size ≤ width) : binaryShiftMulDoubleTime shift ≤ 20 * width + 110 := by have hdoubleSize := binaryRippleAdd_sum_size_le shift shift @@ -579,7 +591,7 @@ private theorem binaryShiftMulDoubleTime_le (shift width : ℕ) clearWorkTimeBound] omega -private theorem binaryShiftMulBodyTime_le (bit : Bool) (acc shift width : ℕ) +theorem binaryShiftMulBodyTime_le (bit : Bool) (acc shift width : ℕ) (hacc : acc.size ≤ width) (hshift : shift.size ≤ width) : binaryShiftMulBodyTime bit acc shift ≤ 33 * width + 162 := by have hupdate := binaryShiftMulUpdateTime_le acc shift width hacc hshift @@ -589,7 +601,7 @@ private theorem binaryShiftMulBodyTime_le (bit : Bool) (acc shift width : ℕ) Bool.false_eq_true, if_false, if_true] <;> omega -private theorem forBinaryWorkLoopTime_le +theorem forBinaryWorkLoopTime_le (bodyTime : ℕ → ℕ) (total bound : ℕ) (hbody : ∀ i, i < total → bodyTime i ≤ bound) : ∀ count value, value + count = total → @@ -608,7 +620,8 @@ private theorem forBinaryWorkLoopTime_le rw [Nat.succ_mul] omega -private def binaryShiftMulBodyPost {n : ℕ} (abi : BinaryShiftMulABI n) +@[nolint docBlame] +def binaryShiftMulBodyPost {n : ℕ} (abi : BinaryShiftMulABI n) (bit : Bool) (acc shift : ℕ) (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) : TapePred n := fun inp work out => @@ -621,7 +634,7 @@ private def binaryShiftMulBodyPost {n : ℕ} (abi : BinaryShiftMulABI n) work i = work₀ i) ∧ out = out₀ -private theorem binaryShiftMulBitBodyTM_hoareTime_frame {n : ℕ} +theorem binaryShiftMulBitBodyTM_hoareTime_frame {n : ℕ} (abi : BinaryShiftMulABI n) (bit : Bool) (acc shift : ℕ) (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) (hbit : (work₀ abi.rhs).read = Γ.ofBool bit) @@ -701,19 +714,22 @@ private theorem binaryShiftMulBitBodyTM_hoareTime_frame {n : ℕ} · intro i haccIdx hshiftIdx htmpIdx hdblIdx rw [hworkEq, hfinalFrame i haccIdx hshiftIdx htmpIdx hdblIdx] -private def binaryShiftMulBitAt (rhs i : ℕ) : Bool := +@[nolint docBlame] +def binaryShiftMulBitAt (rhs i : ℕ) : Bool := (rhs.bits[i]?).getD false -private theorem binaryShiftMulBitAt_eq_get (rhs i : ℕ) (hi : i < rhs.size) : +theorem binaryShiftMulBitAt_eq_get (rhs i : ℕ) (hi : i < rhs.size) : binaryShiftMulBitAt rhs i = rhs.bits.get ⟨i, by simpa [Nat.size_eq_bits_len] using hi⟩ := by simp [binaryShiftMulBitAt, show i < rhs.bits.length by simpa [Nat.size_eq_bits_len] using hi] -private def binaryShiftMulCursorTape (tape : Tape) (index : ℕ) : Tape := +@[nolint docBlame] +def binaryShiftMulCursorTape (tape : Tape) (index : ℕ) : Tape := { head := index + 1, cells := tape.cells } -private def binaryShiftMulLoopWork {n : ℕ} (abi : BinaryShiftMulABI n) +@[nolint docBlame] +def binaryShiftMulLoopWork {n : ℕ} (abi : BinaryShiftMulABI n) (work₀ : Fin n → Tape) (index acc shift : ℕ) : Fin n → Tape := Function.update (Function.update @@ -726,42 +742,42 @@ private def binaryShiftMulLoopWork {n : ℕ} (abi : BinaryShiftMulABI n) abi.tmp (binaryShiftMulNatTape 0)) abi.dbl (binaryShiftMulNatTape 0) -private theorem binaryShiftMulLoopWork_rhs {n : ℕ} +theorem binaryShiftMulLoopWork_rhs {n : ℕ} (abi : BinaryShiftMulABI n) (work₀ : Fin n → Tape) (index acc shift : ℕ) : binaryShiftMulLoopWork abi work₀ index acc shift abi.rhs = binaryShiftMulCursorTape (work₀ abi.rhs) index := by simp [binaryShiftMulLoopWork] -private theorem binaryShiftMulLoopWork_acc {n : ℕ} +theorem binaryShiftMulLoopWork_acc {n : ℕ} (abi : BinaryShiftMulABI n) (work₀ : Fin n → Tape) (index acc shift : ℕ) : binaryShiftMulLoopWork abi work₀ index acc shift abi.acc = binaryShiftMulNatTape acc := by simp [binaryShiftMulLoopWork] -private theorem binaryShiftMulLoopWork_shift {n : ℕ} +theorem binaryShiftMulLoopWork_shift {n : ℕ} (abi : BinaryShiftMulABI n) (work₀ : Fin n → Tape) (index acc shift : ℕ) : binaryShiftMulLoopWork abi work₀ index acc shift abi.shift = binaryShiftMulNatTape shift := by simp [binaryShiftMulLoopWork] -private theorem binaryShiftMulLoopWork_tmp {n : ℕ} +theorem binaryShiftMulLoopWork_tmp {n : ℕ} (abi : BinaryShiftMulABI n) (work₀ : Fin n → Tape) (index acc shift : ℕ) : binaryShiftMulLoopWork abi work₀ index acc shift abi.tmp = binaryShiftMulNatTape 0 := by simp [binaryShiftMulLoopWork] -private theorem binaryShiftMulLoopWork_dbl {n : ℕ} +theorem binaryShiftMulLoopWork_dbl {n : ℕ} (abi : BinaryShiftMulABI n) (work₀ : Fin n → Tape) (index acc shift : ℕ) : binaryShiftMulLoopWork abi work₀ index acc shift abi.dbl = binaryShiftMulNatTape 0 := by simp [binaryShiftMulLoopWork] -private theorem binaryShiftMulLoopWork_other {n : ℕ} +theorem binaryShiftMulLoopWork_other {n : ℕ} (abi : BinaryShiftMulABI n) (work₀ : Fin n → Tape) (index acc shift : ℕ) (i : Fin n) (hrhs : i ≠ abi.rhs) (hacc : i ≠ abi.acc) @@ -770,13 +786,13 @@ private theorem binaryShiftMulLoopWork_other {n : ℕ} binaryShiftMulLoopWork abi work₀ index acc shift i = work₀ i := by simp [binaryShiftMulLoopWork, hrhs, hacc, hshift, htmp, hdbl] -private theorem binaryShiftMulCursorTape_parked {tape : Tape} +theorem binaryShiftMulCursorTape_parked {tape : Tape} (h : Parked tape) (index : ℕ) : Parked (binaryShiftMulCursorTape tape index) := by exact ⟨by simp [binaryShiftMulCursorTape], by simpa [binaryShiftMulCursorTape] using h.2⟩ -private theorem binaryShiftMulLoopWork_parked {n : ℕ} +theorem binaryShiftMulLoopWork_parked {n : ℕ} (abi : BinaryShiftMulABI n) (work₀ : Fin n → Tape) (index acc shift : ℕ) (hwork : ∀ i, Parked (work₀ i)) : ∀ i, Parked (binaryShiftMulLoopWork abi work₀ index acc shift i) := by @@ -805,7 +821,7 @@ private theorem binaryShiftMulLoopWork_parked {n : ℕ} hshift htmp hdbl] exact hwork i -private theorem binaryShiftMulLoopWork_read_bit {n : ℕ} +theorem binaryShiftMulLoopWork_read_bit {n : ℕ} (abi : BinaryShiftMulABI n) (work₀ : Fin n → Tape) (rhs index acc shift : ℕ) (hrhs : (work₀ abi.rhs).HasBinaryNat rhs) (hi : index < rhs.size) : @@ -816,7 +832,7 @@ private theorem binaryShiftMulLoopWork_read_bit {n : ℕ} rw [binaryShiftMulBitAt_eq_get rhs index hi] exact hrhs.2.2.1 index (by simpa [Nat.size_eq_bits_len] using hi) -private theorem binaryShiftMulLoopWork_read_blank {n : ℕ} +theorem binaryShiftMulLoopWork_read_blank {n : ℕ} (abi : BinaryShiftMulABI n) (work₀ : Fin n → Tape) (rhs acc shift : ℕ) (hrhs : (work₀ abi.rhs).HasBinaryNat rhs) : (binaryShiftMulLoopWork abi work₀ rhs.size acc shift abi.rhs).read = @@ -825,7 +841,7 @@ private theorem binaryShiftMulLoopWork_read_blank {n : ℕ} simp only [binaryShiftMulCursorTape] exact hrhs.2.2.2 rhs.size (by simp [Nat.size_eq_bits_len]) -private theorem binaryShiftMulLoopWork_advance {n : ℕ} +theorem binaryShiftMulLoopWork_advance {n : ℕ} (abi : BinaryShiftMulABI n) (work₀ : Fin n → Tape) (index acc shift : ℕ) : (fun i => if i = abi.rhs then @@ -855,20 +871,23 @@ private theorem binaryShiftMulLoopWork_advance {n : ℕ} binaryShiftMulLoopWork_other abi work₀ (index + 1) acc shift i hrhs hacc hshift htmp hdbl] -private def binaryShiftMulPartialWork {n : ℕ} (abi : BinaryShiftMulABI n) +@[nolint docBlame] +def binaryShiftMulPartialWork {n : ℕ} (abi : BinaryShiftMulABI n) (work₀ : Fin n → Tape) (lhs rhs index : ℕ) : Fin n → Tape := binaryShiftMulLoopWork abi work₀ index (BinaryShiftMul.partialAcc lhs rhs index) (BinaryShiftMul.partialShift lhs index) -private def binaryShiftMulBodyDoneWork {n : ℕ} +@[nolint docBlame] +def binaryShiftMulBodyDoneWork {n : ℕ} (abi : BinaryShiftMulABI n) (work₀ : Fin n → Tape) (lhs rhs index : ℕ) : Fin n → Tape := binaryShiftMulLoopWork abi work₀ index (BinaryShiftMul.partialAcc lhs rhs (index + 1)) (BinaryShiftMul.partialShift lhs (index + 1)) -private def binaryShiftMulScanCfg {n : ℕ} (abi : BinaryShiftMulABI n) +@[nolint docBlame] +def binaryShiftMulScanCfg {n : ℕ} (abi : BinaryShiftMulABI n) (lhs rhs index : ℕ) (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) : Cfg n (forBinaryWorkTM abi.rhs (binaryShiftMulBitBodyTM abi)).Q := @@ -877,7 +896,8 @@ private def binaryShiftMulScanCfg {n : ℕ} (abi : BinaryShiftMulABI n) work := binaryShiftMulPartialWork abi work₀ lhs rhs index output := out₀ } -private def binaryShiftMulBodyStartCfg {n : ℕ} +@[nolint docBlame] +def binaryShiftMulBodyStartCfg {n : ℕ} (abi : BinaryShiftMulABI n) (lhs rhs index : ℕ) (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) : Cfg n (forBinaryWorkTM abi.rhs (binaryShiftMulBitBodyTM abi)).Q := @@ -886,7 +906,8 @@ private def binaryShiftMulBodyStartCfg {n : ℕ} work := binaryShiftMulPartialWork abi work₀ lhs rhs index output := out₀ } -private def binaryShiftMulBodyDoneCfg {n : ℕ} +@[nolint docBlame] +def binaryShiftMulBodyDoneCfg {n : ℕ} (abi : BinaryShiftMulABI n) (lhs rhs index : ℕ) (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) : Cfg n (forBinaryWorkTM abi.rhs (binaryShiftMulBitBodyTM abi)).Q := @@ -895,7 +916,8 @@ private def binaryShiftMulBodyDoneCfg {n : ℕ} work := binaryShiftMulBodyDoneWork abi work₀ lhs rhs index output := out₀ } -private def binaryShiftMulDoneCfg {n : ℕ} (abi : BinaryShiftMulABI n) +@[nolint docBlame] +def binaryShiftMulDoneCfg {n : ℕ} (abi : BinaryShiftMulABI n) (lhs rhs : ℕ) (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) : Cfg n (forBinaryWorkTM abi.rhs (binaryShiftMulBitBodyTM abi)).Q := @@ -904,7 +926,7 @@ private def binaryShiftMulDoneCfg {n : ℕ} (abi : BinaryShiftMulABI n) work := binaryShiftMulPartialWork abi work₀ lhs rhs rhs.size output := out₀ } -private theorem binaryShiftMulBody_run {n : ℕ} +theorem binaryShiftMulBody_run {n : ℕ} (abi : BinaryShiftMulABI n) (lhs rhs index : ℕ) (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) (hrhs : (work₀ abi.rhs).HasBinaryNat rhs) @@ -993,10 +1015,12 @@ private theorem binaryShiftMulBody_run {n : ℕ} exact Cfg.ext hhalt hfinalInput hfinalWork hfinalOutput simpa [work, hc] using hreach -private def binaryShiftMulLoopBound (lhs rhs : ℕ) : ℕ := +@[nolint docBlame] +def binaryShiftMulLoopBound (lhs rhs : ℕ) : ℕ := rhs.size * (33 * binaryShiftMulWidth lhs rhs + 164) + 1 -private def binaryShiftMulLoopPost {n : ℕ} (abi : BinaryShiftMulABI n) +@[nolint docBlame] +def binaryShiftMulLoopPost {n : ℕ} (abi : BinaryShiftMulABI n) (lhs rhs : ℕ) (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) : TapePred n := fun inp work out => @@ -1013,7 +1037,7 @@ private def binaryShiftMulLoopPost {n : ℕ} (abi : BinaryShiftMulABI n) i ≠ abi.shift → i ≠ abi.tmp → i ≠ abi.dbl → work i = work₀ i) ∧ out = out₀ -private theorem binaryShiftMulLoopTM_hoareTime_frame {n : ℕ} +theorem binaryShiftMulLoopTM_hoareTime_frame {n : ℕ} (abi : BinaryShiftMulABI n) (lhs rhs : ℕ) (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) (hlhs : (work₀ abi.lhs).HasBinaryNat lhs) @@ -1220,21 +1244,25 @@ private theorem binaryShiftMulLoopTM_hoareTime_frame {n : ℕ} (BinaryShiftMul.partialShift lhs rhs.size) i hrhsIdx haccIdx hshiftIdx htmpIdx hdblIdx] -private def binaryShiftMulCleanupBits {n : ℕ} +@[nolint docBlame] +def binaryShiftMulCleanupBits {n : ℕ} (abi : BinaryShiftMulABI n) (lhs rhs : ℕ) (i : Fin n) : List Bool := if i = abi.shift then (lhs * 2 ^ rhs.size).bits else [] -private def binaryShiftMulCleanupHead {n : ℕ} (_abi : BinaryShiftMulABI n) +@[nolint docBlame unusedArguments] +def binaryShiftMulCleanupHead {n : ℕ} (_abi : BinaryShiftMulABI n) (_i : Fin n) : ℕ := 1 -private def binaryShiftMulCleanupTime {n : ℕ} +@[nolint docBlame] +def binaryShiftMulCleanupTime {n : ℕ} (abi : BinaryShiftMulABI n) (lhs rhs : ℕ) : ℕ := rhs.size + 3 + 1 + resetBinaryWorkManyTime (binaryShiftMulCleanupBits abi lhs rhs) (binaryShiftMulCleanupHead abi) [abi.shift, abi.tmp, abi.dbl] -private def binaryShiftMulCleanupMid {n : ℕ} (abi : BinaryShiftMulABI n) +@[nolint docBlame] +def binaryShiftMulCleanupMid {n : ℕ} (abi : BinaryShiftMulABI n) (lhs rhs : ℕ) (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) : TapePred n := fun inp work out => @@ -1249,7 +1277,8 @@ private def binaryShiftMulCleanupMid {n : ℕ} (abi : BinaryShiftMulABI n) i ≠ abi.shift → i ≠ abi.tmp → i ≠ abi.dbl → work i = work₀ i) ∧ out = out₀ -private def binaryShiftMulPost {n : ℕ} (abi : BinaryShiftMulABI n) +@[nolint docBlame] +def binaryShiftMulPost {n : ℕ} (abi : BinaryShiftMulABI n) (lhs rhs : ℕ) (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) : TapePred n := fun inp work out => @@ -1264,7 +1293,7 @@ private def binaryShiftMulPost {n : ℕ} (abi : BinaryShiftMulABI n) i ≠ abi.shift → i ≠ abi.tmp → i ≠ abi.dbl → work i = work₀ i) ∧ out = out₀ -private theorem binaryShiftMulRewindTM_hoareTime_frame {n : ℕ} +theorem binaryShiftMulRewindTM_hoareTime_frame {n : ℕ} (abi : BinaryShiftMulABI n) (lhs rhs : ℕ) (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) (hinput : Parked inp₀) (hwork : ∀ i, Parked (work₀ i)) @@ -1324,7 +1353,7 @@ private theorem binaryShiftMulRewindTM_hoareTime_frame {n : ℕ} exact (hfinalOther i hrhsIdx).trans (hframe i hlhsIdx hrhsIdx haccIdx hshiftIdx htmpIdx hdblIdx) -private theorem binaryShiftMulResetTM_hoareTime_frame {n : ℕ} +theorem binaryShiftMulResetTM_hoareTime_frame {n : ℕ} (abi : BinaryShiftMulABI n) (lhs rhs : ℕ) (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) (hinput : Parked inp₀) (hwork : ∀ i, Parked (work₀ i)) @@ -1420,7 +1449,7 @@ private theorem binaryShiftMulResetTM_hoareTime_frame {n : ℕ} · exact hframe i hlhsIdx hrhsIdx haccIdx hshiftIdx htmpIdx hdblIdx · simp [hshiftIdx, htmpIdx, hdblIdx] -private theorem binaryShiftMulCleanupTM_hoareTime_frame {n : ℕ} +theorem binaryShiftMulCleanupTM_hoareTime_frame {n : ℕ} (abi : BinaryShiftMulABI n) (lhs rhs : ℕ) (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) (hinput : Parked inp₀) (hwork : ∀ i, Parked (work₀ i)) @@ -1473,7 +1502,8 @@ private theorem binaryShiftMulCleanupTM_hoareTime_frame {n : ℕ} hrewind htransition hreset simpa [binaryShiftMulCleanupTM, binaryShiftMulCleanupTime] using hrun -private def binaryShiftMulInitPost {n : ℕ} (abi : BinaryShiftMulABI n) +@[nolint docBlame] +def binaryShiftMulInitPost {n : ℕ} (abi : BinaryShiftMulABI n) (lhs rhs : ℕ) (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) : TapePred n := fun inp work out => @@ -1488,7 +1518,7 @@ private def binaryShiftMulInitPost {n : ℕ} (abi : BinaryShiftMulABI n) i ≠ abi.shift → i ≠ abi.tmp → i ≠ abi.dbl → work i = work₀ i) ∧ out = out₀ -private theorem binaryShiftMulInitTM_hoareTime_frame {n : ℕ} +theorem binaryShiftMulInitTM_hoareTime_frame {n : ℕ} (abi : BinaryShiftMulABI n) (lhs rhs : ℕ) (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) (hlhs : (work₀ abi.lhs).HasBinaryNat lhs) @@ -1527,7 +1557,7 @@ private theorem binaryShiftMulInitTM_hoareTime_frame {n : ℕ} · intro i hlhsIdx hrhsIdx haccIdx hshiftIdx htmpIdx hdblIdx rw [hworkEq, Function.update_of_ne hshiftIdx] -private theorem binaryShiftMulLoopTM_hoareTime_from_init {n : ℕ} +theorem binaryShiftMulLoopTM_hoareTime_from_init {n : ℕ} (abi : BinaryShiftMulABI n) (lhs rhs : ℕ) (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) (hinput : Parked inp₀) (hwork : ∀ i, Parked (work₀ i)) @@ -1577,7 +1607,7 @@ private theorem binaryShiftMulLoopTM_hoareTime_from_init {n : ℕ} hdblIdx).trans (hframe i hlhsIdx hrhsIdx haccIdx hshiftIdx htmpIdx hdblIdx) -private theorem binaryShiftMulInitPost_transition {n : ℕ} +theorem binaryShiftMulInitPost_transition {n : ℕ} (abi : BinaryShiftMulABI n) (lhs rhs : ℕ) (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) (hinput : Parked inp₀) (hwork : ∀ i, Parked (work₀ i)) @@ -1618,7 +1648,7 @@ private theorem binaryShiftMulInitPost_transition {n : ℕ} rw [hi, hw, ho] exact ⟨hinp, hlhs, hrhs, hacc, hshift, htmp, hdbl, hframe, hout⟩ -private theorem binaryShiftMulLoopPost_transition {n : ℕ} +theorem binaryShiftMulLoopPost_transition {n : ℕ} (abi : BinaryShiftMulABI n) (lhs rhs : ℕ) (inp₀ : Tape) (work₀ : Fin n → Tape) (out₀ : Tape) (hinput : Parked inp₀) (hwork : ∀ i, Parked (work₀ i)) @@ -1660,7 +1690,7 @@ private theorem binaryShiftMulLoopPost_transition {n : ℕ} exact ⟨hinp, hlhs, hrhsContent, hrhsStart, hrhsHead, hacc, hshift, htmp, hdbl, hframe, hout⟩ -private theorem binaryShiftMulCleanupTime_le {n : ℕ} +theorem binaryShiftMulCleanupTime_le {n : ℕ} (abi : BinaryShiftMulABI n) (lhs rhs : ℕ) : binaryShiftMulCleanupTime abi lhs rhs ≤ 3 * binaryShiftMulWidth lhs rhs + 35 := by diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinarySucc.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinarySucc.lean index 6d9fad10..40c1a972 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinarySucc.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinarySucc.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Internal +module + +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Internal /-! # Little-endian binary successor @@ -24,6 +26,8 @@ tape to cell one. - `TM.binarySuccTM_isTransducer` — the output head never moves left. -/ +@[expose] public section + namespace Complexity namespace BinarySucc diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinarySucc/Defs.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinarySucc/Defs.lean index a022b76d..e3f09fa6 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinarySucc/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinarySucc/Defs.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators -import Complexitylib.Models.TuringMachine.Tape.Encoding -import Mathlib.Data.Nat.Size +module + +public import Complexitylib.Models.TuringMachine.Combinators +public import Complexitylib.Models.TuringMachine.Tape.Encoding +public import Mathlib.Data.Nat.Size /-! # Little-endian binary successor — definitions @@ -16,6 +18,8 @@ significant bit comes first and whose representation of zero is empty. Overflow therefore appends one new high bit at the first blank cell. -/ +@[expose] public section + namespace Complexity namespace BinarySucc diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinarySucc/Internal.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinarySucc/Internal.lean index 33bcf5f8..ceacd9a6 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinarySucc/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinarySucc/Internal.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -import Complexitylib.Models.TuringMachine.Hoare.Space -import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs +module + +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +public import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs /-! # Little-endian binary successor — proof internals @@ -15,6 +17,8 @@ of `TM.binarySuccTM`. The carry proof uses a private head-independent binary content predicate, generalized over the already-zeroed low-order prefix. -/ +@[expose] public section + namespace Complexity namespace BinarySucc diff --git a/Complexitylib/Models/TuringMachine/Subroutines/ClearWork.lean b/Complexitylib/Models/TuringMachine/Subroutines/ClearWork.lean index e7b94804..51404bfd 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/ClearWork.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/ClearWork.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.ClearWork.Defs -import Complexitylib.Models.TuringMachine.Subroutines.ClearWork.Internal +module + +public import Complexitylib.Models.TuringMachine.Subroutines.ClearWork.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.ClearWork.Internal /-! # Clearing a binary work tape @@ -20,6 +22,8 @@ discipline of the clearing, rewinding, and composite machines. - `clearWorkTM_isTransducer` — clearing never moves the output head left. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/ClearWork/Defs.lean b/Complexitylib/Models/TuringMachine/Subroutines/ClearWork/Defs.lean index 7b9f7baf..d36139a4 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/ClearWork/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/ClearWork/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines +module + +public import Complexitylib.Models.TuringMachine.Subroutines /-! # Clearing a binary work tape — definitions @@ -12,6 +14,8 @@ This module names the concrete time bound used by the public framed contract for `TM.clearWorkTM`. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/ClearWork/Internal.lean b/Complexitylib/Models/TuringMachine/Subroutines/ClearWork/Internal.lean index ca52d86d..bfd9c727 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/ClearWork/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/ClearWork/Internal.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Hoare.Space -import Complexitylib.Models.TuringMachine.Registers -import Complexitylib.Models.TuringMachine.Subroutines.ClearWork.Defs -import Complexitylib.Models.TuringMachine.Subroutines.Internal +module + +public import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.TuringMachine.Registers +public import Complexitylib.Models.TuringMachine.Subroutines.ClearWork.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.Internal /-! # Clearing a binary work tape — proof internals @@ -16,6 +18,8 @@ contract and proves that its component machines never move the output head left. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/CopyOutput.lean b/Complexitylib/Models/TuringMachine/Subroutines/CopyOutput.lean index de14c24b..d7b19089 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/CopyOutput.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/CopyOutput.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines -import Complexitylib.Models.TuringMachine.Subroutines.Internal.CopyOutput +module + +public import Complexitylib.Models.TuringMachine.Subroutines +public import Complexitylib.Models.TuringMachine.Subroutines.Internal.CopyOutput /-! # Input-to-output copy subroutine @@ -19,6 +21,8 @@ its Boolean input verbatim to its output tape in the exact linear bound within time `m + 2` -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/CopyWorkOutput.lean b/Complexitylib/Models/TuringMachine/Subroutines/CopyWorkOutput.lean index 36bcd8b4..2a53b6e2 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/CopyWorkOutput.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/CopyWorkOutput.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.Internal.CopyWorkOutput +module + +public import Complexitylib.Models.TuringMachine.Subroutines.Internal.CopyWorkOutput /-! # Copy a raw work-tape output @@ -19,6 +21,8 @@ junk. The fresh destination receives a canonical `Tape.HasBinaryPrefix`. - `TM.copyWorkToWorkTM_hoareTime_frame_of_hasOutput` — copy with frame preservation -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/Counter.lean b/Complexitylib/Models/TuringMachine/Subroutines/Counter.lean index 7b07f268..a4f87970 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/Counter.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/Counter.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -import Complexitylib.Models.TuringMachine.Hoare.Defs +module + +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +public import Complexitylib.Models.TuringMachine.Hoare.Defs /-! # Counter-building TM subroutines @@ -16,6 +18,8 @@ The SAT-specific NP construction only needs a linear witness bound: that writes exactly `|input| + 1` unary marks to a designated counter tape. -/ +@[expose] public section + namespace Complexity namespace Tape @@ -264,10 +268,12 @@ instance : Fintype LinearCounterPhase where elems := {.scan, .rewind, .done} complete := fun x => by cases x <;> simp -private def counterPreserveWork (wHeads : Fin n → Γ) : Fin n → Γw := +@[nolint docBlame] +def counterPreserveWork (wHeads : Fin n → Γ) : Fin n → Γw := fun i => readBackWrite (wHeads i) -private def counterIdleDirs (wHeads : Fin n → Γ) : Fin n → Dir3 := +@[nolint docBlame] +def counterIdleDirs (wHeads : Fin n → Γ) : Fin n → Dir3 := fun i => idleDir (wHeads i) private theorem counterIdleDirs_right_of_start (wHeads : Fin n → Γ) : @@ -275,11 +281,13 @@ private theorem counterIdleDirs_right_of_start (wHeads : Fin n → Γ) : intro i hi exact idleDir_right_of_start hi -private def counterWriteOneWork (counterIdx : Fin n) (wHeads : Fin n → Γ) : +@[nolint docBlame] +def counterWriteOneWork (counterIdx : Fin n) (wHeads : Fin n → Γ) : Fin n → Γw := fun i => if i = counterIdx then Γw.one else readBackWrite (wHeads i) -private def counterAdvanceDirs (counterIdx : Fin n) (wHeads : Fin n → Γ) : +@[nolint docBlame] +def counterAdvanceDirs (counterIdx : Fin n) (wHeads : Fin n → Γ) : Fin n → Dir3 := fun i => if i = counterIdx then Dir3.right else idleDir (wHeads i) @@ -291,7 +299,8 @@ private theorem counterAdvanceDirs_right_of_start (counterIdx : Fin n) · simp [counterAdvanceDirs, hidx] · simp [counterAdvanceDirs, hidx, idleDir_right_of_start hi] -private def counterRewindDirs (counterIdx : Fin n) (wHeads : Fin n → Γ) : +@[nolint docBlame] +def counterRewindDirs (counterIdx : Fin n) (wHeads : Fin n → Γ) : Fin n → Dir3 := fun i => if i = counterIdx then moveLeftDir (wHeads i) else idleDir (wHeads i) diff --git a/Complexitylib/Models/TuringMachine/Subroutines/GuessBounded.lean b/Complexitylib/Models/TuringMachine/Subroutines/GuessBounded.lean index 1b790ae2..f532083e 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/GuessBounded.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/GuessBounded.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.Counter -import Complexitylib.Models.TuringMachine.Tape.Encoding -import Complexitylib.Models.TuringMachine.Trace +module + +public import Complexitylib.Models.TuringMachine.Subroutines.Counter +public import Complexitylib.Models.TuringMachine.Tape.Encoding +public import Complexitylib.Models.TuringMachine.Trace /-! # Nondeterministic TM subroutines @@ -19,6 +21,8 @@ guess phase a structural all-paths halting bound, which is essential for `NTIME`. -/ +@[expose] public section + namespace Complexity namespace NTM @@ -49,11 +53,11 @@ instance : Fintype GuessBoundedPhase where /-- Preserve a work tape by writing back the symbol currently under its head and using an idle direction. -/ -private def preserveWork (wHeads : Fin n → Γ) : Fin n → Γw := +def preserveWork (wHeads : Fin n → Γ) : Fin n → Γw := fun i => TM.readBackWrite (wHeads i) /-- Idle directions for all work tapes. -/ -private def idleWorkDirs (wHeads : Fin n → Γ) : Fin n → Dir3 := +def idleWorkDirs (wHeads : Fin n → Γ) : Fin n → Dir3 := fun i => TM.idleDir (wHeads i) private theorem idleWorkDirs_right_of_start (wHeads : Fin n → Γ) : @@ -65,7 +69,7 @@ private theorem idleWorkDirs_right_of_start (wHeads : Fin n → Γ) : nondeterministic bit, while the counter tape has its current mark erased. The definition is meaningful when `witnessIdx ≠ counterIdx`; later correctness lemmas assume that disjointness. -/ -private def guessWriteWork (witnessIdx counterIdx : Fin n) +def guessWriteWork (witnessIdx counterIdx : Fin n) (choice : Bool) (wHeads : Fin n → Γ) : Fin n → Γw := fun i => if i = witnessIdx then Γw.ofBool choice @@ -74,7 +78,7 @@ private def guessWriteWork (witnessIdx counterIdx : Fin n) /-- Work directions for the bit-writing step: witness and counter advance right, all other tapes idle. -/ -private def guessWriteDirs (witnessIdx counterIdx : Fin n) +def guessWriteDirs (witnessIdx counterIdx : Fin n) (wHeads : Fin n → Γ) : Fin n → Dir3 := fun i => if i = witnessIdx then Dir3.right @@ -93,7 +97,7 @@ private theorem guessWriteDirs_right_of_start (witnessIdx counterIdx : Fin n) · simp [guessWriteDirs, hwi, hci, TM.idleDir_right_of_start hi] /-- Work directions for rewinding the witness tape to cell 1. -/ -private def rewindWitnessDirs (witnessIdx : Fin n) +def rewindWitnessDirs (witnessIdx : Fin n) (wHeads : Fin n → Γ) : Fin n → Dir3 := fun i => if i = witnessIdx then TM.moveLeftDir (wHeads i) diff --git a/Complexitylib/Models/TuringMachine/Subroutines/Internal.lean b/Complexitylib/Models/TuringMachine/Subroutines/Internal.lean index fc2d6d6e..61a332f3 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/Internal.lean @@ -3,11 +3,13 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines -import Complexitylib.Models.TuringMachine.Tape.Encoding -import Complexitylib.Models.TuringMachine.Hoare -import Complexitylib.Models.TuringMachine.Hoare.Defs -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +module + +public import Complexitylib.Models.TuringMachine.Subroutines +public import Complexitylib.Models.TuringMachine.Tape.Encoding +public import Complexitylib.Models.TuringMachine.Hoare +public import Complexitylib.Models.TuringMachine.Hoare.Defs +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic /-! # TM Subroutines: proof internals @@ -37,6 +39,8 @@ an arbitrary predicate `P` on the untouched tapes through the run. work-to-work copy -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/Internal/CopyOutput.lean b/Complexitylib/Models/TuringMachine/Subroutines/Internal/CopyOutput.lean index 3b50e3dd..277eb056 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/Internal/CopyOutput.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/Internal/CopyOutput.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines -import Complexitylib.Models.TuringMachine.Tape.Encoding -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +module + +public import Complexitylib.Models.TuringMachine.Subroutines +public import Complexitylib.Models.TuringMachine.Tape.Encoding +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic /-! # Input-to-output copy correctness @@ -19,6 +21,8 @@ The public theorem is stated in `Complexitylib.Models.TuringMachine.Subroutines.CopyOutput`. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/Internal/CopyWorkOutput.lean b/Complexitylib/Models/TuringMachine/Subroutines/Internal/CopyWorkOutput.lean index 7f2f511b..651f93a8 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/Internal/CopyWorkOutput.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/Internal/CopyWorkOutput.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.Internal +module + +public import Complexitylib.Models.TuringMachine.Subroutines.Internal /-! # Copy a raw work-tape output — proof internals @@ -17,6 +19,8 @@ Public statements are in `Complexitylib.Models.TuringMachine.Subroutines.CopyWorkOutput`. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/Internal/ScanRight.lean b/Complexitylib/Models/TuringMachine/Subroutines/Internal/ScanRight.lean index 532b881c..e391469f 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/Internal/ScanRight.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/Internal/ScanRight.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -import Complexitylib.Models.TuringMachine.Hoare.Defs -import Complexitylib.Models.TuringMachine.Subroutines -import Complexitylib.Models.TuringMachine.Tape.Encoding +module + +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +public import Complexitylib.Models.TuringMachine.Hoare.Defs +public import Complexitylib.Models.TuringMachine.Subroutines +public import Complexitylib.Models.TuringMachine.Tape.Encoding /-! # Right-scanner correctness @@ -20,6 +22,8 @@ The public compositional theorem is stated in `Complexitylib.Models.TuringMachine.Subroutines.ScanRight`. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/PairEmit.lean b/Complexitylib/Models/TuringMachine/Subroutines/PairEmit.lean index ea6a7f13..a2097554 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/PairEmit.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/PairEmit.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.PairEmit.Defs -import Complexitylib.Models.TuringMachine.Subroutines.PairEmit.Internal +module + +public import Complexitylib.Models.TuringMachine.Subroutines.PairEmit.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.PairEmit.Internal /-! # Pair emission from the input and a work tape @@ -19,6 +21,8 @@ second component. - `TM.pairInputWorkTM_hoareTime` — compositional time-bounded contract -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/PairEmit/Defs.lean b/Complexitylib/Models/TuringMachine/Subroutines/PairEmit/Defs.lean index 1a64e6ea..fb6e4a59 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/PairEmit/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/PairEmit/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators +module + +public import Complexitylib.Models.TuringMachine.Combinators /-! # Pair emission from the input and a work tape @@ -20,6 +22,8 @@ Both sources are consumed only through their first blank delimiter. - `TM.pairInputWorkTime` — the exact running time on canonical sources -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/PairEmit/Internal.lean b/Complexitylib/Models/TuringMachine/Subroutines/PairEmit/Internal.lean index a24dc7e3..5ac28f13 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/PairEmit/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/PairEmit/Internal.lean @@ -3,11 +3,13 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Encoding.Pairing -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -import Complexitylib.Models.TuringMachine.Hoare.Defs -import Complexitylib.Models.TuringMachine.Subroutines.PairEmit.Defs -import Complexitylib.Models.TuringMachine.Tape.Encoding +module + +public import Complexitylib.Encoding.Pairing +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +public import Complexitylib.Models.TuringMachine.Hoare.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.PairEmit.Defs +public import Complexitylib.Models.TuringMachine.Tape.Encoding /-! # Pair emission from the input and a work tape — proof internals @@ -15,6 +17,8 @@ import Complexitylib.Models.TuringMachine.Tape.Encoding This module verifies the exact two-pass controller in `PairEmit.Defs`. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/PairSplit.lean b/Complexitylib/Models/TuringMachine/Subroutines/PairSplit.lean index 6f711f53..5f0e7d49 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/PairSplit.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/PairSplit.lean @@ -3,10 +3,12 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Hoare.Defs -import Complexitylib.Models.TuringMachine.Subroutines.PairSplit.Defs -import Complexitylib.Models.TuringMachine.Subroutines.PairSplit.Internal -import Complexitylib.Models.TuringMachine.Tape.Encoding +module + +public import Complexitylib.Models.TuringMachine.Hoare.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.PairSplit.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.PairSplit.Internal +public import Complexitylib.Models.TuringMachine.Tape.Encoding /-! # Split a paired input onto work tapes @@ -34,6 +36,8 @@ with a distinct failure result. `HasOutput` specifications. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/PairSplit/Defs.lean b/Complexitylib/Models/TuringMachine/Subroutines/PairSplit/Defs.lean index 6a144749..772dfa1b 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/PairSplit/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/PairSplit/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators +module + +public import Complexitylib.Models.TuringMachine.Combinators /-! # Pair-splitting machine — definitions @@ -14,6 +16,8 @@ and the public compositional specification live in the adjacent internal and surface modules. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/PairSplit/Internal.lean b/Complexitylib/Models/TuringMachine/Subroutines/PairSplit/Internal.lean index 5744a2f9..8cff0d6f 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/PairSplit/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/PairSplit/Internal.lean @@ -3,11 +3,13 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Encoding.Pairing -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -import Complexitylib.Models.TuringMachine.Trace -import Complexitylib.Models.TuringMachine.Subroutines.PairSplit.Defs -import Mathlib.Tactic.Ring +module + +public import Complexitylib.Encoding.Pairing +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +public import Complexitylib.Models.TuringMachine.Trace +public import Complexitylib.Models.TuringMachine.Subroutines.PairSplit.Defs +public import Mathlib.Tactic.Ring /-! # Pair-splitting machine — proof internals @@ -17,6 +19,8 @@ This file proves the stepwise decoding and exact-time correctness facts for `Complexitylib.Models.TuringMachine.Subroutines.PairSplit`. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/PairValidate.lean b/Complexitylib/Models/TuringMachine/Subroutines/PairValidate.lean index 2e84f748..50a7f374 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/PairValidate.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/PairValidate.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Lift -import Complexitylib.Models.TuringMachine.Hoare -import Complexitylib.Models.TuringMachine.Subroutines.PairValidate.Defs -import Complexitylib.Models.TuringMachine.Subroutines.PairValidate.Internal +module + +public import Complexitylib.Models.TuringMachine.Lift +public import Complexitylib.Models.TuringMachine.Hoare +public import Complexitylib.Models.TuringMachine.Subroutines.PairValidate.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.PairValidate.Internal /-! # Validate paired machine inputs @@ -20,6 +22,8 @@ need rejecting semantics, then rewind and use the canonical splitter to stage the two decoded components. -/ +@[expose] public section + namespace Complexity /-- Decoder-facing characterization of membership in `validPairEncoding`. -/ diff --git a/Complexitylib/Models/TuringMachine/Subroutines/PairValidate/Defs.lean b/Complexitylib/Models/TuringMachine/Subroutines/PairValidate/Defs.lean index 3889a078..d198ba1c 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/PairValidate/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/PairValidate/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Encoding.Pairing -import Complexitylib.Models.TuringMachine.Combinators +module + +public import Complexitylib.Encoding.Pairing +public import Complexitylib.Models.TuringMachine.Combinators /-! # Pair-encoding validator — definitions @@ -15,6 +17,8 @@ has total semantics: it writes `1` exactly when `unpair?` succeeds and writes `0` on every malformed encoding. -/ +@[expose] public section + namespace Complexity /-- The language of strings on which the canonical pair decoder succeeds. -/ diff --git a/Complexitylib/Models/TuringMachine/Subroutines/PairValidate/Internal.lean b/Complexitylib/Models/TuringMachine/Subroutines/PairValidate/Internal.lean index 549a2f02..23b98922 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/PairValidate/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/PairValidate/Internal.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.Internal.Scanner -import Complexitylib.Models.TuringMachine.Hoare -import Complexitylib.Models.TuringMachine.Lift -import Complexitylib.Models.TuringMachine.Subroutines.PairValidate.Defs +module + +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Scanner +public import Complexitylib.Models.TuringMachine.Hoare +public import Complexitylib.Models.TuringMachine.Lift +public import Complexitylib.Models.TuringMachine.Subroutines.PairValidate.Defs /-! # Pair-encoding validator — proof internals @@ -15,6 +17,8 @@ The finite-state fold is related to `unpair?`, then the generic scanner correctness theorem supplies the executable machine proof and exact time bound. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/ResetBinary.lean b/Complexitylib/Models/TuringMachine/Subroutines/ResetBinary.lean index 70d86791..fbe9f35c 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/ResetBinary.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/ResetBinary.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Hoare.Space -import Complexitylib.Models.TuringMachine.Subroutines.ClearWork -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary.Defs -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary.Internal +module + +public import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.TuringMachine.Subroutines.ClearWork +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary.Internal /-! # Resetting a binary work tape @@ -15,6 +17,8 @@ This module exposes the framed time and space contracts for rewinding an arbitrary canonical binary cursor and clearing it to the standard blank tape. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/ResetBinary/Defs.lean b/Complexitylib/Models/TuringMachine/Subroutines/ResetBinary/Defs.lean index de9571bc..448a435d 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/ResetBinary/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/ResetBinary/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.ClearWork.Defs -import Complexitylib.Models.TuringMachine.Tape.Encoding +module + +public import Complexitylib.Models.TuringMachine.Subroutines.ClearWork.Defs +public import Complexitylib.Models.TuringMachine.Tape.Encoding /-! # Resetting a binary work tape — definitions @@ -14,6 +16,8 @@ contents and then clears the resulting completed string to the standard blank work tape. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/ResetBinary/Internal.lean b/Complexitylib/Models/TuringMachine/Subroutines/ResetBinary/Internal.lean index acfa84a3..db205396 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/ResetBinary/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/ResetBinary/Internal.lean @@ -3,15 +3,19 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Hoare -import Complexitylib.Models.TuringMachine.Registers -import Complexitylib.Models.TuringMachine.Subroutines.Internal -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary.Defs +module + +public import Complexitylib.Models.TuringMachine.Hoare +public import Complexitylib.Models.TuringMachine.Registers +public import Complexitylib.Models.TuringMachine.Subroutines.Internal +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary.Defs /-! # Resetting a binary work tape — proof internals -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/ResetBinaryMany.lean b/Complexitylib/Models/TuringMachine/Subroutines/ResetBinaryMany.lean index 722ae7ab..f939466f 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/ResetBinaryMany.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/ResetBinaryMany.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Hoare.Space -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany.Defs -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany.Internal +module + +public import Complexitylib.Models.TuringMachine.Hoare.Space +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany.Internal /-! # Resetting several binary work tapes @@ -14,6 +16,8 @@ This module exposes a framed compositional contract for resetting a fixed list of distinct canonical binary work tapes. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/ResetBinaryMany/Defs.lean b/Complexitylib/Models/TuringMachine/Subroutines/ResetBinaryMany/Defs.lean index b2dae0c7..94bc4f47 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/ResetBinaryMany/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/ResetBinaryMany/Defs.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Registers.RegisterOps -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary.Defs +module + +public import Complexitylib.Models.TuringMachine.Registers.RegisterOps +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary.Defs /-! # Resetting several binary work tapes — definitions @@ -14,6 +16,8 @@ tape named by `targets`. The executable machine depends only on the tape-index list; represented contents and resource bounds occur only in its contracts. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/ResetBinaryMany/Internal.lean b/Complexitylib/Models/TuringMachine/Subroutines/ResetBinaryMany/Internal.lean index 536f581b..964612ba 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/ResetBinaryMany/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/ResetBinaryMany/Internal.lean @@ -3,13 +3,17 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary -import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany.Defs +module + +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary +public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany.Defs /-! # Resetting several binary work tapes — proof internals -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/ScanRight.lean b/Complexitylib/Models/TuringMachine/Subroutines/ScanRight.lean index 8d2f2219..31ce64d1 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/ScanRight.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/ScanRight.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Hoare.Defs -import Complexitylib.Models.TuringMachine.Subroutines -import Complexitylib.Models.TuringMachine.Subroutines.Internal.ScanRight -import Complexitylib.Models.TuringMachine.Tape.Encoding +module + +public import Complexitylib.Models.TuringMachine.Hoare.Defs +public import Complexitylib.Models.TuringMachine.Subroutines +public import Complexitylib.Models.TuringMachine.Subroutines.Internal.ScanRight +public import Complexitylib.Models.TuringMachine.Tape.Encoding /-! # Frame-preserving right scan @@ -21,6 +23,8 @@ first blank. Every stable tape outside that target is preserved exactly. - `TM.scanRightTM_hoareTime_frame` — bounded compositional form of that endpoint. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/UnaryLength.lean b/Complexitylib/Models/TuringMachine/Subroutines/UnaryLength.lean index 450d0fa8..3062d439 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/UnaryLength.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/UnaryLength.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.UnaryLength.Defs -import Complexitylib.Models.TuringMachine.Subroutines.UnaryLength.Internal +module + +public import Complexitylib.Models.TuringMachine.Subroutines.UnaryLength.Defs +public import Complexitylib.Models.TuringMachine.Subroutines.UnaryLength.Internal /-! # Unary input-length transducer @@ -18,6 +20,8 @@ emits `List.replicate x.length true` within the linear bound `|x| + 2`. linear time -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/UnaryLength/Defs.lean b/Complexitylib/Models/TuringMachine/Subroutines/UnaryLength/Defs.lean index a28820d7..75bfebfd 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/UnaryLength/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/UnaryLength/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators +module + +public import Complexitylib.Models.TuringMachine.Combinators /-! # Unary input-length transducer — definitions @@ -13,6 +15,8 @@ once and writes one `true` bit per input bit. Its output is therefore the unary representation `List.replicate x.length true` of the input length. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Subroutines/UnaryLength/Internal.lean b/Complexitylib/Models/TuringMachine/Subroutines/UnaryLength/Internal.lean index 403edf8d..700c84b8 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/UnaryLength/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/UnaryLength/Internal.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -import Complexitylib.Models.TuringMachine.Subroutines.UnaryLength.Defs -import Complexitylib.Models.TuringMachine.Tape.Encoding +module + +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +public import Complexitylib.Models.TuringMachine.Subroutines.UnaryLength.Defs +public import Complexitylib.Models.TuringMachine.Tape.Encoding /-! # Unary input-length transducer — proof internals @@ -16,6 +18,8 @@ writes one `true` bit per input bit, and halts on the first input blank after exactly `|x| + 2` transitions. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/Tape/Encoding.lean b/Complexitylib/Models/TuringMachine/Tape/Encoding.lean index 18bfeb33..9a9b1e8e 100644 --- a/Complexitylib/Models/TuringMachine/Tape/Encoding.lean +++ b/Complexitylib/Models/TuringMachine/Tape/Encoding.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine +module + +public import Complexitylib.Models.TuringMachine /-! # Binary string encodings on Turing-machine tapes @@ -17,6 +19,8 @@ beginning of a remaining suffix. These shapes are shared by deterministic and nondeterministic machine constructions. -/ +@[expose] public section + namespace Complexity namespace Tape diff --git a/Complexitylib/Models/TuringMachine/Trace.lean b/Complexitylib/Models/TuringMachine/Trace.lean index 0cce91b0..097f71ab 100644 --- a/Complexitylib/Models/TuringMachine/Trace.lean +++ b/Complexitylib/Models/TuringMachine/Trace.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine -import Complexitylib.Models.TuringMachine.Trace.Internal +module + +public import Complexitylib.Models.TuringMachine +public import Complexitylib.Models.TuringMachine.Trace.Internal /-! # Nondeterministic trace decomposition @@ -18,6 +20,8 @@ dependent `Fin` casts into fixed-schedule simulation proofs. - `NTM.trace_invariant` -- prove an indexed invariant one trace step at a time. -/ +@[expose] public section + namespace Complexity namespace NTM diff --git a/Complexitylib/Models/TuringMachine/Trace/Internal.lean b/Complexitylib/Models/TuringMachine/Trace/Internal.lean index ba9059cb..33f5bac5 100644 --- a/Complexitylib/Models/TuringMachine/Trace/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Trace/Internal.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Internal +module + +public import Complexitylib.Models.TuringMachine.Internal /-! # Nondeterministic trace API -- proof internals @@ -11,6 +13,8 @@ import Complexitylib.Models.TuringMachine.Internal Proofs for the public finite-trace decomposition rules. -/ +@[expose] public section + namespace Complexity namespace NTM diff --git a/Complexitylib/Models/TuringMachine/UTM/Clock.lean b/Complexitylib/Models/TuringMachine/UTM/Clock.lean index 66291d7b..71dc9291 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Clock.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Clock.lean @@ -3,10 +3,12 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Lift -import Complexitylib.Models.TuringMachine.Hoare.Defs -import Complexitylib.Models.TuringMachine.Registers -import Complexitylib.Models.TuringMachine.UTM.Internal.VTape +module + +public import Complexitylib.Models.TuringMachine.Lift +public import Complexitylib.Models.TuringMachine.Hoare.Defs +public import Complexitylib.Models.TuringMachine.Registers +public import Complexitylib.Models.TuringMachine.UTM.Internal.VTape /-! # Clock infrastructure for the time-bounded universal machine @@ -48,6 +50,8 @@ not `bodyTM` phase states, so they sit beside `liftTM` rather than in `zeroTestTM_hoareTime` (4 steps). -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/UTM/ClockConstructible.lean b/Complexitylib/Models/TuringMachine/UTM/ClockConstructible.lean index fc1d3993..0715a6ca 100644 --- a/Complexitylib/Models/TuringMachine/UTM/ClockConstructible.lean +++ b/Complexitylib/Models/TuringMachine/UTM/ClockConstructible.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Mathlib.Tactic.Ring -import Complexitylib.Models.TuringMachine.Registers.Arith +module + +public import Mathlib.Tactic.Ring +public import Complexitylib.Models.TuringMachine.Registers.Arith /-! # Clock constructibility for the time hierarchy theorem @@ -33,6 +35,8 @@ state, ghost-framed step/run lemmas as in `UTM/Clock.lean` and `InputLen.lean`). -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/UTM/ClockedUtm.lean b/Complexitylib/Models/TuringMachine/UTM/ClockedUtm.lean index d5e76c70..5fd55c70 100644 --- a/Complexitylib/Models/TuringMachine/UTM/ClockedUtm.lean +++ b/Complexitylib/Models/TuringMachine/UTM/ClockedUtm.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.UTM.Internal.SimClocked -import Complexitylib.Models.TuringMachine.UTM.Internal.SeekFrontier -import Complexitylib.Models.TuringMachine.Subroutines.Internal +module + +public import Complexitylib.Models.TuringMachine.UTM.Internal.SimClocked +public import Complexitylib.Models.TuringMachine.UTM.Internal.SeekFrontier +public import Complexitylib.Models.TuringMachine.Subroutines.Internal /-! # The clocked universal machine @@ -39,6 +41,8 @@ both within `clockedUtmTime α x V` steps from the started tapes `retargetInput` mid-sequence). -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/UTM/Diagonal.lean b/Complexitylib/Models/TuringMachine/UTM/Diagonal.lean index 3024ec34..8ba255ae 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Diagonal.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Diagonal.lean @@ -3,13 +3,15 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.UTM.Internal.PairSelf -import Complexitylib.Models.TuringMachine.UTM.Internal.TermCheck -import Complexitylib.Models.TuringMachine.UTM.ClockedUtm -import Complexitylib.Models.TuringMachine.UTM.Internal.NegOut -import Complexitylib.Models.TuringMachine.UTM.HierarchySupport -import Complexitylib.Models.TuringMachine.UTM.ClockConstructible -import Complexitylib.Models.TuringMachine.Combinators.Internal.Retarget +module + +public import Complexitylib.Models.TuringMachine.UTM.Internal.PairSelf +public import Complexitylib.Models.TuringMachine.UTM.Internal.TermCheck +public import Complexitylib.Models.TuringMachine.UTM.ClockedUtm +public import Complexitylib.Models.TuringMachine.UTM.Internal.NegOut +public import Complexitylib.Models.TuringMachine.UTM.HierarchySupport +public import Complexitylib.Models.TuringMachine.UTM.ClockConstructible +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Retarget /-! # The time-hierarchy diagonalizer `diagTM` @@ -60,6 +62,8 @@ Two landed specs do not quite fit and are bridged locally: clean output tape. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/UTM/Encoding.lean b/Complexitylib/Models/TuringMachine/UTM/Encoding.lean index 6cac5dcd..15ae608d 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Encoding.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Encoding.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine -import Complexitylib.Mathlib.NatBits +module + +public import Complexitylib.Models.TuringMachine +public import Complexitylib.Mathlib.NatBits /-! # TM State Normalization and Binary Encoding @@ -40,6 +42,8 @@ Turing machines: - `allΓFuncs` — enumerate all `Fin n → Γ` functions -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/UTM/HierarchySupport.lean b/Complexitylib/Models/TuringMachine/UTM/HierarchySupport.lean index 8ec49ee0..a0da65bd 100644 --- a/Complexitylib/Models/TuringMachine/UTM/HierarchySupport.lean +++ b/Complexitylib/Models/TuringMachine/UTM/HierarchySupport.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.UTM.Internal.SimLoop -import Complexitylib.Asymptotics +module + +public import Complexitylib.Models.TuringMachine.UTM.Internal.SimLoop +public import Complexitylib.Asymptotics /-! # Support lemmas for the time-hierarchy theorem @@ -21,6 +23,8 @@ Four self-contained ingredients used by the diagonalization argument: a step budget `V` or is still running after exactly `V` steps. -/ +@[expose] public section + namespace Complexity open Asymptotics Filter diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/Body.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/Body.lean index b0bb8e80..2d02d220 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/Body.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/Body.lean @@ -3,16 +3,18 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine -import Complexitylib.Models.TuringMachine.Combinators -import Complexitylib.Models.TuringMachine.UTM.Internal.Desc -import Complexitylib.Models.TuringMachine.UTM.Internal.VTape -import Mathlib.Tactic.DeriveFintype -import Mathlib.Tactic.FinCases -import Mathlib.Data.Fintype.Sigma -import Mathlib.Data.Fintype.Prod -import Mathlib.Data.Fintype.Option -import Mathlib.Data.Fintype.Sum +module + +public import Complexitylib.Models.TuringMachine +public import Complexitylib.Models.TuringMachine.Combinators +public import Complexitylib.Models.TuringMachine.UTM.Internal.Desc +public import Complexitylib.Models.TuringMachine.UTM.Internal.VTape +public import Mathlib.Tactic.DeriveFintype +public import Mathlib.Tactic.FinCases +public import Mathlib.Data.Fintype.Sigma +public import Mathlib.Data.Fintype.Prod +public import Mathlib.Data.Fintype.Option +public import Mathlib.Data.Fintype.Sum /-! # The universal machine's loop body @@ -33,6 +35,8 @@ This file defines the machine only; its `HoareTime` spec and the correspondence with `TMDesc.toTM.step` live in `BodyInternal.lean` (M3). -/ +@[expose] public section + namespace Complexity namespace TM.UTMBody diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/BodyApply.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/BodyApply.lean index cfd7748b..38f019c4 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/BodyApply.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/BodyApply.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.UTM.Internal.BodyInternal -import Complexitylib.Models.TuringMachine.UTM.Internal.VTape +module + +public import Complexitylib.Models.TuringMachine.UTM.Internal.BodyInternal +public import Complexitylib.Models.TuringMachine.UTM.Internal.VTape /-! # Body machine: peek, default-move, and apply phases @@ -27,6 +29,8 @@ tapes (the `+1`-shift shadows of the simulated input/work/output tapes, decoders to the description decoders in `Desc.lean`. -/ +@[expose] public section + namespace Complexity namespace TM.UTMBody diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/BodyAssembly.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/BodyAssembly.lean index 3ea6199b..63ee0e30 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/BodyAssembly.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/BodyAssembly.lean @@ -3,10 +3,12 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.UTM.Internal.BodyMatch -import Complexitylib.Models.TuringMachine.UTM.Internal.BodyApply -import Complexitylib.Models.TuringMachine.UTM.Internal.DescLayout -import Complexitylib.Models.TuringMachine.UTM.Internal.Verdict +module + +public import Complexitylib.Models.TuringMachine.UTM.Internal.BodyMatch +public import Complexitylib.Models.TuringMachine.UTM.Internal.BodyApply +public import Complexitylib.Models.TuringMachine.UTM.Internal.DescLayout +public import Complexitylib.Models.TuringMachine.UTM.Internal.Verdict /-! # Body correctness: phase assembly @@ -19,6 +21,8 @@ halted interpreted machine makes the body a bounded-time no-op, and a running one brings it to the peek phase with all tapes restored. -/ +@[expose] public section + namespace Complexity namespace TM.UTMBody diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/BodyInternal.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/BodyInternal.lean index ea225432..70cd0f23 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/BodyInternal.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/BodyInternal.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.UTM.Internal.Body -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +module + +public import Complexitylib.Models.TuringMachine.UTM.Internal.Body +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic /-! # Body machine: step reduction @@ -16,6 +18,8 @@ work tapes act per `acts`, whose real input idles, and whose real output write-backs — in closed form. -/ +@[expose] public section + namespace Complexity namespace TM.UTMBody diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/BodyIteration.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/BodyIteration.lean index aa39da42..9b270569 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/BodyIteration.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/BodyIteration.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.UTM.Internal.BodyLoop -import Complexitylib.Models.TuringMachine.UTM.Internal.StepGlue +module + +public import Complexitylib.Models.TuringMachine.UTM.Internal.BodyLoop +public import Complexitylib.Models.TuringMachine.UTM.Internal.StepGlue /-! # Body correctness: the per-iteration theorem @@ -28,6 +30,8 @@ divergence: an entry region starting with an empty segment followed by junk (see `matchLoop`). -/ +@[expose] public section + namespace Complexity namespace TM.UTMBody diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/BodyLookup.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/BodyLookup.lean index 51e6a575..8ea8890e 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/BodyLookup.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/BodyLookup.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.UTM.Internal.Verdict -import Complexitylib.Models.TuringMachine.UTM.Internal.BodyApply +module + +public import Complexitylib.Models.TuringMachine.UTM.Internal.Verdict +public import Complexitylib.Models.TuringMachine.UTM.Internal.BodyApply /-! # Match-loop ↔ lookup correspondence (pure list level) @@ -30,6 +32,8 @@ no machine steps (design appendix 2): entry's action fields. -/ +@[expose] public section + namespace Complexity namespace TM.UTMBody diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/BodyLoop.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/BodyLoop.lean index 5701550a..7ce23013 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/BodyLoop.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/BodyLoop.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.UTM.Internal.BodyAssembly -import Complexitylib.Models.TuringMachine.UTM.Internal.BodyLookup +module + +public import Complexitylib.Models.TuringMachine.UTM.Internal.BodyAssembly +public import Complexitylib.Models.TuringMachine.UTM.Internal.BodyLookup /-! # Body machine: the match-loop induction @@ -40,6 +42,8 @@ regions of the form `entry □ ⋯ □ □` (head symbol is an entry bit) or ` which has just read the next region's head symbol and found it non-`□`. -/ +@[expose] public section + namespace Complexity namespace TM.UTMBody diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/BodyMatch.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/BodyMatch.lean index 23bb1215..d3e90483 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/BodyMatch.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/BodyMatch.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.UTM.Internal.BodyInternal +module + +public import Complexitylib.Models.TuringMachine.UTM.Internal.BodyInternal /-! # Body machine: match-phase loop lemmas @@ -20,6 +22,8 @@ exactly preserved (`idle_tape_id` frames), and scratch extension is stated as an update-on-an-interval of the ghost cells (as in `dfCopy_loop`). -/ +@[expose] public section + namespace Complexity namespace TM.UTMBody diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/ClockFrontier.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/ClockFrontier.lean index 42f2ea3f..3e4e0b39 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/ClockFrontier.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/ClockFrontier.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.UTM.Clock +module + +public import Complexitylib.Models.TuringMachine.UTM.Clock /-! # Frontier-parked clock machines for the time-bounded universal machine @@ -33,6 +35,8 @@ Two `TM 7` machines, both with ghost-initial-tapes `HoareTime` specs: `δ_right_of_start`, making `out.head = 1` unachievable. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/Desc.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/Desc.lean index c52cda1b..f66cb419 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/Desc.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/Desc.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine -import Complexitylib.Models.TuringMachine.UTM.Encoding +module + +public import Complexitylib.Models.TuringMachine +public import Complexitylib.Models.TuringMachine.UTM.Encoding /-! # Machine descriptions for the universal Turing machine @@ -49,6 +51,8 @@ string denotes some machine. - `decodeDesc_encodeDesc_append` — roundtrip ignores trailing junk -/ +@[expose] public section + namespace Complexity -- ════════════════════════════════════════════════════════════════════════ diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/DescLayout.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/DescLayout.lean index 2e5d537c..efe6dae1 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/DescLayout.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/DescLayout.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.UTM.Internal.VTape -import Complexitylib.Models.TuringMachine.UTM.Internal.Desc -import Complexitylib.Models.TuringMachine.UTM.Internal.HaltTest +module + +public import Complexitylib.Models.TuringMachine.UTM.Internal.VTape +public import Complexitylib.Models.TuringMachine.UTM.Internal.Desc +public import Complexitylib.Models.TuringMachine.UTM.Internal.HaltTest /-! # Description-tape layout @@ -22,6 +24,8 @@ These feed the seek phase (two `scanRight_loop` instances land the desc head at the entry region) and the match loop (entry-region cells). -/ +@[expose] public section + namespace Complexity namespace TM.UTMBody diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/Extract.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/Extract.lean index 82518208..1aa28beb 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/Extract.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/Extract.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Hoare.Defs -import Complexitylib.Models.TuringMachine.UTM.Internal.VTape -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +module + +public import Complexitylib.Models.TuringMachine.Hoare.Defs +public import Complexitylib.Models.TuringMachine.UTM.Internal.VTape +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic /-! # UTM extraction phase: `extractTM` @@ -42,6 +44,8 @@ unchanged (only its head moves). within `B + m + 8` steps, where `B` bounds the initial work-2 head. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/HaltTest.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/HaltTest.lean index 3639e8e4..66b4886d 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/HaltTest.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/HaltTest.lean @@ -3,10 +3,12 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Hoare.Defs -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -import Complexitylib.Models.TuringMachine.UTM.Internal.VTape -import Complexitylib.Models.TuringMachine.UTM.Internal.Desc +module + +public import Complexitylib.Models.TuringMachine.Hoare.Defs +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +public import Complexitylib.Models.TuringMachine.UTM.Internal.VTape +public import Complexitylib.Models.TuringMachine.UTM.Internal.Desc /-! # The UTM halt test machine @@ -46,6 +48,8 @@ extends beyond it (and `takeField` fields are always blank-free). The UTM state tape holds bit symbols only, so this is no restriction in use. -/ +@[expose] public section + namespace Complexity -- ════════════════════════════════════════════════════════════════════════ diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/Init.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/Init.lean index fc48baad..8e2e8fc7 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/Init.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/Init.lean @@ -3,11 +3,13 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.UTM.Internal.Desc -import Complexitylib.Models.TuringMachine.UTM.Internal.VTape -import Complexitylib.Models.TuringMachine.Hoare.Defs -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -import Complexitylib.Encoding.Pairing +module + +public import Complexitylib.Models.TuringMachine.UTM.Internal.Desc +public import Complexitylib.Models.TuringMachine.UTM.Internal.VTape +public import Complexitylib.Models.TuringMachine.Hoare.Defs +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +public import Complexitylib.Encoding.Pairing /-! # UTM initialization machine @@ -31,6 +33,8 @@ or a blank in the middle of a 2-cell group in the α-region) make the machine halt immediately; the specification only covers well-formed inputs. -/ +@[expose] public section + namespace Complexity namespace TM @@ -87,7 +91,7 @@ instance : Fintype InitQ where /-- One step of a work-tape rewind: move the head of work tape `idx` left until it reads `▷`, then bounce right to cell 1 and enter `qnext`. All other tapes idle. -/ -private def rewindStep (idx : Fin 6) (qloop qnext : InitQ) +def rewindStep (idx : Fin 6) (qloop qnext : InitQ) (iHead : Γ) (wHeads : Fin 6 → Γ) (oHead : Γ) : InitQ × (Fin 6 → Γw) × Γw × Dir3 × (Fin 6 → Dir3) × Dir3 := if wHeads idx = Γ.start then diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/Interp.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/Interp.lean index f31d30b9..f49b8132 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/Interp.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/Interp.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.UTM.Internal.Desc -import Complexitylib.Models.TuringMachine.UTM.Encoding +module + +public import Complexitylib.Models.TuringMachine.UTM.Internal.Desc +public import Complexitylib.Models.TuringMachine.UTM.Encoding /-! # Interpreting machine descriptions @@ -29,6 +31,8 @@ table lists every `(state, symbols)` combination densely. - `descOfTM_decidesInTime` — language and running time carry over exactly -/ +@[expose] public section + namespace Complexity namespace TMDesc diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/NegOut.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/NegOut.lean index 3d41f4e7..cf3b9e0a 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/NegOut.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/NegOut.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Hoare.Defs -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +module + +public import Complexitylib.Models.TuringMachine.Hoare.Defs +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic /-! # Output negation phase: `negOutTM` @@ -42,6 +44,8 @@ writes and `idleDir` moves); the output cells are unchanged except cell 1. the output head parked at cell 1, and `inp = inp₀`, `work = work₀`. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/PairSelf.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/PairSelf.lean index 0366eff0..f315952d 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/PairSelf.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/PairSelf.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.NP.Internal.PairBuildTM -import Complexitylib.Models.TuringMachine.Subroutines.Internal +module + +public import Complexitylib.Classes.NP.Internal.PairBuildTM +public import Complexitylib.Models.TuringMachine.Subroutines.Internal /-! # `pairSelfTM`: build `pair x x` from input `x` @@ -42,6 +44,8 @@ clearWorkTM 0 erase work tape 0 back to the started blank tape - `pairSelfTime_le` — the clean quadratic bound `pairSelfTime n ≤ 58·(n+1)²` -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/SeekFrontier.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/SeekFrontier.lean index 979c4147..ab2576b6 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/SeekFrontier.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/SeekFrontier.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.UTM.Clock +module + +public import Complexitylib.Models.TuringMachine.UTM.Clock /-! # Frontier-seeking clock machine for the time-bounded universal machine @@ -27,6 +29,8 @@ steps, every other tape exactly preserved. Behavior from head 1 on frontier `V = max V 1`, halting. Total `V + 1` steps. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/Sim.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/Sim.lean index e3a0afd5..e96a7e3c 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/Sim.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/Sim.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.UTM.Machine -import Complexitylib.Models.TuringMachine.UTM.Internal.BodyAssembly -import Complexitylib.Models.TuringMachine.UTM.Internal.Init +module + +public import Complexitylib.Models.TuringMachine.UTM.Machine +public import Complexitylib.Models.TuringMachine.UTM.Internal.BodyAssembly +public import Complexitylib.Models.TuringMachine.UTM.Internal.Init /-! # Universal machine: simulation bridges @@ -24,6 +26,8 @@ The completed loop simulation and headline universal-machine theorems are in `UTM/SimLoop.lean` and `UTM/Universal.lean`. -/ +@[expose] public section + namespace Complexity namespace TM.UTMBody diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/SimClocked.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/SimClocked.lean index 8e6fb2ee..3c5a13cc 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/SimClocked.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/SimClocked.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.UTM.Internal.SimLoop -import Complexitylib.Models.TuringMachine.UTM.Internal.ClockFrontier +module + +public import Complexitylib.Models.TuringMachine.UTM.Internal.SimLoop +public import Complexitylib.Models.TuringMachine.UTM.Internal.ClockFrontier /-! # Universal machine: the clocked (time-bounded) simulate/halt-test loop @@ -51,6 +53,8 @@ the state tape (`SimInv` at the final interpreted configuration makes a subsequent halt test conclusive via `simInv_verdict`). -/ +@[expose] public section + namespace Complexity namespace TM.UTMBody diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/SimLoop.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/SimLoop.lean index 829852c2..86e6013b 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/SimLoop.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/SimLoop.lean @@ -3,10 +3,12 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.UTM.Internal.BodyIteration -import Complexitylib.Models.TuringMachine.UTM.Internal.Sim -import Complexitylib.Models.TuringMachine.Combinators.Internal.Loop -import Complexitylib.Models.TuringMachine.Hoare +module + +public import Complexitylib.Models.TuringMachine.UTM.Internal.BodyIteration +public import Complexitylib.Models.TuringMachine.UTM.Internal.Sim +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Loop +public import Complexitylib.Models.TuringMachine.Hoare /-! # Universal machine: the simulate/halt-test loop @@ -46,6 +48,8 @@ halted-configurations-don't-step principle (`TM.reachesIn_le_halt`) identify the loop's exit configuration with `mcF`. -/ +@[expose] public section + namespace Complexity namespace TM.UTMBody diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/StepGlue.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/StepGlue.lean index 8229e763..792fc5be 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/StepGlue.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/StepGlue.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.UTM.Internal.BodyAssembly -import Complexitylib.Models.TuringMachine.UTM.Internal.BodyLookup +module + +public import Complexitylib.Models.TuringMachine.UTM.Internal.BodyAssembly +public import Complexitylib.Models.TuringMachine.UTM.Internal.BodyLookup /-! # Glue facts: phase outputs vs the interpreted step @@ -19,6 +21,8 @@ Small bridges used when matching the body's phase outputs against the identity on them. -/ +@[expose] public section + namespace Complexity namespace TM.UTMBody diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/TermCheck.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/TermCheck.lean index 7afdae1b..07218643 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/TermCheck.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/TermCheck.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.UTM.Internal.BodyIteration -import Complexitylib.Models.TuringMachine.Registers +module + +public import Complexitylib.Models.TuringMachine.UTM.Internal.BodyIteration +public import Complexitylib.Models.TuringMachine.Registers /-! # `termCheckTM`: deciding `TerminatedRegion` by a single input scan @@ -31,6 +33,8 @@ Contents: `Γ.one`/`Γ.zero` at output cell 1 (output head parked back at 1). -/ +@[expose] public section + namespace Complexity namespace TM.UTMBody diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/Terminated.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/Terminated.lean index fcc7ee5f..fe412bb5 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/Terminated.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/Terminated.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.UTM.Internal.BodyIteration +module + +public import Complexitylib.Models.TuringMachine.UTM.Internal.BodyIteration /-! # `TerminatedRegion` for encoded descriptions @@ -22,6 +24,8 @@ separator `□`. Extracted tables are nonempty (`descOfTM_entries_ne_nil`), since every machine has at least its start state. -/ +@[expose] public section + namespace Complexity namespace TM.UTMBody diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/VTape.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/VTape.lean index 46b109f3..095f0e1c 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/VTape.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/VTape.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine +module + +public import Complexitylib.Models.TuringMachine /-! # Virtual tapes: the +1 shift representation @@ -41,6 +43,8 @@ Under this shift the one-sided tape dynamics correspond exactly: - `VShift.init` — the initial correspondence -/ +@[expose] public section + namespace Complexity -- ════════════════════════════════════════════════════════════════════════ diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/Verdict.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/Verdict.lean index fd62b499..ba3a831d 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/Verdict.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/Verdict.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.UTM.Internal.Interp -import Complexitylib.Mathlib.NatBits -import Complexitylib.Models.TuringMachine.UTM.Internal.HaltTest +module + +public import Complexitylib.Models.TuringMachine.UTM.Internal.Interp +public import Complexitylib.Mathlib.NatBits +public import Complexitylib.Models.TuringMachine.UTM.Internal.HaltTest /-! # Halt-test verdict correspondence @@ -23,6 +25,8 @@ halt check of the interpreted machine `(decodeDesc α).toTM`: the interpreted machine sits exactly at its (clamped) halt state. -/ +@[expose] public section + namespace Complexity namespace TM.UTMBody diff --git a/Complexitylib/Models/TuringMachine/UTM/Machine.lean b/Complexitylib/Models/TuringMachine/UTM/Machine.lean index 8d7c752e..1ba7c394 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Machine.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Machine.lean @@ -3,11 +3,13 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators -import Complexitylib.Models.TuringMachine.UTM.Internal.Init -import Complexitylib.Models.TuringMachine.UTM.Internal.Body -import Complexitylib.Models.TuringMachine.UTM.Internal.HaltTest -import Complexitylib.Models.TuringMachine.UTM.Internal.Extract +module + +public import Complexitylib.Models.TuringMachine.Combinators +public import Complexitylib.Models.TuringMachine.UTM.Internal.Init +public import Complexitylib.Models.TuringMachine.UTM.Internal.Body +public import Complexitylib.Models.TuringMachine.UTM.Internal.HaltTest +public import Complexitylib.Models.TuringMachine.UTM.Internal.Extract /-! # The universal Turing machine @@ -28,6 +30,8 @@ the simulation and time-bound theorems are assembled in `UTM/Sim.lean` from the phase Hoare triples. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/Models/TuringMachine/UTM/Universal.lean b/Complexitylib/Models/TuringMachine/UTM/Universal.lean index 304a4cb2..1f7269b2 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Universal.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Universal.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.UTM.Internal.SimLoop -import Complexitylib.Models.TuringMachine.UTM.Internal.Terminated -import Complexitylib.Models.TuringMachine.Deterministic +module + +public import Complexitylib.Models.TuringMachine.UTM.Internal.SimLoop +public import Complexitylib.Models.TuringMachine.UTM.Internal.Terminated +public import Complexitylib.Models.TuringMachine.Deterministic /-! # The universal machine: headline theorems @@ -25,6 +27,8 @@ import Complexitylib.Models.TuringMachine.Deterministic quadratic factor coming solely from the single-tape reduction. -/ +@[expose] public section + namespace Complexity namespace TM.UTMBody diff --git a/Complexitylib/Models/TuringMachine/WorkReadOnly.lean b/Complexitylib/Models/TuringMachine/WorkReadOnly.lean index 47c634ca..62551cba 100644 --- a/Complexitylib/Models/TuringMachine/WorkReadOnly.lean +++ b/Complexitylib/Models/TuringMachine/WorkReadOnly.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -import Complexitylib.Models.TuringMachine.Internal +module + +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +public import Complexitylib.Models.TuringMachine.Internal /-! # Read-only work-tape certificates @@ -14,6 +16,8 @@ of `tm` writes the symbol already read on work tape `idx`. The head may move, but valid tape contents are preserved through every finite run. -/ +@[expose] public section + namespace Complexity namespace TM diff --git a/Complexitylib/SAT.lean b/Complexitylib/SAT.lean index 2ce8a543..afdc32ec 100644 --- a/Complexitylib/SAT.lean +++ b/Complexitylib/SAT.lean @@ -3,23 +3,25 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Semantics -import Complexitylib.SAT.Rename -import Complexitylib.SAT.ThreeCNF -import Complexitylib.SAT.ThreeSAT -import Complexitylib.SAT.ThreeSAT.Completeness -import Complexitylib.SAT.ThreeSAT.Syntax -import Complexitylib.SAT.Tseitin -import Complexitylib.SAT.Tseitin.Machine -import Complexitylib.SAT.QBF -import Complexitylib.SAT.Resolution -import Complexitylib.SAT.Encoding -import Complexitylib.SAT.Language -import Complexitylib.SAT.Verifier -import Complexitylib.SAT.Headline -import Complexitylib.SAT.ThreeSAT.Headline -import Complexitylib.SAT.CookLevin -import Complexitylib.SAT.CookLevin.Assembly +module + +public import Complexitylib.SAT.Semantics +public import Complexitylib.SAT.Rename +public import Complexitylib.SAT.ThreeCNF +public import Complexitylib.SAT.ThreeSAT +public import Complexitylib.SAT.ThreeSAT.Completeness +public import Complexitylib.SAT.ThreeSAT.Syntax +public import Complexitylib.SAT.Tseitin +public import Complexitylib.SAT.Tseitin.Machine +public import Complexitylib.SAT.QBF +public import Complexitylib.SAT.Resolution +public import Complexitylib.SAT.Encoding +public import Complexitylib.SAT.Language +public import Complexitylib.SAT.Verifier +public import Complexitylib.SAT.Headline +public import Complexitylib.SAT.ThreeSAT.Headline +public import Complexitylib.SAT.CookLevin +public import Complexitylib.SAT.CookLevin.Assembly /-! # SAT: Boolean satisfiability @@ -47,3 +49,5 @@ infrastructure used by the polynomial-time verifier. - `Headline` / `CookLevin.Assembly` — `SAT ∈ NP` and the final NP-completeness theorem. -/ + +@[expose] public section diff --git a/Complexitylib/SAT/CookLevin.lean b/Complexitylib/SAT/CookLevin.lean index da2d729c..f96f7821 100644 --- a/Complexitylib/SAT/CookLevin.lean +++ b/Complexitylib/SAT/CookLevin.lean @@ -3,10 +3,12 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Headline -import Complexitylib.SAT.Rename -import Complexitylib.Classes.NP.Reduction -import Complexitylib.Models.TuringMachine.SingleTape +module + +public import Complexitylib.SAT.Headline +public import Complexitylib.SAT.Rename +public import Complexitylib.Classes.NP.Reduction +public import Complexitylib.Models.TuringMachine.SingleTape /-! # Cook–Levin tableau core @@ -38,6 +40,8 @@ the emitter implementation is split across the modules under `SAT/CookLevin/`. -/ +@[expose] public section + namespace Complexity open Complexity diff --git a/Complexitylib/SAT/CookLevin/Assembly.lean b/Complexitylib/SAT/CookLevin/Assembly.lean index 859ec996..1229283b 100644 --- a/Complexitylib/SAT/CookLevin/Assembly.lean +++ b/Complexitylib/SAT/CookLevin/Assembly.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.CookLevin.Internal.EmitterActive +module + +public import Complexitylib.SAT.CookLevin.Internal.EmitterActive /-! # The reduction emitter, assembled @@ -20,6 +22,8 @@ Cook–Levin reductions `cookLevin_reduction_singleTape` / `NPComplete_language` for the SAT language `language`. -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/CookLevin/Internal/Emitter.lean b/Complexitylib/SAT/CookLevin/Internal/Emitter.lean index 75e19e17..c47f87de 100644 --- a/Complexitylib/SAT/CookLevin/Internal/Emitter.lean +++ b/Complexitylib/SAT/CookLevin/Internal/Emitter.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.CookLevin -import Complexitylib.Models.TuringMachine.Registers.MixedRadix -import Complexitylib.Models.TuringMachine.Registers.DecReg +module + +public import Complexitylib.SAT.CookLevin +public import Complexitylib.Models.TuringMachine.Registers.MixedRadix +public import Complexitylib.Models.TuringMachine.Registers.DecReg /-! # The reduction emitter: clause and CNF machines @@ -22,6 +24,8 @@ these with the concrete descriptor lists mirroring each family's definition. -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/CookLevin/Internal/EmitterActive.lean b/Complexitylib/SAT/CookLevin/Internal/EmitterActive.lean index 356947df..7b3bb7e0 100644 --- a/Complexitylib/SAT/CookLevin/Internal/EmitterActive.lean +++ b/Complexitylib/SAT/CookLevin/Internal/EmitterActive.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.CookLevin.Internal.EmitterStart +module + +public import Complexitylib.SAT.CookLevin.Internal.EmitterStart /-! # The active-transition family emitter @@ -16,6 +18,8 @@ unrolled at definition level (`bigSeqTM` over their lists); rows and positions are runtime loops. -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/CookLevin/Internal/EmitterFamilies.lean b/Complexitylib/SAT/CookLevin/Internal/EmitterFamilies.lean index 819ff386..0ba9f0b7 100644 --- a/Complexitylib/SAT/CookLevin/Internal/EmitterFamilies.lean +++ b/Complexitylib/SAT/CookLevin/Internal/EmitterFamilies.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.CookLevin.Internal.EmitterLoop +module + +public import Complexitylib.SAT.CookLevin.Internal.EmitterLoop /-! # The clause-family emitters @@ -17,6 +19,8 @@ The emitter's tape layout is fixed once (`Emit.nT = 20` work tapes, named indices below), so register-distinctness side conditions are all `decide`. -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/CookLevin/Internal/EmitterLoop.lean b/Complexitylib/SAT/CookLevin/Internal/EmitterLoop.lean index 4778d05f..c9ffaf82 100644 --- a/Complexitylib/SAT/CookLevin/Internal/EmitterLoop.lean +++ b/Complexitylib/SAT/CookLevin/Internal/EmitterLoop.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.CookLevin.Internal.Emitter +module + +public import Complexitylib.SAT.CookLevin.Internal.Emitter /-! # The emitter loop driver @@ -21,6 +23,8 @@ discharges every `LitDesc.Spec` obligation) and the `encode`/`flatMap` distribution lemma. -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/CookLevin/Internal/EmitterStart.lean b/Complexitylib/SAT/CookLevin/Internal/EmitterStart.lean index 2c7d2e8b..05c0dee2 100644 --- a/Complexitylib/SAT/CookLevin/Internal/EmitterStart.lean +++ b/Complexitylib/SAT/CookLevin/Internal/EmitterStart.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.CookLevin.Internal.EmitterFamilies -import Complexitylib.Models.TuringMachine.Registers.Probe +module + +public import Complexitylib.SAT.CookLevin.Internal.EmitterFamilies +public import Complexitylib.Models.TuringMachine.Registers.Probe /-! # The start-clause family emitter @@ -17,6 +19,8 @@ the scratch, emit. Tapes 1 and 2 are blank beyond `▷`, so their loops are ordinary constant-digit clause loops. -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Encoding.lean b/Complexitylib/SAT/Encoding.lean index 9ebd8f9d..03ef8f7c 100644 --- a/Complexitylib/SAT/Encoding.lean +++ b/Complexitylib/SAT/Encoding.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Semantics -import Mathlib.Tactic.Ring -import Mathlib.Tactic.Linarith +module + +public import Complexitylib.SAT.Semantics +public import Mathlib.Tactic.Ring +public import Mathlib.Tactic.Linarith /-! # SAT: Encoding Layer @@ -51,6 +53,8 @@ The matching executable decoder `CNF.decode?`, its round-trip theorem, and its soundness theorem live with the token parser in `Complexitylib.SAT.Verifier`. -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Headline.lean b/Complexitylib/SAT/Headline.lean index f52e7964..0a4ac41d 100644 --- a/Complexitylib/SAT/Headline.lean +++ b/Complexitylib/SAT/Headline.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.VerifierTM -import Complexitylib.SAT.Internal.GuessVerify +module + +public import Complexitylib.SAT.VerifierTM +public import Complexitylib.SAT.Internal.GuessVerify /-! # SAT ∈ NP — the headline theorem @@ -20,6 +22,8 @@ This file ties together the two halves of the `SAT ∈ NP` proof: Combining them yields the unconditional theorem `SAT.language_mem_NP : language ∈ NP`. -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Internal/GuessVerify.lean b/Complexitylib/SAT/Internal/GuessVerify.lean index 1add91b1..3b7a45a6 100644 --- a/Complexitylib/SAT/Internal/GuessVerify.lean +++ b/Complexitylib/SAT/Internal/GuessVerify.lean @@ -3,13 +3,15 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Language -import Complexitylib.Asymptotics -import Complexitylib.Classes.NP.Internal.PairBuildTM -import Complexitylib.Models.TuringMachine.Subroutines.GuessBounded -import Complexitylib.Models.TuringMachine.Subroutines.Internal -import Complexitylib.Models.TuringMachine.Combinators.Internal.Retarget -import Complexitylib.Models.TuringMachine.Trace +module + +public import Complexitylib.SAT.Language +public import Complexitylib.Asymptotics +public import Complexitylib.Classes.NP.Internal.PairBuildTM +public import Complexitylib.Models.TuringMachine.Subroutines.GuessBounded +public import Complexitylib.Models.TuringMachine.Subroutines.Internal +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Retarget +public import Complexitylib.Models.TuringMachine.Trace /-! # SAT-specialized guess-and-verify NTM @@ -33,6 +35,8 @@ counter setup, input rewind, bounded guessing, pair building, and verifier simulation. -/ +@[expose] public section + namespace Complexity namespace SAT @@ -159,14 +163,15 @@ instance {Q : Type} [DecidableEq Q] [Fintype Q] : Fintype (GuessVerifyPhase Q) w def verifierStartedState (M : TM k) : M.Q := (M.δ M.qstart Γ.start (fun _ : Fin k => Γ.start) Γ.start).1 -private def phaseBoundary {Q : Type} (q : GuessVerifyPhase Q) +@[nolint docBlame] +def phaseBoundary {Q : Type} (q : GuessVerifyPhase Q) (iHead : Γ) (wHeads : Fin (k + 3) → Γ) (oHead : Γ) : GuessVerifyPhase Q × (Fin (k + 3) → Γw) × Γw × Dir3 × (Fin (k + 3) → Dir3) × Dir3 := (q, fun i => readBackWrite (wHeads i), readBackWrite oHead, idleDir iHead, fun i => idleDir (wHeads i), idleDir oHead) -private theorem phaseBoundary_right_of_start {Q : Type} (q : GuessVerifyPhase Q) +theorem phaseBoundary_right_of_start {Q : Type} (q : GuessVerifyPhase Q) (iHead : Γ) (wHeads : Fin (k + 3) → Γ) (oHead : Γ) : (iHead = Γ.start → (phaseBoundary (k := k) q iHead wHeads oHead).2.2.2.1 = Dir3.right) ∧ (∀ i, wHeads i = Γ.start → @@ -174,7 +179,8 @@ private theorem phaseBoundary_right_of_start {Q : Type} (q : GuessVerifyPhase Q) (oHead = Γ.start → (phaseBoundary (k := k) q iHead wHeads oHead).2.2.2.2.2 = Dir3.right) := rightOfStart_allIdle iHead wHeads oHead -private def satVerifyTransition (M : TM k) (q : M.Q) +@[nolint docBlame] +def satVerifyTransition (M : TM k) (q : M.Q) (iHead : Γ) (wHeads : Fin (k + 3) → Γ) (oHead : Γ) : GuessVerifyPhase M.Q × (Fin (k + 3) → Γw) × Γw × Dir3 × (Fin (k + 3) → Dir3) × Dir3 := @@ -195,7 +201,7 @@ private def satVerifyTransition (M : TM k) (q : M.Q) else idleDir (wHeads i), outDir) -private theorem satVerifyTransition_right_of_start (M : TM k) (q : M.Q) +theorem satVerifyTransition_right_of_start (M : TM k) (q : M.Q) (iHead : Γ) (wHeads : Fin (k + 3) → Γ) (oHead : Γ) : let tr := satVerifyTransition M q iHead wHeads oHead (iHead = Γ.start → tr.2.2.2.1 = Dir3.right) ∧ @@ -221,7 +227,8 @@ private theorem satVerifyTransition_right_of_start (M : TM k) (q : M.Q) exact hwi) · simp [hip, idleDir_right_of_start hwi] -private def satGuessVerifyDelta (M : TM k) : +@[nolint docBlame] +def satGuessVerifyDelta (M : TM k) : Bool → GuessVerifyPhase M.Q → Γ → (Fin (k + 3) → Γ) → Γ → GuessVerifyPhase M.Q × (Fin (k + 3) → Γw) × Γw × Dir3 × (Fin (k + 3) → Dir3) × Dir3 := @@ -259,7 +266,7 @@ private def satGuessVerifyDelta (M : TM k) : | .verify q => satVerifyTransition M q iHead wHeads oHead -private theorem satGuessVerifyDelta_right_of_start (M : TM k) +theorem satGuessVerifyDelta_right_of_start (M : TM k) (choice : Bool) (state : GuessVerifyPhase M.Q) (iHead : Γ) (wHeads : Fin (k + 3) → Γ) (oHead : Γ) : let tr := satGuessVerifyDelta M choice state iHead wHeads oHead @@ -467,7 +474,7 @@ theorem verifier_started_trace_decides_of_decidesInTime (M : TM k) rw [htrace] exact ⟨hhalt, hyes, hno⟩ -private theorem satTape_writeBack_eq_move (t : Tape) (d : Dir3) +theorem satTape_writeBack_eq_move (t : Tape) (d : Dir3) (h : t.head = 0 ∨ t.read ≠ Γ.start) : t.writeAndMove (readBackWrite t.read).toΓ d = t.move d := by show (t.write (readBackWrite t.read).toΓ).move d = t.move d @@ -481,7 +488,7 @@ private theorem satTape_writeBack_eq_move (t : Tape) (d : Dir3) simp [Tape.read, Function.update_eq_self] rw [hwrite] -private theorem tape_write_readBack_move_cells_ne_start (t : Tape) (d : Dir3) +theorem tape_write_readBack_move_cells_ne_start (t : Tape) (d : Dir3) (hclean : ∀ j, j ≥ 1 → t.cells j ≠ Γ.start) : ∀ j, j ≥ 1 → (t.writeAndMove (readBackWrite t.read).toΓ d).cells j ≠ Γ.start := by @@ -727,7 +734,7 @@ theorem satPair_cells_ne_start_of_initTape_ofBool_move_right (M : TM k) rw [hpair] exact Tape.init_ofBool_move_right_cells_ne_start bits -private theorem tape_eq_initTape_ofBool_move_right_of_head_cells +theorem tape_eq_initTape_ofBool_move_right_of_head_cells (t : Tape) (bits : List Bool) (hhead : t.head = 1) (hcells : t.cells = (Tape.init (bits.map Γ.ofBool)).cells) : @@ -881,7 +888,7 @@ theorem satGuessVerify_counter_trace_exit (M : TM k) (T : ℕ) funext i rfl -private theorem satCounter_trace_preserves_started_blank_other_work +theorem satCounter_trace_preserves_started_blank_other_work (T : ℕ) (choices : Fin T → Bool) (c : Cfg (k + 3) TM.LinearCounterPhase) (i : Fin (k + 3)) (hi : i ≠ satCounterIdx k) @@ -895,7 +902,7 @@ private theorem satCounter_trace_preserves_started_blank_other_work exact TM.inputLengthPlusOneCounterTM_toNTM_trace_one_preserves_started_blank_other_work (satCounterIdx k) (choices ⟨time, htime⟩) current i hi hcurrent -private theorem satCounter_trace_succ_initializes_blank_other_work +theorem satCounter_trace_succ_initializes_blank_other_work (T : ℕ) (choices : Fin (T + 1) → Bool) (c : Cfg (k + 3) TM.LinearCounterPhase) (i : Fin (k + 3)) (hi : i ≠ satCounterIdx k) @@ -913,7 +920,7 @@ private theorem satCounter_trace_succ_initializes_blank_other_work exact satCounter_trace_preserves_started_blank_other_work T (fun j => choices ⟨j.val + 1, by omega⟩) c1 i hi h1 -private theorem satCounter_trace_preserves_started_blank_output +theorem satCounter_trace_preserves_started_blank_output (T : ℕ) (choices : Fin T → Bool) (c : Cfg (k + 3) TM.LinearCounterPhase) (houtput : c.output = (Tape.init []).move Dir3.right) : @@ -926,7 +933,7 @@ private theorem satCounter_trace_preserves_started_blank_output exact TM.inputLengthPlusOneCounterTM_toNTM_trace_one_preserves_started_blank_output (satCounterIdx k) (choices ⟨time, htime⟩) current hcurrent -private theorem satCounter_trace_succ_initializes_blank_output +theorem satCounter_trace_succ_initializes_blank_output (T : ℕ) (choices : Fin (T + 1) → Bool) (c : Cfg (k + 3) TM.LinearCounterPhase) (hstate : c.state ≠ TM.LinearCounterPhase.done) @@ -943,7 +950,7 @@ private theorem satCounter_trace_succ_initializes_blank_output exact satCounter_trace_preserves_started_blank_output T (fun j => choices ⟨j.val + 1, by omega⟩) c1 h1 -private theorem satCounter_init_boundary_started_blank_other_work +theorem satCounter_init_boundary_started_blank_other_work (x : List Bool) (T : ℕ) (choices : Fin T → Bool) (i : Fin (k + 3)) (hi : i ≠ satCounterIdx k) : let counterNTM := (TM.inputLengthPlusOneCounterTM (satCounterIdx k)).toNTM @@ -982,7 +989,7 @@ private theorem satCounter_init_boundary_started_blank_other_work (counterNTM.trace (T + 1) choices c0).work i hread] exact htrace -private theorem satCounter_init_boundary_started_blank_output +theorem satCounter_init_boundary_started_blank_output (x : List Bool) (T : ℕ) (choices : Fin T → Bool) : let counterNTM := (TM.inputLengthPlusOneCounterTM (satCounterIdx k)).toNTM let c0 : Cfg (k + 3) TM.LinearCounterPhase := diff --git a/Complexitylib/SAT/Internal/LinearGuessVerify.lean b/Complexitylib/SAT/Internal/LinearGuessVerify.lean index 570bdd6b..b2a7d647 100644 --- a/Complexitylib/SAT/Internal/LinearGuessVerify.lean +++ b/Complexitylib/SAT/Internal/LinearGuessVerify.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Internal.GuessVerify +module + +public import Complexitylib.SAT.Internal.GuessVerify /-! # Generic linear-witness interface for the SAT guess-and-verify machine @@ -20,6 +22,8 @@ theorems for any relation with that same linear bound. language -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Language.lean b/Complexitylib/SAT/Language.lean index 7537ff68..81c86d0e 100644 --- a/Complexitylib/SAT/Language.lean +++ b/Complexitylib/SAT/Language.lean @@ -3,11 +3,13 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Semantics -import Complexitylib.SAT.Encoding -import Complexitylib.Classes.Pairing -import Complexitylib.Classes.FNP -import Complexitylib.Classes.NP.Witness +module + +public import Complexitylib.SAT.Semantics +public import Complexitylib.SAT.Encoding +public import Complexitylib.Classes.Pairing +public import Complexitylib.Classes.FNP +public import Complexitylib.Classes.NP.Witness /-! # SAT: Language and Witness Relation @@ -28,6 +30,8 @@ SAT-specialized guess-and-verify construction is assembled into the unconditional headline theorem in `SAT/Headline.lean`. -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/QBF.lean b/Complexitylib/SAT/QBF.lean index bdf0a635..9a444ab8 100644 --- a/Complexitylib/SAT/QBF.lean +++ b/Complexitylib/SAT/QBF.lean @@ -3,10 +3,12 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Mathlib.Data.Nat.Basic -import Mathlib.Data.Bool.Basic -import Mathlib.Logic.Function.Basic -import Mathlib.Data.Finset.Basic +module + +public import Mathlib.Data.Nat.Basic +public import Mathlib.Data.Bool.Basic +public import Mathlib.Logic.Function.Basic +public import Mathlib.Data.Finset.Basic /-! # Quantified Boolean formulas @@ -28,6 +30,8 @@ ranges over the two Boolean values substituted for `x_i` via `Function.update`. the quantifiers, phrased as existence/universality over the substituted value -/ +@[expose] public section + namespace Complexity /-- Quantified Boolean formulas over variables indexed by `ℕ`. -/ diff --git a/Complexitylib/SAT/Rename.lean b/Complexitylib/SAT/Rename.lean index 29bb9bf6..2aecf691 100644 --- a/Complexitylib/SAT/Rename.lean +++ b/Complexitylib/SAT/Rename.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Semantics +module + +public import Complexitylib.SAT.Semantics /-! # Variable renaming and satisfiability transport @@ -27,6 +29,8 @@ machine actually emits (`docs/A5-ReductionEmitter.md`). preserves satisfiability -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Resolution.lean b/Complexitylib/SAT/Resolution.lean index 4e471d6a..be7682c0 100644 --- a/Complexitylib/SAT/Resolution.lean +++ b/Complexitylib/SAT/Resolution.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Semantics +module + +public import Complexitylib.SAT.Semantics /-! # Resolution @@ -23,6 +25,8 @@ resolvent — is the semantic core underlying resolution proof systems. clause proves the formula unsatisfiable -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Semantics.lean b/Complexitylib/SAT/Semantics.lean index e8db8019..129d2309 100644 --- a/Complexitylib/SAT/Semantics.lean +++ b/Complexitylib/SAT/Semantics.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Mathlib.Data.List.Basic -import Mathlib.Data.Fintype.Pi -import Mathlib.Tactic.Linarith +module + +public import Mathlib.Data.List.Basic +public import Mathlib.Data.Fintype.Pi +public import Mathlib.Tactic.Linarith /-! # SAT: Semantic Layer @@ -39,6 +41,8 @@ exists, equal to a prefix of any longer one. This is essential for polynomial balance in the NP reduction. -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/ThreeCNF.lean b/Complexitylib/SAT/ThreeCNF.lean index 015d2366..6f978623 100644 --- a/Complexitylib/SAT/ThreeCNF.lean +++ b/Complexitylib/SAT/ThreeCNF.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Rename +module + +public import Complexitylib.SAT.Rename /-! # 3-CNF formulas @@ -25,6 +27,8 @@ turning an arbitrary CNF into an equisatisfiable 3-CNF — builds on this predic and is tracked separately. -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/ThreeSAT.lean b/Complexitylib/SAT/ThreeSAT.lean index fd32c79b..86ceeec8 100644 --- a/Complexitylib/SAT/ThreeSAT.lean +++ b/Complexitylib/SAT/ThreeSAT.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.ThreeCNF -import Complexitylib.SAT.Verifier +module + +public import Complexitylib.SAT.ThreeCNF +public import Complexitylib.SAT.Verifier /-! # Encoded CNF-SAT and 3SAT languages @@ -23,6 +25,8 @@ reduction claim is made here. - `ThreeSAT.fallbackEncoding` — valid no-instance output for malformed inputs -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/ThreeSAT/Completeness.lean b/Complexitylib/SAT/ThreeSAT/Completeness.lean index 1ea6e059..087e177c 100644 --- a/Complexitylib/SAT/ThreeSAT/Completeness.lean +++ b/Complexitylib/SAT/ThreeSAT/Completeness.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.NP.Reduction -import Complexitylib.SAT.CookLevin.Assembly -import Complexitylib.SAT.ThreeSAT.Headline -import Complexitylib.SAT.Tseitin.Machine +module + +public import Complexitylib.Classes.NP.Reduction +public import Complexitylib.SAT.CookLevin.Assembly +public import Complexitylib.SAT.ThreeSAT.Headline +public import Complexitylib.SAT.Tseitin.Machine /-! # NP-completeness of 3SAT @@ -23,6 +25,8 @@ headline NP-completeness theorem. - `ThreeSAT.NPComplete_language` -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/ThreeSAT/Headline.lean b/Complexitylib/SAT/ThreeSAT/Headline.lean index 73359930..949894b0 100644 --- a/Complexitylib/SAT/ThreeSAT/Headline.lean +++ b/Complexitylib/SAT/ThreeSAT/Headline.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Headline -import Complexitylib.SAT.Internal.LinearGuessVerify -import Complexitylib.SAT.ThreeSAT.Verifier -import Complexitylib.Classes.Containments +module + +public import Complexitylib.SAT.Headline +public import Complexitylib.SAT.Internal.LinearGuessVerify +public import Complexitylib.SAT.ThreeSAT.Verifier +public import Complexitylib.Classes.Containments /-! # 3SAT is in NP @@ -18,6 +20,8 @@ is in P. The generic linear-witness guess-and-verify construction then gives the headline theorem `ThreeSAT.language_mem_NP`. -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/ThreeSAT/Syntax.lean b/Complexitylib/SAT/ThreeSAT/Syntax.lean index 6e7e242b..17a9e76e 100644 --- a/Complexitylib/SAT/ThreeSAT/Syntax.lean +++ b/Complexitylib/SAT/ThreeSAT/Syntax.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.ThreeSAT -import Complexitylib.Classes.P -import Complexitylib.Models.TuringMachine.Combinators.Internal.Scanner +module + +public import Complexitylib.SAT.ThreeSAT +public import Complexitylib.Classes.P +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Scanner /-! # Regular syntax checker for exact 3-CNF encodings @@ -24,6 +26,8 @@ and makes the intended 3SAT decomposition explicit. - `ThreeSAT.language_eq_cnfsat_inter_syntax` -- semantic decomposition of 3SAT -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/ThreeSAT/Verifier.lean b/Complexitylib/SAT/ThreeSAT/Verifier.lean index 6f85ed7a..97227a83 100644 --- a/Complexitylib/SAT/ThreeSAT/Verifier.lean +++ b/Complexitylib/SAT/ThreeSAT/Verifier.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.ThreeSAT.Syntax -import Complexitylib.Classes.Pairing -import Complexitylib.Models.TuringMachine.Combinators.Internal.Scanner +module + +public import Complexitylib.SAT.ThreeSAT.Syntax +public import Complexitylib.Classes.Pairing +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Scanner /-! # Exact-3 syntax on paired verifier inputs @@ -22,6 +24,8 @@ exact-3 syntax checker. - `ThreeSAT.PairSyntax.language_mem_P` -- the paired syntax language is in P -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Tseitin.lean b/Complexitylib/SAT/Tseitin.lean index ed634385..feafb415 100644 --- a/Complexitylib/SAT/Tseitin.lean +++ b/Complexitylib/SAT/Tseitin.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.ThreeSAT -import Complexitylib.SAT.Tseitin.Defs -import Complexitylib.SAT.Tseitin.Internal.Correctness -import Complexitylib.SAT.Tseitin.Internal.Size +module + +public import Complexitylib.SAT.ThreeSAT +public import Complexitylib.SAT.Tseitin.Defs +public import Complexitylib.SAT.Tseitin.Internal.Correctness +public import Complexitylib.SAT.Tseitin.Internal.Size /-! # Size-controlled reduction from CNF-SAT to 3SAT @@ -29,6 +31,8 @@ separate from this semantic layer. - `ThreeSAT.reduction_correct` — total encoded membership equivalence -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Tseitin/Defs.lean b/Complexitylib/SAT/Tseitin/Defs.lean index c60fb205..f3ea44f4 100644 --- a/Complexitylib/SAT/Tseitin/Defs.lean +++ b/Complexitylib/SAT/Tseitin/Defs.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.ThreeCNF +module + +public import Complexitylib.SAT.ThreeCNF /-! # Tseitin splitting from CNF to exact 3-CNF @@ -21,6 +23,8 @@ Fresh counters are threaded across clauses, beginning above the largest source variable. Correctness and size theorems live in the internal and public layers. -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Tseitin/Internal/Correctness.lean b/Complexitylib/SAT/Tseitin/Internal/Correctness.lean index b856abed..1c1d5451 100644 --- a/Complexitylib/SAT/Tseitin/Internal/Correctness.lean +++ b/Complexitylib/SAT/Tseitin/Internal/Correctness.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Tseitin.Internal.FunctionSemantics -import Complexitylib.SAT.Tseitin.Internal.Shape +module + +public import Complexitylib.SAT.Tseitin.Internal.FunctionSemantics +public import Complexitylib.SAT.Tseitin.Internal.Shape /-! # Correctness of Tseitin clause splitting @@ -15,6 +17,8 @@ are chosen recursively while preserving all earlier variable values. The CNF proof threads those extensions across disjoint fresh ranges. -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Tseitin/Internal/EncodingBounds.lean b/Complexitylib/SAT/Tseitin/Internal/EncodingBounds.lean index 8d150aa6..3ce2c2f6 100644 --- a/Complexitylib/SAT/Tseitin/Internal/EncodingBounds.lean +++ b/Complexitylib/SAT/Tseitin/Internal/EncodingBounds.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Encoding -import Complexitylib.SAT.Tseitin.Defs +module + +public import Complexitylib.SAT.Encoding +public import Complexitylib.SAT.Tseitin.Defs /-! # Encoding-size support for Tseitin splitting @@ -14,6 +16,8 @@ unary-variable SAT bit encoding and bound exact-3 formulas whose variable indices share a common upper bound. -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Tseitin/Internal/FunctionSemantics.lean b/Complexitylib/SAT/Tseitin/Internal/FunctionSemantics.lean index 9a1072f5..9a2e2760 100644 --- a/Complexitylib/SAT/Tseitin/Internal/FunctionSemantics.lean +++ b/Complexitylib/SAT/Tseitin/Internal/FunctionSemantics.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Tseitin.Defs +module + +public import Complexitylib.SAT.Tseitin.Defs /-! # Total-function semantics for Tseitin splitting @@ -19,6 +21,8 @@ satisfiability notions equivalent, and records the congruence and update lemmas by the recursive Tseitin correctness proof. -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Tseitin/Internal/Shape.lean b/Complexitylib/SAT/Tseitin/Internal/Shape.lean index 42677bde..58a3d286 100644 --- a/Complexitylib/SAT/Tseitin/Internal/Shape.lean +++ b/Complexitylib/SAT/Tseitin/Internal/Shape.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Tseitin.Defs +module + +public import Complexitylib.SAT.Tseitin.Defs /-! # Structural properties of Tseitin clause splitting @@ -14,6 +16,8 @@ generated variable below the first unused counter, and has linear structural size in the source literal and clause counts. -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Tseitin/Internal/Size.lean b/Complexitylib/SAT/Tseitin/Internal/Size.lean index 4ea617aa..1e09e0d1 100644 --- a/Complexitylib/SAT/Tseitin/Internal/Size.lean +++ b/Complexitylib/SAT/Tseitin/Internal/Size.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Tseitin.Internal.EncodingBounds -import Complexitylib.SAT.Tseitin.Internal.Shape +module + +public import Complexitylib.SAT.Tseitin.Internal.EncodingBounds +public import Complexitylib.SAT.Tseitin.Internal.Shape /-! # Size bounds for Tseitin splitting @@ -14,6 +16,8 @@ Because the concrete SAT codec writes variable indices in unary, newly allocated indices make the honest bit-level bound quadratic in the source encoding length. -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Tseitin/Internal/StateBounds.lean b/Complexitylib/SAT/Tseitin/Internal/StateBounds.lean index 21997b16..ec2c1826 100644 --- a/Complexitylib/SAT/Tseitin/Internal/StateBounds.lean +++ b/Complexitylib/SAT/Tseitin/Internal/StateBounds.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Tseitin.Internal.Streaming +module + +public import Complexitylib.SAT.Tseitin.Internal.Streaming /-! # Register bounds for the streaming Tseitin transformation @@ -15,6 +17,8 @@ consumed. The concrete reduction machine uses this invariant to select one uniform register-operation budget for its entire input scan. -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Tseitin/Internal/Streaming.lean b/Complexitylib/SAT/Tseitin/Internal/Streaming.lean index 410ad59d..84092c99 100644 --- a/Complexitylib/SAT/Tseitin/Internal/Streaming.lean +++ b/Complexitylib/SAT/Tseitin/Internal/Streaming.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Tseitin.Defs -import Complexitylib.SAT.Verifier +module + +public import Complexitylib.SAT.Tseitin.Defs +public import Complexitylib.SAT.Verifier /-! # Streaming specification for the CNF-to-3CNF transformation @@ -23,6 +25,8 @@ variables are fresh. On a valid `CNF.tokens` stream, the emitted tokens and bits are exactly the encoding produced by `CNF.to3Aux` at that start value. -/ +@[expose] public section + namespace Complexity namespace SAT @@ -72,7 +76,7 @@ def initial (next : ℕ) : State := { next, pending := .zero, scan := .boundary, emitted := [] } /-- The token encoding of one completed output clause. -/ -private def clauseTokens (c : Clause) : List EncToken := +def clauseTokens (c : Clause) : List EncToken := CNF.tokens [c] /-- Incorporate a decoded source literal. The first three literals are kept; diff --git a/Complexitylib/SAT/Tseitin/Internal/StreamingEndpoint.lean b/Complexitylib/SAT/Tseitin/Internal/StreamingEndpoint.lean index 4c957487..150bd809 100644 --- a/Complexitylib/SAT/Tseitin/Internal/StreamingEndpoint.lean +++ b/Complexitylib/SAT/Tseitin/Internal/StreamingEndpoint.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Tseitin.Internal.Streaming +module + +public import Complexitylib.SAT.Tseitin.Internal.Streaming /-! # Successful streaming endpoints @@ -14,6 +16,8 @@ typed CNF token stream. The endpoint is recovered from the public `Internal.Streaming` remains the single source of truth. -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Tseitin/Machine.lean b/Complexitylib/SAT/Tseitin/Machine.lean index 0f8c7c6f..1857c939 100644 --- a/Complexitylib/SAT/Tseitin/Machine.lean +++ b/Complexitylib/SAT/Tseitin/Machine.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Classes.P.NormalForm -import Complexitylib.SAT.Tseitin.Machine.Controller -import Complexitylib.SAT.Tseitin.Machine.Internal.PolynomialTime +module + +public import Complexitylib.Classes.P.NormalForm +public import Complexitylib.SAT.Tseitin.Machine.Controller +public import Complexitylib.SAT.Tseitin.Machine.Internal.PolynomialTime /-! # Polynomial-time Tseitin reduction machine @@ -21,6 +23,8 @@ the fixed malformed-input fallback. - `ThreeSAT.reduction_mem_FP` -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Tseitin/Machine/Controller.lean b/Complexitylib/SAT/Tseitin/Machine/Controller.lean index 21522d31..ae1328ed 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Controller.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Controller.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Tseitin.Machine.Defs -import Mathlib.Data.Fintype.Sigma +module + +public import Complexitylib.SAT.Tseitin.Machine.Defs +public import Mathlib.Data.Fintype.Sigma /-! # Streaming controller for the CNF-to-3CNF reduction machine @@ -30,6 +32,8 @@ accounting live in proof-only internal modules and are exposed publicly by `Complexitylib.SAT.Tseitin.Machine`. -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Tseitin/Machine/Defs.lean b/Complexitylib/SAT/Tseitin/Machine/Defs.lean index 3eddfb4d..c9cf7335 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Defs.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Defs.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Lift -import Complexitylib.Models.TuringMachine.Registers.InputLen -import Complexitylib.SAT.ThreeSAT +module + +public import Complexitylib.Models.TuringMachine.Lift +public import Complexitylib.Models.TuringMachine.Registers.InputLen +public import Complexitylib.SAT.ThreeSAT /-! # Machine building blocks for the CNF-to-3CNF reduction @@ -36,6 +38,8 @@ these machines. - `reductionTMWith` — validate first, then branch to an emitter or fallback -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Tseitin/Machine/Internal/BranchFrame.lean b/Complexitylib/SAT/Tseitin/Machine/Internal/BranchFrame.lean index c2573b01..d0a0f267 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Internal/BranchFrame.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Internal/BranchFrame.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Tseitin.Machine.Internal.FrontEndSpec +module + +public import Complexitylib.SAT.Tseitin.Machine.Internal.FrontEndSpec /-! # Shared branch frame for the Tseitin reduction machine @@ -22,6 +24,8 @@ work registers, validator verdict, tape well-formedness, and the standard - `validationFramedPost_to_branchPre_internal` -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Tseitin/Machine/Internal/BufferSpecs.lean b/Complexitylib/SAT/Tseitin/Machine/Internal/BufferSpecs.lean index 79b613d2..9fe8c371 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Internal/BufferSpecs.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Internal/BufferSpecs.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Experimental.EmitSpec -import Complexitylib.SAT.Tseitin.Machine.Defs -import Mathlib.Tactic.FinCases +module + +public import Complexitylib.Models.TuringMachine.Experimental.EmitSpec +public import Complexitylib.SAT.Tseitin.Machine.Defs +public import Mathlib.Tactic.FinCases /-! # Hoare specifications for Tseitin literal buffers and emitters @@ -31,6 +33,8 @@ stable under later polynomial rounding. - `closeClauseTM_hoareTime_internal` -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerCalls.lean b/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerCalls.lean index 01b1eb6d..a08e6e99 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerCalls.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerCalls.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Tseitin.Machine.Internal.BufferSpecs -import Complexitylib.SAT.Tseitin.Machine.Internal.ControllerLift +module + +public import Complexitylib.SAT.Tseitin.Machine.Internal.BufferSpecs +public import Complexitylib.SAT.Tseitin.Machine.Internal.ControllerLift /-! # Completed child calls of the Tseitin streaming controller @@ -16,6 +18,8 @@ step, and exposes the resulting first-bit read state together with the exact buffer/output postcondition. -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerInput.lean b/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerInput.lean index aa3ae067..5d5ccf76 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerInput.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerInput.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Tseitin.Machine.Internal.ControllerRead -import Complexitylib.SAT.Tseitin.Machine.Internal.RuntimeBounds +module + +public import Complexitylib.SAT.Tseitin.Machine.Internal.ControllerRead +public import Complexitylib.SAT.Tseitin.Machine.Internal.RuntimeBounds /-! # Input framing for the Tseitin streaming controller @@ -16,6 +18,8 @@ the next two cells with the next token and normalize the frame after those two cells have been consumed. -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerInvariant.lean b/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerInvariant.lean index 694635f2..100a773a 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerInvariant.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerInvariant.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Tseitin.Internal.Streaming -import Complexitylib.SAT.Tseitin.Machine.Controller -import Complexitylib.SAT.Tseitin.Machine.Internal.BufferSpecs +module + +public import Complexitylib.SAT.Tseitin.Internal.Streaming +public import Complexitylib.SAT.Tseitin.Machine.Controller +public import Complexitylib.SAT.Tseitin.Machine.Internal.BufferSpecs /-! # Register invariant for the Tseitin streaming controller @@ -35,6 +37,8 @@ register-level Hoare specifications in `Machine.Internal.BufferSpecs`. - `StreamingStatePred` -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerLift.lean b/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerLift.lean index b40a2f55..66da55ed 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerLift.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerLift.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -import Complexitylib.SAT.Tseitin.Machine.Controller +module + +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +public import Complexitylib.SAT.Tseitin.Machine.Controller /-! # Child-execution lifting for the Tseitin streaming controller @@ -32,6 +34,8 @@ No token semantics are proved here. - `validEmitterTM_close_return_step_internal` -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerRead.lean b/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerRead.lean index 251bb039..f7e95377 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerRead.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerRead.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Tseitin.Machine.Internal.ControllerLift +module + +public import Complexitylib.SAT.Tseitin.Machine.Internal.ControllerLift /-! # Concrete read paths for the Tseitin streaming controller @@ -25,6 +27,8 @@ semantics remain separate layers. - `validEmitterTM_read_blank_reachesIn_internal` -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerRun.lean b/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerRun.lean index fb0a87c4..f990d35e 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerRun.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerRun.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Tseitin.Machine.Internal.ControllerInput -import Complexitylib.SAT.Tseitin.Machine.Internal.ControllerToken +module + +public import Complexitylib.SAT.Tseitin.Machine.Internal.ControllerInput +public import Complexitylib.SAT.Tseitin.Machine.Internal.ControllerToken /-! # Run simulation for the Tseitin streaming controller @@ -26,6 +28,8 @@ to the next layer. - `validEmitterTM_streaming_run_internal` -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerSemantics.lean b/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerSemantics.lean index 4d8eb543..9ed8f0c6 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerSemantics.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerSemantics.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Tseitin.Machine.Internal.ControllerInvariant -import Complexitylib.SAT.Tseitin.Machine.Internal.RuntimeBounds +module + +public import Complexitylib.SAT.Tseitin.Machine.Internal.ControllerInvariant +public import Complexitylib.SAT.Tseitin.Machine.Internal.RuntimeBounds /-! # Semantic glue for the streaming Tseitin controller @@ -26,6 +28,8 @@ The results are definitional seams used by the later controller induction. - `pendingBits_eq_closeClause_emitted_internal` -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerToken.lean b/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerToken.lean index 4a5cb8b0..f1a8c4a1 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerToken.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerToken.lean @@ -3,10 +3,12 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Tseitin.Machine.Internal.ControllerCalls -import Complexitylib.SAT.Tseitin.Machine.Internal.ControllerRead -import Complexitylib.SAT.Tseitin.Machine.Internal.ControllerSemantics -import Complexitylib.SAT.Tseitin.Machine.Internal.RuntimeBounds +module + +public import Complexitylib.SAT.Tseitin.Machine.Internal.ControllerCalls +public import Complexitylib.SAT.Tseitin.Machine.Internal.ControllerRead +public import Complexitylib.SAT.Tseitin.Machine.Internal.ControllerSemantics +public import Complexitylib.SAT.Tseitin.Machine.Internal.RuntimeBounds /-! # One-token simulation for the Tseitin streaming controller @@ -26,6 +28,8 @@ later induction over `Streaming.run` can instantiate it directly. - `validEmitterTM_streaming_step_internal` -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Tseitin/Machine/Internal/EmitterSpec.lean b/Complexitylib/SAT/Tseitin/Machine/Internal/EmitterSpec.lean index 1904b50c..01b76b0c 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Internal/EmitterSpec.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Internal/EmitterSpec.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Tseitin.Internal.StreamingEndpoint -import Complexitylib.SAT.Tseitin.Machine.Internal.BranchFrame -import Complexitylib.SAT.Tseitin.Machine.Internal.ControllerRun +module + +public import Complexitylib.SAT.Tseitin.Internal.StreamingEndpoint +public import Complexitylib.SAT.Tseitin.Machine.Internal.BranchFrame +public import Complexitylib.SAT.Tseitin.Machine.Internal.ControllerRun /-! # Typed-input specification for the Tseitin valid emitter @@ -27,6 +29,8 @@ rounds it to the library's explicit quartic envelope. - `validEmitterTM_hoareTime_quartic_internal` -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Tseitin/Machine/Internal/Execution.lean b/Complexitylib/SAT/Tseitin/Machine/Internal/Execution.lean index c407bd0f..61fb14e0 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Internal/Execution.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Internal/Execution.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -import Complexitylib.SAT.Tseitin.Machine.Internal.ValidationFramed +module + +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +public import Complexitylib.SAT.Tseitin.Machine.Internal.ValidationFramed /-! # Execution of the Tseitin syntax-validation machine @@ -24,6 +26,8 @@ started execution theorem. - `validationTM_hoareTime_internal` — compositional `HoareTime` interface -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Tseitin/Machine/Internal/FrontEndSpec.lean b/Complexitylib/SAT/Tseitin/Machine/Internal/FrontEndSpec.lean index 39f39125..6f19c398 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Internal/FrontEndSpec.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Internal/FrontEndSpec.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Tseitin.Machine.Internal.Setup -import Complexitylib.SAT.Tseitin.Machine.Internal.ValidationFramed +module + +public import Complexitylib.SAT.Tseitin.Machine.Internal.Setup +public import Complexitylib.SAT.Tseitin.Machine.Internal.ValidationFramed /-! # Hoare specification for the Tseitin reduction front end @@ -29,6 +31,8 @@ The resulting postcondition records all state needed by the branch assembly: `13(|z| + 1)` -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Tseitin/Machine/Internal/InvalidBranchSpec.lean b/Complexitylib/SAT/Tseitin/Machine/Internal/InvalidBranchSpec.lean index 4dfac22f..6f7e0e66 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Internal/InvalidBranchSpec.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Internal/InvalidBranchSpec.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Tseitin.Machine.Internal.BranchFrame +module + +public import Complexitylib.SAT.Tseitin.Machine.Internal.BranchFrame /-! # Invalid-input branch of the Tseitin reduction machine @@ -23,6 +25,8 @@ time bound are completely independent of the supplied `validEmitter`. - `reductionTMWith_invalid_reachesIn_internal` -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Tseitin/Machine/Internal/PolynomialTime.lean b/Complexitylib/SAT/Tseitin/Machine/Internal/PolynomialTime.lean index 6898a541..9ee7e6ba 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Internal/PolynomialTime.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Internal/PolynomialTime.lean @@ -3,12 +3,14 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Asymptotics -import Complexitylib.SAT.Tseitin -import Complexitylib.SAT.Tseitin.Machine.Internal.EmitterSpec -import Complexitylib.SAT.Tseitin.Machine.Internal.InvalidBranchSpec -import Complexitylib.SAT.Tseitin.Machine.Internal.ValidBranchAssembly -import Complexitylib.SAT.Tseitin.Machine.Internal.Validation +module + +public import Complexitylib.Asymptotics +public import Complexitylib.SAT.Tseitin +public import Complexitylib.SAT.Tseitin.Machine.Internal.EmitterSpec +public import Complexitylib.SAT.Tseitin.Machine.Internal.InvalidBranchSpec +public import Complexitylib.SAT.Tseitin.Machine.Internal.ValidBranchAssembly +public import Complexitylib.SAT.Tseitin.Machine.Internal.Validation /-! # Polynomial-time correctness of the Tseitin reduction machine @@ -26,6 +28,8 @@ bit length. - `reductionTM_computesInTime_internal` -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Tseitin/Machine/Internal/RuntimeBounds.lean b/Complexitylib/SAT/Tseitin/Machine/Internal/RuntimeBounds.lean index d78f58f9..2dffd034 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Internal/RuntimeBounds.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Internal/RuntimeBounds.lean @@ -3,9 +3,11 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Registers.Horner -import Complexitylib.SAT.Tseitin.Internal.StateBounds -import Complexitylib.SAT.Tseitin.Machine.Internal.ControllerInvariant +module + +public import Complexitylib.Models.TuringMachine.Registers.Horner +public import Complexitylib.SAT.Tseitin.Internal.StateBounds +public import Complexitylib.SAT.Tseitin.Machine.Internal.ControllerInvariant /-! # Coarse runtime bounds for the streaming Tseitin controller @@ -28,6 +30,8 @@ overhead. The complete token pass is bounded by an explicit quartic. - `typed_controllerRun_le_quartic_internal` -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Tseitin/Machine/Internal/Setup.lean b/Complexitylib/SAT/Tseitin/Machine/Internal/Setup.lean index 01f886dc..d476647c 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Internal/Setup.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Internal/Setup.lean @@ -3,8 +3,10 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine.Subroutines.Internal -import Complexitylib.SAT.Tseitin.Machine.Defs +module + +public import Complexitylib.Models.TuringMachine.Subroutines.Internal +public import Complexitylib.SAT.Tseitin.Machine.Defs /-! # Setup specifications for the Tseitin reduction machine @@ -25,6 +27,8 @@ are preserved. - `fallbackEmitter_hoareTime_internal` — emit the fixed fallback from a clear output -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Tseitin/Machine/Internal/ValidBranchAssembly.lean b/Complexitylib/SAT/Tseitin/Machine/Internal/ValidBranchAssembly.lean index 42fa43c9..fc62afe4 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Internal/ValidBranchAssembly.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Internal/ValidBranchAssembly.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Tseitin.Machine.Internal.BranchFrame +module + +public import Complexitylib.SAT.Tseitin.Machine.Internal.BranchFrame /-! # Valid-input assembly for the Tseitin reduction machine @@ -24,6 +26,8 @@ which is exactly the final transition performed by `ifTM`. - `reductionTMWith_valid_emit_reachesIn_internal` -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Tseitin/Machine/Internal/Validation.lean b/Complexitylib/SAT/Tseitin/Machine/Internal/Validation.lean index 1351d266..f8240466 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Internal/Validation.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Internal/Validation.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Tseitin.Machine.Defs +module + +public import Complexitylib.SAT.Tseitin.Machine.Defs /-! # Correctness of the pure Tseitin input validator @@ -15,6 +17,8 @@ streams, then transports that characterization across the concrete two-bit tokenization. -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Tseitin/Machine/Internal/ValidationFramed.lean b/Complexitylib/SAT/Tseitin/Machine/Internal/ValidationFramed.lean index f417fc08..55a8f57e 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Internal/ValidationFramed.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Internal/ValidationFramed.lean @@ -3,7 +3,9 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Tseitin.Machine.Defs +module + +public import Complexitylib.SAT.Tseitin.Machine.Defs /-! # Framed execution of the Tseitin syntax validator @@ -21,6 +23,8 @@ its Boolean verdict, for a total of `|z| + 1` steps. - `validationTM_started_framed_hoareTime_internal` -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Tseitin/Machine/Validation.lean b/Complexitylib/SAT/Tseitin/Machine/Validation.lean index 8bace7c6..8b77274d 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Validation.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Validation.lean @@ -3,12 +3,14 @@ Copyright (c) 2026 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Tseitin -import Complexitylib.SAT.Tseitin.Internal.Streaming -import Complexitylib.SAT.Tseitin.Machine.Controller -import Complexitylib.SAT.Tseitin.Machine.Internal.Execution -import Complexitylib.SAT.Tseitin.Machine.Internal.PolynomialTime -import Complexitylib.SAT.Tseitin.Machine.Internal.Validation +module + +public import Complexitylib.SAT.Tseitin +public import Complexitylib.SAT.Tseitin.Internal.Streaming +public import Complexitylib.SAT.Tseitin.Machine.Controller +public import Complexitylib.SAT.Tseitin.Machine.Internal.Execution +public import Complexitylib.SAT.Tseitin.Machine.Internal.PolynomialTime +public import Complexitylib.SAT.Tseitin.Machine.Internal.Validation /-! # Executable validation for the Tseitin reduction front end @@ -28,6 +30,8 @@ to the executable guards, its imported proof layer establishes: within one explicit quartic bound. -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/Verifier.lean b/Complexitylib/SAT/Verifier.lean index 7af8461b..40b21940 100644 --- a/Complexitylib/SAT/Verifier.lean +++ b/Complexitylib/SAT/Verifier.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Language +module + +public import Complexitylib.SAT.Language /-! # SAT verifier specification @@ -20,6 +22,8 @@ computes this specification and proves `pairLang Witness ∈ P`; this file is the small executable/semantic audit surface for that machine proof. -/ +@[expose] public section + namespace Complexity namespace SAT diff --git a/Complexitylib/SAT/VerifierTM.lean b/Complexitylib/SAT/VerifierTM.lean index 4466ddc5..b53f6964 100644 --- a/Complexitylib/SAT/VerifierTM.lean +++ b/Complexitylib/SAT/VerifierTM.lean @@ -3,15 +3,17 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.SAT.Verifier -import Complexitylib.Models.TuringMachine.Subroutines.PairSplit -import Complexitylib.Models.TuringMachine.Subroutines.Counter -import Complexitylib.Models.TuringMachine.Combinators -import Complexitylib.Models.TuringMachine.Combinators.Internal.Retarget -import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -import Complexitylib.Models.TuringMachine.Hoare -import Complexitylib.Models.TuringMachine.Hoare.Defs -import Complexitylib.Models.TuringMachine.Tape.Encoding +module + +public import Complexitylib.SAT.Verifier +public import Complexitylib.Models.TuringMachine.Subroutines.PairSplit +public import Complexitylib.Models.TuringMachine.Subroutines.Counter +public import Complexitylib.Models.TuringMachine.Combinators +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Retarget +public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +public import Complexitylib.Models.TuringMachine.Hoare +public import Complexitylib.Models.TuringMachine.Hoare.Defs +public import Complexitylib.Models.TuringMachine.Tape.Encoding /-! # SAT verifier TMs @@ -36,6 +38,8 @@ paired witness language underlying `SAT.language ∈ NP` — is characterized both semantically and at the machine level. -/ +@[expose] public section + namespace Complexity namespace SAT @@ -46,7 +50,7 @@ namespace VerifierTM -- Small tape helpers -- ════════════════════════════════════════════════════════════════════════ -private theorem eq_initTape_move_right_of_cells_head_one {t : Tape} (bits : List Bool) +theorem eq_initTape_move_right_of_cells_head_one {t : Tape} (bits : List Bool) (hcells : t.cells = (Tape.init (bits.map Γ.ofBool)).cells) (hhead : t.head = 1) : t = (Tape.init (bits.map Γ.ofBool)).move Dir3.right := by @@ -63,53 +67,54 @@ private theorem eq_initTape_move_right_of_cells_head_one {t : Tape} (bits : List simp [Tape.init] exact Tape.eq_init_move_right_of_hasBinaryString hbits h0 -private theorem cells_eq_initTape_ofBool_cell0 {t : Tape} (bits : List Bool) +theorem cells_eq_initTape_ofBool_cell0 {t : Tape} (bits : List Bool) (hcells : t.cells = (Tape.init (bits.map Γ.ofBool)).cells) : t.cells 0 = Γ.start := by rw [hcells] simp [Tape.init] -private theorem cells_eq_initTape_ofBool_ne_start {t : Tape} (bits : List Bool) +theorem cells_eq_initTape_ofBool_ne_start {t : Tape} (bits : List Bool) (hcells : t.cells = (Tape.init (bits.map Γ.ofBool)).cells) : ∀ j, j ≥ 1 → t.cells j ≠ Γ.start := by intro j hj rw [hcells] exact Tape.init_ofBool_cells_ne_start bits j hj -private theorem read_ne_start_of_cells_eq_initTape_ofBool {t : Tape} (bits : List Bool) +theorem read_ne_start_of_cells_eq_initTape_ofBool {t : Tape} (bits : List Bool) (hcells : t.cells = (Tape.init (bits.map Γ.ofBool)).cells) (hhead : t.head ≥ 1) : t.read ≠ Γ.start := by simp [Tape.read] exact cells_eq_initTape_ofBool_ne_start bits hcells t.head hhead -private abbrev hasBoolSuffix := Tape.HasBinarySuffix +@[nolint docBlame] +abbrev hasBoolSuffix := Tape.HasBinarySuffix -private theorem initTape_move_right_hasBoolSuffix (bits : List Bool) : +theorem initTape_move_right_hasBoolSuffix (bits : List Bool) : hasBoolSuffix ((Tape.init (bits.map Γ.ofBool)).move Dir3.right) bits := Tape.init_move_right_hasBinarySuffix bits -private theorem hasBoolSuffix_read_cons {t : Tape} {b : Bool} {bits : List Bool} +theorem hasBoolSuffix_read_cons {t : Tape} {b : Bool} {bits : List Bool} (h : hasBoolSuffix t (b :: bits)) : t.read = Γ.ofBool b := h.read_cons -private theorem hasBoolSuffix_move_right_cons {t : Tape} {b : Bool} {bits : List Bool} +theorem hasBoolSuffix_move_right_cons {t : Tape} {b : Bool} {bits : List Bool} (h : hasBoolSuffix t (b :: bits)) : hasBoolSuffix (t.move Dir3.right) bits := h.move_right_cons -private theorem hasBoolSuffix_read_nil {t : Tape} +theorem hasBoolSuffix_read_nil {t : Tape} (h : hasBoolSuffix t []) : t.read = Γ.blank := h.read_nil -private theorem hasBoolSuffix_read_ne_start {t : Tape} {bits : List Bool} +theorem hasBoolSuffix_read_ne_start {t : Tape} {bits : List Bool} (h : hasBoolSuffix t bits) : t.read ≠ Γ.start := h.read_ne_start -private theorem retargetInput_step_preserves_input_of_read_ne_start {k : ℕ} (M : TM k) +theorem retargetInput_step_preserves_input_of_read_ne_start {k : ℕ} (M : TM k) {c c' : Cfg (k + 1) (TM.retargetInput M).Q} (hstep : (TM.retargetInput M).step c = some c') (hinp : c.input.read ≠ Γ.start) : @@ -121,7 +126,7 @@ private theorem retargetInput_step_preserves_input_of_read_ne_start {k : ℕ} (M subst hstep simp [TM.idleDir, hinp, Tape.move] -private theorem retargetInput_reachesIn_preserves_input_of_read_ne_start {k : ℕ} +theorem retargetInput_reachesIn_preserves_input_of_read_ne_start {k : ℕ} (M : TM k) {t : ℕ} {c c' : Cfg (k + 1) (TM.retargetInput M).Q} (hreach : (TM.retargetInput M).reachesIn t c c') @@ -135,12 +140,12 @@ private theorem retargetInput_reachesIn_preserves_input_of_read_ne_start {k : rw [← hmid] exact ih (by simpa [hmid] using hinp) -private theorem started_blank_output_read_ne_start : +theorem started_blank_output_read_ne_start : (((Tape.init []).move Dir3.right).read) ≠ Γ.start := by rw [Tape.init_nil_move_right_read] decide -private theorem unaryCounter_read_ne_start {t : Tape} {B : ℕ} +theorem unaryCounter_read_ne_start {t : Tape} {B : ℕ} (h : t.HasUnaryCounter B) : t.read ≠ Γ.start := by by_cases hB : B = 0 · subst hB @@ -150,11 +155,11 @@ private theorem unaryCounter_read_ne_start {t : Tape} {B : ℕ} rw [Tape.hasUnaryCounter_read_pos h hpos] simp -private theorem started_input_read_ne_start (α : List Bool) : +theorem started_input_read_ne_start (α : List Bool) : (((Tape.init (α.map Γ.ofBool)).move Dir3.right).read) ≠ Γ.start := by exact Tape.init_ofBool_move_right_read_ne_start α -private theorem fin2_ne_zero_eq_one (i : Fin 2) (h : i ≠ ⟨0, by omega⟩) : +theorem fin2_ne_zero_eq_one (i : Fin 2) (h : i ≠ ⟨0, by omega⟩) : i = ⟨1, by omega⟩ := by apply Fin.ext have hne0 : (i : ℕ) ≠ 0 := by @@ -276,7 +281,7 @@ def satLengthCheckTime (n : ℕ) : ℕ := -- Step lemmas -- ════════════════════════════════════════════════════════════════════════ -private theorem satLengthCheck_init_step (α : List Bool) (B : ℕ) +theorem satLengthCheck_init_step (α : List Bool) (B : ℕ) (c : Cfg 1 satLengthCheckTM.Q) (hstate : c.state = .init) (hinput : c.input = (Tape.init (α.map Γ.ofBool)).move Dir3.right) @@ -303,7 +308,7 @@ private theorem satLengthCheck_init_step (α : List Bool) (B : ℕ) · change TM.transitionTape c.output = c.output exact TM.transitionTape_eq_self hout' -private theorem satLengthCheck_scan_continue_step (α : List Bool) (B k : ℕ) +theorem satLengthCheck_scan_continue_step (α : List Bool) (B k : ℕ) (c : Cfg 1 satLengthCheckTM.Q) (hk : k < α.length) (hkB : k < B) @@ -339,7 +344,7 @@ private theorem satLengthCheck_scan_continue_step (α : List Bool) (B k : ℕ) · change TM.transitionTape c.output = c.output exact TM.transitionTape_eq_self hout' -private theorem satLengthCheck_scan_accept_step (α : List Bool) (B : ℕ) +theorem satLengthCheck_scan_accept_step (α : List Bool) (B : ℕ) (c : Cfg 1 satLengthCheckTM.Q) (hstate : c.state = .scan) (hinput_cells : c.input.cells = (Tape.init (α.map Γ.ofBool)).cells) @@ -366,7 +371,7 @@ private theorem satLengthCheck_scan_accept_step (α : List Bool) (B : ℕ) simp [Tape.move, Tape.init] simp [Tape.writeAndMove, Tape.move, Tape.write, ho_head, TM.idleDir, Γw.toΓ] -private theorem satLengthCheck_scan_reject_step (α : List Bool) (B : ℕ) +theorem satLengthCheck_scan_reject_step (α : List Bool) (B : ℕ) (c : Cfg 1 satLengthCheckTM.Q) (hB : B < α.length) (hstate : c.state = .scan) @@ -403,7 +408,7 @@ private theorem satLengthCheck_scan_reject_step (α : List Bool) (B : ℕ) -- Prefix scan loop -- ════════════════════════════════════════════════════════════════════════ -private theorem satLengthCheck_scan_prefix_loop (α : List Bool) (B : ℕ) : +theorem satLengthCheck_scan_prefix_loop (α : List Bool) (B : ℕ) : ∀ (m k : ℕ) (c : Cfg 1 satLengthCheckTM.Q), k + m ≤ α.length → k + m ≤ B → @@ -836,7 +841,7 @@ def satLengthCheckPassiveTM : TM 2 where | .done => exact TM.rightOfStart_allIdle iHead wHeads oHead -private theorem satLengthCheckPassive_init_step (α β : List Bool) (B : ℕ) +theorem satLengthCheckPassive_init_step (α β : List Bool) (B : ℕ) (c : Cfg 2 satLengthCheckPassiveTM.Q) (hstate : c.state = .init) (hinput : c.input = (Tape.init (α.map Γ.ofBool)).move Dir3.right) @@ -870,7 +875,7 @@ private theorem satLengthCheckPassive_init_step (α β : List Bool) (B : ℕ) · change TM.transitionTape c.output = c.output exact TM.transitionTape_eq_self hout' -private theorem satLengthCheckPassive_scan_continue_step (α β : List Bool) (B k : ℕ) +theorem satLengthCheckPassive_scan_continue_step (α β : List Bool) (B k : ℕ) (c : Cfg 2 satLengthCheckPassiveTM.Q) (hk : k < α.length) (hkB : k < B) @@ -913,7 +918,7 @@ private theorem satLengthCheckPassive_scan_continue_step (α β : List Bool) (B · change TM.transitionTape c.output = c.output exact TM.transitionTape_eq_self hout' -private theorem satLengthCheckPassive_scan_accept_step (α β : List Bool) (B : ℕ) +theorem satLengthCheckPassive_scan_accept_step (α β : List Bool) (B : ℕ) (c : Cfg 2 satLengthCheckPassiveTM.Q) (hstate : c.state = .scan) (hinput_cells : c.input.cells = (Tape.init (α.map Γ.ofBool)).cells) @@ -947,7 +952,7 @@ private theorem satLengthCheckPassive_scan_accept_step (α β : List Bool) (B : simp [Tape.move, Tape.init] simp [Tape.writeAndMove, Tape.move, Tape.write, ho_head, TM.idleDir, Γw.toΓ] -private theorem satLengthCheckPassive_scan_reject_step (α β : List Bool) (B : ℕ) +theorem satLengthCheckPassive_scan_reject_step (α β : List Bool) (B : ℕ) (c : Cfg 2 satLengthCheckPassiveTM.Q) (hB : B < α.length) (hstate : c.state = .scan) @@ -987,7 +992,7 @@ private theorem satLengthCheckPassive_scan_reject_step (α β : List Bool) (B : simp [Tape.move, Tape.init] simp [Tape.writeAndMove, Tape.move, Tape.write, ho_head, TM.idleDir, Γw.toΓ] -private theorem satLengthCheckPassive_scan_prefix_loop (α β : List Bool) (B : ℕ) : +theorem satLengthCheckPassive_scan_prefix_loop (α β : List Bool) (B : ℕ) : ∀ (m k : ℕ) (c : Cfg 2 satLengthCheckPassiveTM.Q), k + m ≤ α.length → k + m ≤ B → @@ -1290,21 +1295,25 @@ instance : Fintype SatEvalPhase where | rewindAlpha mode => simp -private def boolWrite (b : Bool) : Γw := +@[nolint docBlame] +def boolWrite (b : Bool) : Γw := if b then Γw.one else Γw.zero -private def readBit? : Γ → Option Bool +@[nolint docBlame] +def readBit? : Γ → Option Bool | Γ.zero => some false | Γ.one => some true | _ => none -private def assignmentBitAtHead (g : Γ) : Bool := +@[nolint docBlame] +def assignmentBitAtHead (g : Γ) : Bool := g = Γ.one -private def literalValueAtHead (sign : Bool) (g : Γ) : Bool := +@[nolint docBlame] +def literalValueAtHead (sign : Bool) (g : Γ) : Bool := assignmentBitAtHead g == sign -private theorem assignmentBitAtHead_initTape_eq_get (α : Assignment) (var : ℕ) : +theorem assignmentBitAtHead_initTape_eq_get (α : Assignment) (var : ℕ) : assignmentBitAtHead ((Tape.init (α.map Γ.ofBool)).cells (var + 1)) = Assignment.get α var := by by_cases h : var < α.length @@ -1315,23 +1324,26 @@ private theorem assignmentBitAtHead_initTape_eq_get (α : Assignment) (var : ℕ rw [Tape.init_ofBool_cells_ge α var hge] simp [assignmentBitAtHead, Assignment.get, List.getElem?_eq_none hge] -private theorem literalValueAtHead_initTape_eq_litEval +theorem literalValueAtHead_initTape_eq_litEval (α : Assignment) (sign : Bool) (var : ℕ) : literalValueAtHead sign ((Tape.init (α.map Γ.ofBool)).cells (var + 1)) = (Assignment.get α var == sign) := by simp [literalValueAtHead, assignmentBitAtHead_initTape_eq_get] -private def finishEvalMode : SatEvalMode → Γw +@[nolint docBlame] +def finishEvalMode : SatEvalMode → Γw | .boundary cnf _clause empty => boolWrite (cnf && empty) | .inLit .. => Γw.zero -private def satEvalReject {n : ℕ} (state : SatEvalPhase) +@[nolint docBlame] +def satEvalReject {n : ℕ} (state : SatEvalPhase) (iHead : Γ) (wHeads : Fin n → Γ) (oHead : Γ) : SatEvalPhase × (Fin n → Γw) × Γw × Dir3 × (Fin n → Dir3) × Dir3 := (state, fun i => TM.readBackWrite (wHeads i), Γw.zero, TM.idleDir iHead, fun i => TM.idleDir (wHeads i), TM.idleDir oHead) -private def satEvalTokenStep (mode : SatEvalMode) (tok : EncToken) (αHead : Γ) : +@[nolint docBlame] +def satEvalTokenStep (mode : SatEvalMode) (tok : EncToken) (αHead : Γ) : SatEvalPhase × Dir3 × Γw := match mode with | .boundary cnf clause empty => @@ -1352,14 +1364,16 @@ private def satEvalTokenStep (mode : SatEvalMode) (tok : EncToken) (αHead : Γ) | .clauseSep => (.done, Dir3.stay, Γw.zero) -private def tokenOfBits (first second : Bool) : EncToken := +@[nolint docBlame] +def tokenOfBits (first second : Bool) : EncToken := match first, second with | false, false => .bit false | true, true => .bit true | false, true => .litSep | true, false => .clauseSep -private def satEvalDelta : +@[nolint docBlame] +def satEvalDelta : SatEvalPhase → Γ → (Fin 1 → Γ) → Γ → SatEvalPhase × (Fin 1 → Γw) × Γw × Dir3 × (Fin 1 → Dir3) × Dir3 := fun state iHead wHeads oHead => @@ -1419,7 +1433,7 @@ private def satEvalDelta : | .done => TM.allIdle .done iHead wHeads oHead -private theorem satEvalDelta_right_of_start +theorem satEvalDelta_right_of_start (state : SatEvalPhase) (iHead : Γ) (wHeads : Fin 1 → Γ) (oHead : Γ) : let tr := satEvalDelta state iHead wHeads oHead (iHead = Γ.start → tr.2.2.2.1 = Dir3.right) ∧ @@ -1446,7 +1460,7 @@ def satEvalOnInputTM : TM 1 where intro state iHead wHeads oHead exact satEvalDelta_right_of_start state iHead wHeads oHead -private theorem satEval_readFirst_bit_step (mode : SatEvalMode) (b : Bool) +theorem satEval_readFirst_bit_step (mode : SatEvalMode) (b : Bool) (c : Cfg 1 satEvalOnInputTM.Q) (hstate : c.state = .readFirst mode) (hread : c.input.read = Γ.ofBool b) @@ -1483,7 +1497,7 @@ private theorem satEval_readFirst_bit_step (mode : SatEvalMode) (b : Bool) exact TM.transitionTape_eq_self hwork · exact TM.transitionTape_eq_self hout_read -private theorem satEval_readFirst_blank_step (mode : SatEvalMode) +theorem satEval_readFirst_blank_step (mode : SatEvalMode) (c : Cfg 1 satEvalOnInputTM.Q) (hstate : c.state = .readFirst mode) (hread : c.input.read = Γ.blank) @@ -1520,7 +1534,7 @@ private theorem satEval_readFirst_blank_step (mode : SatEvalMode) simp [c', Tape.writeAndMove, Tape.write, Tape.move, TM.idleDir, hout_read, ho_head, Γw.toΓ] -private theorem satEval_readSecond_bit_step (mode : SatEvalMode) (first second : Bool) +theorem satEval_readSecond_bit_step (mode : SatEvalMode) (first second : Bool) (c : Cfg 1 satEvalOnInputTM.Q) (hstate : c.state = .readSecond mode first) (hread : c.input.read = Γ.ofBool second) @@ -1556,7 +1570,7 @@ private theorem satEval_readSecond_bit_step (mode : SatEvalMode) (first second : simpa using hwork simp [c', tr, hwork0] -private theorem satEval_readSecond_blank_step (mode : SatEvalMode) (first : Bool) +theorem satEval_readSecond_blank_step (mode : SatEvalMode) (first : Bool) (c : Cfg 1 satEvalOnInputTM.Q) (hstate : c.state = .readSecond mode first) (hread : c.input.read = Γ.blank) @@ -1595,7 +1609,7 @@ private theorem satEval_readSecond_blank_step (mode : SatEvalMode) (first : Bool simp [c', Tape.writeAndMove, Tape.write, Tape.move, TM.idleDir, hout_read, ho_head, Γw.toΓ] -private theorem satEval_rewindAlpha_left_step (mode : SatEvalMode) +theorem satEval_rewindAlpha_left_step (mode : SatEvalMode) (c : Cfg 1 satEvalOnInputTM.Q) (hstate : c.state = .rewindAlpha mode) (hinp : c.input.read ≠ Γ.start) @@ -1628,7 +1642,7 @@ private theorem satEval_rewindAlpha_left_step (mode : SatEvalMode) · exact TM.tape_readBackWrite_preserves _ _ (Or.inr hread) · exact TM.transitionTape_eq_self hout_read -private theorem satEval_rewindAlpha_base_step (mode : SatEvalMode) +theorem satEval_rewindAlpha_base_step (mode : SatEvalMode) (c : Cfg 1 satEvalOnInputTM.Q) (hstate : c.state = .rewindAlpha mode) (hinp : c.input.read ≠ Γ.start) @@ -1668,7 +1682,7 @@ private theorem satEval_rewindAlpha_base_step (mode : SatEvalMode) · exact TM.tape_readBackWrite_preserves _ _ (Or.inl hhead0) · exact TM.transitionTape_eq_self hout_read -private theorem satEval_rewindAlpha_loop (mode : SatEvalMode) : +theorem satEval_rewindAlpha_loop (mode : SatEvalMode) : ∀ (p : ℕ) (c : Cfg 1 satEvalOnInputTM.Q), c.state = .rewindAlpha mode → c.input.read ≠ Γ.start → @@ -1725,7 +1739,7 @@ private theorem satEval_rewindAlpha_loop (mode : SatEvalMode) : · rw [hcells', hcells1] · rw [hout', hout1] -private theorem satEval_two_bit_step (mode : SatEvalMode) (first second : Bool) +theorem satEval_two_bit_step (mode : SatEvalMode) (first second : Bool) (rest : List Bool) (c : Cfg 1 satEvalOnInputTM.Q) (hstate : c.state = .readFirst mode) (hinput : hasBoolSuffix c.input (first :: second :: rest)) @@ -1764,7 +1778,7 @@ private theorem satEval_two_bit_step (mode : SatEvalMode) (first second : Bool) · simpa [tr, hwork1] using hwork2 · simpa [tr, hout1, hwork1] using hout2 -private theorem satEval_output_blank_id (w : Γw) : +theorem satEval_output_blank_id (w : Γw) : w = Γw.blank → ((Tape.init []).move Dir3.right).writeAndMove w.toΓ (TM.idleDir (((Tape.init []).move Dir3.right).read)) = @@ -1776,18 +1790,18 @@ private theorem satEval_output_blank_id (w : Γw) : · intro j hj simp [Tape.move, Tape.init, show j ≠ 0 by omega] -private theorem satEval_work_stay_id {t : Tape} +theorem satEval_work_stay_id {t : Tape} (hread : t.read ≠ Γ.start) : t.writeAndMove (TM.readBackWrite t.read).toΓ Dir3.stay = t := by simpa [TM.transitionTape, TM.idleDir, hread] using (TM.transitionTape_eq_self hread) -private theorem satEval_work_cells_preserved_readBack {t : Tape} (d : Dir3) +theorem satEval_work_cells_preserved_readBack {t : Tape} (d : Dir3) (hread : t.read ≠ Γ.start) : (t.writeAndMove (TM.readBackWrite t.read).toΓ d).cells = t.cells := by exact TM.tape_readBackWrite_preserves t d (Or.inr hread) -private theorem satEval_reject_output_zero (w : Γw) : +theorem satEval_reject_output_zero (w : Γw) : w = Γw.zero → (((Tape.init []).move Dir3.right).writeAndMove w.toΓ (TM.idleDir (((Tape.init []).move Dir3.right).read))).cells 1 = @@ -1824,11 +1838,13 @@ def SatEvalSemState.finish : SatEvalSemState → Bool | .boundary cnf _ empty => cnf && empty | .inLit .. => false -private def SatEvalMode.toSemState : SatEvalMode → ℕ → SatEvalSemState +@[nolint docBlame] +def SatEvalMode.toSemState : SatEvalMode → ℕ → SatEvalSemState | .boundary cnf clause empty, _ => .boundary cnf clause empty | .inLit cnf clause empty sign, var => .inLit cnf clause empty sign var -private def SatEvalMode.assignmentHead : SatEvalMode → ℕ → ℕ +@[nolint docBlame] +def SatEvalMode.assignmentHead : SatEvalMode → ℕ → ℕ | .boundary .., _ => 1 | .inLit .., var => var + 1 @@ -1836,7 +1852,7 @@ private def SatEvalMode.varBound : SatEvalMode → ℕ → ℕ → Prop | .boundary .., _, _ => True | .inLit .., var, k => var ≤ k -private theorem finishEvalMode_toΓ_eq_finish (mode : SatEvalMode) (var : ℕ) : +theorem finishEvalMode_toΓ_eq_finish (mode : SatEvalMode) (var : ℕ) : (finishEvalMode mode).toΓ = (if (mode.toSemState var).finish then Γ.one else Γ.zero) := by cases mode with @@ -1870,7 +1886,7 @@ def satEvalSemRun (α : Assignment) : List EncToken → SatEvalSemState → Bool | none => false | some st' => satEvalSemRun α toks st' -private theorem satEvalOnInputTM_token_loop_correct (α : Assignment) : +theorem satEvalOnInputTM_token_loop_correct (α : Assignment) : ∀ (toks : List EncToken) (mode : SatEvalMode) (var : ℕ) (c : Cfg 1 satEvalOnInputTM.Q), c.state = .readFirst mode → @@ -2104,7 +2120,7 @@ private theorem satEvalOnInputTM_token_loop_correct (α : Assignment) : simpa [satEvalSemRun, satEvalSemStep, tokenOfBits, satEvalTokenStep] using satEval_reject_output_zero _ (by rfl) -private theorem satEvalOnInputTM_tokenize_none_reject (α : Assignment) : +theorem satEvalOnInputTM_tokenize_none_reject (α : Assignment) : ∀ (suffix : List Bool) (mode : SatEvalMode) (var : ℕ) (c : Cfg 1 satEvalOnInputTM.Q), tokenize? suffix = none → @@ -2349,7 +2365,7 @@ def satEvalSemBits (α z : List Bool) : Bool := | none => false | some toks => satEvalSemRun α toks (.boundary true false true) -private theorem encodeTokens_length (toks : List EncToken) : +theorem encodeTokens_length (toks : List EncToken) : (encodeTokens toks).length = 2 * toks.length := by induction toks with | nil => rfl @@ -2362,7 +2378,7 @@ private theorem encodeTokens_length (toks : List EncToken) : simp only [encodeTokens_cons, List.length_append, htlen, ih, List.length_cons] omega -private theorem satEvalOnInputTM_started_correct (α z : List Bool) +theorem satEvalOnInputTM_started_correct (α z : List Bool) (c : Cfg 1 satEvalOnInputTM.Q) (hstate : c.state = .readFirst (.boundary true false true)) (hinput : c.input = (Tape.init (z.map Γ.ofBool)).move Dir3.right) @@ -2415,26 +2431,28 @@ private def satEvalSemFrom (α suffix : List Bool) (mode : SatEvalMode) (var : | none => false | some toks => satEvalSemRun α toks (mode.toSemState var) -private def parseEvalResult (α : Assignment) (toks : List EncToken) +@[nolint docBlame] +def parseEvalResult (α : Assignment) (toks : List EncToken) (rawRev : List Bool) (clauseRev : Clause) (cnfRev : CNF) : Bool := match parseTokensAux toks rawRev clauseRev cnfRev with | none => false | some φ => CNF.eval α φ -private def RawInvalid (rawRev : List Bool) : Prop := +@[nolint docBlame] +def RawInvalid (rawRev : List Bool) : Prop := ∃ sign rest, rawRev.reverse = sign :: rest ∧ false ∈ rest -private lemma RawInvalid.cons (b : Bool) {rawRev : List Bool} (h : RawInvalid rawRev) : +lemma RawInvalid.cons (b : Bool) {rawRev : List Bool} (h : RawInvalid rawRev) : RawInvalid (b :: rawRev) := by rcases h with ⟨sign, rest, hrev, hmem⟩ refine ⟨sign, rest ++ [b], ?_, ?_⟩ <;> simp [hrev, hmem] -private lemma RawInvalid.ne_nil {rawRev : List Bool} (h : RawInvalid rawRev) : rawRev ≠ [] := by +lemma RawInvalid.ne_nil {rawRev : List Bool} (h : RawInvalid rawRev) : rawRev ≠ [] := by rintro rfl rcases h with ⟨_sign, _rest, hrev, _⟩ simp at hrev -private lemma RawInvalid.decodeRaw?_eq_none {rawRev : List Bool} (h : RawInvalid rawRev) : +lemma RawInvalid.decodeRaw?_eq_none {rawRev : List Bool} (h : RawInvalid rawRev) : Lit.decodeRaw? rawRev.reverse = none := by rcases h with ⟨sign, rest, hrev, hmem⟩ rw [hrev] @@ -2444,7 +2462,7 @@ private lemma RawInvalid.decodeRaw?_eq_none {rawRev : List Bool} (h : RawInvalid cases hfalse · rfl -private lemma parseEvalResult_invalid_raw (α : Assignment) (toks : List EncToken) +lemma parseEvalResult_invalid_raw (α : Assignment) (toks : List EncToken) {rawRev : List Bool} (hbad : RawInvalid rawRev) (clauseRev : Clause) (cnfRev : CNF) : parseEvalResult α toks rawRev clauseRev cnfRev = false := by @@ -2464,7 +2482,8 @@ private lemma parseEvalResult_invalid_raw (α : Assignment) (toks : List EncToke Clause.eval α [ℓ] = Lit.eval α ℓ := by simp [Clause.eval] -private def SatEvalSemRel (α : Assignment) : +@[nolint docBlame] +def SatEvalSemRel (α : Assignment) : SatEvalSemState → List Bool → Clause → CNF → Prop | .boundary cnf clause empty, rawRev, clauseRev, cnfRev => rawRev = [] ∧ cnf = CNF.eval α cnfRev.reverse ∧ @@ -2473,17 +2492,17 @@ private def SatEvalSemRel (α : Assignment) : rawRev = List.replicate var true ++ [sign] ∧ cnf = CNF.eval α cnfRev.reverse ∧ clause = Clause.eval α clauseRev.reverse -private lemma rawInvalid_false_cons_valid (sign : Bool) (var : Nat) : +lemma rawInvalid_false_cons_valid (sign : Bool) (var : Nat) : RawInvalid (false :: (List.replicate var true ++ [sign])) := by refine ⟨sign, List.replicate var true ++ [false], ?_, ?_⟩ · simp [List.reverse_append] · simp -private lemma lit_decode_replicate (sign : Bool) (var : Nat) : +lemma lit_decode_replicate (sign : Bool) (var : Nat) : Lit.decodeRaw? (sign :: List.replicate var true) = some { sign := sign, var := var } := by simp [Lit.decodeRaw?] -private lemma satEvalSemRun_correct (α : Assignment) (toks : List EncToken) : +lemma satEvalSemRun_correct (α : Assignment) (toks : List EncToken) : ∀ (st : SatEvalSemState) (rawRev : List Bool) (clauseRev : Clause) (cnfRev : CNF), SatEvalSemRel α st rawRev clauseRev cnfRev → satEvalSemRun α toks st = parseEvalResult α toks rawRev clauseRev cnfRev := by @@ -2680,41 +2699,48 @@ instance : Fintype VerifyPairPhase where intro q cases q <;> simp -private def verifyPairReject (iHead : Γ) (wHeads : Fin 3 → Γ) (oHead : Γ) : +@[nolint docBlame] +def verifyPairReject (iHead : Γ) (wHeads : Fin 3 → Γ) (oHead : Γ) : VerifyPairPhase × (Fin 3 → Γw) × Γw × Dir3 × (Fin 3 → Dir3) × Dir3 := (.done, fun i => TM.readBackWrite (wHeads i), Γw.zero, TM.idleDir iHead, fun i => TM.idleDir (wHeads i), TM.idleDir oHead) -private def verifyPairPreserveWork (wHeads : Fin 3 → Γ) : Fin 3 → Γw := +@[nolint docBlame] +def verifyPairPreserveWork (wHeads : Fin 3 → Γ) : Fin 3 → Γw := fun i => TM.readBackWrite (wHeads i) -private def verifyPairSplitWrite (zBit : Bool) (wHeads : Fin 3 → Γ) : Fin 3 → Γw := +@[nolint docBlame] +def verifyPairSplitWrite (zBit : Bool) (wHeads : Fin 3 → Γ) : Fin 3 → Γw := fun i => if i = ⟨0, by omega⟩ then boolWrite zBit else if i = ⟨2, by omega⟩ then Γw.one else TM.readBackWrite (wHeads i) -private def verifyPairSplitDirs (wHeads : Fin 3 → Γ) : Fin 3 → Dir3 := +@[nolint docBlame] +def verifyPairSplitDirs (wHeads : Fin 3 → Γ) : Fin 3 → Dir3 := fun i => if i = ⟨0, by omega⟩ then Dir3.right else if i = ⟨2, by omega⟩ then Dir3.right else TM.idleDir (wHeads i) -private def verifyPairCopyAlphaWrite (aBit : Bool) (wHeads : Fin 3 → Γ) : +@[nolint docBlame] +def verifyPairCopyAlphaWrite (aBit : Bool) (wHeads : Fin 3 → Γ) : Fin 3 → Γw := fun i => if i = ⟨1, by omega⟩ then boolWrite aBit else if i = ⟨2, by omega⟩ then Γw.blank else TM.readBackWrite (wHeads i) -private def verifyPairCopyAlphaDirs (wHeads : Fin 3 → Γ) : Fin 3 → Dir3 := +@[nolint docBlame] +def verifyPairCopyAlphaDirs (wHeads : Fin 3 → Γ) : Fin 3 → Dir3 := fun i => if i = ⟨1, by omega⟩ then Dir3.right else if i = ⟨2, by omega⟩ then Dir3.right else TM.idleDir (wHeads i) -private def verifyPairEvalDirs (αHead : Γ) (αDir : Dir3) (wHeads : Fin 3 → Γ) : +@[nolint docBlame] +def verifyPairEvalDirs (αHead : Γ) (αDir : Dir3) (wHeads : Fin 3 → Γ) : Fin 3 → Dir3 := fun i => if i = ⟨0, by omega⟩ then Dir3.right @@ -2723,7 +2749,8 @@ private def verifyPairEvalDirs (αHead : Γ) (αDir : Dir3) (wHeads : Fin 3 → else TM.idleDir (wHeads i) -private def verifyPairDelta : +@[nolint docBlame] +def verifyPairDelta : VerifyPairPhase → Γ → (Fin 3 → Γ) → Γ → VerifyPairPhase × (Fin 3 → Γw) × Γw × Dir3 × (Fin 3 → Dir3) × Dir3 := fun state iHead wHeads oHead => @@ -2918,7 +2945,7 @@ private def verifyPairDelta : | .done => TM.allIdle .done iHead wHeads oHead -private theorem verifyPairDelta_right_of_start +theorem verifyPairDelta_right_of_start (state : VerifyPairPhase) (iHead : Γ) (wHeads : Fin 3 → Γ) (oHead : Γ) : let tr := verifyPairDelta state iHead wHeads oHead (iHead = Γ.start → tr.2.2.2.1 = Dir3.right) ∧ @@ -2952,7 +2979,7 @@ def verifyPairTM : TM 3 where /-- Writing back the symbol just read is a no-op when no interior cell holds the left marker (so the head, if `≥ 1`, reads a non-marker). -/ -private theorem writeBack_self (t : Tape) (h : ∀ j, j ≥ 1 → t.cells j ≠ Γ.start) : +theorem writeBack_self (t : Tape) (h : ∀ j, j ≥ 1 → t.cells j ≠ Γ.start) : t.write (TM.readBackWrite t.read).toΓ = t := by by_cases hh : t.head = 0 · simp [Tape.write, hh] @@ -2961,13 +2988,13 @@ private theorem writeBack_self (t : Tape) (h : ∀ j, j ≥ 1 → t.cells j ≠ simp [Tape.write, hh, Tape.read, Function.update_eq_self] /-- Hence a write-back-and-move on such a tape is just a move (read-only behavior). -/ -private theorem writeBackMove_eq_move (t : Tape) (d : Dir3) +theorem writeBackMove_eq_move (t : Tape) (d : Dir3) (h : ∀ j, j ≥ 1 → t.cells j ≠ Γ.start) : t.writeAndMove (TM.readBackWrite t.read).toΓ d = t.move d := by rw [Tape.writeAndMove, writeBack_self t h] /-- Project a `verifyPairTM` eval-phase state to the single-tape evaluator's. -/ -private def projEvalState : VerifyPairPhase → SatEvalPhase +def projEvalState : VerifyPairPhase → SatEvalPhase | .evalReadFirst m => .readFirst m | .evalReadSecond m first => .readSecond m first | .evalRewindAlpha m => .rewindAlpha m @@ -2976,13 +3003,13 @@ private def projEvalState : VerifyPairPhase → SatEvalPhase /-- Project a `verifyPairTM` configuration onto a `satEvalOnInputTM` configuration: the formula tape `0` becomes the (read-only) input, the assignment tape `1` becomes work tape `0`, and the output is shared. -/ -private def projEvalCfg (c : Cfg 3 verifyPairTM.Q) : Cfg 1 satEvalOnInputTM.Q := +def projEvalCfg (c : Cfg 3 verifyPairTM.Q) : Cfg 1 satEvalOnInputTM.Q := { state := projEvalState c.state input := c.work ⟨0, by omega⟩ work := fun _ => c.work ⟨1, by omega⟩ output := c.output } -private theorem verifyPairTM_init_steps (w : List Bool) : +theorem verifyPairTM_init_steps (w : List Bool) : ∃ c', verifyPairTM.reachesIn 2 (verifyPairTM.initCfg w) c' ∧ c'.state = .splitScan ∧ @@ -3045,7 +3072,7 @@ private theorem verifyPairTM_init_steps (w : List Bool) : /-- In `.splitScan`, reading the first `false` advances to `.splitAfterFalse`, moving the input head right and leaving all work tapes and the output tape unchanged. -/ -private theorem verifyPairSplit_scanX_false_step +theorem verifyPairSplit_scanX_false_step (c : Cfg 3 verifyPairTM.Q) (hst : c.state = .splitScan) (hiread : c.input.read = Γ.zero) (hwst : ∀ i, (c.work i).head ≥ 1 ∧ ∀ j, j ≥ 1 → (c.work i).cells j ≠ Γ.start) @@ -3077,7 +3104,7 @@ private theorem verifyPairSplit_scanX_false_step formula tape `0`, adds a tally to the counter tape `2`, advances back to `.splitScan`, and leaves the assignment tape `1` and the output tape unchanged. -/ -private theorem verifyPairSplit_afterFalse_zero_step +theorem verifyPairSplit_afterFalse_zero_step (c : Cfg 3 verifyPairTM.Q) (hst : c.state = .splitAfterFalse) (hiread : c.input.read = Γ.zero) (h0h : (c.work ⟨0, by omega⟩).head ≥ 1) @@ -3133,7 +3160,7 @@ private theorem verifyPairSplit_afterFalse_zero_step /-- In `.splitScan`, reading the first `true` advances to `.splitAfterTrue`, moving the input head right and leaving all work tapes and the output tape unchanged. -/ -private theorem verifyPairSplit_scanX_true_step +theorem verifyPairSplit_scanX_true_step (c : Cfg 3 verifyPairTM.Q) (hst : c.state = .splitScan) (hiread : c.input.read = Γ.one) (hwst : ∀ i, (c.work i).head ≥ 1 ∧ ∀ j, j ≥ 1 → (c.work i).cells j ≠ Γ.start) @@ -3164,7 +3191,7 @@ private theorem verifyPairSplit_scanX_true_step /-- In `.splitAfterFalse`, reading `true` recognizes the separator `01` and advances to `.rewindCounterForAlpha`, leaving all work tapes and the output tape unchanged. -/ -private theorem verifyPairSplit_afterFalse_sep_step +theorem verifyPairSplit_afterFalse_sep_step (c : Cfg 3 verifyPairTM.Q) (hst : c.state = .splitAfterFalse) (hiread : c.input.read = Γ.one) (hwst : ∀ i, (c.work i).head ≥ 1 ∧ ∀ j, j ≥ 1 → (c.work i).cells j ≠ Γ.start) @@ -3195,7 +3222,7 @@ private theorem verifyPairSplit_afterFalse_sep_step /-- In `.splitAfterTrue`, reading the second `true` writes `true` to the formula tape `0`, adds a tally to the counter tape `2`, advances back to `.splitScan`, and leaves the assignment tape `1` and the output tape unchanged. -/ -private theorem verifyPairSplit_afterTrue_one_step +theorem verifyPairSplit_afterTrue_one_step (c : Cfg 3 verifyPairTM.Q) (hst : c.state = .splitAfterTrue) (hiread : c.input.read = Γ.one) (h0h : (c.work ⟨0, by omega⟩).head ≥ 1) @@ -3250,7 +3277,7 @@ private theorem verifyPairSplit_afterTrue_one_step /-- Two-step decoding of a doubled `false` bit: writes `false` to the formula tape, a tally to the counter tape, and returns to `.splitScan`. -/ -private theorem verifyPairSplit_false_bit_step +theorem verifyPairSplit_false_bit_step (c : Cfg 3 verifyPairTM.Q) (hst : c.state = .splitScan) (hread0 : c.input.read = Γ.zero) @@ -3295,7 +3322,7 @@ private theorem verifyPairSplit_false_bit_step /-- Two-step decoding of a doubled `true` bit: writes `true` to the formula tape, a tally to the counter tape, and returns to `.splitScan`. -/ -private theorem verifyPairSplit_true_bit_step +theorem verifyPairSplit_true_bit_step (c : Cfg 3 verifyPairTM.Q) (hst : c.state = .splitScan) (hread1 : c.input.read = Γ.one) @@ -3339,7 +3366,7 @@ private theorem verifyPairSplit_true_bit_step · rw [hc2_o, hc1_o] /-- Two-step decoding of a doubled `b` bit, uniform in `b`. -/ -private theorem verifyPairSplit_bit_step (b : Bool) +theorem verifyPairSplit_bit_step (b : Bool) (c : Cfg 3 verifyPairTM.Q) (hst : c.state = .splitScan) (hread : c.input.read = Γ.ofBool b) @@ -3371,7 +3398,7 @@ private theorem verifyPairSplit_bit_step (b : Bool) /-- Two-step recognition of the separator `01`, transitioning from the split loop into `.rewindCounterForAlpha`, leaving all work tapes and the output tape unchanged. -/ -private theorem verifyPairSplit_separator_step +theorem verifyPairSplit_separator_step (c : Cfg 3 verifyPairTM.Q) (hst : c.state = .splitScan) (hread0 : c.input.read = Γ.zero) @@ -3406,7 +3433,7 @@ doubled bits of `bits`, the machine consumes `2 * |bits|` input cells, writes `bits` to the formula tape `0` and `|bits|` tallies to the counter tape `2`, and returns to `.splitScan`, leaving the assignment tape `1` and the output tape unchanged. -/ -private theorem verifyPairSplit_scanX_loop : +theorem verifyPairSplit_scanX_loop : ∀ (bits : List Bool) (c : Cfg 3 verifyPairTM.Q), c.state = .splitScan → c.input.head ≥ 1 → @@ -3581,7 +3608,7 @@ in `rState`, move the tracked tape `rIdx` left while preserving everything else (and at head `0` enter `tState` moving `rIdx` to cell `1`), the machine rewinds tape `rIdx` from head `p` to head `1` in `p + 1` steps, preserving all cells of `rIdx`, every other work tape, the input, and the output. -/ -private theorem verifyPair_rewind_loop (rIdx : Fin 3) (rState tState : VerifyPairPhase) +theorem verifyPair_rewind_loop (rIdx : Fin 3) (rState tState : VerifyPairPhase) (hleft : ∀ c : Cfg 3 verifyPairTM.Q, c.state = rState → (c.work rIdx).read ≠ Γ.start → c.input.head ≥ 1 → (∀ j, j ≥ 1 → c.input.cells j ≠ Γ.start) → (∀ i, i ≠ rIdx → (c.work i).head ≥ 1 ∧ ∀ j, j ≥ 1 → (c.work i).cells j ≠ Γ.start) → @@ -3643,7 +3670,7 @@ private theorem verifyPair_rewind_loop (rIdx : Fin 3) (rState tState : VerifyPai /-- `.rewindCounterForAlpha` left step: with a non-start counter cell under the head, move the counter tape left, preserving everything else. -/ -private theorem verifyPairSplit_rewindCounter_left_step +theorem verifyPairSplit_rewindCounter_left_step (c : Cfg 3 verifyPairTM.Q) (hst : c.state = .rewindCounterForAlpha) (hread : (c.work ⟨2, by omega⟩).read ≠ Γ.start) (hih : c.input.head ≥ 1) (hins : ∀ j, j ≥ 1 → c.input.cells j ≠ Γ.start) @@ -3687,7 +3714,7 @@ private theorem verifyPairSplit_rewindCounter_left_step /-- `.rewindCounterForAlpha` base step: with the counter head at the left marker, move right into `.copyAlpha`, preserving everything else. -/ -private theorem verifyPairSplit_rewindCounter_base_step +theorem verifyPairSplit_rewindCounter_base_step (c : Cfg 3 verifyPairTM.Q) (hst : c.state = .rewindCounterForAlpha) (hread : (c.work ⟨2, by omega⟩).read = Γ.start) (hhead0 : (c.work ⟨2, by omega⟩).head = 0) @@ -3732,7 +3759,7 @@ private theorem verifyPairSplit_rewindCounter_base_step · exact TM.tape_writeAndMove_stable c.output hoh hons /-- `.rewindFormula` left step: move the formula tape left, preserving the rest. -/ -private theorem verifyPairSplit_rewindFormula_left_step +theorem verifyPairSplit_rewindFormula_left_step (c : Cfg 3 verifyPairTM.Q) (hst : c.state = .rewindFormula) (hread : (c.work ⟨0, by omega⟩).read ≠ Γ.start) (hih : c.input.head ≥ 1) (hins : ∀ j, j ≥ 1 → c.input.cells j ≠ Γ.start) @@ -3775,7 +3802,7 @@ private theorem verifyPairSplit_rewindFormula_left_step · exact TM.tape_writeAndMove_stable c.output hoh hons /-- `.rewindFormula` base step: move right into `.rewindAssignment`. -/ -private theorem verifyPairSplit_rewindFormula_base_step +theorem verifyPairSplit_rewindFormula_base_step (c : Cfg 3 verifyPairTM.Q) (hst : c.state = .rewindFormula) (hread : (c.work ⟨0, by omega⟩).read = Γ.start) (hhead0 : (c.work ⟨0, by omega⟩).head = 0) @@ -3820,7 +3847,7 @@ private theorem verifyPairSplit_rewindFormula_base_step · exact TM.tape_writeAndMove_stable c.output hoh hons /-- `.rewindAssignment` left step: move the assignment tape left. -/ -private theorem verifyPairSplit_rewindAssignment_left_step +theorem verifyPairSplit_rewindAssignment_left_step (c : Cfg 3 verifyPairTM.Q) (hst : c.state = .rewindAssignment) (hread : (c.work ⟨1, by omega⟩).read ≠ Γ.start) (hih : c.input.head ≥ 1) (hins : ∀ j, j ≥ 1 → c.input.cells j ≠ Γ.start) @@ -3863,7 +3890,7 @@ private theorem verifyPairSplit_rewindAssignment_left_step · exact TM.tape_writeAndMove_stable c.output hoh hons /-- `.rewindAssignment` base step: move right into the evaluator's first read. -/ -private theorem verifyPairSplit_rewindAssignment_base_step +theorem verifyPairSplit_rewindAssignment_base_step (c : Cfg 3 verifyPairTM.Q) (hst : c.state = .rewindAssignment) (hread : (c.work ⟨1, by omega⟩).read = Γ.start) (hhead0 : (c.work ⟨1, by omega⟩).head = 0) @@ -3913,7 +3940,7 @@ live counter tally, copy the bit to the assignment tape `1`, erase one counter tally on tape `2`, advance the input, and stay in `.copyAlpha`. This is the witness-length check: the counter has `|z| + 1` tallies, so it runs dry exactly when `|α| > |z| + 1`. -/ -private theorem verifyPairSplit_copyAlpha_bit_step (b : Bool) +theorem verifyPairSplit_copyAlpha_bit_step (b : Bool) (c : Cfg 3 verifyPairTM.Q) (hst : c.state = .copyAlpha) (hib : c.input.read = Γ.ofBool b) (hcounter : (c.work ⟨2, by omega⟩).read = Γ.one) @@ -3972,7 +3999,7 @@ private theorem verifyPairSplit_copyAlpha_bit_step (b : Bool) /-- `.copyAlpha` blank step: once the input head reaches the blank after `α`, transition to `.rewindFormula`, leaving all work tapes and the output unchanged. -/ -private theorem verifyPairSplit_copyAlpha_blank_step +theorem verifyPairSplit_copyAlpha_blank_step (c : Cfg 3 verifyPairTM.Q) (hst : c.state = .copyAlpha) (hib : c.input.read = Γ.blank) (hwst : ∀ i, (c.work i).head ≥ 1 ∧ ∀ j, j ≥ 1 → (c.work i).cells j ≠ Γ.start) @@ -4003,7 +4030,7 @@ private theorem verifyPairSplit_copyAlpha_blank_step `as` from the input to tape `1`, erasing one counter tally per bit, and returns to `.copyAlpha`. Tape `0` and the output are untouched; tape `2` stays stable (its exact erased content is irrelevant downstream). -/ -private theorem verifyPairSplit_copyAlpha_loop : +theorem verifyPairSplit_copyAlpha_loop : ∀ (as : List Bool) (c : Cfg 3 verifyPairTM.Q), c.state = .copyAlpha → c.input.head ≥ 1 → c.input.cells 0 = Γ.start → @@ -4150,7 +4177,7 @@ private theorem verifyPairSplit_copyAlpha_loop : /-- The counter-rewind phase: from `.rewindCounterForAlpha` with the counter head at `p`, reach `.copyAlpha` with the counter head back at `1` in `p + 1` steps, preserving every tape's contents. -/ -private theorem verifyPairSplit_rewindCounter_phase (p : ℕ) (c : Cfg 3 verifyPairTM.Q) +theorem verifyPairSplit_rewindCounter_phase (p : ℕ) (c : Cfg 3 verifyPairTM.Q) (hst : c.state = .rewindCounterForAlpha) (hc0 : (c.work ⟨2, by omega⟩).cells 0 = Γ.start) (hns : ∀ j, j ≥ 1 → (c.work ⟨2, by omega⟩).cells j ≠ Γ.start) @@ -4170,7 +4197,7 @@ private theorem verifyPairSplit_rewindCounter_phase (p : ℕ) (c : Cfg 3 verifyP /-- The formula-rewind phase: from `.rewindFormula` with the formula head at `p`, reach `.rewindAssignment` with the formula head back at `1`. -/ -private theorem verifyPairSplit_rewindFormula_phase (p : ℕ) (c : Cfg 3 verifyPairTM.Q) +theorem verifyPairSplit_rewindFormula_phase (p : ℕ) (c : Cfg 3 verifyPairTM.Q) (hst : c.state = .rewindFormula) (hc0 : (c.work ⟨0, by omega⟩).cells 0 = Γ.start) (hns : ∀ j, j ≥ 1 → (c.work ⟨0, by omega⟩).cells j ≠ Γ.start) @@ -4191,7 +4218,7 @@ private theorem verifyPairSplit_rewindFormula_phase (p : ℕ) (c : Cfg 3 verifyP /-- The assignment-rewind phase: from `.rewindAssignment` with the assignment head at `p`, reach the evaluator's first read with the assignment head back at `1`. -/ -private theorem verifyPairSplit_rewindAssignment_phase (p : ℕ) (c : Cfg 3 verifyPairTM.Q) +theorem verifyPairSplit_rewindAssignment_phase (p : ℕ) (c : Cfg 3 verifyPairTM.Q) (hst : c.state = .rewindAssignment) (hc0 : (c.work ⟨1, by omega⟩).cells 0 = Γ.start) (hns : ∀ j, j ≥ 1 → (c.work ⟨1, by omega⟩).cells j ≠ Γ.start) @@ -4213,7 +4240,7 @@ private theorem verifyPairSplit_rewindAssignment_phase (p : ℕ) (c : Cfg 3 veri /-- `.copyAlpha` reject step: an assignment bit with the counter already exhausted (`≠ Γ.one`) means `|α| > |z| + 1`; the machine halts with output `0`. -/ -private theorem verifyPairSplit_copyAlpha_reject_step (b : Bool) +theorem verifyPairSplit_copyAlpha_reject_step (b : Bool) (c : Cfg 3 verifyPairTM.Q) (hst : c.state = .copyAlpha) (hib : c.input.read = Γ.ofBool b) (hcounter : (c.work ⟨2, by omega⟩).read ≠ Γ.one) @@ -4241,7 +4268,7 @@ private theorem verifyPairSplit_copyAlpha_reject_step (b : Bool) /-- The input tape after the initial `▷→cell 1` shift exposes the doubled bits of `z` at the positions the split loop reads them. -/ -private theorem verifyPair_input_doubled (z α : List Bool) (i : ℕ) (hi : i < z.length) : +theorem verifyPair_input_doubled (z α : List Bool) (i : ℕ) (hi : i < z.length) : ((Tape.init ((pair z α).map Γ.ofBool)).move Dir3.right).cells (1 + 2 * i) = Γ.ofBool (z[i]'hi) ∧ ((Tape.init ((pair z α).map Γ.ofBool)).move Dir3.right).cells (1 + (2 * i + 1)) = @@ -4259,7 +4286,7 @@ formula-scan, and separator phases, reaching `.rewindCounterForAlpha` with the formula `z` staged on tape `0`, the `|z|+1`-tally counter on tape `2`, the assignment tape `1` still blank, and the input head positioned at the start of `α`'s region. -/ -private theorem verifyPairSplit_setup_through_separator (z α : List Bool) : +theorem verifyPairSplit_setup_through_separator (z α : List Bool) : ∃ c', verifyPairTM.reachesIn (2 * z.length + 4) (verifyPairTM.initCfg (pair z α)) c' ∧ c'.state = .rewindCounterForAlpha ∧ c'.input.head = 2 * z.length + 3 ∧ @@ -4404,7 +4431,7 @@ private theorem verifyPairSplit_setup_through_separator (z α : List Bool) : /-- A tape pinned down by its cell contents (left marker, `l`'s bits, then blanks) with head at cell `1` is exactly `Tape.init (l.map Γ.ofBool)` shifted right — the canonical "started binary input" shape consumed by the evaluator. -/ -private theorem tape_eq_initTape_of_cells (t : Tape) (l : List Bool) +theorem tape_eq_initTape_of_cells (t : Tape) (l : List Bool) (hh : t.head = 1) (h0 : t.cells 0 = Γ.start) (hdata : ∀ i, (h : i < l.length) → t.cells (1 + i) = Γ.ofBool (l[i]'h)) (hblank : ∀ j, j ≥ 1 + l.length → t.cells j = Γ.blank) : @@ -4432,7 +4459,7 @@ private theorem tape_eq_initTape_of_cells (t : Tape) (l : List Bool) runs from the initial configuration on `pair z α` to the evaluator's first read, leaving the formula `z` staged on tape `0` and the assignment `α` on tape `1`, both as left-anchored binary tapes with head at cell `1`. -/ -private theorem verifyPairSplit_setup_success (z α : List Bool) +theorem verifyPairSplit_setup_success (z α : List Bool) (hlen : α.length ≤ z.length + 1) : ∃ c', verifyPairTM.reachesIn (4 * z.length + 2 * α.length + 12) (verifyPairTM.initCfg (pair z α)) c' ∧ @@ -4606,7 +4633,7 @@ private theorem verifyPairSplit_setup_success (z α : List Bool) /-- The setup success path, with the staged formula and assignment tapes repackaged in the exact `Tape.init`-shifted shape consumed by the evaluator. -/ -private theorem verifyPairSplit_setup_success_initTape (z α : List Bool) +theorem verifyPairSplit_setup_success_initTape (z α : List Bool) (hlen : α.length ≤ z.length + 1) : ∃ c', verifyPairTM.reachesIn (4 * z.length + 2 * α.length + 12) (verifyPairTM.initCfg (pair z α)) c' ∧ @@ -4650,7 +4677,7 @@ theorem verifyPairTMTime_polynomial : -- ════════════════════════════════════════════════════════════════════════ /-- Predicate isolating the three evaluator-phase states of `verifyPairTM`. -/ -private def isEvalState : VerifyPairPhase → Prop +def isEvalState : VerifyPairPhase → Prop | .evalReadFirst _ => True | .evalReadSecond _ _ => True | .evalRewindAlpha _ => True @@ -4658,14 +4685,14 @@ private def isEvalState : VerifyPairPhase → Prop /-- The projection only sends `.done` (among eval-or-done states) to the evaluator's halt state, so a halted projection forces a halted verifier. -/ -private theorem state_done_of_isEvalOrDone {s : VerifyPairPhase} +theorem state_done_of_isEvalOrDone {s : VerifyPairPhase} (h : isEvalState s ∨ s = .done) (hd : projEvalState s = .done) : s = .done := by cases s <;> simp_all [isEvalState, projEvalState] /-- **One-step projection.** A verifier step from an eval-phase configuration whose formula tape carries no interior left-markers maps onto a single `satEvalOnInputTM` step of the projected configuration. -/ -private theorem projEval_step (c c' : Cfg 3 verifyPairTM.Q) +theorem projEval_step (c c' : Cfg 3 verifyPairTM.Q) (heval : isEvalState c.state) (hnostart : ∀ j, j ≥ 1 → (c.work ⟨0, by omega⟩).cells j ≠ Γ.start) (hstep : verifyPairTM.step c = some c') : @@ -4730,7 +4757,7 @@ private theorem projEval_step (c c' : Cfg 3 verifyPairTM.Q) rw [main, hstep]; rfl /-- A TM step never modifies its read-only input tape's cells (only its head). -/ -private theorem step_input_cells {m : ℕ} {tm : TM m} {c c' : Cfg m tm.Q} +theorem step_input_cells {m : ℕ} {tm : TM m} {c c' : Cfg m tm.Q} (h : tm.step c = some c') : c'.input.cells = c.input.cells := by rw [TM.step] at h split at h @@ -4739,7 +4766,7 @@ private theorem step_input_cells {m : ℕ} {tm : TM m} {c c' : Cfg m tm.Q} exact Tape.move_cells _ _ /-- The evaluator phases only transition to evaluator phases or the halt state. -/ -private theorem verify_eval_next_state (c c' : Cfg 3 verifyPairTM.Q) +theorem verify_eval_next_state (c c' : Cfg 3 verifyPairTM.Q) (hev : isEvalState c.state) (hvstep : verifyPairTM.step c = some c') : isEvalState c'.state ∨ c'.state = .done := by have hcne : c.state ≠ verifyPairTM.qhalt := by @@ -4787,7 +4814,7 @@ private theorem verify_eval_next_state (c c' : Cfg 3 verifyPairTM.Q) configuration lifts back to a verifier trace of the same length, preserving the eval-or-done invariant and the no-interior-marker invariant on the formula tape. -/ -private theorem projEval_reaches : +theorem projEval_reaches : ∀ (t : ℕ) (c : Cfg 3 verifyPairTM.Q) (d : Cfg 1 satEvalOnInputTM.Q), (isEvalState c.state ∨ c.state = .done) → (∀ j, j ≥ 1 → (c.work ⟨0, by omega⟩).cells j ≠ Γ.start) → @@ -4832,7 +4859,7 @@ private theorem projEval_reaches : whole split/setup/eval pipeline from `initCfg (pair z α)`, halting within `(4·|z| + 2·|α| + 12) + (2·|z| + 1)` steps with output equal to the SAT semantics `satEvalSemBits α z`. -/ -private theorem verifyPairSplit_eval_success (z α : List Bool) +theorem verifyPairSplit_eval_success (z α : List Bool) (hlen : α.length ≤ z.length + 1) : ∃ c' t, t ≤ 4 * z.length + 2 * α.length + 12 + (2 * z.length + 1) ∧ @@ -4872,7 +4899,7 @@ private theorem verifyPairSplit_eval_success (z α : List Bool) /-- **Reject (witness too long).** When `|z| + 1 < |α|`, the counter is exhausted during the copy of `α`, so the verifier halts with output `0`. -/ -private theorem verifyPairSplit_reject_long (z α : List Bool) +theorem verifyPairSplit_reject_long (z α : List Bool) (hlen : z.length + 1 < α.length) : ∃ c' t, t ≤ 4 * z.length + 10 ∧ @@ -4957,7 +4984,7 @@ private theorem verifyPairSplit_reject_long (z α : List Bool) (TM.reachesIn_trans _ hr5 (.step hstep6 .zero))) /-- A split-phase reject from `.splitScan` reading a blank (end of input). -/ -private theorem verifyPairSplit_splitScan_reject (c : Cfg 3 verifyPairTM.Q) +theorem verifyPairSplit_splitScan_reject (c : Cfg 3 verifyPairTM.Q) (hst : c.state = .splitScan) (hread : c.input.read = Γ.blank) (hout : c.output = (Tape.init []).move Dir3.right) : ∃ c', verifyPairTM.step c = some c' ∧ verifyPairTM.halted c' ∧ @@ -4979,7 +5006,7 @@ private theorem verifyPairSplit_splitScan_reject (c : Cfg 3 verifyPairTM.Q) Tape.init, Γw.toΓ] /-- A split-phase reject from `.splitAfterFalse` reading a blank. -/ -private theorem verifyPairSplit_afterFalse_reject (c : Cfg 3 verifyPairTM.Q) +theorem verifyPairSplit_afterFalse_reject (c : Cfg 3 verifyPairTM.Q) (hst : c.state = .splitAfterFalse) (hread : c.input.read = Γ.blank) (hout : c.output = (Tape.init []).move Dir3.right) : ∃ c', verifyPairTM.step c = some c' ∧ verifyPairTM.halted c' ∧ @@ -5002,7 +5029,7 @@ private theorem verifyPairSplit_afterFalse_reject (c : Cfg 3 verifyPairTM.Q) /-- A split-phase reject from `.splitAfterTrue` reading anything other than a second `true` (a blank, or a `0`). -/ -private theorem verifyPairSplit_afterTrue_reject (c : Cfg 3 verifyPairTM.Q) +theorem verifyPairSplit_afterTrue_reject (c : Cfg 3 verifyPairTM.Q) (hst : c.state = .splitAfterTrue) (hread : c.input.read = Γ.blank ∨ c.input.read = Γ.zero) (hout : c.output = (Tape.init []).move Dir3.right) : @@ -5027,7 +5054,7 @@ private theorem verifyPairSplit_afterTrue_reject (c : Cfg 3 verifyPairTM.Q) /-- The split scan rejects every input that is not a valid `pair` encoding, mirroring the recursion of `unpair?`. -/ -private theorem verifyPairSplit_scan_reject : +theorem verifyPairSplit_scan_reject : ∀ (suffix : List Bool) (c : Cfg 3 verifyPairTM.Q), c.state = .splitScan → unpair? suffix = none → @@ -5176,7 +5203,7 @@ private theorem verifyPairSplit_scan_reject : /-- **Reject (malformed input).** When `w` is not a valid `pair`, the split scan rejects, halting with output `0`. -/ -private theorem verifyPairSplit_reject_malformed (w : List Bool) +theorem verifyPairSplit_reject_malformed (w : List Bool) (hw : unpair? w = none) : ∃ c' t, t ≤ 2 * w.length + 4 ∧ diff --git a/Complexitylib/TimeConstructible.lean b/Complexitylib/TimeConstructible.lean index 444e55fa..32af8b01 100644 --- a/Complexitylib/TimeConstructible.lean +++ b/Complexitylib/TimeConstructible.lean @@ -3,9 +3,11 @@ Copyright (c) 2025 Samuel Schlesinger. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Samuel Schlesinger -/ -import Complexitylib.Models.TuringMachine -import Complexitylib.Asymptotics -import Mathlib.Data.Nat.Bits +module + +public import Complexitylib.Models.TuringMachine +public import Complexitylib.Asymptotics +public import Mathlib.Data.Nat.Bits /-! # Time-constructible functions @@ -31,6 +33,8 @@ time-constructible. - `TimeConstructible.computable` — extract the witnessing TM and time bound -/ +@[expose] public section + namespace Complexity diff --git a/scripts/lint_style.py b/scripts/lint_style.py index 797695b3..034d6bc6 100644 --- a/scripts/lint_style.py +++ b/scripts/lint_style.py @@ -5,7 +5,8 @@ copyright — a Mathlib-style copyright header at the top of the file moduleDoc — a module docstring (`/-! ... -/`) - lineLength — no line longer than 100 characters (lines containing URLs exempt) + lineLength — no line longer than 100 characters (URL lines and `import` + lines exempt; module paths cannot be wrapped) trailingWs — no trailing whitespace finalNl — file ends with exactly one newline rootEscape — no `_root_.` escapes; they signal a nested namespace shadowing @@ -36,6 +37,7 @@ ) MODULE_DOC_RE = re.compile(r"^/-!", re.MULTILINE) URL_RE = re.compile(r"https?://") +IMPORT_RE = re.compile(r"^(public )?(meta )?import ") def check_file(path: Path) -> set[str]: @@ -47,7 +49,10 @@ def check_file(path: Path) -> set[str]: if not MODULE_DOC_RE.search(text): violations.add("moduleDoc") lines = text.split("\n") - if any(len(line) > MAX_LINE and not URL_RE.search(line) for line in lines): + if any( + len(line) > MAX_LINE and not URL_RE.search(line) and not IMPORT_RE.match(line) + for line in lines + ): violations.add("lineLength") if any(line != line.rstrip() for line in lines): violations.add("trailingWs") From 50c05bd9c9ef22dd608f0b0805ac2a9a766f3cdb Mon Sep 17 00:00:00 2001 From: Bolton Bailey Date: Mon, 27 Jul 2026 06:11:31 -0700 Subject: [PATCH 2/3] fix(validation): add meta imports for native_decide regression guards MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The module migration left `Repetition.Validation` and `Tseitin.Machine.Validation` with `public import`s only. Their `#eval`/`native_decide` regression guards run at elaboration time and need the imported instances/IR (`instDecidableEqΓ`, `fallbackEncoding`, `reductionTM`) accessible as `meta`, so add a parallel `meta import` alongside each `public import` (matching the SingleTape/Encoding validation files). Co-Authored-By: Claude Opus 4.8 --- .../Models/TuringMachine/Repetition/Validation.lean | 1 + Complexitylib/SAT/Tseitin/Machine/Validation.lean | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/Complexitylib/Models/TuringMachine/Repetition/Validation.lean b/Complexitylib/Models/TuringMachine/Repetition/Validation.lean index ae1d2dfc..3f1b908f 100644 --- a/Complexitylib/Models/TuringMachine/Repetition/Validation.lean +++ b/Complexitylib/Models/TuringMachine/Repetition/Validation.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.TuringMachine.Repetition +meta import Complexitylib.Models.TuringMachine.Repetition /-! # Executable validation for fixed-time repetition diff --git a/Complexitylib/SAT/Tseitin/Machine/Validation.lean b/Complexitylib/SAT/Tseitin/Machine/Validation.lean index 8b77274d..96a60737 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Validation.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Validation.lean @@ -6,11 +6,17 @@ Authors: Samuel Schlesinger module public import Complexitylib.SAT.Tseitin +meta import Complexitylib.SAT.Tseitin public import Complexitylib.SAT.Tseitin.Internal.Streaming +meta import Complexitylib.SAT.Tseitin.Internal.Streaming public import Complexitylib.SAT.Tseitin.Machine.Controller +meta import Complexitylib.SAT.Tseitin.Machine.Controller public import Complexitylib.SAT.Tseitin.Machine.Internal.Execution +meta import Complexitylib.SAT.Tseitin.Machine.Internal.Execution public import Complexitylib.SAT.Tseitin.Machine.Internal.PolynomialTime +meta import Complexitylib.SAT.Tseitin.Machine.Internal.PolynomialTime public import Complexitylib.SAT.Tseitin.Machine.Internal.Validation +meta import Complexitylib.SAT.Tseitin.Machine.Internal.Validation /-! # Executable validation for the Tseitin reduction front end From 0f26dd2c7d788cdf9eda35bfb354ed9b332ba274 Mon Sep 17 00:00:00 2001 From: Bolton Bailey Date: Mon, 27 Jul 2026 08:55:24 -0700 Subject: [PATCH 3/3] lake shake --fix --keep-public --- Complexitylib/Asymptotics.lean | 7 ------- Complexitylib/BooleanAnalysis/FourierExpansion.lean | 1 + .../BooleanAnalysis/FourierExpansion/Defs.lean | 1 - .../BooleanAnalysis/FourierExpansion/Internal.lean | 1 + Complexitylib/Circuits/AC0/Iteration/Defs.lean | 2 -- Complexitylib/Circuits/AC0/Iteration/Internal.lean | 2 +- .../Circuits/AC0/Normalization/Internal.lean | 1 + Complexitylib/Circuits/AC0/Restriction.lean | 2 ++ .../Circuits/AC0/Switching/Collection/Internal.lean | 1 - Complexitylib/Circuits/AC0/Switching/Defs.lean | 1 - Complexitylib/Circuits/AC0/Switching/Internal.lean | 2 ++ .../Circuits/AC0/Switching/Parity/Internal.lean | 1 - Complexitylib/Circuits/AndOrNot.lean | 1 - Complexitylib/Circuits/Barrington.lean | 2 ++ Complexitylib/Circuits/BarringtonBridge.lean | 1 - .../Circuits/BarringtonCodeGenerator/Defs.lean | 1 - .../Circuits/BarringtonCodeGenerator/Internal.lean | 1 - .../Circuits/BarringtonCompiler/Internal.lean | 2 ++ Complexitylib/Circuits/BarringtonConverse/Defs.lean | 1 - .../Circuits/BarringtonConverse/Internal.lean | 2 ++ Complexitylib/Circuits/BarringtonFamily.lean | 1 - Complexitylib/Circuits/BarringtonLength.lean | 2 +- Complexitylib/Circuits/BarringtonRepr.lean | 5 +---- Complexitylib/Circuits/BarringtonS5.lean | 3 --- .../Circuits/BarringtonTyped/Internal.lean | 1 + Complexitylib/Circuits/BitString.lean | 1 - .../Circuits/BranchingProgramEncoding/Internal.lean | 1 + Complexitylib/Circuits/DecisionTree.lean | 5 +---- Complexitylib/Circuits/DecisionTree/Block/Defs.lean | 1 - .../Circuits/DecisionTree/Block/Internal.lean | 1 + .../Circuits/DecisionTree/Finite/Internal.lean | 1 + .../Circuits/DecisionTree/NormalForm/Defs.lean | 1 - .../Circuits/DecisionTree/NormalForm/Internal.lean | 2 ++ .../Circuits/DecisionTree/Path/Internal.lean | 1 + .../Circuits/DecisionTree/Restriction.lean | 1 + Complexitylib/Circuits/Dependency/Internal.lean | 1 + Complexitylib/Circuits/DepthClasses/Defs.lean | 2 -- Complexitylib/Circuits/DepthClasses/Internal.lean | 1 - Complexitylib/Circuits/Encoding/Family.lean | 1 + .../Circuits/Encoding/Formula/Batch/Internal.lean | 2 ++ Complexitylib/Circuits/Encoding/Internal/Codec.lean | 1 + .../Circuits/Encoding/Internal/Fragment.lean | 1 + .../Circuits/Encoding/Internal/Semantics.lean | 1 + .../Encoding/Machine/Core/Internal/Evaluator.lean | 1 - .../Core/Internal/Execution/EmptyReject.lean | 1 + .../Machine/Core/Internal/Execution/Gate.lean | 1 + .../Core/Internal/Execution/Gate/Attempt.lean | 1 + .../Machine/Core/Internal/Execution/Gate/Loop.lean | 1 + .../Core/Internal/Execution/PositiveReject.lean | 1 - .../Encoding/Machine/Core/Internal/Tape.lean | 1 + .../Circuits/Encoding/Machine/GateStream/Defs.lean | 1 - .../Encoding/Machine/GateStream/Internal.lean | 2 -- .../Encoding/Machine/Internal/FrontEnd.lean | 1 - .../Circuits/Encoding/Machine/NatCode/Internal.lean | 3 --- .../Circuits/Encoding/Machine/RawGate/Internal.lean | 1 - .../Circuits/Encoding/Threshold/Internal.lean | 1 + Complexitylib/Circuits/Formula.lean | 3 --- .../Circuits/FormulaEncoding/Internal.lean | 1 + Complexitylib/Circuits/Internal/AndOrNot.lean | 2 ++ .../Circuits/Internal/CircuitDescriptor.lean | 2 +- Complexitylib/Circuits/Internal/LowerBound.lean | 1 + Complexitylib/Circuits/Internal/Nondeterminism.lean | 1 + Complexitylib/Circuits/Internal/NormalForm.lean | 2 ++ Complexitylib/Circuits/Internal/Schnorr.lean | 3 ++- Complexitylib/Circuits/Internal/ShannonBridge.lean | 1 + Complexitylib/Circuits/Internal/ShannonUpper.lean | 3 ++- Complexitylib/Circuits/Internal/Simulation.lean | 1 + Complexitylib/Circuits/Internal/Spira.lean | 2 +- Complexitylib/Circuits/Internal/Valiant.lean | 6 ++---- Complexitylib/Circuits/KarchmerWigderson/Defs.lean | 1 - Complexitylib/Circuits/LowerBound.lean | 1 - Complexitylib/Circuits/MultilinearExtension.lean | 1 - Complexitylib/Circuits/Nondeterminism/Defs.lean | 3 ++- Complexitylib/Circuits/NormalForm/Defs.lean | 2 ++ Complexitylib/Circuits/NormalForm/Restriction.lean | 2 ++ Complexitylib/Circuits/RandomRestriction/Defs.lean | 1 - .../Circuits/RandomRestriction/Internal.lean | 2 +- Complexitylib/Circuits/Restriction.lean | 1 + Complexitylib/Circuits/Schnorr.lean | 1 - Complexitylib/Circuits/Spira.lean | 1 - Complexitylib/Circuits/Threshold/Defs.lean | 1 - Complexitylib/Circuits/Threshold/Internal.lean | 2 ++ Complexitylib/Circuits/Unrolling/Acceptance.lean | 1 + .../Unrolling/Acceptance/Internal/Evaluation.lean | 3 ++- .../Unrolling/Acceptance/Internal/Structure.lean | 4 +--- .../Circuits/Unrolling/Amplification/Defs.lean | 2 -- .../Amplification/Internal/Evaluation.lean | 2 +- .../Unrolling/Amplification/Internal/Structure.lean | 1 - .../Unrolling/Amplification/Internal/Topology.lean | 1 + Complexitylib/Circuits/Unrolling/Defs.lean | 1 + .../Circuits/Unrolling/Internal/Initialization.lean | 2 ++ Complexitylib/Circuits/Unrolling/Trace/Defs.lean | 1 - .../Unrolling/Trace/Internal/Structure.lean | 1 - .../Circuits/Unrolling/Trace/Internal/Topology.lean | 1 - .../Unrolling/Transition/Fragment/Defs.lean | 1 - .../Transition/Fragment/Internal/Evaluation.lean | 2 -- .../Transition/Fragment/Internal/Size.lean | 1 + .../Transition/Fragment/Internal/Topology.lean | 1 - .../Unrolling/Transition/Internal/Semantics.lean | 3 ++- .../Unrolling/Transition/Internal/Support.lean | 1 + Complexitylib/Circuits/XOR.lean | 1 + .../Circuits/XOR/Restriction/Internal.lean | 2 ++ Complexitylib/Classes/Containments.lean | 3 +-- Complexitylib/Classes/DTISP.lean | 3 --- Complexitylib/Classes/EventProb.lean | 7 ++----- Complexitylib/Classes/FNP/Internal.lean | 2 -- Complexitylib/Classes/FiniteCounting.lean | 9 ++------- Complexitylib/Classes/Hierarchy.lean | 1 - Complexitylib/Classes/L.lean | 3 --- Complexitylib/Classes/NP/Internal/PairBuildTM.lean | 2 +- Complexitylib/Classes/P/FinsetDomain/Internal.lean | 3 --- Complexitylib/Classes/P/Internal.lean | 2 -- Complexitylib/Classes/PPoly.lean | 1 + Complexitylib/Classes/PPoly/Advice.lean | 1 + Complexitylib/Classes/PPoly/Advice/Internal.lean | 1 - .../Classes/PPoly/Uniform/Containment/Internal.lean | 1 - .../Uniform/Unrolling/Containment/Internal.lean | 3 --- .../Unrolling/Generator/Finalization/Internal.lean | 3 +-- .../Generator/Initialization/Internal.lean | 4 ++-- .../Unrolling/Generator/Offset/Internal.lean | 2 +- .../Generator/PolynomialOffset/Internal.lean | 1 + .../Unrolling/Generator/Primitive/Internal.lean | 3 +-- .../Unrolling/Generator/Program/Internal.lean | 3 +-- .../Uniform/Unrolling/Generator/Tableau/Defs.lean | 2 -- .../Unrolling/Generator/Tableau/Internal.lean | 5 +---- .../Unrolling/Generator/Transition/Case/Defs.lean | 1 - .../Generator/Transition/Case/Internal.lean | 3 +-- .../Generator/Transition/Effect/Internal.lean | 5 +---- .../Generator/Transition/MovedHead/Defs.lean | 1 - .../Generator/Transition/MovedHead/Internal.lean | 2 +- .../Unrolling/Generator/Transition/Next/Defs.lean | 1 - .../Generator/Transition/Next/Internal.lean | 5 +---- .../Generator/Transition/PackedCopy/Internal.lean | 1 + .../Generator/Transition/Predecessor/Defs.lean | 1 - .../Generator/Transition/Predecessor/Internal.lean | 5 +---- .../Unrolling/Generator/Transition/Read/Defs.lean | 1 - .../Generator/Transition/Read/Internal.lean | 4 +--- .../Generator/Transition/Step/Internal.lean | 6 +----- .../Generator/Transition/Step/Internal/Effect.lean | 4 +--- .../Generator/Transition/Step/Internal/Packed.lean | 1 + .../Transition/Step/Internal/Requires.lean | 3 +-- .../Generator/Transition/Step/Internal/Sound.lean | 4 +--- .../Generator/Transition/Step/Internal/Space.lean | 1 + .../Transition/Step/Internal/Space/Common.lean | 2 +- .../Transition/Step/Internal/Space/Packed.lean | 2 +- .../Generator/Transition/WrittenCell/Internal.lean | 7 +------ .../Classes/PPoly/Uniform/Unrolling/Internal.lean | 1 - .../PPoly/Uniform/Unrolling/Padded/Internal.lean | 2 +- .../Uniform/Unrolling/Serializer/Bounds/Defs.lean | 1 - .../Unrolling/Serializer/Finalization/Internal.lean | 2 +- .../Serializer/Initialization/Internal.lean | 2 ++ .../Uniform/Unrolling/Serializer/Internal.lean | 1 + .../Serializer/Transition/Atomic/Internal.lean | 2 +- .../Serializer/Transition/Case/Internal.lean | 2 +- .../Serializer/Transition/Effect/Internal.lean | 1 - .../Unrolling/Serializer/Transition/Internal.lean | 2 +- .../Serializer/Transition/MovedHead/Internal.lean | 1 - .../Unrolling/Serializer/Transition/Next/Defs.lean | 2 -- .../Serializer/Transition/Next/Internal.lean | 3 --- .../Serializer/Transition/Polynomial/Defs.lean | 1 - .../Serializer/Transition/Step/Internal.lean | 2 -- .../Serializer/Transition/WrittenCell.lean | 1 + .../Serializer/Transition/WrittenCell/Internal.lean | 2 +- .../PPoly/Uniform/Unrolling/Stream/Internal.lean | 1 - Complexitylib/Classes/PPoly/Unrolling/Internal.lean | 1 - Complexitylib/Classes/PropertyDensity.lean | 2 -- Complexitylib/Classes/Randomized.lean | 2 -- .../Classes/Randomized/CircuitAmplification.lean | 1 + Complexitylib/Classes/Randomized/GoodSeed.lean | 1 + Complexitylib/DescriptiveComplexity/Definable.lean | 2 -- Complexitylib/DescriptiveComplexity/Encoding.lean | 4 +--- Complexitylib/DescriptiveComplexity/Examples.lean | 1 - .../DescriptiveComplexity/ModelChecking.lean | 2 -- Complexitylib/DescriptiveComplexity/Reduction.lean | 1 - .../SecondOrder/Semantics.lean | 2 -- Complexitylib/Encoding/Pairing.lean | 1 + Complexitylib/Languages/AllSymbol.lean | 5 ++--- Complexitylib/Languages/AnBn.lean | 3 +-- Complexitylib/Languages/Balanced.lean | 3 +-- Complexitylib/Languages/Contains.lean | 4 ++-- Complexitylib/Languages/FirstCell.lean | 4 ++-- Complexitylib/Languages/LastBit.lean | 2 -- Complexitylib/Languages/LengthDivBy.lean | 3 --- Complexitylib/Languages/LengthParity.lean | 3 +-- Complexitylib/Languages/Palindromes.lean | 3 +-- Complexitylib/Languages/Trivial.lean | 2 -- Complexitylib/Languages/ZeroPrefix.lean | 3 +-- Complexitylib/Mathlib/Digraph.lean | 1 + Complexitylib/Mathlib/FinsetPrefixes.lean | 1 - Complexitylib/Mathlib/NatBits.lean | 1 - Complexitylib/Models/RandomAccessMachine.lean | 7 ------- .../Simulation/RegisterStore/Containment/Defs.lean | 1 - .../RegisterStore/Containment/Internal.lean | 4 +--- .../RegisterStore/DenseOverlay/Internal.lean | 1 + .../Simulation/RegisterStore/Internal.lean | 1 + .../Simulation/RegisterStore/Machine/AddressEq.lean | 1 - .../RegisterStore/Machine/AddressEq/Internal.lean | 2 -- .../Machine/DenseInputLookup/Defs.lean | 1 + .../Machine/DenseInputLookup/Internal.lean | 4 ---- .../RegisterStore/Machine/EntryAppend.lean | 1 - .../RegisterStore/Machine/EntryAppend/Internal.lean | 1 - .../RegisterStore/Machine/EntryCleanup.lean | 1 - .../RegisterStore/Machine/EntryCleanup/Defs.lean | 1 - .../RegisterStore/Machine/EntryDecode/Internal.lean | 2 -- .../Machine/EntryDecode/LinearInternal.lean | 2 -- .../RegisterStore/Machine/EntryEncode.lean | 1 - .../RegisterStore/Machine/EntryEncode/Internal.lean | 1 - .../RegisterStore/Machine/EntryLookup/Internal.lean | 1 + .../RegisterStore/Machine/EntryLookupRestore.lean | 3 --- .../RegisterStore/Machine/EntryMatch.lean | 2 +- .../RegisterStore/Machine/EntryMatch/Internal.lean | 3 +-- .../RegisterStore/Machine/EntryMissCopy.lean | 1 - .../RegisterStore/Machine/EntryReplace.lean | 1 - .../RegisterStore/Machine/EntryReplace/Defs.lean | 1 - .../Machine/EntryReplace/Internal.lean | 1 - .../Simulation/RegisterStore/Machine/EntryScan.lean | 1 - .../RegisterStore/Machine/EntryScan/Defs.lean | 1 + .../Machine/EntryScan/Internal/Ctrl.lean | 1 - .../Machine/EntryScan/Internal/Inv.lean | 2 -- .../Machine/EntryScan/Internal/Sem.lean | 1 + .../RegisterStore/Machine/EntryScanStep.lean | 1 - .../Machine/EntryScanStep/Internal.lean | 1 + .../RegisterStore/Machine/EntryUpdate.lean | 2 -- .../RegisterStore/Machine/EntryUpdate/Defs.lean | 2 +- .../Machine/EntryUpdate/Internal/Ctrl.lean | 1 - .../Machine/EntryUpdate/Internal/End.lean | 1 - .../Machine/EntryUpdate/Internal/Hit.lean | 12 +----------- .../Machine/EntryUpdate/Internal/Inv.lean | 2 +- .../Machine/EntryUpdate/Internal/Miss.lean | 7 ------- .../Machine/EntryUpdate/Internal/Out.lean | 2 -- .../Machine/EntryUpdate/Internal/Step.lean | 1 + .../Machine/EntryUpdate/Internal/Time.lean | 1 - .../RegisterStore/Machine/EntryUpdate/Progress.lean | 1 + .../RegisterStore/Machine/EntryUpdate/Source.lean | 2 +- .../Machine/EntryUpdate/TaggedDefs.lean | 1 - .../Machine/EntryUpdate/TaggedProof.lean | 1 - .../RegisterStore/Machine/Instruction.lean | 1 - .../RegisterStore/Machine/Instruction/Control.lean | 4 ---- .../RegisterStore/Machine/Instruction/Defs.lean | 5 ----- .../RegisterStore/Machine/Instruction/Dense.lean | 2 -- .../Machine/Instruction/DenseCtrlSim.lean | 1 + .../Machine/Instruction/DenseDispatch.lean | 5 +---- .../Machine/Instruction/DenseStore.lean | 1 - .../RegisterStore/Machine/Instruction/Direct.lean | 1 - .../RegisterStore/Machine/Instruction/Dispatch.lean | 9 +-------- .../RegisterStore/Machine/Instruction/Internal.lean | 1 - .../RegisterStore/Machine/Instruction/Load.lean | 1 - .../RegisterStore/Machine/Instruction/Sim/Data.lean | 1 - .../RegisterStore/Machine/Instruction/Sim/Defs.lean | 5 ----- .../Machine/Instruction/Sim/Internal.lean | 3 --- .../RegisterStore/Machine/Instruction/Store.lean | 1 - .../RegisterStore/Machine/Lookup/Defs.lean | 3 --- .../RegisterStore/Machine/Lookup/DenseInternal.lean | 2 +- .../Machine/Lookup/Internal/Reset.lean | 2 +- .../Machine/Lookup/Internal/Restore.lean | 1 - .../RegisterStore/Machine/Lookup/Internal/Scan.lean | 2 -- .../Machine/Lookup/Internal/Static.lean | 1 - .../Machine/Program/Bounds/Internal.lean | 3 +-- .../RegisterStore/Machine/Program/Defs.lean | 5 +---- .../RegisterStore/Machine/Program/DenseBounds.lean | 2 -- .../Machine/Program/DenseBoundsProof.lean | 6 +----- .../Machine/Program/DenseDecision.lean | 2 -- .../RegisterStore/Machine/Program/DenseInit.lean | 2 -- .../Machine/Program/DenseInitDefs.lean | 2 +- .../Machine/Program/DenseInitProof.lean | 1 + .../Machine/Program/DenseInternal.lean | 1 + .../RegisterStore/Machine/Program/Init/Defs.lean | 9 +-------- .../Machine/Program/Init/Internal.lean | 13 +------------ .../Machine/Program/Initialization.lean | 2 -- .../RegisterStore/Machine/Program/Internal.lean | 4 ---- .../RegisterStore/Machine/WordDecode.lean | 1 - .../RegisterStore/Machine/WordDecode/Defs.lean | 2 +- .../RegisterStore/Machine/WordDecode/Internal.lean | 1 + .../Machine/WordDecode/LinearInternal.lean | 2 +- .../RegisterStore/Machine/WordEncode.lean | 1 - .../RegisterStore/Machine/WordEncode/Defs.lean | 3 +-- .../RegisterStore/Machine/WordEncode/Internal.lean | 2 -- .../Simulation/TMConfig/Internal.lean | 1 + .../TMConfig/Sparse/ABI/Internal/Capture.lean | 1 + .../TMConfig/Sparse/ABI/Internal/Decision.lean | 1 + .../TMConfig/Sparse/ABI/Internal/Loop.lean | 1 + .../TMConfig/Sparse/ABI/Internal/Marshal.lean | 1 + .../TMConfig/Sparse/ABI/Internal/Resources.lean | 1 + .../Simulation/TMConfig/Sparse/Internal.lean | 1 + .../TMConfig/Sparse/Step/Internal/Action.lean | 1 + .../TMConfig/Sparse/Step/Internal/Dispatch.lean | 1 + .../TMConfig/Sparse/Step/Internal/Load.lean | 1 + .../TMConfig/Sparse/Step/Internal/Resources.lean | 2 +- .../Simulation/TMConfig/Step/Internal/Action.lean | 1 + .../Simulation/TMConfig/Step/Internal/Dispatch.lean | 1 + .../Simulation/TMConfig/Step/Internal/Load.lean | 1 + .../TMConfig/Step/Internal/Resources.lean | 1 + .../Structured/GateEval/Internal.lean | 3 ++- .../Structured/GateStep/Internal.lean | 1 + .../Structured/GateStreamStep/Internal.lean | 1 + .../Structured/Hamming/Internal.lean | 2 +- .../RandomAccessMachine/Structured/Internal.lean | 1 + .../Structured/Internal/Resources.lean | 1 + .../RandomAccessMachine/Structured/LastBit.lean | 1 + .../Structured/LastBit/Defs.lean | 1 + .../Structured/PairValidate/Defs.lean | 1 + .../Structured/Scanner/Internal.lean | 3 ++- .../Structured/ThreeSATSyntax/Defs.lean | 1 + .../Structured/UnaryDecode/Internal.lean | 2 +- Complexitylib/Models/RoseTreeMachine/Prog.lean | 2 +- Complexitylib/Models/TuringMachine.lean | 2 +- Complexitylib/Models/TuringMachine/Combinators.lean | 1 + .../Combinators/ForBinaryWork/Defs.lean | 1 + .../TuringMachine/Combinators/ForInput/Defs.lean | 1 + .../TuringMachine/Combinators/ForWorkOnes/Defs.lean | 1 + .../Combinators/Internal/Complement.lean | 2 +- .../TuringMachine/Combinators/Internal/If.lean | 1 - .../TuringMachine/Combinators/Internal/Loop.lean | 1 - .../Combinators/Internal/Retarget.lean | 4 ---- .../TuringMachine/Combinators/Internal/Scanner.lean | 3 ++- .../TuringMachine/Combinators/Internal/Seq.lean | 1 - .../TuringMachine/Combinators/Internal/Union.lean | 1 - .../Combinators/RetargetCompute/Internal.lean | 2 +- .../TuringMachine/Combinators/WorkBranch/Defs.lean | 1 + .../Combinators/WorkBranch/Internal.lean | 3 +-- .../Composition/Internal/FirstPhase.lean | 1 + .../TuringMachine/Composition/Internal/Tail.lean | 2 -- .../Composition/PairWithInput/Internal.lean | 1 - .../Models/TuringMachine/Deterministic.lean | 1 - .../Experimental/BinaryRoutine/Arithmetic/Defs.lean | 6 ------ .../BinaryRoutine/Arithmetic/Internal.lean | 6 ------ .../Experimental/BinaryRoutine/Control/Defs.lean | 1 - .../BinaryRoutine/Control/Internal.lean | 5 +---- .../Experimental/BinaryRoutine/Defs.lean | 3 --- .../BinaryRoutine/InputLength/Internal.lean | 1 - .../Experimental/BinaryRoutine/Internal.lean | 2 -- .../Experimental/BinaryRoutine/List/Internal.lean | 1 + .../BinaryRoutine/SpaceBounds/Defs.lean | 1 - .../BinaryRoutine/SpaceBounds/Internal.lean | 1 - Complexitylib/Models/TuringMachine/Hoare/Defs.lean | 1 - Complexitylib/Models/TuringMachine/Internal.lean | 1 + Complexitylib/Models/TuringMachine/Lift.lean | 1 + .../Models/TuringMachine/Placement/Defs.lean | 1 + .../Models/TuringMachine/Registers/DecReg.lean | 1 + .../Models/TuringMachine/Registers/Emit.lean | 1 + .../Models/TuringMachine/Registers/ForReg.lean | 1 + .../Models/TuringMachine/Registers/Horner.lean | 2 +- .../Models/TuringMachine/Registers/Probe.lean | 1 + .../Models/TuringMachine/Registers/RegisterOps.lean | 1 + .../TuringMachine/Repetition/Correctness.lean | 1 + .../Models/TuringMachine/Repetition/Defs.lean | 2 +- .../Models/TuringMachine/Repetition/Internal.lean | 1 + .../TuringMachine/Repetition/Internal/Finish.lean | 1 + .../TuringMachine/Repetition/Internal/Schedule.lean | 1 - .../TuringMachine/Repetition/Internal/Setup.lean | 1 + .../TuringMachine/Repetition/Internal/VoteStep.lean | 2 ++ .../TuringMachine/Repetition/Internal/Votes.lean | 1 + Complexitylib/Models/TuringMachine/SingleTape.lean | 1 - .../SingleTape/Internal/Correctness.lean | 2 ++ .../TuringMachine/SingleTape/Internal/Sim.lean | 2 -- .../SpaceTime/Internal/Observation.lean | 1 + .../TuringMachine/SpaceTime/Internal/Snapshot.lean | 2 ++ Complexitylib/Models/TuringMachine/Subroutines.lean | 1 + .../Subroutines/BinaryAdd/Internal.lean | 3 --- .../Subroutines/BinaryAddConst/Internal.lean | 2 -- .../Subroutines/BinaryCopy/Internal.lean | 1 - .../TuringMachine/Subroutines/BinaryEq/Defs.lean | 1 + .../Subroutines/BinaryEq/Internal.lean | 2 ++ .../TuringMachine/Subroutines/BinaryFor/Defs.lean | 1 + .../Subroutines/BinaryFor/Internal/Comparison.lean | 1 + .../Subroutines/BinaryFor/Internal/Loop.lean | 2 -- .../Subroutines/BinaryLength/Internal.lean | 2 -- .../Subroutines/BinaryMulAdd/Internal.lean | 7 ------- .../Subroutines/BinaryPolynomial/Defs.lean | 1 - .../Subroutines/BinaryPolynomial/Internal.lean | 3 +-- .../TuringMachine/Subroutines/BinaryPred/Defs.lean | 3 +-- .../Subroutines/BinaryPred/Internal.lean | 2 +- .../Subroutines/BinaryRippleAdd/Defs.lean | 1 + .../Subroutines/BinaryRippleAdd/Internal/Pure.lean | 2 ++ .../Subroutines/BinaryRippleAdd/Internal/Scan.lean | 2 +- .../Subroutines/BinaryRippleAdd/Internal/Sem.lean | 3 +-- .../Subroutines/BinaryRippleSub/Defs.lean | 1 + .../BinaryRippleSub/Internal/Backward.lean | 1 + .../Subroutines/BinaryRippleSub/Internal/Pure.lean | 1 + .../Subroutines/BinaryRippleSub/Internal/Scan.lean | 2 +- .../Subroutines/BinaryRippleSub/Internal/Sem.lean | 2 +- .../Subroutines/BinaryShiftMul/Internal/Out.lean | 1 - .../Subroutines/BinaryShiftMul/Internal/Sem.lean | 2 +- .../TuringMachine/Subroutines/BinarySucc/Defs.lean | 1 + .../Subroutines/BinarySucc/Internal.lean | 1 - .../TuringMachine/Subroutines/CopyOutput.lean | 1 - .../Models/TuringMachine/Subroutines/Counter.lean | 1 + .../TuringMachine/Subroutines/GuessBounded.lean | 2 ++ .../Models/TuringMachine/Subroutines/Internal.lean | 3 +-- .../Subroutines/Internal/CopyWorkOutput.lean | 1 + .../TuringMachine/Subroutines/PairEmit/Defs.lean | 1 + .../TuringMachine/Subroutines/PairSplit/Defs.lean | 1 + .../Subroutines/PairSplit/Internal.lean | 1 + .../TuringMachine/Subroutines/PairValidate.lean | 2 -- .../Subroutines/PairValidate/Defs.lean | 1 + .../Subroutines/PairValidate/Internal.lean | 1 + .../TuringMachine/Subroutines/ResetBinary.lean | 1 - .../Subroutines/ResetBinary/Internal.lean | 1 - .../TuringMachine/Subroutines/ResetBinaryMany.lean | 1 - .../Subroutines/ResetBinaryMany/Internal.lean | 1 + .../Models/TuringMachine/Subroutines/ScanRight.lean | 3 --- .../TuringMachine/Subroutines/UnaryLength/Defs.lean | 1 + .../Models/TuringMachine/Tape/Encoding.lean | 1 + Complexitylib/Models/TuringMachine/Trace.lean | 1 - Complexitylib/Models/TuringMachine/UTM/Clock.lean | 2 +- .../TuringMachine/UTM/ClockConstructible.lean | 1 + .../Models/TuringMachine/UTM/ClockedUtm.lean | 1 + .../Models/TuringMachine/UTM/Diagonal.lean | 1 + .../Models/TuringMachine/UTM/Encoding.lean | 1 + .../Models/TuringMachine/UTM/Internal/Body.lean | 2 -- .../TuringMachine/UTM/Internal/BodyApply.lean | 2 +- .../TuringMachine/UTM/Internal/BodyLookup.lean | 2 ++ .../Models/TuringMachine/UTM/Internal/BodyLoop.lean | 1 + .../TuringMachine/UTM/Internal/ClockFrontier.lean | 1 + .../Models/TuringMachine/UTM/Internal/Desc.lean | 2 +- .../TuringMachine/UTM/Internal/DescLayout.lean | 3 +-- .../Models/TuringMachine/UTM/Internal/Extract.lean | 1 + .../Models/TuringMachine/UTM/Internal/HaltTest.lean | 1 + .../Models/TuringMachine/UTM/Internal/Init.lean | 1 + .../Models/TuringMachine/UTM/Internal/Interp.lean | 1 - .../Models/TuringMachine/UTM/Internal/NegOut.lean | 1 + .../TuringMachine/UTM/Internal/SeekFrontier.lean | 1 + .../Models/TuringMachine/UTM/Internal/Sim.lean | 2 +- .../TuringMachine/UTM/Internal/SimClocked.lean | 1 + .../Models/TuringMachine/UTM/Internal/SimLoop.lean | 2 +- .../TuringMachine/UTM/Internal/TermCheck.lean | 2 ++ .../TuringMachine/UTM/Internal/Terminated.lean | 1 + .../Models/TuringMachine/UTM/Internal/VTape.lean | 1 + .../Models/TuringMachine/UTM/Internal/Verdict.lean | 2 +- Complexitylib/Models/TuringMachine/UTM/Machine.lean | 1 - Complexitylib/SAT/CookLevin.lean | 2 ++ Complexitylib/SAT/CookLevin/Internal/Emitter.lean | 1 - .../SAT/CookLevin/Internal/EmitterFamilies.lean | 1 + .../SAT/CookLevin/Internal/EmitterStart.lean | 1 + Complexitylib/SAT/Encoding.lean | 2 +- Complexitylib/SAT/Internal/GuessVerify.lean | 5 +---- Complexitylib/SAT/Language.lean | 3 --- Complexitylib/SAT/QBF.lean | 4 +--- Complexitylib/SAT/Resolution.lean | 1 + Complexitylib/SAT/Semantics.lean | 1 - Complexitylib/SAT/ThreeCNF.lean | 1 + Complexitylib/SAT/ThreeSAT.lean | 1 + Complexitylib/SAT/ThreeSAT/Completeness.lean | 1 - Complexitylib/SAT/ThreeSAT/Syntax.lean | 3 +-- Complexitylib/SAT/ThreeSAT/Verifier.lean | 2 -- Complexitylib/SAT/Tseitin/Internal/Correctness.lean | 2 ++ .../SAT/Tseitin/Internal/EncodingBounds.lean | 1 + .../SAT/Tseitin/Internal/FunctionSemantics.lean | 1 + Complexitylib/SAT/Tseitin/Internal/Shape.lean | 1 + Complexitylib/SAT/Tseitin/Internal/StateBounds.lean | 1 + Complexitylib/SAT/Tseitin/Machine.lean | 1 - Complexitylib/SAT/Tseitin/Machine/Controller.lean | 1 - Complexitylib/SAT/Tseitin/Machine/Defs.lean | 1 - .../SAT/Tseitin/Machine/Internal/BufferSpecs.lean | 1 - .../Tseitin/Machine/Internal/ControllerLift.lean | 1 - .../Tseitin/Machine/Internal/ControllerRead.lean | 2 ++ .../Machine/Internal/ControllerSemantics.lean | 1 - .../Tseitin/Machine/Internal/ControllerToken.lean | 1 - .../Tseitin/Machine/Internal/PolynomialTime.lean | 1 - .../SAT/Tseitin/Machine/Internal/RuntimeBounds.lean | 1 + .../SAT/Tseitin/Machine/Internal/Setup.lean | 1 - .../SAT/Tseitin/Machine/Internal/Validation.lean | 1 + .../Tseitin/Machine/Internal/ValidationFramed.lean | 1 + Complexitylib/SAT/Verifier.lean | 2 ++ Complexitylib/SAT/VerifierTM.lean | 9 ++------- Complexitylib/TimeConstructible.lean | 1 - scripts/noshake.json | 1 + 467 files changed, 324 insertions(+), 556 deletions(-) create mode 100644 scripts/noshake.json diff --git a/Complexitylib/Asymptotics.lean b/Complexitylib/Asymptotics.lean index aa8c7850..e1438351 100644 --- a/Complexitylib/Asymptotics.lean +++ b/Complexitylib/Asymptotics.lean @@ -5,15 +5,8 @@ Authors: Samuel Schlesinger -/ module -public import Mathlib.Analysis.Asymptotics.Defs public import Mathlib.Analysis.Asymptotics.SpecificAsymptotics -public import Mathlib.Analysis.Asymptotics.Lemmas -public import Mathlib.Algebra.Polynomial.Eval.Defs -public import Mathlib.Algebra.Polynomial.Eval.Degree -public import Mathlib.Data.Finset.Lattice.Fold -public import Mathlib.Data.Nat.Log public import Mathlib.Data.Nat.Size -public import Mathlib.Algebra.Order.Floor.Semiring /-! # Asymptotic notation for natural number functions diff --git a/Complexitylib/BooleanAnalysis/FourierExpansion.lean b/Complexitylib/BooleanAnalysis/FourierExpansion.lean index 5fb42df8..a68764cb 100644 --- a/Complexitylib/BooleanAnalysis/FourierExpansion.lean +++ b/Complexitylib/BooleanAnalysis/FourierExpansion.lean @@ -7,6 +7,7 @@ module public import Complexitylib.BooleanAnalysis.FourierExpansion.Internal public import Mathlib.Probability.ProbabilityMassFunction.Constructions +import Std.Tactic.BVDecide.Normalize.Prop /-! # Chapter 1: Boolean functions and the Fourier expansion diff --git a/Complexitylib/BooleanAnalysis/FourierExpansion/Defs.lean b/Complexitylib/BooleanAnalysis/FourierExpansion/Defs.lean index c4c4c631..80b9947f 100644 --- a/Complexitylib/BooleanAnalysis/FourierExpansion/Defs.lean +++ b/Complexitylib/BooleanAnalysis/FourierExpansion/Defs.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Mathlib.Algebra.BigOperators.Expect public import Mathlib.Analysis.InnerProductSpace.Basic public import Mathlib.Data.ZMod.Basic diff --git a/Complexitylib/BooleanAnalysis/FourierExpansion/Internal.lean b/Complexitylib/BooleanAnalysis/FourierExpansion/Internal.lean index 5d112aee..3ab18200 100644 --- a/Complexitylib/BooleanAnalysis/FourierExpansion/Internal.lean +++ b/Complexitylib/BooleanAnalysis/FourierExpansion/Internal.lean @@ -7,6 +7,7 @@ module public import Complexitylib.BooleanAnalysis.FourierExpansion.Defs public import Mathlib.Analysis.InnerProductSpace.PiL2 +import Std.Tactic.BVDecide.Normalize.Prop /-! # Chapter 1: Boolean functions and the Fourier expansion — Internal lemmas diff --git a/Complexitylib/Circuits/AC0/Iteration/Defs.lean b/Complexitylib/Circuits/AC0/Iteration/Defs.lean index 47652d96..6fb96a50 100644 --- a/Complexitylib/Circuits/AC0/Iteration/Defs.lean +++ b/Complexitylib/Circuits/AC0/Iteration/Defs.lean @@ -8,9 +8,7 @@ module public import Complexitylib.Circuits.AC0.Restriction public import Complexitylib.Circuits.AC0.Switching.Defs public import Complexitylib.Circuits.DecisionTree.NormalForm.Defs -public import Complexitylib.Circuits.RandomRestriction.Defs public import Mathlib.Data.Fintype.BigOperators -public import Mathlib.Data.Fintype.Card /-! # Iterated switching for AC0 formulas -- definitions diff --git a/Complexitylib/Circuits/AC0/Iteration/Internal.lean b/Complexitylib/Circuits/AC0/Iteration/Internal.lean index 8ed791db..8297d95b 100644 --- a/Complexitylib/Circuits/AC0/Iteration/Internal.lean +++ b/Complexitylib/Circuits/AC0/Iteration/Internal.lean @@ -8,9 +8,9 @@ module public import Complexitylib.Circuits.AC0.Iteration.Defs public import Complexitylib.Circuits.AC0.Switching.Internal public import Complexitylib.Circuits.DecisionTree.NormalForm.Internal -public import Complexitylib.Circuits.RandomRestriction.Internal public import Mathlib.Algebra.BigOperators.Ring.Finset public import Mathlib.Algebra.Order.BigOperators.Group.Finset +import Std.Tactic.BVDecide.Normalize.Prop /-! # Iterated switching for AC0 formulas -- proof internals diff --git a/Complexitylib/Circuits/AC0/Normalization/Internal.lean b/Complexitylib/Circuits/AC0/Normalization/Internal.lean index 965a49c8..979f4be1 100644 --- a/Complexitylib/Circuits/AC0/Normalization/Internal.lean +++ b/Complexitylib/Circuits/AC0/Normalization/Internal.lean @@ -8,6 +8,7 @@ module public import Complexitylib.Circuits.AC0.NormalForm.Internal public import Complexitylib.Circuits.AC0.Normalization.Defs public import Mathlib.Tactic +import Std.Tactic.BVDecide.Normalize.Bool /-! # AC0 circuit normalization -- proof internals diff --git a/Complexitylib/Circuits/AC0/Restriction.lean b/Complexitylib/Circuits/AC0/Restriction.lean index ce2d9f43..b6c8d83b 100644 --- a/Complexitylib/Circuits/AC0/Restriction.lean +++ b/Complexitylib/Circuits/AC0/Restriction.lean @@ -7,6 +7,8 @@ module public import Complexitylib.Circuits.AC0.NormalForm public import Complexitylib.Circuits.Restriction +import Std.Tactic.BVDecide.Normalize.Bool +import Std.Tactic.BVDecide.Normalize.Prop /-! # Restricting negation-normal AC0 formulas diff --git a/Complexitylib/Circuits/AC0/Switching/Collection/Internal.lean b/Complexitylib/Circuits/AC0/Switching/Collection/Internal.lean index 11b41401..c454859b 100644 --- a/Complexitylib/Circuits/AC0/Switching/Collection/Internal.lean +++ b/Complexitylib/Circuits/AC0/Switching/Collection/Internal.lean @@ -7,7 +7,6 @@ module public import Complexitylib.Circuits.AC0.Switching.Collection.Defs public import Complexitylib.Circuits.AC0.Switching.Internal -public import Complexitylib.Circuits.RandomRestriction.Internal public import Mathlib.Algebra.BigOperators.Ring.Finset public import Mathlib.Algebra.Order.BigOperators.Group.Finset diff --git a/Complexitylib/Circuits/AC0/Switching/Defs.lean b/Complexitylib/Circuits/AC0/Switching/Defs.lean index a9286af1..3231d96b 100644 --- a/Complexitylib/Circuits/AC0/Switching/Defs.lean +++ b/Complexitylib/Circuits/AC0/Switching/Defs.lean @@ -6,7 +6,6 @@ Authors: Samuel Schlesinger module public import Complexitylib.Circuits.DecisionTree.Block.Defs -public import Complexitylib.Circuits.DecisionTree.Finite.Defs public import Complexitylib.Circuits.NormalForm.Restriction public import Complexitylib.Circuits.RandomRestriction.Defs diff --git a/Complexitylib/Circuits/AC0/Switching/Internal.lean b/Complexitylib/Circuits/AC0/Switching/Internal.lean index f9f38580..94eb8f79 100644 --- a/Complexitylib/Circuits/AC0/Switching/Internal.lean +++ b/Complexitylib/Circuits/AC0/Switching/Internal.lean @@ -10,6 +10,8 @@ public import Complexitylib.Circuits.DecisionTree.Block public import Complexitylib.Circuits.DecisionTree.Finite public import Complexitylib.Circuits.DecisionTree.Path public import Complexitylib.Circuits.RandomRestriction.Internal +import Std.Tactic.BVDecide.Normalize.BitVec +import Std.Tactic.BVDecide.Normalize.Prop /-! # Switching-lemma substrate -- proof internals diff --git a/Complexitylib/Circuits/AC0/Switching/Parity/Internal.lean b/Complexitylib/Circuits/AC0/Switching/Parity/Internal.lean index 39f7e297..4a5818bc 100644 --- a/Complexitylib/Circuits/AC0/Switching/Parity/Internal.lean +++ b/Complexitylib/Circuits/AC0/Switching/Parity/Internal.lean @@ -6,7 +6,6 @@ Authors: Samuel Schlesinger module public import Complexitylib.Circuits.AC0.Switching.Internal -public import Complexitylib.Circuits.RandomRestriction.Internal public import Complexitylib.Circuits.XOR.Restriction.Internal /-! diff --git a/Complexitylib/Circuits/AndOrNot.lean b/Complexitylib/Circuits/AndOrNot.lean index 4b2fd15d..2699d5e7 100644 --- a/Complexitylib/Circuits/AndOrNot.lean +++ b/Complexitylib/Circuits/AndOrNot.lean @@ -6,7 +6,6 @@ Authors: Samuel Schlesinger module public import Complexitylib.Circuits.AndOrNot.Defs -public import Complexitylib.Circuits.Internal.AndOrNot public import Complexitylib.Circuits.Internal.Simulation /-! # AND/OR/NOT Basis diff --git a/Complexitylib/Circuits/Barrington.lean b/Complexitylib/Circuits/Barrington.lean index 9e589bc8..3580bf94 100644 --- a/Complexitylib/Circuits/Barrington.lean +++ b/Complexitylib/Circuits/Barrington.lean @@ -8,6 +8,8 @@ module public import Complexitylib.Circuits.BranchingProgram public import Mathlib.Algebra.Group.Commutator public import Mathlib.Data.List.ModifyLast +import Std.Tactic.BVDecide.Normalize.Bool +import Std.Tactic.BVDecide.Normalize.Prop /-! # Toward Barrington's theorem: the group-theoretic core diff --git a/Complexitylib/Circuits/BarringtonBridge.lean b/Complexitylib/Circuits/BarringtonBridge.lean index 5d56fa1b..9d3eaa37 100644 --- a/Complexitylib/Circuits/BarringtonBridge.lean +++ b/Complexitylib/Circuits/BarringtonBridge.lean @@ -7,7 +7,6 @@ module public import Complexitylib.Circuits.Barrington public import Complexitylib.Circuits.BarringtonS5 -public import Mathlib.GroupTheory.Perm.Cycle.Type /-! # Barrington: bridging the abstract move-set to the `S₅` cycle algebra diff --git a/Complexitylib/Circuits/BarringtonCodeGenerator/Defs.lean b/Complexitylib/Circuits/BarringtonCodeGenerator/Defs.lean index 07aea0f5..19859e84 100644 --- a/Complexitylib/Circuits/BarringtonCodeGenerator/Defs.lean +++ b/Complexitylib/Circuits/BarringtonCodeGenerator/Defs.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Circuits.BarringtonCompiler.Defs public import Complexitylib.Circuits.BranchingProgramEncoding.Defs public import Complexitylib.Circuits.FormulaEncoding.Defs diff --git a/Complexitylib/Circuits/BarringtonCodeGenerator/Internal.lean b/Complexitylib/Circuits/BarringtonCodeGenerator/Internal.lean index 19b79b78..908c0383 100644 --- a/Complexitylib/Circuits/BarringtonCodeGenerator/Internal.lean +++ b/Complexitylib/Circuits/BarringtonCodeGenerator/Internal.lean @@ -6,7 +6,6 @@ Authors: Samuel Schlesinger module public import Complexitylib.Circuits.BarringtonCodeGenerator.Defs -public import Complexitylib.Circuits.BarringtonCompiler public import Complexitylib.Circuits.BranchingProgramEncoding public import Complexitylib.Circuits.FormulaEncoding diff --git a/Complexitylib/Circuits/BarringtonCompiler/Internal.lean b/Complexitylib/Circuits/BarringtonCompiler/Internal.lean index 9ef73106..68910f4e 100644 --- a/Complexitylib/Circuits/BarringtonCompiler/Internal.lean +++ b/Complexitylib/Circuits/BarringtonCompiler/Internal.lean @@ -7,6 +7,8 @@ module public import Complexitylib.Circuits.BarringtonCompiler.Defs public import Complexitylib.Circuits.BarringtonLength +import Std.Tactic.BVDecide.Normalize.BitVec +import Std.Tactic.BVDecide.Normalize.Prop /-! # An executable Barrington compiler -- proof internals diff --git a/Complexitylib/Circuits/BarringtonConverse/Defs.lean b/Complexitylib/Circuits/BarringtonConverse/Defs.lean index a00f6cf9..b489ee8e 100644 --- a/Complexitylib/Circuits/BarringtonConverse/Defs.lean +++ b/Complexitylib/Circuits/BarringtonConverse/Defs.lean @@ -6,7 +6,6 @@ Authors: Samuel Schlesinger module public import Complexitylib.Circuits.BarringtonFamily -public import Mathlib.Data.List.OfFn /-! # The converse direction of Barrington's theorem -- definitions diff --git a/Complexitylib/Circuits/BarringtonConverse/Internal.lean b/Complexitylib/Circuits/BarringtonConverse/Internal.lean index 38e04903..a67908f1 100644 --- a/Complexitylib/Circuits/BarringtonConverse/Internal.lean +++ b/Complexitylib/Circuits/BarringtonConverse/Internal.lean @@ -6,6 +6,8 @@ Authors: Samuel Schlesinger module public import Complexitylib.Circuits.BarringtonConverse.Defs +import Std.Tactic.BVDecide.Normalize.Bool +import Std.Tactic.BVDecide.Normalize.Prop /-! # The converse direction of Barrington's theorem -- proof internals diff --git a/Complexitylib/Circuits/BarringtonFamily.lean b/Complexitylib/Circuits/BarringtonFamily.lean index 93a81284..000604e1 100644 --- a/Complexitylib/Circuits/BarringtonFamily.lean +++ b/Complexitylib/Circuits/BarringtonFamily.lean @@ -6,7 +6,6 @@ Authors: Samuel Schlesinger module public import Complexitylib.Circuits.BarringtonLength -public import Mathlib.Data.Nat.Log /-! # Barrington at the family level: `NC¹ ⊆` polynomial-size width-`5` branching programs diff --git a/Complexitylib/Circuits/BarringtonLength.lean b/Complexitylib/Circuits/BarringtonLength.lean index 62dcb6d3..f3e77401 100644 --- a/Complexitylib/Circuits/BarringtonLength.lean +++ b/Complexitylib/Circuits/BarringtonLength.lean @@ -8,7 +8,7 @@ module public import Complexitylib.Circuits.BarringtonBridge public import Complexitylib.Circuits.Formula public import Mathlib.Tactic.Linarith -public import Mathlib.Data.Nat.Log +import Std.Tactic.BVDecide.Normalize.Bool /-! # Barrington's theorem with a length bound diff --git a/Complexitylib/Circuits/BarringtonRepr.lean b/Complexitylib/Circuits/BarringtonRepr.lean index 0e12bb25..b1324a81 100644 --- a/Complexitylib/Circuits/BarringtonRepr.lean +++ b/Complexitylib/Circuits/BarringtonRepr.lean @@ -5,12 +5,9 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Circuits.Barrington -public import Complexitylib.Circuits.BarringtonS5 public import Complexitylib.Circuits.BarringtonBridge public import Complexitylib.Circuits.Formula -public import Mathlib.GroupTheory.Perm.Cycle.Type -public import Mathlib.GroupTheory.Perm.Fin +import Std.Tactic.BVDecide.Normalize.Bool /-! # Barrington's theorem (representation form) diff --git a/Complexitylib/Circuits/BarringtonS5.lean b/Complexitylib/Circuits/BarringtonS5.lean index 70ebe57a..368b526d 100644 --- a/Complexitylib/Circuits/BarringtonS5.lean +++ b/Complexitylib/Circuits/BarringtonS5.lean @@ -6,11 +6,8 @@ Authors: Samuel Schlesinger module public import Mathlib.GroupTheory.Perm.Fin -public import Mathlib.GroupTheory.Perm.Cycle.Type public import Mathlib.GroupTheory.Perm.Cycle.Concrete -public import Mathlib.Algebra.Group.Commutator public import Mathlib.Tactic.NormNum.Prime -public import Mathlib.Tactic.Common /-! # The `S₅` five-cycle commutator (Barrington's non-solvability input) diff --git a/Complexitylib/Circuits/BarringtonTyped/Internal.lean b/Complexitylib/Circuits/BarringtonTyped/Internal.lean index 2e25fdfc..5ec7900a 100644 --- a/Complexitylib/Circuits/BarringtonTyped/Internal.lean +++ b/Complexitylib/Circuits/BarringtonTyped/Internal.lean @@ -8,6 +8,7 @@ module public import Complexitylib.Circuits.BarringtonCompiler public import Complexitylib.Circuits.BarringtonConverse public import Complexitylib.Circuits.BarringtonTyped.Defs +import Std.Tactic.BVDecide.Normalize.BitVec /-! # Fixed-arity nonuniform Barrington families -- proof internals diff --git a/Complexitylib/Circuits/BitString.lean b/Complexitylib/Circuits/BitString.lean index 7b08d9f4..a54181d5 100644 --- a/Complexitylib/Circuits/BitString.lean +++ b/Complexitylib/Circuits/BitString.lean @@ -6,7 +6,6 @@ Authors: Samuel Schlesinger module public import Complexitylib.Circuits.Basic -public import Mathlib.Data.List.OfFn /-! # Fixed-length bit strings and lists diff --git a/Complexitylib/Circuits/BranchingProgramEncoding/Internal.lean b/Complexitylib/Circuits/BranchingProgramEncoding/Internal.lean index 4bb71199..56b4218b 100644 --- a/Complexitylib/Circuits/BranchingProgramEncoding/Internal.lean +++ b/Complexitylib/Circuits/BranchingProgramEncoding/Internal.lean @@ -8,6 +8,7 @@ module public import Complexitylib.Circuits.BarringtonCompiler public import Complexitylib.Circuits.BranchingProgramEncoding.Defs public import Complexitylib.Circuits.Encoding +import Std.Tactic.BVDecide.Normalize.Prop /-! # Width-five branching-program codec internals diff --git a/Complexitylib/Circuits/DecisionTree.lean b/Complexitylib/Circuits/DecisionTree.lean index cdadf2de..cf6e44f9 100644 --- a/Complexitylib/Circuits/DecisionTree.lean +++ b/Complexitylib/Circuits/DecisionTree.lean @@ -5,12 +5,9 @@ Authors: Samuel Schlesinger -/ module -public import Mathlib.Data.Nat.Basic -public import Mathlib.Data.Bool.Basic -public import Mathlib.Data.Finset.Basic -public import Mathlib.Data.Finset.Union public import Mathlib.Data.Finset.Card public import Complexitylib.Circuits.Formula +import Std.Tactic.BVDecide.Normalize.Bool /-! # Boolean decision trees diff --git a/Complexitylib/Circuits/DecisionTree/Block/Defs.lean b/Complexitylib/Circuits/DecisionTree/Block/Defs.lean index 31417f3a..587ff45d 100644 --- a/Complexitylib/Circuits/DecisionTree/Block/Defs.lean +++ b/Complexitylib/Circuits/DecisionTree/Block/Defs.lean @@ -6,7 +6,6 @@ Authors: Samuel Schlesinger module public import Complexitylib.Circuits.DecisionTree.Path.Defs -public import Complexitylib.Circuits.Restriction /-! # Complete query blocks in finite decision trees -- definitions diff --git a/Complexitylib/Circuits/DecisionTree/Block/Internal.lean b/Complexitylib/Circuits/DecisionTree/Block/Internal.lean index 2757ffc3..33f8ec1b 100644 --- a/Complexitylib/Circuits/DecisionTree/Block/Internal.lean +++ b/Complexitylib/Circuits/DecisionTree/Block/Internal.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Circuits.DecisionTree.Block.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Complete query blocks in finite decision trees -- proof internals diff --git a/Complexitylib/Circuits/DecisionTree/Finite/Internal.lean b/Complexitylib/Circuits/DecisionTree/Finite/Internal.lean index 8f3208fe..2f2013e1 100644 --- a/Complexitylib/Circuits/DecisionTree/Finite/Internal.lean +++ b/Complexitylib/Circuits/DecisionTree/Finite/Internal.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Circuits.DecisionTree.Finite.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Finite-arity decision trees -- proof internals diff --git a/Complexitylib/Circuits/DecisionTree/NormalForm/Defs.lean b/Complexitylib/Circuits/DecisionTree/NormalForm/Defs.lean index f97bf76a..cdceff89 100644 --- a/Complexitylib/Circuits/DecisionTree/NormalForm/Defs.lean +++ b/Complexitylib/Circuits/DecisionTree/NormalForm/Defs.lean @@ -6,7 +6,6 @@ Authors: Samuel Schlesinger module public import Complexitylib.Circuits.DecisionTree.Finite.Defs -public import Complexitylib.Circuits.NormalForm.Defs public import Complexitylib.Circuits.NormalForm.Operations.Defs /-! diff --git a/Complexitylib/Circuits/DecisionTree/NormalForm/Internal.lean b/Complexitylib/Circuits/DecisionTree/NormalForm/Internal.lean index bf837521..ae297616 100644 --- a/Complexitylib/Circuits/DecisionTree/NormalForm/Internal.lean +++ b/Complexitylib/Circuits/DecisionTree/NormalForm/Internal.lean @@ -8,6 +8,8 @@ module public import Complexitylib.Circuits.DecisionTree.Finite.Internal public import Complexitylib.Circuits.DecisionTree.NormalForm.Defs public import Complexitylib.Circuits.NormalForm.Operations.Internal +import Std.Tactic.BVDecide.Normalize.Bool +import Std.Tactic.BVDecide.Normalize.Prop /-! # Compiling finite decision trees to CNF and DNF -- proof internals diff --git a/Complexitylib/Circuits/DecisionTree/Path/Internal.lean b/Complexitylib/Circuits/DecisionTree/Path/Internal.lean index 7ff7812c..4f55c090 100644 --- a/Complexitylib/Circuits/DecisionTree/Path/Internal.lean +++ b/Complexitylib/Circuits/DecisionTree/Path/Internal.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Circuits.DecisionTree.Path.Defs public import Complexitylib.Circuits.DecisionTree.Finite.Internal +import Std.Tactic.BVDecide.Normalize.Prop /-! # Canonical deepest paths in finite decision trees -- proof internals diff --git a/Complexitylib/Circuits/DecisionTree/Restriction.lean b/Complexitylib/Circuits/DecisionTree/Restriction.lean index 98c6b6ea..3585bc6a 100644 --- a/Complexitylib/Circuits/DecisionTree/Restriction.lean +++ b/Complexitylib/Circuits/DecisionTree/Restriction.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Circuits.DecisionTree public import Complexitylib.Circuits.Restriction +import Std.Tactic.BVDecide.Normalize.Prop /-! # Restricting decision trees diff --git a/Complexitylib/Circuits/Dependency/Internal.lean b/Complexitylib/Circuits/Dependency/Internal.lean index 1717fa9b..c943db86 100644 --- a/Complexitylib/Circuits/Dependency/Internal.lean +++ b/Complexitylib/Circuits/Dependency/Internal.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Circuits.Dependency.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Circuit dependency graphs -- proof internals diff --git a/Complexitylib/Circuits/DepthClasses/Defs.lean b/Complexitylib/Circuits/DepthClasses/Defs.lean index c2b30f5a..6c9b8bc2 100644 --- a/Complexitylib/Circuits/DepthClasses/Defs.lean +++ b/Complexitylib/Circuits/DepthClasses/Defs.lean @@ -5,8 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Circuits.AndOrNot.Defs -public import Complexitylib.Circuits.Family.Defs public import Complexitylib.Circuits.Threshold.Defs public import Mathlib.Data.Nat.Log diff --git a/Complexitylib/Circuits/DepthClasses/Internal.lean b/Complexitylib/Circuits/DepthClasses/Internal.lean index abd483ff..2deba6a3 100644 --- a/Complexitylib/Circuits/DepthClasses/Internal.lean +++ b/Complexitylib/Circuits/DepthClasses/Internal.lean @@ -6,7 +6,6 @@ Authors: Samuel Schlesinger module public import Complexitylib.Circuits.DepthClasses.Defs -public import Complexitylib.Circuits.BasisHom public import Complexitylib.Circuits.Family public import Complexitylib.Circuits.Threshold diff --git a/Complexitylib/Circuits/Encoding/Family.lean b/Complexitylib/Circuits/Encoding/Family.lean index fd33eee9..5a102cb3 100644 --- a/Complexitylib/Circuits/Encoding/Family.lean +++ b/Complexitylib/Circuits/Encoding/Family.lean @@ -8,6 +8,7 @@ module public import Complexitylib.Circuits.Encoding public import Complexitylib.Circuits.Family public import Complexitylib.Encoding.Pairing +import Std.Tactic.BVDecide.Normalize.Prop /-! # Encodings of whole circuit families diff --git a/Complexitylib/Circuits/Encoding/Formula/Batch/Internal.lean b/Complexitylib/Circuits/Encoding/Formula/Batch/Internal.lean index ccd5d022..65316b39 100644 --- a/Complexitylib/Circuits/Encoding/Formula/Batch/Internal.lean +++ b/Complexitylib/Circuits/Encoding/Formula/Batch/Internal.lean @@ -7,6 +7,8 @@ module public import Complexitylib.Circuits.Encoding.Formula.Batch.Defs public import Complexitylib.Circuits.Encoding.Formula.Internal +import Std.Tactic.BVDecide.Normalize.BitVec +import Std.Tactic.BVDecide.Normalize.Prop /-! # Internals for batch formula compilation diff --git a/Complexitylib/Circuits/Encoding/Internal/Codec.lean b/Complexitylib/Circuits/Encoding/Internal/Codec.lean index 6897e289..4521c637 100644 --- a/Complexitylib/Circuits/Encoding/Internal/Codec.lean +++ b/Complexitylib/Circuits/Encoding/Internal/Codec.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Circuits.Encoding.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Correctness of the machine-facing circuit codec diff --git a/Complexitylib/Circuits/Encoding/Internal/Fragment.lean b/Complexitylib/Circuits/Encoding/Internal/Fragment.lean index 6e0f46de..ab48e74f 100644 --- a/Complexitylib/Circuits/Encoding/Internal/Fragment.lean +++ b/Complexitylib/Circuits/Encoding/Internal/Fragment.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Circuits.Encoding.Internal.Codec public import Complexitylib.Circuits.Encoding.Fragment.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Internal laws for appendable raw-circuit fragments diff --git a/Complexitylib/Circuits/Encoding/Internal/Semantics.lean b/Complexitylib/Circuits/Encoding/Internal/Semantics.lean index 83484634..324863de 100644 --- a/Complexitylib/Circuits/Encoding/Internal/Semantics.lean +++ b/Complexitylib/Circuits/Encoding/Internal/Semantics.lean @@ -8,6 +8,7 @@ module public import Complexitylib.Circuits.BitString public import Complexitylib.Circuits.Encoding.Internal.Codec public import Complexitylib.Circuits.Internal.CircuitToDescriptor +import Std.Tactic.BVDecide.Normalize.Prop /-! # Internal: semantics of encoded fan-in-two circuits diff --git a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Evaluator.lean b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Evaluator.lean index 8cedf087..3be71aa1 100644 --- a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Evaluator.lean +++ b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Evaluator.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Asymptotics public import Complexitylib.Circuits.Encoding.Machine.Internal.FrontEnd public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Hoare public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Stage diff --git a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/EmptyReject.lean b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/EmptyReject.lean index 3cdbe613..3cc5b66f 100644 --- a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/EmptyReject.lean +++ b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/EmptyReject.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Pure +import Std.Tactic.BVDecide.Normalize.Prop /-! # Malformed empty-family execution diff --git a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Gate.lean b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Gate.lean index 01497751..0ddbf3ac 100644 --- a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Gate.lean +++ b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Gate.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution +import Std.Tactic.BVDecide.Normalize.Bool /-! # One-gate execution for the streaming circuit evaluator diff --git a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Gate/Attempt.lean b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Gate/Attempt.lean index 9bf0d16b..a4ff2a38 100644 --- a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Gate/Attempt.lean +++ b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Gate/Attempt.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.Gate public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Pure +import Std.Tactic.BVDecide.Normalize.BitVec /-! # Pure-to-machine gate-attempt bridge diff --git a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Gate/Loop.lean b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Gate/Loop.lean index e3baa5de..568259b6 100644 --- a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Gate/Loop.lean +++ b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/Gate/Loop.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution.Gate.Attempt +import Std.Tactic.BVDecide.Normalize.Prop /-! # Successful gate-stream execution diff --git a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/PositiveReject.lean b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/PositiveReject.lean index e79c96f2..a01088a6 100644 --- a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/PositiveReject.lean +++ b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Execution/PositiveReject.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Circuits.Encoding.Internal.Codec public import Complexitylib.Circuits.Encoding.Machine.Core.Internal.Execution /-! diff --git a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Tape.lean b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Tape.lean index 4bb3eba9..28a03e78 100644 --- a/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Tape.lean +++ b/Complexitylib/Circuits/Encoding/Machine/Core/Internal/Tape.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Circuits.Encoding.Machine.Core.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Tape cursors for the streaming circuit evaluator diff --git a/Complexitylib/Circuits/Encoding/Machine/GateStream/Defs.lean b/Complexitylib/Circuits/Encoding/Machine/GateStream/Defs.lean index f69580ff..ce20a002 100644 --- a/Complexitylib/Circuits/Encoding/Machine/GateStream/Defs.lean +++ b/Complexitylib/Circuits/Encoding/Machine/GateStream/Defs.lean @@ -6,7 +6,6 @@ Authors: Samuel Schlesinger module public import Complexitylib.Circuits.Encoding.Machine.RawGate.Defs -public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs /-! # One streaming raw-gate step diff --git a/Complexitylib/Circuits/Encoding/Machine/GateStream/Internal.lean b/Complexitylib/Circuits/Encoding/Machine/GateStream/Internal.lean index 2a7e013f..06e62b9e 100644 --- a/Complexitylib/Circuits/Encoding/Machine/GateStream/Internal.lean +++ b/Complexitylib/Circuits/Encoding/Machine/GateStream/Internal.lean @@ -7,8 +7,6 @@ module public import Complexitylib.Circuits.Encoding.Machine.GateStream.Defs public import Complexitylib.Circuits.Encoding.Machine.RawGate -public import Complexitylib.Models.TuringMachine.Hoare.Space -public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc /-! # One streaming raw-gate step -- proof internals diff --git a/Complexitylib/Circuits/Encoding/Machine/Internal/FrontEnd.lean b/Complexitylib/Circuits/Encoding/Machine/Internal/FrontEnd.lean index e6303091..551712f4 100644 --- a/Complexitylib/Circuits/Encoding/Machine/Internal/FrontEnd.lean +++ b/Complexitylib/Circuits/Encoding/Machine/Internal/FrontEnd.lean @@ -6,7 +6,6 @@ Authors: Samuel Schlesinger module public import Complexitylib.Circuits.Encoding.Machine.Defs -public import Complexitylib.Models.TuringMachine.Hoare public import Complexitylib.Models.TuringMachine.Subroutines.Internal public import Complexitylib.Models.TuringMachine.Subroutines.PairSplit public import Complexitylib.Models.TuringMachine.Subroutines.PairValidate diff --git a/Complexitylib/Circuits/Encoding/Machine/NatCode/Internal.lean b/Complexitylib/Circuits/Encoding/Machine/NatCode/Internal.lean index 0c5ebb4d..bc91d669 100644 --- a/Complexitylib/Circuits/Encoding/Machine/NatCode/Internal.lean +++ b/Complexitylib/Circuits/Encoding/Machine/NatCode/Internal.lean @@ -6,9 +6,6 @@ Authors: Samuel Schlesinger module public import Complexitylib.Circuits.Encoding.Machine.NatCode.Defs -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Seq -public import Complexitylib.Models.TuringMachine.Hoare.Space -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Internal.Control public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc public import Complexitylib.Models.TuringMachine.Subroutines.ClearWork diff --git a/Complexitylib/Circuits/Encoding/Machine/RawGate/Internal.lean b/Complexitylib/Circuits/Encoding/Machine/RawGate/Internal.lean index e149fe0f..c0962932 100644 --- a/Complexitylib/Circuits/Encoding/Machine/RawGate/Internal.lean +++ b/Complexitylib/Circuits/Encoding/Machine/RawGate/Internal.lean @@ -7,7 +7,6 @@ module public import Complexitylib.Circuits.Encoding.Machine.NatCode public import Complexitylib.Circuits.Encoding.Machine.RawGate.Defs -public import Complexitylib.Models.TuringMachine.Hoare.Space /-! # Machine emission of raw circuit gates — proof internals diff --git a/Complexitylib/Circuits/Encoding/Threshold/Internal.lean b/Complexitylib/Circuits/Encoding/Threshold/Internal.lean index 3dc693d4..9d1ad27a 100644 --- a/Complexitylib/Circuits/Encoding/Threshold/Internal.lean +++ b/Complexitylib/Circuits/Encoding/Threshold/Internal.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Circuits.Encoding.Threshold.Defs public import Complexitylib.Circuits.Encoding.Fragment +import Std.Tactic.BVDecide.Normalize.BitVec /-! # Raw threshold-fragment internals diff --git a/Complexitylib/Circuits/Formula.lean b/Complexitylib/Circuits/Formula.lean index 3d36dfc8..7838a4f8 100644 --- a/Complexitylib/Circuits/Formula.lean +++ b/Complexitylib/Circuits/Formula.lean @@ -5,9 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Mathlib.Data.Nat.Basic -public import Mathlib.Data.Bool.Basic -public import Mathlib.Data.Finset.Basic public import Mathlib.Data.Finset.Union /-! diff --git a/Complexitylib/Circuits/FormulaEncoding/Internal.lean b/Complexitylib/Circuits/FormulaEncoding/Internal.lean index a53af67b..e45ab127 100644 --- a/Complexitylib/Circuits/FormulaEncoding/Internal.lean +++ b/Complexitylib/Circuits/FormulaEncoding/Internal.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Circuits.Encoding public import Complexitylib.Circuits.FormulaEncoding.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Boolean-formula codec internals diff --git a/Complexitylib/Circuits/Internal/AndOrNot.lean b/Complexitylib/Circuits/Internal/AndOrNot.lean index 46f31b26..0b663854 100644 --- a/Complexitylib/Circuits/Internal/AndOrNot.lean +++ b/Complexitylib/Circuits/Internal/AndOrNot.lean @@ -6,6 +6,8 @@ Authors: Samuel Schlesinger module public import Complexitylib.Circuits.AndOrNot.Defs +import Std.Tactic.BVDecide.Normalize.BitVec +import Std.Tactic.BVDecide.Normalize.Prop /-! # Internal: AND/OR/NOT Completeness Proof diff --git a/Complexitylib/Circuits/Internal/CircuitDescriptor.lean b/Complexitylib/Circuits/Internal/CircuitDescriptor.lean index c5011fdd..d244e6d4 100644 --- a/Complexitylib/Circuits/Internal/CircuitDescriptor.lean +++ b/Complexitylib/Circuits/Internal/CircuitDescriptor.lean @@ -5,9 +5,9 @@ Authors: Samuel Schlesinger -/ module -public import Mathlib.Data.Fintype.BigOperators public import Mathlib.Tactic public import Complexitylib.Circuits.Basic +import Std.Tactic.BVDecide.Normalize.Prop /-! # Internal: Circuit Descriptors and Shannon Counting Bound diff --git a/Complexitylib/Circuits/Internal/LowerBound.lean b/Complexitylib/Circuits/Internal/LowerBound.lean index 1eecc40f..117cbf40 100644 --- a/Complexitylib/Circuits/Internal/LowerBound.lean +++ b/Complexitylib/Circuits/Internal/LowerBound.lean @@ -9,6 +9,7 @@ public import Mathlib.Algebra.Order.BigOperators.Group.Finset public import Complexitylib.Circuits.EssentialInput public import Complexitylib.Circuits.AndOrNot.Defs public import Complexitylib.Circuits.Dependency.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Internal: Gate Elimination Lower Bound diff --git a/Complexitylib/Circuits/Internal/Nondeterminism.lean b/Complexitylib/Circuits/Internal/Nondeterminism.lean index 05c80548..86e19d7e 100644 --- a/Complexitylib/Circuits/Internal/Nondeterminism.lean +++ b/Complexitylib/Circuits/Internal/Nondeterminism.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Circuits.Nondeterminism.Defs public import Complexitylib.Circuits.Internal.ShannonUpper +import Std.Tactic.BVDecide.Normalize.Bool /-! # Internal: Nondeterministic Quantification Circuit Constructions diff --git a/Complexitylib/Circuits/Internal/NormalForm.lean b/Complexitylib/Circuits/Internal/NormalForm.lean index 1fd95c5b..6a515369 100644 --- a/Complexitylib/Circuits/Internal/NormalForm.lean +++ b/Complexitylib/Circuits/Internal/NormalForm.lean @@ -8,6 +8,8 @@ module public import Complexitylib.Circuits.NormalForm.Defs public import Complexitylib.Circuits.AndOrNot.Defs public import Mathlib.Data.Fintype.BigOperators +import Std.Tactic.BVDecide.Normalize.Bool +import Std.Tactic.BVDecide.Normalize.Prop /-! # Internal: Normal Form Proof Machinery diff --git a/Complexitylib/Circuits/Internal/Schnorr.lean b/Complexitylib/Circuits/Internal/Schnorr.lean index 02fdb596..df4b21ac 100644 --- a/Complexitylib/Circuits/Internal/Schnorr.lean +++ b/Complexitylib/Circuits/Internal/Schnorr.lean @@ -5,9 +5,10 @@ Authors: Samuel Schlesinger -/ module -public import Mathlib.Tactic public import Complexitylib.Circuits.XOR public import Complexitylib.Circuits.Internal.CircuitDescriptor +import Std.Tactic.BVDecide.Normalize.Bool +import Std.Tactic.BVDecide.Normalize.Prop @[expose] public section diff --git a/Complexitylib/Circuits/Internal/ShannonBridge.lean b/Complexitylib/Circuits/Internal/ShannonBridge.lean index a861a36d..50143de9 100644 --- a/Complexitylib/Circuits/Internal/ShannonBridge.lean +++ b/Complexitylib/Circuits/Internal/ShannonBridge.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Circuits.Internal.CircuitToDescriptor +import Std.Tactic.BVDecide.Normalize.Bool /-! # Internal: Shannon bridge from descriptors to typed circuits diff --git a/Complexitylib/Circuits/Internal/ShannonUpper.lean b/Complexitylib/Circuits/Internal/ShannonUpper.lean index e0ee57c9..aa166daf 100644 --- a/Complexitylib/Circuits/Internal/ShannonUpper.lean +++ b/Complexitylib/Circuits/Internal/ShannonUpper.lean @@ -6,8 +6,9 @@ Authors: Samuel Schlesinger module public import Complexitylib.Circuits.AndOrNot.Defs -public import Mathlib.Data.Nat.Log public import Mathlib.Tactic +import Std.Tactic.BVDecide.Normalize.BitVec +import Std.Tactic.BVDecide.Normalize.Prop /-! # Internal: Shannon Upper Bound Construction diff --git a/Complexitylib/Circuits/Internal/Simulation.lean b/Complexitylib/Circuits/Internal/Simulation.lean index 848bbbbe..a95f8cfd 100644 --- a/Complexitylib/Circuits/Internal/Simulation.lean +++ b/Complexitylib/Circuits/Internal/Simulation.lean @@ -8,6 +8,7 @@ module public import Complexitylib.Circuits.Internal.AndOrNot public import Complexitylib.Circuits.Dependency.Defs public import Mathlib.Algebra.BigOperators.Fin +import Std.Tactic.BVDecide.Normalize.BitVec /-! # Internal: Completeness of fan-in-2 AND/OR diff --git a/Complexitylib/Circuits/Internal/Spira.lean b/Complexitylib/Circuits/Internal/Spira.lean index 34ce1454..cf6a3da0 100644 --- a/Complexitylib/Circuits/Internal/Spira.lean +++ b/Complexitylib/Circuits/Internal/Spira.lean @@ -6,8 +6,8 @@ Authors: Samuel Schlesinger module public import Complexitylib.Circuits.Formula -public import Mathlib.Data.Nat.Log public import Mathlib.Tactic +import Std.Tactic.BVDecide.Normalize.Bool /-! # Spira formula balancing -- proof internals diff --git a/Complexitylib/Circuits/Internal/Valiant.lean b/Complexitylib/Circuits/Internal/Valiant.lean index 165d8b12..0005594a 100644 --- a/Complexitylib/Circuits/Internal/Valiant.lean +++ b/Complexitylib/Circuits/Internal/Valiant.lean @@ -6,15 +6,13 @@ Authors: Samuel Schlesinger module public import Complexitylib.Mathlib.Digraph -public import Mathlib.Algebra.BigOperators.Group.Finset.Basic public import Mathlib.Algebra.Order.BigOperators.Group.Finset -public import Mathlib.Data.Finset.Card -public import Mathlib.Data.Finset.Max public import Mathlib.Data.Fintype.BigOperators -public import Mathlib.Data.Fintype.Prod public import Mathlib.Data.Nat.Bitwise public import Mathlib.Data.Nat.Log public import Mathlib.Tactic.Ring +import Std.Tactic.BVDecide.Normalize.Bool +import Std.Tactic.BVDecide.Normalize.Prop /-! # Internal helpers for Valiant's Depth Reduction Lemma diff --git a/Complexitylib/Circuits/KarchmerWigderson/Defs.lean b/Complexitylib/Circuits/KarchmerWigderson/Defs.lean index 9ad9518c..74bb1df8 100644 --- a/Complexitylib/Circuits/KarchmerWigderson/Defs.lean +++ b/Complexitylib/Circuits/KarchmerWigderson/Defs.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Mathlib.Data.Set.Basic public import Complexitylib.Circuits.Monotone.Defs /-! diff --git a/Complexitylib/Circuits/LowerBound.lean b/Complexitylib/Circuits/LowerBound.lean index ae68d697..dff9d252 100644 --- a/Complexitylib/Circuits/LowerBound.lean +++ b/Complexitylib/Circuits/LowerBound.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Circuits.EssentialInput public import Complexitylib.Circuits.Internal.LowerBound /-! # Gate Elimination Lower Bound diff --git a/Complexitylib/Circuits/MultilinearExtension.lean b/Complexitylib/Circuits/MultilinearExtension.lean index 50d0cfa9..7d125ec9 100644 --- a/Complexitylib/Circuits/MultilinearExtension.lean +++ b/Complexitylib/Circuits/MultilinearExtension.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Mathlib.Algebra.Ring.Defs public import Mathlib.Tactic.Ring /-! diff --git a/Complexitylib/Circuits/Nondeterminism/Defs.lean b/Complexitylib/Circuits/Nondeterminism/Defs.lean index 3cfc22e5..cbd6096e 100644 --- a/Complexitylib/Circuits/Nondeterminism/Defs.lean +++ b/Complexitylib/Circuits/Nondeterminism/Defs.lean @@ -6,8 +6,9 @@ Authors: Samuel Schlesinger module public import Complexitylib.Circuits.Basic -public import Mathlib.Data.Fin.Tuple.Basic public import Mathlib.Data.Fintype.BigOperators +import Std.Tactic.BVDecide.Normalize.BitVec +import Std.Tactic.BVDecide.Normalize.Prop /-! # Nondeterministic Quantification of Boolean Functions diff --git a/Complexitylib/Circuits/NormalForm/Defs.lean b/Complexitylib/Circuits/NormalForm/Defs.lean index 7378ec82..dcf88298 100644 --- a/Complexitylib/Circuits/NormalForm/Defs.lean +++ b/Complexitylib/Circuits/NormalForm/Defs.lean @@ -6,6 +6,8 @@ Authors: Samuel Schlesinger module public import Complexitylib.Circuits.Basic +import Std.Tactic.BVDecide.Normalize.Bool +import Std.Tactic.BVDecide.Normalize.Prop /-! # Normal Forms — Core Definitions diff --git a/Complexitylib/Circuits/NormalForm/Restriction.lean b/Complexitylib/Circuits/NormalForm/Restriction.lean index 63830990..cb0e329a 100644 --- a/Complexitylib/Circuits/NormalForm/Restriction.lean +++ b/Complexitylib/Circuits/NormalForm/Restriction.lean @@ -7,6 +7,8 @@ module public import Complexitylib.Circuits.NormalForm.Defs public import Complexitylib.Circuits.Restriction +import Std.Tactic.BVDecide.Normalize.BitVec +import Std.Tactic.BVDecide.Normalize.Prop /-! # Restricting CNF and DNF formulas diff --git a/Complexitylib/Circuits/RandomRestriction/Defs.lean b/Complexitylib/Circuits/RandomRestriction/Defs.lean index 1ab5fa96..62e98ef5 100644 --- a/Complexitylib/Circuits/RandomRestriction/Defs.lean +++ b/Complexitylib/Circuits/RandomRestriction/Defs.lean @@ -6,7 +6,6 @@ Authors: Samuel Schlesinger module public import Complexitylib.Circuits.Restriction -public import Mathlib.Data.Fintype.Card public import Mathlib.Data.Fintype.Pi public import Mathlib.Data.Fintype.Prod public import Mathlib.Data.Fintype.Sum diff --git a/Complexitylib/Circuits/RandomRestriction/Internal.lean b/Complexitylib/Circuits/RandomRestriction/Internal.lean index e8cf672d..13393410 100644 --- a/Complexitylib/Circuits/RandomRestriction/Internal.lean +++ b/Complexitylib/Circuits/RandomRestriction/Internal.lean @@ -7,7 +7,7 @@ module public import Complexitylib.Circuits.RandomRestriction.Defs public import Mathlib.Data.Fintype.BigOperators -public import Mathlib.Data.Finset.Card +import Std.Tactic.BVDecide.Normalize.Prop /-! # Finite random restrictions -- proof internals diff --git a/Complexitylib/Circuits/Restriction.lean b/Complexitylib/Circuits/Restriction.lean index 9607b723..e342f851 100644 --- a/Complexitylib/Circuits/Restriction.lean +++ b/Complexitylib/Circuits/Restriction.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Circuits.Basic public import Complexitylib.Circuits.Formula +import Std.Tactic.BVDecide.Normalize.Prop /-! # Restrictions diff --git a/Complexitylib/Circuits/Schnorr.lean b/Complexitylib/Circuits/Schnorr.lean index d3ffcb4e..8f1fb936 100644 --- a/Complexitylib/Circuits/Schnorr.lean +++ b/Complexitylib/Circuits/Schnorr.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Circuits.XOR public import Complexitylib.Circuits.Internal.SchnorrBridge /-! # Schnorr's Lower Bound for XOR Circuits diff --git a/Complexitylib/Circuits/Spira.lean b/Complexitylib/Circuits/Spira.lean index ac0c9bfa..4f906687 100644 --- a/Complexitylib/Circuits/Spira.lean +++ b/Complexitylib/Circuits/Spira.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Circuits.Formula public import Complexitylib.Circuits.Internal.Spira /-! diff --git a/Complexitylib/Circuits/Threshold/Defs.lean b/Complexitylib/Circuits/Threshold/Defs.lean index 64771689..e10bed29 100644 --- a/Complexitylib/Circuits/Threshold/Defs.lean +++ b/Complexitylib/Circuits/Threshold/Defs.lean @@ -7,7 +7,6 @@ module public import Complexitylib.Circuits.AndOrNot.Defs public import Complexitylib.Circuits.BasisHom.Defs -public import Batteries.Data.Fin.Lemmas /-! # Threshold circuits -- definitions diff --git a/Complexitylib/Circuits/Threshold/Internal.lean b/Complexitylib/Circuits/Threshold/Internal.lean index 4cfd809d..c7ee0e65 100644 --- a/Complexitylib/Circuits/Threshold/Internal.lean +++ b/Complexitylib/Circuits/Threshold/Internal.lean @@ -7,6 +7,8 @@ module public import Complexitylib.Circuits.BasisHom public import Complexitylib.Circuits.Threshold.Defs +import Std.Tactic.BVDecide.Normalize.BitVec +import Std.Tactic.BVDecide.Normalize.Prop /-! # Threshold circuits -- proof internals diff --git a/Complexitylib/Circuits/Unrolling/Acceptance.lean b/Complexitylib/Circuits/Unrolling/Acceptance.lean index 30bc95c4..2c8a7334 100644 --- a/Complexitylib/Circuits/Unrolling/Acceptance.lean +++ b/Complexitylib/Circuits/Unrolling/Acceptance.lean @@ -9,6 +9,7 @@ public import Complexitylib.Circuits.Encoding.ToCircuit public import Complexitylib.Circuits.Unrolling.Acceptance.Defs public import Complexitylib.Circuits.Unrolling.Acceptance.Internal.Evaluation public import Complexitylib.Circuits.Unrolling.Acceptance.Internal.Structure +import Std.Tactic.BVDecide.Normalize.Prop /-! # Acceptance circuits for bounded Turing-machine traces diff --git a/Complexitylib/Circuits/Unrolling/Acceptance/Internal/Evaluation.lean b/Complexitylib/Circuits/Unrolling/Acceptance/Internal/Evaluation.lean index 826b7388..46a8a7db 100644 --- a/Complexitylib/Circuits/Unrolling/Acceptance/Internal/Evaluation.lean +++ b/Complexitylib/Circuits/Unrolling/Acceptance/Internal/Evaluation.lean @@ -5,9 +5,10 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Circuits.Unrolling.Acceptance.Defs public import Complexitylib.Circuits.Unrolling.Acceptance.Internal.Structure public import Complexitylib.Circuits.Unrolling.Trace.Internal.Evaluation +import Std.Tactic.BVDecide.Normalize.BitVec +import Std.Tactic.BVDecide.Normalize.Prop /-! # Evaluation of bounded-trace acceptance circuits diff --git a/Complexitylib/Circuits/Unrolling/Acceptance/Internal/Structure.lean b/Complexitylib/Circuits/Unrolling/Acceptance/Internal/Structure.lean index 65853506..60f89266 100644 --- a/Complexitylib/Circuits/Unrolling/Acceptance/Internal/Structure.lean +++ b/Complexitylib/Circuits/Unrolling/Acceptance/Internal/Structure.lean @@ -5,11 +5,9 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Circuits.Encoding.Fragment public import Complexitylib.Circuits.Unrolling.Acceptance.Defs -public import Complexitylib.Circuits.Unrolling.Trace.Internal.Structure public import Complexitylib.Circuits.Unrolling.Trace.Internal.Topology -public import Mathlib.Tactic.Ring +import Std.Tactic.BVDecide.Normalize.Prop /-! # Structure of bounded-trace acceptance circuits diff --git a/Complexitylib/Circuits/Unrolling/Amplification/Defs.lean b/Complexitylib/Circuits/Unrolling/Amplification/Defs.lean index 0d8b878a..a525570b 100644 --- a/Complexitylib/Circuits/Unrolling/Amplification/Defs.lean +++ b/Complexitylib/Circuits/Unrolling/Amplification/Defs.lean @@ -6,9 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Circuits.Encoding.Threshold.Defs -public import Complexitylib.Circuits.BitString public import Complexitylib.Circuits.Unrolling.Acceptance.Defs -public import Mathlib.Data.List.FinRange /-! # Parallel amplification circuits -- definitions diff --git a/Complexitylib/Circuits/Unrolling/Amplification/Internal/Evaluation.lean b/Complexitylib/Circuits/Unrolling/Amplification/Internal/Evaluation.lean index 595fec62..e7156eb8 100644 --- a/Complexitylib/Circuits/Unrolling/Amplification/Internal/Evaluation.lean +++ b/Complexitylib/Circuits/Unrolling/Amplification/Internal/Evaluation.lean @@ -5,9 +5,9 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Circuits.Encoding.Threshold.Internal public import Complexitylib.Circuits.Unrolling.Acceptance.Internal.Evaluation public import Complexitylib.Circuits.Unrolling.Amplification.Internal.Structure +import Std.Tactic.BVDecide.Normalize.Prop /-! # Evaluation internals for parallel amplification circuits diff --git a/Complexitylib/Circuits/Unrolling/Amplification/Internal/Structure.lean b/Complexitylib/Circuits/Unrolling/Amplification/Internal/Structure.lean index 692d209b..d7b9f445 100644 --- a/Complexitylib/Circuits/Unrolling/Amplification/Internal/Structure.lean +++ b/Complexitylib/Circuits/Unrolling/Amplification/Internal/Structure.lean @@ -8,7 +8,6 @@ module public import Complexitylib.Circuits.Encoding.Threshold.Internal public import Complexitylib.Circuits.Unrolling.Acceptance.Internal.Structure public import Complexitylib.Circuits.Unrolling.Amplification.Defs -public import Mathlib.Tactic.Ring /-! # Structural internals for parallel amplification circuits diff --git a/Complexitylib/Circuits/Unrolling/Amplification/Internal/Topology.lean b/Complexitylib/Circuits/Unrolling/Amplification/Internal/Topology.lean index 31a15cc4..1fb4424c 100644 --- a/Complexitylib/Circuits/Unrolling/Amplification/Internal/Topology.lean +++ b/Complexitylib/Circuits/Unrolling/Amplification/Internal/Topology.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Circuits.Unrolling.Amplification.Internal.Structure +import Std.Tactic.BVDecide.Normalize.Prop /-! # Topology internals for parallel amplification circuits diff --git a/Complexitylib/Circuits/Unrolling/Defs.lean b/Complexitylib/Circuits/Unrolling/Defs.lean index 5bb88c2c..68408809 100644 --- a/Complexitylib/Circuits/Unrolling/Defs.lean +++ b/Complexitylib/Circuits/Unrolling/Defs.lean @@ -10,6 +10,7 @@ public import Complexitylib.Models.TuringMachine public import Mathlib.Data.Fintype.Sum public import Mathlib.Logic.Equiv.Fin.Basic public import Mathlib.Tactic.DeriveFintype +import Std.Tactic.BVDecide.Normalize.Prop /-! # Circuit layouts for bounded Turing-machine traces diff --git a/Complexitylib/Circuits/Unrolling/Internal/Initialization.lean b/Complexitylib/Circuits/Unrolling/Internal/Initialization.lean index a638e132..b8812d72 100644 --- a/Complexitylib/Circuits/Unrolling/Internal/Initialization.lean +++ b/Complexitylib/Circuits/Unrolling/Internal/Initialization.lean @@ -8,6 +8,8 @@ module public import Complexitylib.Circuits.Encoding.Fragment public import Complexitylib.Circuits.BitString public import Complexitylib.Circuits.Unrolling.Defs +import Std.Tactic.BVDecide.Normalize.BitVec +import Std.Tactic.BVDecide.Normalize.Prop /-! # Internal correctness of bounded-trace initialization circuits diff --git a/Complexitylib/Circuits/Unrolling/Trace/Defs.lean b/Complexitylib/Circuits/Unrolling/Trace/Defs.lean index 65077925..30ed16fe 100644 --- a/Complexitylib/Circuits/Unrolling/Trace/Defs.lean +++ b/Complexitylib/Circuits/Unrolling/Trace/Defs.lean @@ -6,7 +6,6 @@ Authors: Samuel Schlesinger module public import Complexitylib.Circuits.Unrolling.Transition.Fragment.Defs -public import Mathlib.Data.List.FinRange /-! # Definitions for tiled bounded-trace circuits diff --git a/Complexitylib/Circuits/Unrolling/Trace/Internal/Structure.lean b/Complexitylib/Circuits/Unrolling/Trace/Internal/Structure.lean index 02651212..da79bbbd 100644 --- a/Complexitylib/Circuits/Unrolling/Trace/Internal/Structure.lean +++ b/Complexitylib/Circuits/Unrolling/Trace/Internal/Structure.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Circuits.Unrolling.Internal.Initialization public import Complexitylib.Circuits.Unrolling.Trace.Defs public import Complexitylib.Circuits.Unrolling.Transition.Fragment.Internal.Size diff --git a/Complexitylib/Circuits/Unrolling/Trace/Internal/Topology.lean b/Complexitylib/Circuits/Unrolling/Trace/Internal/Topology.lean index dcdec07f..ae430922 100644 --- a/Complexitylib/Circuits/Unrolling/Trace/Internal/Topology.lean +++ b/Complexitylib/Circuits/Unrolling/Trace/Internal/Topology.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Circuits.Encoding.Fragment public import Complexitylib.Circuits.Unrolling.Trace.Internal.Structure public import Complexitylib.Circuits.Unrolling.Transition.Fragment.Internal.Topology diff --git a/Complexitylib/Circuits/Unrolling/Transition/Fragment/Defs.lean b/Complexitylib/Circuits/Unrolling/Transition/Fragment/Defs.lean index df991a98..baa022d6 100644 --- a/Complexitylib/Circuits/Unrolling/Transition/Fragment/Defs.lean +++ b/Complexitylib/Circuits/Unrolling/Transition/Fragment/Defs.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Circuits.Encoding.Formula.Batch.Defs public import Complexitylib.Circuits.Unrolling.Transition.Defs /-! diff --git a/Complexitylib/Circuits/Unrolling/Transition/Fragment/Internal/Evaluation.lean b/Complexitylib/Circuits/Unrolling/Transition/Fragment/Internal/Evaluation.lean index 843f4031..8880d7b9 100644 --- a/Complexitylib/Circuits/Unrolling/Transition/Fragment/Internal/Evaluation.lean +++ b/Complexitylib/Circuits/Unrolling/Transition/Fragment/Internal/Evaluation.lean @@ -5,8 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Circuits.Encoding.Formula.Batch -public import Complexitylib.Circuits.Unrolling.Transition.Fragment.Defs public import Complexitylib.Circuits.Unrolling.Transition.Fragment.Internal.Structure public import Complexitylib.Circuits.Unrolling.Transition.Internal.Semantics public import Complexitylib.Circuits.Unrolling.Transition.Internal.Support diff --git a/Complexitylib/Circuits/Unrolling/Transition/Fragment/Internal/Size.lean b/Complexitylib/Circuits/Unrolling/Transition/Fragment/Internal/Size.lean index 56aaea33..e4fa9500 100644 --- a/Complexitylib/Circuits/Unrolling/Transition/Fragment/Internal/Size.lean +++ b/Complexitylib/Circuits/Unrolling/Transition/Fragment/Internal/Size.lean @@ -8,6 +8,7 @@ module public import Complexitylib.Circuits.Unrolling.Transition.Fragment.Internal.Structure public import Mathlib.Algebra.Order.BigOperators.Group.List public import Mathlib.Tactic.Ring +import Std.Tactic.BVDecide.Normalize.Prop /-! # Size bounds for packed one-step transition fragments diff --git a/Complexitylib/Circuits/Unrolling/Transition/Fragment/Internal/Topology.lean b/Complexitylib/Circuits/Unrolling/Transition/Fragment/Internal/Topology.lean index b9e125eb..1e6bd8f0 100644 --- a/Complexitylib/Circuits/Unrolling/Transition/Fragment/Internal/Topology.lean +++ b/Complexitylib/Circuits/Unrolling/Transition/Fragment/Internal/Topology.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Circuits.Encoding.Formula.Batch public import Complexitylib.Circuits.Unrolling.Transition.Fragment.Defs public import Complexitylib.Circuits.Unrolling.Transition.Internal.Support diff --git a/Complexitylib/Circuits/Unrolling/Transition/Internal/Semantics.lean b/Complexitylib/Circuits/Unrolling/Transition/Internal/Semantics.lean index c120200f..7a917d48 100644 --- a/Complexitylib/Circuits/Unrolling/Transition/Internal/Semantics.lean +++ b/Complexitylib/Circuits/Unrolling/Transition/Internal/Semantics.lean @@ -7,7 +7,8 @@ module public import Complexitylib.Circuits.Encoding.Formula.Batch public import Complexitylib.Circuits.Unrolling.Transition.Defs -public import Mathlib.Data.List.OfFn +import Std.Tactic.BVDecide.Normalize.BitVec +import Std.Tactic.BVDecide.Normalize.Prop /-! # Semantic correctness of one-step transition formulas diff --git a/Complexitylib/Circuits/Unrolling/Transition/Internal/Support.lean b/Complexitylib/Circuits/Unrolling/Transition/Internal/Support.lean index 662b0f2d..69e2f7f7 100644 --- a/Complexitylib/Circuits/Unrolling/Transition/Internal/Support.lean +++ b/Complexitylib/Circuits/Unrolling/Transition/Internal/Support.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Circuits.Encoding.Formula.Batch public import Complexitylib.Circuits.Unrolling.Transition.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Variable support of transition formulas diff --git a/Complexitylib/Circuits/XOR.lean b/Complexitylib/Circuits/XOR.lean index e47a854c..5f1a7c58 100644 --- a/Complexitylib/Circuits/XOR.lean +++ b/Complexitylib/Circuits/XOR.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Circuits.Basic +import Std.Tactic.BVDecide.Normalize.Bool /-! # XOR (Parity) Function diff --git a/Complexitylib/Circuits/XOR/Restriction/Internal.lean b/Complexitylib/Circuits/XOR/Restriction/Internal.lean index 80649aff..052ea375 100644 --- a/Complexitylib/Circuits/XOR/Restriction/Internal.lean +++ b/Complexitylib/Circuits/XOR/Restriction/Internal.lean @@ -7,6 +7,8 @@ module public import Complexitylib.Circuits.DecisionTree.Finite public import Complexitylib.Circuits.XOR.Restriction.Defs +import Std.Tactic.BVDecide.Normalize.Bool +import Std.Tactic.BVDecide.Normalize.Prop /-! # Parity on a finite support -- proof internals diff --git a/Complexitylib/Classes/Containments.lean b/Complexitylib/Classes/Containments.lean index 8cd3785e..c09c2749 100644 --- a/Complexitylib/Classes/Containments.lean +++ b/Complexitylib/Classes/Containments.lean @@ -10,8 +10,7 @@ public import Complexitylib.Classes.NP public import Complexitylib.Classes.Randomized public import Complexitylib.Classes.L public import Complexitylib.Classes.Exponential -public import Complexitylib.Models.TuringMachine.Internal -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Complement +import Std.Tactic.BVDecide.Normalize.Prop /-! # Containment relations between complexity classes diff --git a/Complexitylib/Classes/DTISP.lean b/Complexitylib/Classes/DTISP.lean index e86f7cea..3fdd6bfe 100644 --- a/Complexitylib/Classes/DTISP.lean +++ b/Complexitylib/Classes/DTISP.lean @@ -5,10 +5,7 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine public import Complexitylib.Classes.Space -public import Complexitylib.Asymptotics -public import Mathlib.Data.Nat.Log /-! # Simultaneous time-space complexity classes diff --git a/Complexitylib/Classes/EventProb.lean b/Complexitylib/Classes/EventProb.lean index e5fce49f..2ff3ba22 100644 --- a/Complexitylib/Classes/EventProb.lean +++ b/Complexitylib/Classes/EventProb.lean @@ -8,14 +8,11 @@ module public import Complexitylib.Classes.FiniteCounting public import Complexitylib.Models.TuringMachine public import Mathlib.Algebra.BigOperators.Field -public import Mathlib.Algebra.Order.Field.Basic public import Mathlib.Data.Nat.Choose.Sum public import Mathlib.Tactic.FieldSimp -public import Mathlib.Tactic.GCongr -public import Mathlib.Tactic.Linarith -public import Mathlib.Tactic.NormNum public import Mathlib.Tactic.Positivity -public import Mathlib.Tactic.Ring +import Std.Tactic.BVDecide.Normalize.Bool +import Std.Tactic.BVDecide.Normalize.Prop /-! # Finite event probability diff --git a/Complexitylib/Classes/FNP/Internal.lean b/Complexitylib/Classes/FNP/Internal.lean index c5d47bcf..9dae6bdf 100644 --- a/Complexitylib/Classes/FNP/Internal.lean +++ b/Complexitylib/Classes/FNP/Internal.lean @@ -6,8 +6,6 @@ Authors: Samuel Schlesinger module public import Complexitylib.Classes.FNP.Defs -public import Complexitylib.Classes.P -public import Mathlib.Analysis.Asymptotics.Defs /-! # FNP and TFNP — Internal proofs diff --git a/Complexitylib/Classes/FiniteCounting.lean b/Complexitylib/Classes/FiniteCounting.lean index 7801ad06..c661a41b 100644 --- a/Complexitylib/Classes/FiniteCounting.lean +++ b/Complexitylib/Classes/FiniteCounting.lean @@ -5,18 +5,13 @@ Authors: Samuel Schlesinger -/ module -public import Mathlib.Data.Fintype.Card public import Mathlib.Data.Fintype.Fin -public import Mathlib.Data.Fintype.Sum public import Mathlib.Data.Fintype.BigOperators -public import Mathlib.Data.Finset.Card public import Mathlib.Data.Finset.Powerset -public import Mathlib.Logic.Equiv.Prod public import Mathlib.Logic.Equiv.Fin.Basic -public import Mathlib.Algebra.BigOperators.Group.Finset.Basic -public import Mathlib.Algebra.BigOperators.Group.Finset.Piecewise public import Mathlib.Algebra.Ring.Parity -public import Mathlib.Order.Interval.Finset.Nat +import Std.Tactic.BVDecide.Normalize.BitVec +import Std.Tactic.BVDecide.Normalize.Prop /-! # Finite counting toolkit diff --git a/Complexitylib/Classes/Hierarchy.lean b/Complexitylib/Classes/Hierarchy.lean index 6a472ef2..e0c8a8f3 100644 --- a/Complexitylib/Classes/Hierarchy.lean +++ b/Complexitylib/Classes/Hierarchy.lean @@ -8,7 +8,6 @@ module public import Complexitylib.Models.TuringMachine.UTM.Diagonal public import Complexitylib.Models.TuringMachine.UTM.Universal public import Complexitylib.Classes.Containments -public import Mathlib.Analysis.Asymptotics.SpecificAsymptotics /-! # The deterministic time hierarchy theorem (weak form) diff --git a/Complexitylib/Classes/L.lean b/Complexitylib/Classes/L.lean index fdeffb3b..a046aee2 100644 --- a/Complexitylib/Classes/L.lean +++ b/Complexitylib/Classes/L.lean @@ -5,11 +5,8 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine public import Complexitylib.Classes.Time public import Complexitylib.Classes.Pairing -public import Complexitylib.Asymptotics -public import Mathlib.Data.Nat.Log /-! # Log-space transducer classes diff --git a/Complexitylib/Classes/NP/Internal/PairBuildTM.lean b/Complexitylib/Classes/NP/Internal/PairBuildTM.lean index 685eb7f9..92a7a456 100644 --- a/Complexitylib/Classes/NP/Internal/PairBuildTM.lean +++ b/Complexitylib/Classes/NP/Internal/PairBuildTM.lean @@ -6,11 +6,11 @@ Authors: Samuel Schlesinger module public import Mathlib.Tactic.Ring -public import Complexitylib.Models.TuringMachine.Combinators public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic public import Complexitylib.Models.TuringMachine.Hoare.Defs public import Complexitylib.Models.TuringMachine.Trace public import Complexitylib.Classes.Pairing +import Std.Tactic.BVDecide.Normalize.Prop /-! # `pairBuildTM`: construct `pair x y` on a work tape diff --git a/Complexitylib/Classes/P/FinsetDomain/Internal.lean b/Complexitylib/Classes/P/FinsetDomain/Internal.lean index 5dd421ae..a24ccca3 100644 --- a/Complexitylib/Classes/P/FinsetDomain/Internal.lean +++ b/Complexitylib/Classes/P/FinsetDomain/Internal.lean @@ -5,9 +5,6 @@ Authors: Bolton Bailey -/ module -public import Mathlib.Data.Fintype.Sets -public import Mathlib.Data.Fintype.Option -public import Mathlib.Data.Finset.Lattice.Fold public import Complexitylib.Mathlib.FinsetPrefixes public import Complexitylib.Classes.P.NormalForm public import Complexitylib.Models.TuringMachine.Tape.Encoding diff --git a/Complexitylib/Classes/P/Internal.lean b/Complexitylib/Classes/P/Internal.lean index 22f815d3..13de84a7 100644 --- a/Complexitylib/Classes/P/Internal.lean +++ b/Complexitylib/Classes/P/Internal.lean @@ -6,9 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Classes.P.Defs -public import Complexitylib.Models.TuringMachine.Combinators public import Complexitylib.Models.TuringMachine.Combinators.Internal -public import Mathlib.Analysis.Asymptotics.Defs /-! # P closure properties — proof internals diff --git a/Complexitylib/Classes/PPoly.lean b/Complexitylib/Classes/PPoly.lean index 1d3e1fcd..fb398e1e 100644 --- a/Complexitylib/Classes/PPoly.lean +++ b/Complexitylib/Classes/PPoly.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Classes.PPoly.Defs public import Complexitylib.Circuits.Family +import Std.Tactic.BVDecide.Normalize.Prop /-! # P/poly and circuit-size classes diff --git a/Complexitylib/Classes/PPoly/Advice.lean b/Complexitylib/Classes/PPoly/Advice.lean index 7180a765..ff54fddd 100644 --- a/Complexitylib/Classes/PPoly/Advice.lean +++ b/Complexitylib/Classes/PPoly/Advice.lean @@ -8,6 +8,7 @@ module public import Complexitylib.Classes.PPoly.Advice.Defs public import Complexitylib.Classes.PPoly.Advice.Internal public import Complexitylib.Classes.PPoly.Advice.Reverse +import Std.Tactic.BVDecide.Normalize.Prop /-! # Polynomial advice and nonuniform circuits diff --git a/Complexitylib/Classes/PPoly/Advice/Internal.lean b/Complexitylib/Classes/PPoly/Advice/Internal.lean index 514eed88..0c6b680a 100644 --- a/Complexitylib/Classes/PPoly/Advice/Internal.lean +++ b/Complexitylib/Classes/PPoly/Advice/Internal.lean @@ -7,7 +7,6 @@ module public import Complexitylib.Classes.PPoly public import Complexitylib.Classes.PPoly.Advice.Defs -public import Complexitylib.Models.TuringMachine.Internal /-! # Polynomial advice — proof internals diff --git a/Complexitylib/Classes/PPoly/Uniform/Containment/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Containment/Internal.lean index 83feaf4d..6c168e3f 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Containment/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Containment/Internal.lean @@ -7,7 +7,6 @@ module public import Complexitylib.Classes.L.PolynomialTime public import Complexitylib.Classes.P.Preimage -public import Complexitylib.Classes.PPoly.Uniform public import Complexitylib.Classes.PPoly.Uniform.Preprocessing public import Complexitylib.Circuits.Encoding.Machine diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Containment/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Containment/Internal.lean index 02c30802..0e40bf02 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Containment/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Containment/Internal.lean @@ -5,11 +5,8 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Classes.P.NormalForm -public import Complexitylib.Classes.PPoly.Uniform public import Complexitylib.Classes.PPoly.Uniform.Containment public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Tableau -public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Padded /-! # Deterministic unrolling into uniform P/poly -- proof internals diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Finalization/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Finalization/Internal.lean index f141fdcf..9c503be3 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Finalization/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Finalization/Internal.lean @@ -6,10 +6,9 @@ Authors: Samuel Schlesinger module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Finalization.Defs -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.SpaceBounds +import Std.Tactic.BVDecide.Normalize.Prop /-! # Direct-unrolling finalization generator -- proof internals diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Initialization/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Initialization/Internal.lean index a168e2da..0af9160d 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Initialization/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Initialization/Internal.lean @@ -8,11 +8,11 @@ module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Initialization.Defs public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Bounds public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Initialization -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.InputLength -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.SpaceBounds +import Std.Tactic.BVDecide.Normalize.BitVec +import Std.Tactic.BVDecide.Normalize.Prop /-! # Direct-unrolling initialization generator -- proof internals diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Offset/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Offset/Internal.lean index f2a1bc39..eda0b3e5 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Offset/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Offset/Internal.lean @@ -8,7 +8,7 @@ module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Offset.Defs public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Primitive public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.SpaceBounds +import Std.Tactic.BVDecide.Normalize.Prop /-! # Dynamic recent-wire offsets -- proof internals diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/PolynomialOffset/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/PolynomialOffset/Internal.lean index eef72af5..db80362c 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/PolynomialOffset/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/PolynomialOffset/Internal.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Offset public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.PolynomialOffset.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Polynomial recent-wire offsets -- proof internals diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Primitive/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Primitive/Internal.lean index b973c88d..184cf3cb 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Primitive/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Primitive/Internal.lean @@ -6,9 +6,8 @@ Authors: Samuel Schlesinger module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Primitive.Defs -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.SpaceBounds +import Std.Tactic.BVDecide.Normalize.Prop /-! # Direct-unrolling generator primitives -- proof internals diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Program/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Program/Internal.lean index 64980354..dfd24a22 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Program/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Program/Internal.lean @@ -6,11 +6,10 @@ Authors: Samuel Schlesinger module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Program.Defs -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.InputLength -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.SpaceBounds +import Std.Tactic.BVDecide.Normalize.Prop /-! # Direct-unrolling generator program -- proof internals diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Tableau/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Tableau/Defs.lean index d0883089..faf7e5cf 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Tableau/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Tableau/Defs.lean @@ -6,8 +6,6 @@ Authors: Samuel Schlesinger module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Finalization.Defs -public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Initialization.Defs -public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Program.Defs public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Defs /-! diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Tableau/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Tableau/Internal.lean index 3e0b2908..be8fdc2a 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Tableau/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Tableau/Internal.lean @@ -6,15 +6,12 @@ Authors: Samuel Schlesinger module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Finalization -public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Initialization public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Program public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Tableau.Defs public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Padded public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Finalization -public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Stream -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.InputLength -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.SpaceBounds +import Std.Tactic.BVDecide.Normalize.Prop /-! # Complete direct-unrolling generator -- proof internals diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Case/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Case/Defs.lean index 370d88a9..ffe52229 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Case/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Case/Defs.lean @@ -8,7 +8,6 @@ module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Initialization.Defs public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Offset.Defs public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Read.Defs -public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Case.Defs /-! # Direct-unrolling transition-case generator -- definitions diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Case/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Case/Internal.lean index 6198068d..bf05a5cf 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Case/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Case/Internal.lean @@ -10,8 +10,7 @@ public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Offset public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Case.Defs public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Read public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Case -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List +import Std.Tactic.BVDecide.Normalize.Prop /-! # Direct-unrolling transition-case generator -- proof internals diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Effect/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Effect/Internal.lean index 682c3f69..790bec9b 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Effect/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Effect/Internal.lean @@ -5,12 +5,9 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Offset public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Case -public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Read public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Effect.Defs -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List +import Std.Tactic.BVDecide.Normalize.Prop /-! # Direct-unrolling transition-effect generator -- proof internals diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/MovedHead/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/MovedHead/Defs.lean index 7a478e75..72bc8638 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/MovedHead/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/MovedHead/Defs.lean @@ -8,7 +8,6 @@ module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.PolynomialOffset.Defs public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Effect.Defs public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Predecessor.Defs -public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.MovedHead.Defs /-! # Direct-unrolling moved-head generator -- definitions diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/MovedHead/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/MovedHead/Internal.lean index 8d40dc58..5af61706 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/MovedHead/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/MovedHead/Internal.lean @@ -11,7 +11,7 @@ public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Predecessor public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.MovedHead public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Polynomial -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List +import Std.Tactic.BVDecide.Normalize.Prop /-! # Direct-unrolling moved-head generator -- proof internals diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Next/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Next/Defs.lean index 79dd40ca..faee13e5 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Next/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Next/Defs.lean @@ -7,7 +7,6 @@ module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.MovedHead.Defs public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.WrittenCell.Defs -public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Next.Defs /-! # Direct-unrolling next-atom generator -- definitions diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Next/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Next/Internal.lean index 652ad337..23cd4393 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Next/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Next/Internal.lean @@ -5,13 +5,10 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.PolynomialOffset -public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Primitive public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Next.Defs -public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Effect public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.MovedHead public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.WrittenCell -public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Polynomial +import Std.Tactic.BVDecide.Normalize.Prop /-! # Direct-unrolling next-atom generator -- proof internals diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/PackedCopy/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/PackedCopy/Internal.lean index 262930e0..df51cab8 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/PackedCopy/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/PackedCopy/Internal.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.PolynomialOffset public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.PackedCopy.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Delayed packed-formula copies -- proof internals diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Predecessor/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Predecessor/Defs.lean index bab173eb..ec474b32 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Predecessor/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Predecessor/Defs.lean @@ -7,7 +7,6 @@ module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Initialization.Defs public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Offset.Defs -public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Primitive.Defs public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.MovedHead.Defs /-! diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Predecessor/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Predecessor/Internal.lean index 9f47a62f..f9287417 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Predecessor/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Predecessor/Internal.lean @@ -7,12 +7,9 @@ module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Initialization public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Offset -public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Primitive public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Predecessor.Defs public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List +import Std.Tactic.BVDecide.Normalize.Prop /-! # Direct predecessor-head formula generation -- proof internals diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Read/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Read/Defs.lean index 7024dc27..da0b99ac 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Read/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Read/Defs.lean @@ -6,7 +6,6 @@ Authors: Samuel Schlesinger module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Primitive.Defs -public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Defs /-! # Direct-unrolling read-formula generator -- definitions diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Read/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Read/Internal.lean index 4409713e..86bd47af 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Read/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Read/Internal.lean @@ -8,10 +8,8 @@ module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Primitive public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Read.Defs public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List -public import Mathlib.Data.Nat.Pairing +import Std.Tactic.BVDecide.Normalize.Prop /-! # Direct-unrolling read-formula generator -- proof internals diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal.lean index 768b255d..e67e23a4 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal.lean @@ -5,9 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.PackedCopy -public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Next -public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Defs public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Effect public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Emitted public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Packed @@ -16,8 +13,7 @@ public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Space public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Top public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Step -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List +import Std.Tactic.BVDecide.Normalize.Prop /-! # Direct-unrolling packed-step generator -- proof internals diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Effect.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Effect.lean index de2458ab..f1663582 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Effect.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Effect.lean @@ -8,9 +8,7 @@ module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Next public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.PackedCopy public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Defs -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List +import Std.Tactic.BVDecide.Normalize.Prop /-! # Exact effects of the direct packed-step generator diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Packed.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Packed.lean index 00943e29..c715b15b 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Packed.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Packed.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Emitted +import Std.Tactic.BVDecide.Normalize.Prop /-! # Exact packed-copy output of the direct step generator diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Requires.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Requires.lean index 12012df0..da4e05de 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Requires.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Requires.lean @@ -8,8 +8,7 @@ module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Next public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.PackedCopy public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Defs -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List +import Std.Tactic.BVDecide.Normalize.Prop /-! # Packed-step generator domains diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Sound.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Sound.lean index 6ba17efe..db8b79e5 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Sound.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Sound.lean @@ -8,9 +8,7 @@ module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Next public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.PackedCopy public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Defs -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List +import Std.Tactic.BVDecide.Normalize.Prop /-! # Packed-step generator soundness diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Space.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Space.lean index 5ac3d5a9..4d6ee282 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Space.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Space.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.FormulaSpace public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Space.Packed +import Std.Tactic.BVDecide.Normalize.Prop /-! # Whole-step space bound for direct transition generation diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Space/Common.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Space/Common.lean index 6085b667..368b5a29 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Space/Common.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Space/Common.lean @@ -6,7 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Emitted -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.SpaceBounds +import Std.Tactic.BVDecide.Normalize.Prop /-! # Common packed-step width helpers diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Space/Packed.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Space/Packed.lean index 77c43692..1a942d39 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Space/Packed.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/Step/Internal/Space/Packed.lean @@ -5,8 +5,8 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Emitted public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Step.Internal.Space.Common +import Std.Tactic.BVDecide.Normalize.Prop /-! # Packed-copy space bound for one direct transition step diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/WrittenCell/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/WrittenCell/Internal.lean index 1776435c..c3040a2b 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/WrittenCell/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Generator/Transition/WrittenCell/Internal.lean @@ -5,15 +5,10 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Initialization -public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Offset -public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Primitive public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Effect -public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.Read public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Generator.Transition.WrittenCell.Defs public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.WrittenCell -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic -public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List +import Std.Tactic.BVDecide.Normalize.Prop /-! # Direct-unrolling written-cell generator -- proof internals diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Internal.lean index d2a2fb71..caa98724 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Internal.lean @@ -7,7 +7,6 @@ module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Defs public import Complexitylib.Classes.PPoly.Unrolling -public import Complexitylib.Models.TuringMachine.Internal /-! # Streamable deterministic unrolling families — proof internals diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Padded/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Padded/Internal.lean index 00c7c95d..8e034c90 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Padded/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Padded/Internal.lean @@ -6,7 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Padded.Defs -public import Complexitylib.Circuits.Encoding.Fragment +import Std.Tactic.BVDecide.Normalize.Prop /-! # Regularly padded deterministic unrolling families -- proof internals diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Bounds/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Bounds/Defs.lean index 10d56454..f7565e5f 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Bounds/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Bounds/Defs.lean @@ -6,7 +6,6 @@ Authors: Samuel Schlesinger module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Padded.Defs -public import Mathlib.Algebra.Polynomial.Eval.Defs /-! # Polynomial counters for direct tableau serialization -- definitions diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Finalization/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Finalization/Internal.lean index 39401438..5fb4a8bb 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Finalization/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Finalization/Internal.lean @@ -8,7 +8,7 @@ module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Finalization.Defs public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Initialization public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Stream -public import Complexitylib.Circuits.Unrolling +import Std.Tactic.BVDecide.Normalize.Prop /-! # Numeric direct-tableau finalization -- proof internals diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Initialization/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Initialization/Internal.lean index 635d4f5d..31916b6f 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Initialization/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Initialization/Internal.lean @@ -8,6 +8,8 @@ module public import Complexitylib.Classes.PPoly.Uniform.Unrolling public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Initialization.Defs public import Complexitylib.Circuits.Unrolling +import Std.Tactic.BVDecide.Normalize.BitVec +import Std.Tactic.BVDecide.Normalize.Prop /-! # Numeric initialization schedule -- proof internals diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Internal.lean index 99f25009..b352d6db 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Internal.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Defs public import Complexitylib.Circuits.Encoding.Formula.Stream +import Std.Tactic.BVDecide.Normalize.Prop /-! # Numeric schedules for streaming tableau serialization -- proof internals diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Atomic/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Atomic/Internal.lean index 1f376720..8f1bf000 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Atomic/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Atomic/Internal.lean @@ -7,7 +7,7 @@ module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Atomic.Defs -public import Complexitylib.Circuits.Encoding.Formula +import Std.Tactic.BVDecide.Normalize.Prop /-! # Numeric schedules for atomic transition formulas -- proof internals diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Case/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Case/Internal.lean index b1598398..14b2d2eb 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Case/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Case/Internal.lean @@ -7,7 +7,7 @@ module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Case.Defs -public import Complexitylib.Circuits.Unrolling.Transition +import Std.Tactic.BVDecide.Normalize.Prop /-! # Numeric transition-case schedules -- proof internals diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Effect/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Effect/Internal.lean index 4ec47beb..3fbde285 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Effect/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Effect/Internal.lean @@ -7,7 +7,6 @@ module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Case public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Effect.Defs -public import Complexitylib.Circuits.Encoding.Formula /-! # Numeric transition-effect schedules -- proof internals diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Internal.lean index fc55398c..273c43d4 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Internal.lean @@ -8,7 +8,7 @@ module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Initialization.Internal public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Defs -public import Complexitylib.Circuits.Unrolling.Transition +import Std.Tactic.BVDecide.Normalize.Prop /-! # Numeric transition-formula schedules -- proof internals diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/MovedHead/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/MovedHead/Internal.lean index 5c624608..e533221f 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/MovedHead/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/MovedHead/Internal.lean @@ -7,7 +7,6 @@ module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Effect public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.MovedHead.Defs -public import Complexitylib.Circuits.Unrolling.Transition /-! # Numeric moved-head schedules -- proof internals diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Next/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Next/Defs.lean index 625ffe91..16bc9330 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Next/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Next/Defs.lean @@ -5,8 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Atomic.Defs -public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Effect.Defs public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.MovedHead.Defs public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.WrittenCell.Defs diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Next/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Next/Internal.lean index b962f38a..8f87214f 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Next/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Next/Internal.lean @@ -5,12 +5,9 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Atomic -public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Effect public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.MovedHead public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Next.Defs public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.WrittenCell -public import Complexitylib.Circuits.Encoding.Formula /-! # Numeric next-atom schedules -- proof internals diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Polynomial/Defs.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Polynomial/Defs.lean index 40bc7895..bcc16502 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Polynomial/Defs.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Polynomial/Defs.lean @@ -6,7 +6,6 @@ Authors: Samuel Schlesinger module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Next.Defs -public import Mathlib.Algebra.Polynomial.Eval.Defs /-! # Fixed transition-schedule size polynomials -- definitions diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Step/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Step/Internal.lean index 177d3a06..6860116c 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Step/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/Step/Internal.lean @@ -5,10 +5,8 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Next public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Step.Defs -public import Complexitylib.Circuits.Unrolling.Transition.Fragment /-! # Numeric packed-step schedules -- proof internals diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/WrittenCell.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/WrittenCell.lean index d5b0daba..13434d5a 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/WrittenCell.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/WrittenCell.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.WrittenCell.Defs public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.WrittenCell.Internal +import Std.Tactic.BVDecide.Normalize.Prop /-! # Numeric schedules for written-cell formulas diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/WrittenCell/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/WrittenCell/Internal.lean index b9f0d59c..01ca5034 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/WrittenCell/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Serializer/Transition/WrittenCell/Internal.lean @@ -9,7 +9,7 @@ public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Initializ public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Atomic public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.Effect public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Serializer.Transition.WrittenCell.Defs -public import Complexitylib.Circuits.Encoding.Formula +import Std.Tactic.BVDecide.Normalize.Prop /-! # Numeric written-cell schedules -- proof internals diff --git a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Stream/Internal.lean b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Stream/Internal.lean index 8a4ca82f..59227cec 100644 --- a/Complexitylib/Classes/PPoly/Uniform/Unrolling/Stream/Internal.lean +++ b/Complexitylib/Classes/PPoly/Uniform/Unrolling/Stream/Internal.lean @@ -6,7 +6,6 @@ Authors: Samuel Schlesinger module public import Complexitylib.Classes.PPoly.Uniform.Unrolling.Stream.Defs -public import Complexitylib.Circuits.Unrolling.Trace.Internal.Structure /-! # Streamable deterministic unrolling arithmetic — proof internals diff --git a/Complexitylib/Classes/PPoly/Unrolling/Internal.lean b/Complexitylib/Classes/PPoly/Unrolling/Internal.lean index 6e405b02..66a210a1 100644 --- a/Complexitylib/Classes/PPoly/Unrolling/Internal.lean +++ b/Complexitylib/Classes/PPoly/Unrolling/Internal.lean @@ -8,7 +8,6 @@ module public import Complexitylib.Classes.P public import Complexitylib.Classes.PPoly public import Complexitylib.Classes.PPoly.Unrolling.Defs -public import Complexitylib.Models.TuringMachine.Internal /-! # Deterministic unrolling families — proof internals diff --git a/Complexitylib/Classes/PropertyDensity.lean b/Complexitylib/Classes/PropertyDensity.lean index 7fd72f74..ecfa12fe 100644 --- a/Complexitylib/Classes/PropertyDensity.lean +++ b/Complexitylib/Classes/PropertyDensity.lean @@ -6,9 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Classes.FiniteCounting -public import Mathlib.Algebra.Order.Field.Basic public import Mathlib.Tactic.FieldSimp -public import Mathlib.Tactic.GCongr public import Mathlib.Tactic.Positivity /-! diff --git a/Complexitylib/Classes/Randomized.lean b/Complexitylib/Classes/Randomized.lean index 351c2be6..f5010cbf 100644 --- a/Complexitylib/Classes/Randomized.lean +++ b/Complexitylib/Classes/Randomized.lean @@ -5,8 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine -public import Complexitylib.Asymptotics public import Complexitylib.Classes.Time /-! diff --git a/Complexitylib/Classes/Randomized/CircuitAmplification.lean b/Complexitylib/Classes/Randomized/CircuitAmplification.lean index 40d64abb..66501af2 100644 --- a/Complexitylib/Classes/Randomized/CircuitAmplification.lean +++ b/Complexitylib/Classes/Randomized/CircuitAmplification.lean @@ -8,6 +8,7 @@ module public import Complexitylib.Circuits.Hardwiring public import Complexitylib.Circuits.Unrolling.Amplification public import Complexitylib.Models.TuringMachine.Repetition.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Probabilistic semantics of circuit amplification diff --git a/Complexitylib/Classes/Randomized/GoodSeed.lean b/Complexitylib/Classes/Randomized/GoodSeed.lean index 7047a449..a50588e6 100644 --- a/Complexitylib/Classes/Randomized/GoodSeed.lean +++ b/Complexitylib/Classes/Randomized/GoodSeed.lean @@ -8,6 +8,7 @@ module public import Complexitylib.Circuits.BitString public import Complexitylib.Classes.Randomized public import Complexitylib.Models.TuringMachine.Repetition.Correctness +import Std.Tactic.BVDecide.Normalize.Prop /-! # Uniform good seeds for bounded-error machines diff --git a/Complexitylib/DescriptiveComplexity/Definable.lean b/Complexitylib/DescriptiveComplexity/Definable.lean index 8284ba35..644da0c8 100644 --- a/Complexitylib/DescriptiveComplexity/Definable.lean +++ b/Complexitylib/DescriptiveComplexity/Definable.lean @@ -5,8 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.DescriptiveComplexity.Query -public import Complexitylib.DescriptiveComplexity.FirstOrder public import Complexitylib.DescriptiveComplexity.Reduction public import Complexitylib.DescriptiveComplexity.SecondOrder diff --git a/Complexitylib/DescriptiveComplexity/Encoding.lean b/Complexitylib/DescriptiveComplexity/Encoding.lean index 8d7ed8ae..d37df389 100644 --- a/Complexitylib/DescriptiveComplexity/Encoding.lean +++ b/Complexitylib/DescriptiveComplexity/Encoding.lean @@ -6,11 +6,9 @@ Authors: Samuel Schlesinger module public import Complexitylib.DescriptiveComplexity.Structure -public import Mathlib.Data.Fintype.Pi public import Mathlib.Data.Fintype.BigOperators -public import Mathlib.Data.List.FinRange -public import Mathlib.Data.Fin.Tuple.Basic public import Mathlib.Data.List.TakeWhile +import Std.Tactic.BVDecide.Normalize.Prop /-! # Encoding finite structures as bit strings diff --git a/Complexitylib/DescriptiveComplexity/Examples.lean b/Complexitylib/DescriptiveComplexity/Examples.lean index e4f859e4..bee6bafb 100644 --- a/Complexitylib/DescriptiveComplexity/Examples.lean +++ b/Complexitylib/DescriptiveComplexity/Examples.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.DescriptiveComplexity.Query public import Complexitylib.DescriptiveComplexity.FirstOrder /-! diff --git a/Complexitylib/DescriptiveComplexity/ModelChecking.lean b/Complexitylib/DescriptiveComplexity/ModelChecking.lean index 7b64e166..90a71e03 100644 --- a/Complexitylib/DescriptiveComplexity/ModelChecking.lean +++ b/Complexitylib/DescriptiveComplexity/ModelChecking.lean @@ -5,8 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.DescriptiveComplexity.Structure -public import Complexitylib.DescriptiveComplexity.Env public import Complexitylib.DescriptiveComplexity.FirstOrder.Semantics public import Mathlib.Data.List.FinRange diff --git a/Complexitylib/DescriptiveComplexity/Reduction.lean b/Complexitylib/DescriptiveComplexity/Reduction.lean index cde292c0..2cb7b6d3 100644 --- a/Complexitylib/DescriptiveComplexity/Reduction.lean +++ b/Complexitylib/DescriptiveComplexity/Reduction.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.DescriptiveComplexity.Query public import Complexitylib.DescriptiveComplexity.FirstOrder /-! diff --git a/Complexitylib/DescriptiveComplexity/SecondOrder/Semantics.lean b/Complexitylib/DescriptiveComplexity/SecondOrder/Semantics.lean index 8a89d9b6..9da703f1 100644 --- a/Complexitylib/DescriptiveComplexity/SecondOrder/Semantics.lean +++ b/Complexitylib/DescriptiveComplexity/SecondOrder/Semantics.lean @@ -6,8 +6,6 @@ Authors: Samuel Schlesinger module public import Complexitylib.DescriptiveComplexity.SecondOrder.Syntax -public import Complexitylib.DescriptiveComplexity.Structure -public import Complexitylib.DescriptiveComplexity.Env public import Complexitylib.DescriptiveComplexity.FirstOrder.Semantics /-! diff --git a/Complexitylib/Encoding/Pairing.lean b/Complexitylib/Encoding/Pairing.lean index d5772a01..b6df3466 100644 --- a/Complexitylib/Encoding/Pairing.lean +++ b/Complexitylib/Encoding/Pairing.lean @@ -8,6 +8,7 @@ module public import Mathlib.Data.List.Basic public import Mathlib.Data.Nat.Init public import Lean.Elab.Tactic.Omega +import Std.Tactic.BVDecide.Normalize.Prop /-! # Pairing binary strings diff --git a/Complexitylib/Languages/AllSymbol.lean b/Complexitylib/Languages/AllSymbol.lean index 880538eb..278ab444 100644 --- a/Complexitylib/Languages/AllSymbol.lean +++ b/Complexitylib/Languages/AllSymbol.lean @@ -6,9 +6,8 @@ Authors: Samuel Schlesinger module public import Complexitylib.Languages.Trivial -public import Complexitylib.Models.TuringMachine.Combinators -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Scanner -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Complement +import Std.Tactic.BVDecide.Normalize.BitVec +import Std.Tactic.BVDecide.Normalize.Prop /-! # `allZeros` and `allOnes`: single-symbol languages diff --git a/Complexitylib/Languages/AnBn.lean b/Complexitylib/Languages/AnBn.lean index 685decd2..d0aca1ce 100644 --- a/Complexitylib/Languages/AnBn.lean +++ b/Complexitylib/Languages/AnBn.lean @@ -6,8 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Languages.Trivial -public import Complexitylib.Models.TuringMachine.Combinators -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Complement +import Std.Tactic.BVDecide.Normalize.Prop /-! # `{0ⁿ 1ⁿ : n ≥ 0}`: the canonical push-down language diff --git a/Complexitylib/Languages/Balanced.lean b/Complexitylib/Languages/Balanced.lean index a9094ce1..20e077d1 100644 --- a/Complexitylib/Languages/Balanced.lean +++ b/Complexitylib/Languages/Balanced.lean @@ -6,8 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Languages.Trivial -public import Complexitylib.Models.TuringMachine.Combinators -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Complement +import Std.Tactic.BVDecide.Normalize.Prop /-! # `{x : #false x = #true x}`: equal-count / "balanced" language diff --git a/Complexitylib/Languages/Contains.lean b/Complexitylib/Languages/Contains.lean index dedbdadb..7406daf3 100644 --- a/Complexitylib/Languages/Contains.lean +++ b/Complexitylib/Languages/Contains.lean @@ -6,8 +6,8 @@ Authors: Samuel Schlesinger module public import Complexitylib.Languages.Trivial -public import Complexitylib.Models.TuringMachine.Combinators -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Scanner +import Std.Tactic.BVDecide.Normalize.BitVec +import Std.Tactic.BVDecide.Normalize.Prop /-! # `containsZero` and `containsOne`: "contains-a-bit" languages diff --git a/Complexitylib/Languages/FirstCell.lean b/Complexitylib/Languages/FirstCell.lean index c238e610..2e4b7bc6 100644 --- a/Complexitylib/Languages/FirstCell.lean +++ b/Complexitylib/Languages/FirstCell.lean @@ -6,8 +6,8 @@ Authors: Samuel Schlesinger module public import Complexitylib.Languages.Trivial -public import Complexitylib.Models.TuringMachine.Combinators -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Complement +import Std.Tactic.BVDecide.Normalize.BitVec +import Std.Tactic.BVDecide.Normalize.Prop /-! # Languages determined by the first input cell diff --git a/Complexitylib/Languages/LastBit.lean b/Complexitylib/Languages/LastBit.lean index 5685b7ed..3d0bb44b 100644 --- a/Complexitylib/Languages/LastBit.lean +++ b/Complexitylib/Languages/LastBit.lean @@ -6,8 +6,6 @@ Authors: Samuel Schlesinger module public import Complexitylib.Languages.Trivial -public import Complexitylib.Models.TuringMachine.Combinators -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Scanner /-! # `lastBitOne` and `lastBitZero`: final-symbol languages diff --git a/Complexitylib/Languages/LengthDivBy.lean b/Complexitylib/Languages/LengthDivBy.lean index d2e72cbb..22eaba42 100644 --- a/Complexitylib/Languages/LengthDivBy.lean +++ b/Complexitylib/Languages/LengthDivBy.lean @@ -6,9 +6,6 @@ Authors: Samuel Schlesinger module public import Complexitylib.Languages.Trivial -public import Complexitylib.Models.TuringMachine.Combinators -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Scanner -public import Mathlib.Data.ZMod.Basic /-! # `lengthDivBy k`: length-divisibility language family diff --git a/Complexitylib/Languages/LengthParity.lean b/Complexitylib/Languages/LengthParity.lean index 1d840def..160b3f1b 100644 --- a/Complexitylib/Languages/LengthParity.lean +++ b/Complexitylib/Languages/LengthParity.lean @@ -6,8 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Languages.Trivial -public import Complexitylib.Models.TuringMachine.Combinators -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Complement +import Std.Tactic.BVDecide.Normalize.Prop /-! # Languages determined by the parity of the input length diff --git a/Complexitylib/Languages/Palindromes.lean b/Complexitylib/Languages/Palindromes.lean index 9b63431c..03f47bdf 100644 --- a/Complexitylib/Languages/Palindromes.lean +++ b/Complexitylib/Languages/Palindromes.lean @@ -6,8 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Languages.Trivial -public import Complexitylib.Models.TuringMachine.Combinators -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Complement +import Std.Tactic.BVDecide.Normalize.Prop /-! # `palindromes`: strings equal to their reverse diff --git a/Complexitylib/Languages/Trivial.lean b/Complexitylib/Languages/Trivial.lean index 5af1be1f..02486f75 100644 --- a/Complexitylib/Languages/Trivial.lean +++ b/Complexitylib/Languages/Trivial.lean @@ -5,9 +5,7 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Classes.P public import Complexitylib.Classes.Containments -public import Complexitylib.Models.TuringMachine.Subroutines.Internal /-! # Trivial languages: `∅` and `Set.univ` diff --git a/Complexitylib/Languages/ZeroPrefix.lean b/Complexitylib/Languages/ZeroPrefix.lean index bedeb9ab..ff59df1c 100644 --- a/Complexitylib/Languages/ZeroPrefix.lean +++ b/Complexitylib/Languages/ZeroPrefix.lean @@ -6,8 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Languages.Trivial -public import Complexitylib.Models.TuringMachine.Combinators -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Complement +import Std.Tactic.BVDecide.Normalize.Prop /-! # `{0ⁿ 1ᵐ : n ≥ m}`: a push-down language with inequality counter diff --git a/Complexitylib/Mathlib/Digraph.lean b/Complexitylib/Mathlib/Digraph.lean index b134ad97..d83ae762 100644 --- a/Complexitylib/Mathlib/Digraph.lean +++ b/Complexitylib/Mathlib/Digraph.lean @@ -8,6 +8,7 @@ module public import Mathlib.Combinatorics.Digraph.Basic public import Mathlib.Data.Fintype.Prod public import Mathlib.Data.Nat.Lattice +import Std.Tactic.BVDecide.Normalize.Prop /-! # Digraph extensions for Mathlib diff --git a/Complexitylib/Mathlib/FinsetPrefixes.lean b/Complexitylib/Mathlib/FinsetPrefixes.lean index e987adaf..236bd90e 100644 --- a/Complexitylib/Mathlib/FinsetPrefixes.lean +++ b/Complexitylib/Mathlib/FinsetPrefixes.lean @@ -6,7 +6,6 @@ Authors: Bolton Bailey module public import Mathlib.Data.Finset.Union -public import Mathlib.Data.List.Infix /-! # Finsets of prefixes and suffixes diff --git a/Complexitylib/Mathlib/NatBits.lean b/Complexitylib/Mathlib/NatBits.lean index 79fdb681..6cc17c0d 100644 --- a/Complexitylib/Mathlib/NatBits.lean +++ b/Complexitylib/Mathlib/NatBits.lean @@ -8,7 +8,6 @@ module public import Mathlib.Data.Nat.Log public import Mathlib.Data.Nat.Size public import Mathlib.Tactic.Ring -public import Mathlib.Tactic.Lemma /-! # Fixed-width binary encodings of natural numbers diff --git a/Complexitylib/Models/RandomAccessMachine.lean b/Complexitylib/Models/RandomAccessMachine.lean index 6ce640c6..4a99e95c 100644 --- a/Complexitylib/Models/RandomAccessMachine.lean +++ b/Complexitylib/Models/RandomAccessMachine.lean @@ -52,10 +52,6 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Decision public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordDecode public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordEncode -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryEq -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryShiftMul public import Complexitylib.Models.RandomAccessMachine.Structured public import Complexitylib.Models.RandomAccessMachine.Structured.Switch.Compiled public import Complexitylib.Models.RandomAccessMachine.Structured.Hamming @@ -64,12 +60,9 @@ public import Complexitylib.Models.RandomAccessMachine.Structured.GateStep public import Complexitylib.Models.RandomAccessMachine.Structured.GateStreamStep public import Complexitylib.Models.RandomAccessMachine.Structured.Scanner public import Complexitylib.Models.RandomAccessMachine.Structured.PairValidate -public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary public import Complexitylib.Models.RandomAccessMachine.Structured.LastBit public import Complexitylib.Models.RandomAccessMachine.Structured.ThreeSATSyntax public import Complexitylib.Models.RandomAccessMachine.Structured.UnaryDecode -public import Complexitylib.Asymptotics -public import Complexitylib.Classes.Time /-! # Random access machines (surface) diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Containment/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Containment/Defs.lean index a21dc8bf..f47ecd89 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Containment/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Containment/Defs.lean @@ -7,7 +7,6 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Bounds.Defs -public import Mathlib.Algebra.Polynomial.Eval.Defs public import Mathlib.Tactic /-! diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Containment/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Containment/Internal.lean index f564a4e9..c7122a43 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Containment/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Containment/Internal.lean @@ -9,13 +9,11 @@ public import Complexitylib.Classes.P.NormalForm public import Complexitylib.Models.RandomAccessMachine.Classes public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Containment.Defs -public import - Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Bounds public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.DenseBounds public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.DenseDecision -public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program +import Std.Tactic.BVDecide.Normalize.Prop /-! # RAM-to-TM time-class containment -- proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/DenseOverlay/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/DenseOverlay/Internal.lean index 333df923..42b69d68 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/DenseOverlay/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/DenseOverlay/Internal.lean @@ -8,6 +8,7 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.DenseOverlay.Defs public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Internal +import Std.Tactic.BVDecide.Normalize.Prop /-! # Dense public input with a sparse mutable overlay -- proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Internal.lean index acba58b6..d0d80ed5 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Internal.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Defs public import Complexitylib.Models.RandomAccessMachine.Internal +import Std.Tactic.BVDecide.Normalize.Prop /-! # Sparse RAM register stores on Turing tapes: proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/AddressEq.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/AddressEq.lean index f1f7587f..61a84e61 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/AddressEq.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/AddressEq.lean @@ -7,7 +7,6 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.AddressEq.Internal -public import Complexitylib.Models.TuringMachine.Hoare.Space public import Complexitylib.Models.TuringMachine.Subroutines.ClearWork /-! diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/AddressEq/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/AddressEq/Internal.lean index 56d81214..475641ea 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/AddressEq/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/AddressEq/Internal.lean @@ -7,8 +7,6 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.AddressEq.Defs public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordDecode -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Seq -public import Complexitylib.Models.TuringMachine.Internal public import Complexitylib.Models.TuringMachine.Subroutines.BinaryEq /-! diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/DenseInputLookup/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/DenseInputLookup/Defs.lean index e78bcee4..1c0a93f6 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/DenseInputLookup/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/DenseInputLookup/Defs.lean @@ -11,6 +11,7 @@ public import Complexitylib.Models.TuringMachine.Combinators.ForInput.Defs public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy.Defs public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred.Defs public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Dense public-input lookup -- definitions diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/DenseInputLookup/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/DenseInputLookup/Internal.lean index 84639891..ca5a2b91 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/DenseInputLookup/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/DenseInputLookup/Internal.lean @@ -9,13 +9,9 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.DenseInputLookup.Defs public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch public import Complexitylib.Models.TuringMachine.Combinators.ForInput.Internal -public import Complexitylib.Models.TuringMachine.Registers public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary -public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc -public import Complexitylib.Models.TuringMachine.Subroutines.Internal -public import Complexitylib.Models.TuringMachine.Tape.Encoding /-! # Dense public-input lookup -- proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryAppend.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryAppend.lean index e0ec9336..7ec2c530 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryAppend.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryAppend.lean @@ -9,7 +9,6 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryAppend.Defs public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryAppend.Internal -public import Complexitylib.Models.TuringMachine.Hoare.Space /-! # Sparse-entry final append diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryAppend/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryAppend/Internal.lean index 4fdaa942..dfd00187 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryAppend/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryAppend/Internal.lean @@ -11,7 +11,6 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryEncode public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScan -public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary /-! # Sparse-entry final append — proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryCleanup.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryCleanup.lean index beb4e6cd..90f14f85 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryCleanup.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryCleanup.lean @@ -9,7 +9,6 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryCleanup.Defs public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryCleanup.Internal -public import Complexitylib.Models.TuringMachine.Hoare.Space /-! # Sparse-entry miss cleanup diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryCleanup/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryCleanup/Defs.lean index fa010e60..d5cde544 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryCleanup/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryCleanup/Defs.lean @@ -8,7 +8,6 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryMatch.Defs public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany.Defs -public import Mathlib.Data.List.FinRange /-! # Sparse-entry miss cleanup — definitions diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryDecode/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryDecode/Internal.lean index b45dd1f9..da946e56 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryDecode/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryDecode/Internal.lean @@ -7,8 +7,6 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryDecode.Defs public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordDecode -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Seq -public import Complexitylib.Models.TuringMachine.Internal /-! # RAM sparse-entry decoder — proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryDecode/LinearInternal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryDecode/LinearInternal.lean index db68ee13..ff415f5e 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryDecode/LinearInternal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryDecode/LinearInternal.lean @@ -7,8 +7,6 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryDecode.Defs public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordDecode -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Seq -public import Complexitylib.Models.TuringMachine.Internal /-! # Linear RAM sparse-entry decoder -- proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryEncode.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryEncode.lean index 940cbf0a..90903415 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryEncode.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryEncode.lean @@ -10,7 +10,6 @@ public import public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryEncode.Internal public import Complexitylib.Models.TuringMachine.Hoare.RetargetOutput -public import Complexitylib.Models.TuringMachine.Hoare.Space /-! # Sparse entry emission diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryEncode/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryEncode/Internal.lean index f8daaf28..b4b2812b 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryEncode/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryEncode/Internal.lean @@ -9,7 +9,6 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryEncode.Defs public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordEncode -public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary /-! # Sparse entry emission — proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryLookup/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryLookup/Internal.lean index 3105cbde..e2a7757c 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryLookup/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryLookup/Internal.lean @@ -10,6 +10,7 @@ public import public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScan public import Mathlib.Data.Nat.Bitwise +import Std.Tactic.BVDecide.Normalize.Prop /-! # Sparse register lookup — proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryLookupRestore.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryLookupRestore.lean index 0237b0c2..3fb5548f 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryLookupRestore.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryLookupRestore.lean @@ -5,11 +5,8 @@ Authors: Samuel Schlesinger -/ module -public import - Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Lookup.Internal.Static public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Lookup.DenseInternal -public import Complexitylib.Models.TuringMachine.Subroutines.ClearWork /-! # Reusable sparse-register operand lookup diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMatch.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMatch.lean index ae1af5a7..5aeb5c29 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMatch.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMatch.lean @@ -9,7 +9,7 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryMatch.Defs public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryMatch.Internal -public import Complexitylib.Models.TuringMachine.Hoare.Space +import Std.Tactic.BVDecide.Normalize.BitVec /-! # RAM sparse-entry matching diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMatch/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMatch/Internal.lean index 52c5d2a7..85dfa110 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMatch/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMatch/Internal.lean @@ -11,8 +11,7 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryDecode public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryMatch.Defs -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Seq -public import Complexitylib.Models.TuringMachine.Internal +import Std.Tactic.BVDecide.Normalize.Prop /-! # RAM sparse-entry matching — proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMissCopy.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMissCopy.lean index c65d0146..b2bb1b08 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMissCopy.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryMissCopy.lean @@ -9,7 +9,6 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryMissCopy.Defs public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryMissCopy.Internal -public import Complexitylib.Models.TuringMachine.Hoare.Space /-! # Sparse-entry miss copy diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryReplace.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryReplace.lean index 1875b3c1..2b19e8fb 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryReplace.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryReplace.lean @@ -9,7 +9,6 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryReplace.Defs public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryReplace.Internal -public import Complexitylib.Models.TuringMachine.Hoare.Space /-! # Sparse-entry replacement diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryReplace/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryReplace/Defs.lean index b9423af4..4bb26106 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryReplace/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryReplace/Defs.lean @@ -9,7 +9,6 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryCleanup.Defs public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryEncode.Defs -public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary.Defs /-! # Sparse-entry replacement — definitions diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryReplace/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryReplace/Internal.lean index 18f4b814..627e7c94 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryReplace/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryReplace/Internal.lean @@ -11,7 +11,6 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryCleanup public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryEncode -public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary /-! # Sparse-entry replacement — proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan.lean index 2d6349ab..d1bac039 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan.lean @@ -11,7 +11,6 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScan.Internal.Sem public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScan.Internal.Bounds -public import Complexitylib.Models.TuringMachine.Hoare.Space /-! # Bounded sparse-entry scan diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Defs.lean index 543056ba..b2087477 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Defs.lean @@ -8,6 +8,7 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScanStep.Defs public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Bounded sparse-entry scan — definitions diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Internal/Ctrl.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Internal/Ctrl.lean index 3209d07f..3db5bf15 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Internal/Ctrl.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Internal/Ctrl.lean @@ -7,7 +7,6 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScan.Defs -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic /-! # Bounded sparse-entry scan — controller internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Internal/Inv.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Internal/Inv.lean index 3779f5dc..6b18db3c 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Internal/Inv.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Internal/Inv.lean @@ -9,8 +9,6 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScan.Defs public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScanStep -public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany -public import Mathlib.Tactic.FinCases /-! # Bounded sparse-entry scan — invariant internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Internal/Sem.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Internal/Sem.lean index 2cfd7268..0bda5f7a 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Internal/Sem.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScan/Internal/Sem.lean @@ -11,6 +11,7 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScan.Internal.Inv public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred +import Std.Tactic.BVDecide.Normalize.Prop /-! # Bounded sparse-entry scan — semantic internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScanStep.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScanStep.lean index 6320fc81..000e3ff8 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScanStep.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScanStep.lean @@ -9,7 +9,6 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScanStep.Defs public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScanStep.Internal -public import Complexitylib.Models.TuringMachine.Hoare.Space /-! # One bounded sparse-entry scan iteration diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScanStep/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScanStep/Internal.lean index e3aea645..68293c5c 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScanStep/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryScanStep/Internal.lean @@ -10,6 +10,7 @@ public import public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScanStep.Defs public import Complexitylib.Models.TuringMachine.Combinators.WorkSymbolBranch +import Std.Tactic.BVDecide.Normalize.BitVec /-! # One bounded sparse-entry scan iteration — proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate.lean index 5549ebaa..73827e86 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate.lean @@ -15,8 +15,6 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.BoundsInternal public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Source -public import Complexitylib.Models.TuringMachine.Hoare.Space -public import Complexitylib.Models.TuringMachine.Hoare.RetargetOutput /-! # Bounded encoded sparse-store update diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Defs.lean index 83568fe5..b07cd642 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Defs.lean @@ -10,7 +10,7 @@ public import public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryMissCopy.Defs public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred.Defs -public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Bounded encoded sparse-store update — controller definitions diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Ctrl.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Ctrl.lean index 6752ec60..e2daae3c 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Ctrl.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Ctrl.lean @@ -7,7 +7,6 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Defs -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic /-! # Bounded encoded sparse-store update — controller internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/End.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/End.lean index c5606754..368eda9a 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/End.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/End.lean @@ -11,7 +11,6 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Internal.Out public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Internal.Time -public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch /-! # Bounded encoded sparse-store update -- terminal loop case diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Hit.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Hit.lean index bd398354..5033f188 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Hit.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Hit.lean @@ -5,23 +5,13 @@ Authors: Samuel Schlesinger -/ module -public import - Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryCleanup -public import - Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryMatch -public import - Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryReplace -public import -Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Internal.Ctrl -public import - Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Internal.Inv public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Internal.Loop public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Internal.Out public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Internal.Time -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred +import Std.Tactic.BVDecide.Normalize.Prop /-! # Bounded encoded sparse-store update -- matching iterations diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Inv.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Inv.lean index 16880ac8..c131e4dc 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Inv.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Inv.lean @@ -10,7 +10,7 @@ Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryU public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScan.Internal.Inv public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred -public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc +import Std.Tactic.BVDecide.Normalize.Prop /-! # Bounded encoded sparse-store update — invariant internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Miss.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Miss.lean index 9b744789..20c72a26 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Miss.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Miss.lean @@ -5,19 +5,12 @@ Authors: Samuel Schlesinger -/ module -public import - Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryMatch -public import - Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryMissCopy -public import -Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Internal.Ctrl public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Internal.Loop public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Internal.Out public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Internal.Time -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred public import Mathlib.Data.Nat.Bitwise /-! diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Out.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Out.lean index 4ad92791..aa56d66a 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Out.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Out.lean @@ -13,8 +13,6 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryMissCopy public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryReplace -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred -public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc /-! # Bounded encoded sparse-store update — output safety internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Step.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Step.lean index 10512299..cd9d3c4a 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Step.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Step.lean @@ -9,6 +9,7 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Internal.Hit public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Internal.Miss +import Std.Tactic.BVDecide.Normalize.Prop /-! # Bounded encoded sparse-store update -- one positive iteration diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Time.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Time.lean index 94ce1b6f..327f11ca 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Time.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Internal/Time.lean @@ -14,7 +14,6 @@ public import public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Defs public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred -public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc /-! # Bounded encoded sparse-store update — static runtime bounds diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Progress.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Progress.lean index 1df36334..6da47ebe 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Progress.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Progress.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Bounded encoded sparse-store update — progress invariant internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Source.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Source.lean index 5f803849..122b884b 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Source.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/Source.lean @@ -9,8 +9,8 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Defs public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScan.Defs -public import Complexitylib.Models.TuringMachine.Combinators.WorkSymbolBranch.Defs public import Complexitylib.Models.TuringMachine.WorkReadOnly +import Std.Tactic.BVDecide.Normalize.BitVec /-! # Sparse-store update source preservation diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/TaggedDefs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/TaggedDefs.lean index 9a6f5309..5edb3889 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/TaggedDefs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/TaggedDefs.lean @@ -9,7 +9,6 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Defs public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.DenseOverlay.Defs -public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs /-! # Positive-tag sparse updates diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/TaggedProof.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/TaggedProof.lean index 013f46c5..43da66b5 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/TaggedProof.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/EntryUpdate/TaggedProof.lean @@ -9,7 +9,6 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.TaggedDefs public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate -public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc /-! # Positive-tag sparse updates -- proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction.lean index cd621a4f..2a79cc60 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction.lean @@ -19,7 +19,6 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Store public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Control -public import Complexitylib.Models.TuringMachine.Hoare.RetargetOutput /-! # Concrete sparse-store arithmetic instruction kernel diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Control.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Control.lean index 5ff8be97..156c6808 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Control.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Control.lean @@ -9,10 +9,6 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Defs public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryLookupRestore -public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst -public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc -public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary /-! # Sparse-store control instructions diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Defs.lean index 1a7cbf90..b9315fdb 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Defs.lean @@ -9,13 +9,8 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate.Defs public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Lookup.Defs -public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch.Defs -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst.Defs -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Defs public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Defs public import Complexitylib.Models.TuringMachine.Subroutines.BinaryShiftMul.Defs -public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary.Defs -public import Mathlib.Tactic.FinCases /-! # Concrete sparse-store arithmetic instruction kernel diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Dense.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Dense.lean index a819bf68..8899a6c5 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Dense.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Dense.lean @@ -7,8 +7,6 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.DenseControl -public import - Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.DenseDirect public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.DenseImm public import diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseCtrlSim.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseCtrlSim.lean index 07178c32..65f55a3a 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseCtrlSim.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseCtrlSim.lean @@ -11,6 +11,7 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.DenseSimDefs public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Sim.Control +import Std.Tactic.BVDecide.Normalize.Prop /-! # Dense-overlay control-instruction simulation diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseDispatch.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseDispatch.lean index 43e65013..080d3fa4 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseDispatch.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseDispatch.lean @@ -10,10 +10,7 @@ Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instru public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.DenseOverlay public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Sim.Internal -public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred -public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary +import Std.Tactic.BVDecide.Normalize.Prop /-! # Fixed-program dense-overlay dispatch diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseStore.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseStore.lean index 972d3e43..72c8d10b 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseStore.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/DenseStore.lean @@ -7,7 +7,6 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.DenseDirect -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy /-! # Dense-overlay indirect store diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Direct.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Direct.lean index 614a4be5..1c507e23 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Direct.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Direct.lean @@ -9,7 +9,6 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Internal public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryLookupRestore -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst /-! # Direct sparse-store arithmetic instructions -- proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Dispatch.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Dispatch.lean index 53cc4c72..5fe38dcf 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Dispatch.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Dispatch.lean @@ -5,20 +5,13 @@ Authors: Samuel Schlesinger -/ module -public import - Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction -public import - Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Sim.Defs public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Sim.Control public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Sim.Data public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Sim.Internal -public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch -public import Complexitylib.Models.TuringMachine.Hoare.Space -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred +import Std.Tactic.BVDecide.Normalize.Prop /-! # Fixed-program sparse RAM dispatch diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Internal.lean index e2d8f143..082e42de 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Internal.lean @@ -9,7 +9,6 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Defs public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub public import Complexitylib.Models.TuringMachine.Subroutines.BinaryShiftMul diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Load.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Load.lean index 3f5cc179..84b76fc6 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Load.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Load.lean @@ -9,7 +9,6 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Internal public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryLookupRestore -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst /-! # Indirect sparse-store load instructions -- proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Sim/Data.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Sim/Data.lean index 67820de8..f5d45a3b 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Sim/Data.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Sim/Data.lean @@ -9,7 +9,6 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Sim.Defs public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction -public import Complexitylib.Models.TuringMachine.Hoare.RetargetOutput /-! # Uniform next-store buffering for data instructions diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Sim/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Sim/Defs.lean index f878db02..3770545d 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Sim/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Sim/Defs.lean @@ -7,12 +7,7 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Defs -public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch.Defs public import Complexitylib.Models.TuringMachine.Lift -public import Complexitylib.Models.TuringMachine.Subroutines -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy.Defs -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred.Defs -public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany.Defs /-! # Fixed-program sparse RAM instruction dispatch -- definitions diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Sim/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Sim/Internal.lean index 746c5e9f..4bf19525 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Sim/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Sim/Internal.lean @@ -9,11 +9,8 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Sim.Defs public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch -public import Complexitylib.Models.TuringMachine.Hoare.Space public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred -public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc -public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany /-! diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Store.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Store.lean index 16aff0be..537c42d0 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Store.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Instruction/Store.lean @@ -7,7 +7,6 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Direct -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy /-! # Indirect sparse-store instructions -- proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Defs.lean index c36716b0..159118f7 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Defs.lean @@ -11,10 +11,7 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.DenseInputLookup.Defs public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.DenseOverlay.Defs -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy.Defs public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst.Defs -public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary.Defs -public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany.Defs public import Mathlib.Tactic.FinCases /-! diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/DenseInternal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/DenseInternal.lean index ed9d853a..5edf2cc0 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/DenseInternal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/DenseInternal.lean @@ -9,7 +9,7 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Lookup.Internal.Static public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.DenseInputLookup.Internal -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred +import Std.Tactic.BVDecide.Normalize.Prop /-! # Dense overlay lookup -- proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Reset.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Reset.lean index 8faa1ac8..c684ee0e 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Reset.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Reset.lean @@ -9,7 +9,7 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryLookup public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Lookup.Internal.Bounds -public import Mathlib.Tactic.FinCases +import Std.Tactic.BVDecide.Normalize.Prop /-! # Reusable sparse-register lookup -- reset certificates diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Restore.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Restore.lean index af4ddc05..dc3c682f 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Restore.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Restore.lean @@ -7,7 +7,6 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Lookup.Internal.Value -public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany /-! # Reusable sparse-register lookup -- scanner restoration diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Scan.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Scan.lean index 5c9e1671..b8ce544b 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Scan.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Scan.lean @@ -5,8 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import - Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryLookup public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Lookup.Internal.Reset diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Static.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Static.lean index e348d969..964c5200 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Static.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Lookup/Internal/Static.lean @@ -8,7 +8,6 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Lookup.Internal.Assemble public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst -public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary /-! # Fixed-address sparse-register lookup -- proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Bounds/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Bounds/Internal.lean index 6bfb6aea..d0072254 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Bounds/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Bounds/Internal.lean @@ -9,8 +9,7 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Bounds.Defs public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Decision -public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany -public import Mathlib.Tactic.Linarith +import Std.Tactic.BVDecide.Normalize.Prop /-! # Sparse RAM decision-machine resource-bound proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Defs.lean index 11bd47b2..35fb85f1 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Defs.lean @@ -7,10 +7,7 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Sim.Defs -public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch.Defs -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy.Defs -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred.Defs -public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Sparse RAM program controller -- definitions diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseBounds.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseBounds.lean index b10d2fac..f7423284 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseBounds.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseBounds.lean @@ -5,8 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import - Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.DenseBoundsDefs public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.DenseBoundsProof diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseBoundsProof.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseBoundsProof.lean index 45990b01..101c7056 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseBoundsProof.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseBoundsProof.lean @@ -9,14 +9,10 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.DenseBoundsDefs public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Bounds -public import - Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryScan -public import - Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryUpdate public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.DenseInputLookup public import Mathlib.Algebra.Order.BigOperators.Group.Finset -public import Mathlib.Tactic.Linarith +import Std.Tactic.BVDecide.Normalize.Prop /-! # Dense-overlay RAM decision-machine resource-bound proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseDecision.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseDecision.lean index 5dcd53ce..7143f6da 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseDecision.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseDecision.lean @@ -5,8 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import -Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.DenseDecisionDefs public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.DenseDecisionProof diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseInit.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseInit.lean index 6fb11e7c..325f6719 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseInit.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseInit.lean @@ -5,8 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import - Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.DenseInitDefs public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.DenseInitProof diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseInitDefs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseInitDefs.lean index 2d86479b..289ae8d8 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseInitDefs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseInitDefs.lean @@ -7,7 +7,7 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Init.Defs -public import Complexitylib.Models.TuringMachine.Subroutines +import Std.Tactic.BVDecide.Normalize.Prop /-! # Dense-overlay public-input initialization -- definitions diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseInitProof.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseInitProof.lean index 22222e73..c61cd4e8 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseInitProof.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseInitProof.lean @@ -10,6 +10,7 @@ public import public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Init.Internal public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.DenseOverlay +import Std.Tactic.BVDecide.Normalize.Prop /-! # Dense-overlay public-input initialization -- proofs diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseInternal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseInternal.lean index fcf1db2d..851b0947 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseInternal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/DenseInternal.lean @@ -9,6 +9,7 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.DenseDefs public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program +import Std.Tactic.BVDecide.Normalize.Prop /-! # Dense-overlay RAM program controller -- proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Init/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Init/Defs.lean index 5fb92031..0e061e82 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Init/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Init/Defs.lean @@ -7,14 +7,7 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Defs -public import - Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryEncode.Defs -public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch.Defs -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy.Defs -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred.Defs -public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs -public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary.Defs -public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Sparse RAM public-input initialization definitions diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Init/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Init/Internal.lean index c9f271f1..71923543 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Init/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Init/Internal.lean @@ -7,20 +7,9 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Init.Defs -public import - Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.EntryEncode public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Internal -public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -public import Complexitylib.Models.TuringMachine.Hoare.RetargetOutput -public import Complexitylib.Models.TuringMachine.Internal -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred -public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc -public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary -public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany -public import Complexitylib.Models.TuringMachine.Subroutines.Internal +import Std.Tactic.BVDecide.Normalize.Prop /-! # Sparse RAM public-input initialization -- proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Initialization.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Initialization.lean index 34460c01..f46e2410 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Initialization.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Initialization.lean @@ -5,8 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import - Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Init.Defs public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Init.Internal diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Internal.lean index 4020dc88..7af37d88 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/Program/Internal.lean @@ -9,10 +9,6 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Program.Defs public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.Instruction.Dispatch -public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred -public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary /-! # Sparse RAM program controller -- proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordDecode.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordDecode.lean index 97f72247..d9103d02 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordDecode.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordDecode.lean @@ -10,7 +10,6 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore. public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordDecode.LinearInternal public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Defs -public import Complexitylib.Models.TuringMachine.Hoare.Space /-! # RAM snapshot word-width decoder diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordDecode/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordDecode/Defs.lean index 5c8ad3dc..a60b8ae9 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordDecode/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordDecode/Defs.lean @@ -7,7 +7,7 @@ module public import Complexitylib.Models.TuringMachine.Combinators.ForWorkOnes.Defs public import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Defs -public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # RAM snapshot word-width decoder — definitions diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordDecode/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordDecode/Internal.lean index 58e2f125..9f1f0301 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordDecode/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordDecode/Internal.lean @@ -11,6 +11,7 @@ public import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc public import Complexitylib.Models.TuringMachine.Subroutines.Internal public import Mathlib.Tactic.Linarith +import Std.Tactic.BVDecide.Normalize.BitVec /-! # RAM snapshot word-width decoder — proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordDecode/LinearInternal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordDecode/LinearInternal.lean index 0dde1aeb..7aa8729c 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordDecode/LinearInternal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordDecode/LinearInternal.lean @@ -7,7 +7,7 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordDecode.Defs public import Complexitylib.Models.TuringMachine.Internal -public import Complexitylib.Models.TuringMachine.Tape.Encoding +import Std.Tactic.BVDecide.Normalize.BitVec /-! # Linear RAM snapshot word decoder — proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordEncode.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordEncode.lean index 6b0deb72..fb8cd24e 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordEncode.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordEncode.lean @@ -9,7 +9,6 @@ public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordEncode.Defs public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordEncode.Internal -public import Complexitylib.Models.TuringMachine.Hoare.Space /-! # Self-delimiting word emission diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordEncode/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordEncode/Defs.lean index 76847a7a..e8ab7f35 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordEncode/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordEncode/Defs.lean @@ -7,10 +7,9 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Defs -public import Complexitylib.Models.TuringMachine.Combinators public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary.Defs -public import Complexitylib.Models.TuringMachine.Tape.Encoding +import Std.Tactic.BVDecide.Normalize.Prop /-! # Self-delimiting word emission — definitions diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordEncode/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordEncode/Internal.lean index d70b52c6..30a794cf 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordEncode/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/RegisterStore/Machine/WordEncode/Internal.lean @@ -7,8 +7,6 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordEncode.Defs -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -public import Complexitylib.Models.TuringMachine.Hoare public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary /-! diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Internal.lean index 3d7bf3d7..3d315547 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Internal.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Bounded Turing-machine configuration encoding -- proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Capture.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Capture.lean index d223d6e8..eaa17e04 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Capture.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Capture.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.ABI.Defs public import Complexitylib.Models.RandomAccessMachine.Structured.Internal +import Std.Tactic.BVDecide.Normalize.Prop /-! # Capturing raw-input scratch bits in finite control -- proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Decision.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Decision.lean index 5dd84e0d..f11bc009 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Decision.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Decision.lean @@ -8,6 +8,7 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.ABI.Internal.Marshal public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal.Iteration public import Complexitylib.Models.RandomAccessMachine.Structured +import Std.Tactic.BVDecide.Normalize.Prop /-! # End-to-end public-ABI sparse simulation -- proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Loop.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Loop.lean index 99b8f77e..60198211 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Loop.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Loop.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.ABI.Internal.Capture public import Complexitylib.Models.RandomAccessMachine.Structured.Internal.Resources +import Std.Tactic.BVDecide.Normalize.Prop /-! # Backward public-input copy -- proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Marshal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Marshal.lean index 9deff6c1..c40b9bc0 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Marshal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Marshal.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.ABI.Internal.Loop public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Internal +import Std.Tactic.BVDecide.Normalize.Prop /-! # Public-input marshalling correctness -- proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Resources.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Resources.lean index 5a03cd96..69a0eaf7 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Resources.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/ABI/Internal/Resources.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.ABI.Internal.Decision public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal.Resources +import Std.Tactic.BVDecide.Normalize.Prop /-! # Resource bounds for the public sparse-simulator ABI -- proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Internal.lean index 18f2e80d..4426702c 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Internal.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Defs public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Internal +import Std.Tactic.BVDecide.Normalize.Prop /-! # Sparse unbounded TM configuration encoding -- proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Action.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Action.lean index d726ed72..1eac1c54 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Action.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Action.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal.Load public import Complexitylib.Models.RandomAccessMachine.Structured.Internal.Resources +import Std.Tactic.BVDecide.Normalize.Prop /-! # Selected sparse TM transition actions -- proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Dispatch.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Dispatch.lean index a0a64dca..f2e6c28f 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Dispatch.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Dispatch.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal.Action public import Complexitylib.Models.RandomAccessMachine.Structured.Switch +import Std.Tactic.BVDecide.Normalize.Prop /-! # Nested finite dispatch for the fixed sparse TM transition -- proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Load.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Load.lean index f5a2a355..f3cb158d 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Load.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Load.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal.Layout +import Std.Tactic.BVDecide.Normalize.Prop /-! # Loading sparse TM states and head symbols -- proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Resources.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Resources.lean index 36591de0..e3291126 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Resources.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Sparse/Step/Internal/Resources.lean @@ -6,7 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Sparse.Step.Internal.Iteration -public import Complexitylib.Models.RandomAccessMachine.Structured.Internal.Resources +import Std.Tactic.BVDecide.Normalize.Prop /-! # Resource envelopes for the fixed sparse TM simulator -- proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Action.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Action.lean index 7f5b3fd2..2f13cb06 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Action.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Action.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Step.Internal.Load +import Std.Tactic.BVDecide.Normalize.Prop /-! # Selected TM transition actions -- proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Dispatch.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Dispatch.lean index ad8b317c..425c5f00 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Dispatch.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Dispatch.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Step.Internal.Action public import Complexitylib.Models.RandomAccessMachine.Structured.Switch +import Std.Tactic.BVDecide.Normalize.Prop /-! # Nested finite dispatch for one TM transition -- proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Load.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Load.lean index b2e21d6c..48079233 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Load.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Load.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Step.Internal.Layout public import Complexitylib.Models.RandomAccessMachine.Structured.Internal.Resources +import Std.Tactic.BVDecide.Normalize.Prop /-! # Loading represented TM states and head symbols -- proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Resources.lean b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Resources.lean index c11145c6..9558e4f3 100644 --- a/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Resources.lean +++ b/Complexitylib/Models/RandomAccessMachine/Simulation/TMConfig/Step/Internal/Resources.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.RandomAccessMachine.Simulation.TMConfig.Step.Internal.Dispatch +import Std.Tactic.BVDecide.Normalize.Prop /-! # Resource bounds for one TM-to-RAM transition -- proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/GateEval/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Structured/GateEval/Internal.lean index fe7a7e3c..c0111e9f 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/GateEval/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/GateEval/Internal.lean @@ -7,7 +7,8 @@ module public import Complexitylib.Models.RandomAccessMachine.Structured public import Complexitylib.Models.RandomAccessMachine.Structured.GateEval.Defs -public import Complexitylib.Models.RandomAccessMachine.Structured.Internal.Resources +import Std.Tactic.BVDecide.Normalize.Bool +import Std.Tactic.BVDecide.Normalize.Prop /-! # Structured RAM decoded-gate evaluator — proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/GateStep/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Structured/GateStep/Internal.lean index 74f8e219..abe93f66 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/GateStep/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/GateStep/Internal.lean @@ -10,6 +10,7 @@ public import Complexitylib.Models.RandomAccessMachine.Structured.GateEval.Inter public import Complexitylib.Models.RandomAccessMachine.Structured.GateStep.Defs public import Complexitylib.Models.RandomAccessMachine.Structured.UnaryDecode.Internal public import Mathlib.Tactic.IntervalCases +import Std.Tactic.BVDecide.Normalize.Prop /-! # Structured RAM serialized-gate step — proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/GateStreamStep/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Structured/GateStreamStep/Internal.lean index ef1d0f2a..45279c4c 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/GateStreamStep/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/GateStreamStep/Internal.lean @@ -10,6 +10,7 @@ public import Complexitylib.Models.RandomAccessMachine.Structured.GateEval.Inter public import Complexitylib.Models.RandomAccessMachine.Structured.GateStreamStep.Defs public import Complexitylib.Models.RandomAccessMachine.Structured.UnaryDecode.Internal public import Mathlib.Tactic.IntervalCases +import Std.Tactic.BVDecide.Normalize.Prop /-! # Structured RAM iterable serialized-gate step — proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/Hamming/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Structured/Hamming/Internal.lean index 0e0a64b5..7b394dd0 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/Hamming/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/Hamming/Internal.lean @@ -7,7 +7,7 @@ module public import Complexitylib.Models.RandomAccessMachine.Structured public import Complexitylib.Models.RandomAccessMachine.Structured.Hamming.Defs -public import Complexitylib.Models.RandomAccessMachine.Structured.Internal.Resources +import Std.Tactic.BVDecide.Normalize.Prop /-! # Structured RAM Hamming-weight program — proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Structured/Internal.lean index f329261d..57ef72fb 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/Internal.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Models.RandomAccessMachine.Internal public import Complexitylib.Models.RandomAccessMachine.Structured.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Structured logarithmic-cost RAM programs — proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/Internal/Resources.lean b/Complexitylib/Models/RandomAccessMachine/Structured/Internal/Resources.lean index e44ec4ab..d8ac465d 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/Internal/Resources.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/Internal/Resources.lean @@ -8,6 +8,7 @@ module public import Mathlib.Algebra.Order.BigOperators.Group.Finset public import Mathlib.Tactic.Ring public import Complexitylib.Models.RandomAccessMachine.Structured.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Resource-proof infrastructure for structured RAM programs diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/LastBit.lean b/Complexitylib/Models/RandomAccessMachine/Structured/LastBit.lean index 754999c7..fffa826b 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/LastBit.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/LastBit.lean @@ -8,6 +8,7 @@ module public import Complexitylib.Models.RandomAccessMachine.Structured.LastBit.Defs public import Complexitylib.Models.RandomAccessMachine.Structured.Scanner public import Complexitylib.Languages.LastBit +import Std.Tactic.BVDecide.Normalize.Prop /-! # Verified structured RAM last-bit scanner diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/LastBit/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Structured/LastBit/Defs.lean index 2ae991e6..265894b0 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/LastBit/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/LastBit/Defs.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Models.RandomAccessMachine.Structured.Scanner.Defs public import Mathlib.Data.FinEnum.Option +import Std.Tactic.BVDecide.Normalize.Prop /-! # Structured RAM last-bit scanner — definitions diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/PairValidate/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Structured/PairValidate/Defs.lean index 80985bab..2745c945 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/PairValidate/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/PairValidate/Defs.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Models.RandomAccessMachine.Structured.Scanner.Defs public import Complexitylib.Models.TuringMachine.Subroutines.PairValidate.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Structured RAM pair-encoding validator — definitions diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/Scanner/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Structured/Scanner/Internal.lean index c5984fd1..2b76f452 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/Scanner/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/Scanner/Internal.lean @@ -6,8 +6,9 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.RandomAccessMachine.Structured -public import Complexitylib.Models.RandomAccessMachine.Structured.Internal.Resources public import Complexitylib.Models.RandomAccessMachine.Structured.Scanner.Defs +import Std.Tactic.BVDecide.Normalize.BitVec +import Std.Tactic.BVDecide.Normalize.Prop /-! # Finite-state structured RAM scanners — proof internals diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/ThreeSATSyntax/Defs.lean b/Complexitylib/Models/RandomAccessMachine/Structured/ThreeSATSyntax/Defs.lean index 60269b5f..9a74f569 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/ThreeSATSyntax/Defs.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/ThreeSATSyntax/Defs.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Models.RandomAccessMachine.Structured.Scanner.Defs public import Complexitylib.SAT.ThreeSAT.Syntax +import Std.Tactic.BVDecide.Normalize.Prop /-! # Structured RAM exact-3-CNF syntax scanner — definitions diff --git a/Complexitylib/Models/RandomAccessMachine/Structured/UnaryDecode/Internal.lean b/Complexitylib/Models/RandomAccessMachine/Structured/UnaryDecode/Internal.lean index f895dc09..09432755 100644 --- a/Complexitylib/Models/RandomAccessMachine/Structured/UnaryDecode/Internal.lean +++ b/Complexitylib/Models/RandomAccessMachine/Structured/UnaryDecode/Internal.lean @@ -6,8 +6,8 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.RandomAccessMachine.Structured -public import Complexitylib.Models.RandomAccessMachine.Structured.Internal.Resources public import Complexitylib.Models.RandomAccessMachine.Structured.UnaryDecode.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Structured RAM terminated-unary decoder — proof internals diff --git a/Complexitylib/Models/RoseTreeMachine/Prog.lean b/Complexitylib/Models/RoseTreeMachine/Prog.lean index f6494672..fb40e1ca 100644 --- a/Complexitylib/Models/RoseTreeMachine/Prog.lean +++ b/Complexitylib/Models/RoseTreeMachine/Prog.lean @@ -6,8 +6,8 @@ Authors: Christian Reitwiessner module -public import Complexitylib.Models.RoseTreeMachine.Data public import Complexitylib.Models.RoseTreeMachine.DataEncode +import Std.Tactic.BVDecide.Normalize.Prop /-! diff --git a/Complexitylib/Models/TuringMachine.lean b/Complexitylib/Models/TuringMachine.lean index 0545de2d..2a899fea 100644 --- a/Complexitylib/Models/TuringMachine.lean +++ b/Complexitylib/Models/TuringMachine.lean @@ -5,9 +5,9 @@ Authors: Samuel Schlesinger -/ module -public import Mathlib.Logic.Relation public import Mathlib.Data.Fintype.Pi public import Mathlib.Data.Rat.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Turing machines diff --git a/Complexitylib/Models/TuringMachine/Combinators.lean b/Complexitylib/Models/TuringMachine/Combinators.lean index 170d0ec1..04676e99 100644 --- a/Complexitylib/Models/TuringMachine/Combinators.lean +++ b/Complexitylib/Models/TuringMachine/Combinators.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Models.TuringMachine public import Mathlib.Data.Fintype.Sum +import Std.Tactic.BVDecide.Normalize.Prop /-! # TM Combinators diff --git a/Complexitylib/Models/TuringMachine/Combinators/ForBinaryWork/Defs.lean b/Complexitylib/Models/TuringMachine/Combinators/ForBinaryWork/Defs.lean index 4830e8e9..137adac6 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/ForBinaryWork/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/ForBinaryWork/Defs.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.TuringMachine.Combinators +import Std.Tactic.BVDecide.Normalize.Prop /-! # Binary work-tape loop combinator -- definitions diff --git a/Complexitylib/Models/TuringMachine/Combinators/ForInput/Defs.lean b/Complexitylib/Models/TuringMachine/Combinators/ForInput/Defs.lean index dea1fd2a..3b3d3234 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/ForInput/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/ForInput/Defs.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.TuringMachine.Combinators +import Std.Tactic.BVDecide.Normalize.Prop /-! # Read-only-input loop combinator — definitions diff --git a/Complexitylib/Models/TuringMachine/Combinators/ForWorkOnes/Defs.lean b/Complexitylib/Models/TuringMachine/Combinators/ForWorkOnes/Defs.lean index 38dc7612..0e79b630 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/ForWorkOnes/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/ForWorkOnes/Defs.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.TuringMachine.Combinators +import Std.Tactic.BVDecide.Normalize.Prop /-! # One-prefix work-tape loop combinator — definitions diff --git a/Complexitylib/Models/TuringMachine/Combinators/Internal/Complement.lean b/Complexitylib/Models/TuringMachine/Combinators/Internal/Complement.lean index 5c7a2fae..76052492 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/Internal/Complement.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/Internal/Complement.lean @@ -5,9 +5,9 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine.Combinators public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic public import Complexitylib.Models.TuringMachine.Internal +import Std.Tactic.BVDecide.Normalize.Prop /-! # Complement TM: proof internals diff --git a/Complexitylib/Models/TuringMachine/Combinators/Internal/If.lean b/Complexitylib/Models/TuringMachine/Combinators/Internal/If.lean index 99a47e8d..1cf54380 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/Internal/If.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/Internal/If.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine.Combinators public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic /-! diff --git a/Complexitylib/Models/TuringMachine/Combinators/Internal/Loop.lean b/Complexitylib/Models/TuringMachine/Combinators/Internal/Loop.lean index 5087f275..53083a0e 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/Internal/Loop.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/Internal/Loop.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine.Combinators public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic /-! diff --git a/Complexitylib/Models/TuringMachine/Combinators/Internal/Retarget.lean b/Complexitylib/Models/TuringMachine/Combinators/Internal/Retarget.lean index 1113141a..5d0ff94a 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/Internal/Retarget.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/Internal/Retarget.lean @@ -5,10 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine.Combinators -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -public import Complexitylib.Models.TuringMachine.Internal -public import Complexitylib.Models.TuringMachine.Hoare.Defs public import Complexitylib.Models.TuringMachine.Subroutines.Counter public import Complexitylib.Models.TuringMachine.Subroutines.Internal diff --git a/Complexitylib/Models/TuringMachine/Combinators/Internal/Scanner.lean b/Complexitylib/Models/TuringMachine/Combinators/Internal/Scanner.lean index 08a90300..9bc8b668 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/Internal/Scanner.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/Internal/Scanner.lean @@ -5,8 +5,9 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine.Combinators public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +import Std.Tactic.BVDecide.Normalize.BitVec +import Std.Tactic.BVDecide.Normalize.Prop /-! # Correctness of the generic finite-state scanner diff --git a/Complexitylib/Models/TuringMachine/Combinators/Internal/Seq.lean b/Complexitylib/Models/TuringMachine/Combinators/Internal/Seq.lean index 183ecdce..0682c181 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/Internal/Seq.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/Internal/Seq.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine.Combinators public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic /-! diff --git a/Complexitylib/Models/TuringMachine/Combinators/Internal/Union.lean b/Complexitylib/Models/TuringMachine/Combinators/Internal/Union.lean index c44dac78..ee5f4e1e 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/Internal/Union.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/Internal/Union.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine.Combinators public import Complexitylib.Models.TuringMachine.Internal public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic diff --git a/Complexitylib/Models/TuringMachine/Combinators/RetargetCompute/Internal.lean b/Complexitylib/Models/TuringMachine/Combinators/RetargetCompute/Internal.lean index 885aa6b6..f5dd7e26 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/RetargetCompute/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/RetargetCompute/Internal.lean @@ -7,8 +7,8 @@ module public import Complexitylib.Models.TuringMachine.Combinators.RetargetCompute.Defs public import Complexitylib.Models.TuringMachine.Combinators.Internal.Retarget -public import Complexitylib.Models.TuringMachine.Hoare.Defs public import Complexitylib.Models.TuringMachine.Placement.Internal +import Std.Tactic.BVDecide.Normalize.Prop /-! # Retargeted-input computation seam internals diff --git a/Complexitylib/Models/TuringMachine/Combinators/WorkBranch/Defs.lean b/Complexitylib/Models/TuringMachine/Combinators/WorkBranch/Defs.lean index 22bfed7c..7ba383c5 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/WorkBranch/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/WorkBranch/Defs.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.TuringMachine.Combinators +import Std.Tactic.BVDecide.Normalize.Prop /-! # Direct work-symbol branch combinator -- definitions diff --git a/Complexitylib/Models/TuringMachine/Combinators/WorkBranch/Internal.lean b/Complexitylib/Models/TuringMachine/Combinators/WorkBranch/Internal.lean index 1c99ba91..f0964647 100644 --- a/Complexitylib/Models/TuringMachine/Combinators/WorkBranch/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Combinators/WorkBranch/Internal.lean @@ -6,11 +6,10 @@ Authors: Samuel Schlesinger module public import Complexitylib.Mathlib.NatBits -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch.Defs public import Complexitylib.Models.TuringMachine.Hoare.Space -public import Complexitylib.Models.TuringMachine.SpaceTime.Internal.Reachability public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Direct work-symbol branch combinator -- proof internals diff --git a/Complexitylib/Models/TuringMachine/Composition/Internal/FirstPhase.lean b/Complexitylib/Models/TuringMachine/Composition/Internal/FirstPhase.lean index 77d7fea1..e4bf2e12 100644 --- a/Complexitylib/Models/TuringMachine/Composition/Internal/FirstPhase.lean +++ b/Complexitylib/Models/TuringMachine/Composition/Internal/FirstPhase.lean @@ -8,6 +8,7 @@ module public import Complexitylib.Models.TuringMachine.Composition.Defs public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic public import Complexitylib.Models.TuringMachine.Placement.Internal +import Std.Tactic.BVDecide.Normalize.Prop /-! # Function composition: first-phase boundary diff --git a/Complexitylib/Models/TuringMachine/Composition/Internal/Tail.lean b/Complexitylib/Models/TuringMachine/Composition/Internal/Tail.lean index 819b1a56..cb0b827f 100644 --- a/Complexitylib/Models/TuringMachine/Composition/Internal/Tail.lean +++ b/Complexitylib/Models/TuringMachine/Composition/Internal/Tail.lean @@ -8,8 +8,6 @@ module public import Complexitylib.Models.TuringMachine.Composition.Defs public import Complexitylib.Models.TuringMachine.Subroutines.CopyWorkOutput public import Complexitylib.Models.TuringMachine.Combinators.RetargetCompute -public import Complexitylib.Models.TuringMachine.Hoare -public import Complexitylib.Models.TuringMachine.Tape.Encoding /-! # Sequential-composition tail pipeline diff --git a/Complexitylib/Models/TuringMachine/Composition/PairWithInput/Internal.lean b/Complexitylib/Models/TuringMachine/Composition/PairWithInput/Internal.lean index b05a6878..763dcddc 100644 --- a/Complexitylib/Models/TuringMachine/Composition/PairWithInput/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Composition/PairWithInput/Internal.lean @@ -7,7 +7,6 @@ module public import Complexitylib.Models.TuringMachine.Composition.Internal.FirstPhase public import Complexitylib.Models.TuringMachine.Composition.PairWithInput.Defs -public import Complexitylib.Models.TuringMachine.Hoare public import Complexitylib.Models.TuringMachine.OutputBounds public import Complexitylib.Models.TuringMachine.Subroutines.Internal public import Complexitylib.Models.TuringMachine.Subroutines.PairEmit diff --git a/Complexitylib/Models/TuringMachine/Deterministic.lean b/Complexitylib/Models/TuringMachine/Deterministic.lean index 89c2b323..ab804004 100644 --- a/Complexitylib/Models/TuringMachine/Deterministic.lean +++ b/Complexitylib/Models/TuringMachine/Deterministic.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine.Internal public import Complexitylib.Models.TuringMachine.SingleTape /-! diff --git a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Arithmetic/Defs.lean b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Arithmetic/Defs.lean index 2f957871..102474dd 100644 --- a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Arithmetic/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Arithmetic/Defs.lean @@ -5,14 +5,8 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Circuits.Encoding.Machine.NatCode.Defs -public import Complexitylib.Circuits.Encoding.Machine.RawGate.Defs public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Defs -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAdd.Defs -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst.Defs -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryMulAdd.Defs public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPolynomial.Defs -public import Complexitylib.Models.TuringMachine.Subroutines.ClearWork.Defs /-! # Arithmetic leaves for proof-carrying binary routines -- definitions diff --git a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Arithmetic/Internal.lean b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Arithmetic/Internal.lean index 39d3c344..9e8b78ed 100644 --- a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Arithmetic/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Arithmetic/Internal.lean @@ -5,15 +5,9 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Circuits.Encoding.Machine.NatCode -public import Complexitylib.Circuits.Encoding.Machine.RawGate public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic.Defs -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAdd -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryMulAdd public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPolynomial -public import Complexitylib.Models.TuringMachine.Subroutines.ClearWork /-! # Arithmetic leaves for proof-carrying binary routines -- proof internals diff --git a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Control/Defs.lean b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Control/Defs.lean index d2990a7d..052cc58a 100644 --- a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Control/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Control/Defs.lean @@ -7,7 +7,6 @@ module public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch.Defs public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Defs -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Defs /-! # Proof-carrying binary routine control -- definitions diff --git a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Control/Internal.lean b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Control/Internal.lean index b8d6ad72..4798f085 100644 --- a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Control/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Control/Internal.lean @@ -8,10 +8,7 @@ module public import Complexitylib.Models.TuringMachine.Combinators.WorkBranch public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control.Defs -public import Complexitylib.Models.TuringMachine.Hoare.Space -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Internal.Control -public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc +import Std.Tactic.BVDecide.Normalize.Prop /-! # Proof-carrying binary routine control -- proof internals diff --git a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Defs.lean b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Defs.lean index bb32af1e..29378e4e 100644 --- a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Defs.lean @@ -6,11 +6,8 @@ Authors: Samuel Schlesinger module public import Complexitylib.Circuits.Encoding.Machine.GateStream.Defs -public import Complexitylib.Models.TuringMachine.Hoare.Space.Defs -public import Complexitylib.Models.TuringMachine.Registers.Emit public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy.Defs public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred.Defs -public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs /-! # Proof-carrying binary stream routines -- definitions diff --git a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/InputLength/Internal.lean b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/InputLength/Internal.lean index edf7b9b8..1c881ed2 100644 --- a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/InputLength/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/InputLength/Internal.lean @@ -7,7 +7,6 @@ module public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.InputLength.Defs -public import Complexitylib.Models.TuringMachine.Hoare.Space public import Complexitylib.Models.TuringMachine.Subroutines.BinaryLength /-! diff --git a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Internal.lean b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Internal.lean index a6dc3a91..9c172c81 100644 --- a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/Internal.lean @@ -7,10 +7,8 @@ module public import Complexitylib.Circuits.Encoding.Machine.GateStream public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Defs -public import Complexitylib.Models.TuringMachine.Hoare.Space public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred -public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc /-! # Proof-carrying binary stream routines -- proof internals diff --git a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/List/Internal.lean b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/List/Internal.lean index 978f87e0..d2506686 100644 --- a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/List/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/List/Internal.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Finite composition of proof-carrying binary routines -- proof internals diff --git a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/SpaceBounds/Defs.lean b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/SpaceBounds/Defs.lean index 5777da72..3cd23702 100644 --- a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/SpaceBounds/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/SpaceBounds/Defs.lean @@ -7,7 +7,6 @@ module public import Complexitylib.Asymptotics public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control.Defs -public import Mathlib.Data.Nat.Pairing /-! # Compositional width bounds for binary routines -- definitions diff --git a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/SpaceBounds/Internal.lean b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/SpaceBounds/Internal.lean index 37a30128..c3ac1cf7 100644 --- a/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/SpaceBounds/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Experimental/BinaryRoutine/SpaceBounds/Internal.lean @@ -8,7 +8,6 @@ module public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.SpaceBounds.Defs public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Arithmetic public import Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.List -public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc /-! # Compositional width bounds for binary routines -- proof internals diff --git a/Complexitylib/Models/TuringMachine/Hoare/Defs.lean b/Complexitylib/Models/TuringMachine/Hoare/Defs.lean index 17cb5c3b..0fb15f1e 100644 --- a/Complexitylib/Models/TuringMachine/Hoare/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Hoare/Defs.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine public import Complexitylib.Models.TuringMachine.Internal /-! diff --git a/Complexitylib/Models/TuringMachine/Internal.lean b/Complexitylib/Models/TuringMachine/Internal.lean index 9f19a446..b9f6a801 100644 --- a/Complexitylib/Models/TuringMachine/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Internal.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Models.TuringMachine public import Mathlib.Data.Finset.Lattice.Fold +import Std.Tactic.BVDecide.Normalize.Prop /-! # TM–NTM embedding: proof internals diff --git a/Complexitylib/Models/TuringMachine/Lift.lean b/Complexitylib/Models/TuringMachine/Lift.lean index 4819f4a6..c912dce2 100644 --- a/Complexitylib/Models/TuringMachine/Lift.lean +++ b/Complexitylib/Models/TuringMachine/Lift.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.TuringMachine.Combinators +import Std.Tactic.BVDecide.Normalize.Prop /-! # Tape-layout combinators: extra work tapes and output retargeting diff --git a/Complexitylib/Models/TuringMachine/Placement/Defs.lean b/Complexitylib/Models/TuringMachine/Placement/Defs.lean index 33e313b2..7b62d16e 100644 --- a/Complexitylib/Models/TuringMachine/Placement/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Placement/Defs.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.TuringMachine.Combinators +import Std.Tactic.BVDecide.Normalize.Prop /-! # Work-tape placement diff --git a/Complexitylib/Models/TuringMachine/Registers/DecReg.lean b/Complexitylib/Models/TuringMachine/Registers/DecReg.lean index d577d203..89326247 100644 --- a/Complexitylib/Models/TuringMachine/Registers/DecReg.lean +++ b/Complexitylib/Models/TuringMachine/Registers/DecReg.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.TuringMachine.Registers.MixedRadix +import Std.Tactic.BVDecide.Normalize.Prop /-! # decRegTM: decrement a register diff --git a/Complexitylib/Models/TuringMachine/Registers/Emit.lean b/Complexitylib/Models/TuringMachine/Registers/Emit.lean index c0f12a59..2344cb2c 100644 --- a/Complexitylib/Models/TuringMachine/Registers/Emit.lean +++ b/Complexitylib/Models/TuringMachine/Registers/Emit.lean @@ -8,6 +8,7 @@ module public import Complexitylib.Models.TuringMachine.Subroutines public import Complexitylib.Models.TuringMachine.Registers public import Complexitylib.Models.TuringMachine.Hoare +import Std.Tactic.BVDecide.Normalize.Prop /-! # Output-emission subroutines diff --git a/Complexitylib/Models/TuringMachine/Registers/ForReg.lean b/Complexitylib/Models/TuringMachine/Registers/ForReg.lean index 83698b52..6d4d9b8a 100644 --- a/Complexitylib/Models/TuringMachine/Registers/ForReg.lean +++ b/Complexitylib/Models/TuringMachine/Registers/ForReg.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.TuringMachine.Registers.RegisterOps +import Std.Tactic.BVDecide.Normalize.Prop /-! # forRegTM: the register-fueled loop combinator diff --git a/Complexitylib/Models/TuringMachine/Registers/Horner.lean b/Complexitylib/Models/TuringMachine/Registers/Horner.lean index d0fbacfe..3018aa8b 100644 --- a/Complexitylib/Models/TuringMachine/Registers/Horner.lean +++ b/Complexitylib/Models/TuringMachine/Registers/Horner.lean @@ -6,8 +6,8 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.TuringMachine.Registers.EmitSeq -public import Mathlib.Algebra.Polynomial.Eval.Defs public import Mathlib.Algebra.Polynomial.Eval.Degree +import Std.Tactic.BVDecide.Normalize.Prop /-! # Horner layers: polynomial register evaluation diff --git a/Complexitylib/Models/TuringMachine/Registers/Probe.lean b/Complexitylib/Models/TuringMachine/Registers/Probe.lean index 526969f3..21aed585 100644 --- a/Complexitylib/Models/TuringMachine/Registers/Probe.lean +++ b/Complexitylib/Models/TuringMachine/Registers/Probe.lean @@ -7,6 +7,7 @@ module public import Mathlib.Tactic.FinCases public import Complexitylib.Models.TuringMachine.Registers.MixedRadix +import Std.Tactic.BVDecide.Normalize.Prop /-! # symProbeTM: read the input symbol at a register-indexed position diff --git a/Complexitylib/Models/TuringMachine/Registers/RegisterOps.lean b/Complexitylib/Models/TuringMachine/Registers/RegisterOps.lean index 69b41387..40c270b1 100644 --- a/Complexitylib/Models/TuringMachine/Registers/RegisterOps.lean +++ b/Complexitylib/Models/TuringMachine/Registers/RegisterOps.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.TuringMachine.Registers.Emit +import Std.Tactic.BVDecide.Normalize.Prop /-! # Register operations diff --git a/Complexitylib/Models/TuringMachine/Repetition/Correctness.lean b/Complexitylib/Models/TuringMachine/Repetition/Correctness.lean index 5e330cc0..8315c430 100644 --- a/Complexitylib/Models/TuringMachine/Repetition/Correctness.lean +++ b/Complexitylib/Models/TuringMachine/Repetition/Correctness.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Classes.EventProb public import Complexitylib.Models.TuringMachine.Repetition.Internal.Correctness +import Std.Tactic.BVDecide.Normalize.Prop /-! # Correctness and amplification for fixed-time repetition diff --git a/Complexitylib/Models/TuringMachine/Repetition/Defs.lean b/Complexitylib/Models/TuringMachine/Repetition/Defs.lean index 762c6945..55013289 100644 --- a/Complexitylib/Models/TuringMachine/Repetition/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Repetition/Defs.lean @@ -7,7 +7,7 @@ module public import Complexitylib.Classes.FiniteCounting public import Complexitylib.Models.TuringMachine.Combinators -public import Mathlib.Logic.Equiv.Fin.Basic +import Std.Tactic.BVDecide.Normalize.Prop /-! # Fixed-time repetition of probabilistic Turing machines diff --git a/Complexitylib/Models/TuringMachine/Repetition/Internal.lean b/Complexitylib/Models/TuringMachine/Repetition/Internal.lean index c048f7aa..3a3fd6fa 100644 --- a/Complexitylib/Models/TuringMachine/Repetition/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Repetition/Internal.lean @@ -8,6 +8,7 @@ module public import Complexitylib.Models.TuringMachine.Repetition.Defs public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic public import Complexitylib.Models.TuringMachine.Trace +import Std.Tactic.BVDecide.Normalize.BitVec /-! # Correctness internals for fixed-time repetition diff --git a/Complexitylib/Models/TuringMachine/Repetition/Internal/Finish.lean b/Complexitylib/Models/TuringMachine/Repetition/Internal/Finish.lean index 1576c6c5..e87a829c 100644 --- a/Complexitylib/Models/TuringMachine/Repetition/Internal/Finish.lean +++ b/Complexitylib/Models/TuringMachine/Repetition/Internal/Finish.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.TuringMachine.Repetition.Internal +import Std.Tactic.BVDecide.Normalize.BitVec /-! # Setup and finish phases for fixed-time repetition diff --git a/Complexitylib/Models/TuringMachine/Repetition/Internal/Schedule.lean b/Complexitylib/Models/TuringMachine/Repetition/Internal/Schedule.lean index c599bb0a..e076a5db 100644 --- a/Complexitylib/Models/TuringMachine/Repetition/Internal/Schedule.lean +++ b/Complexitylib/Models/TuringMachine/Repetition/Internal/Schedule.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine.Repetition.Defs public import Complexitylib.Models.TuringMachine.Repetition.Internal.Parked public import Complexitylib.Models.TuringMachine.Repetition.Internal.ScheduleArithmetic public import Complexitylib.Models.TuringMachine.Repetition.Internal.VoteStep diff --git a/Complexitylib/Models/TuringMachine/Repetition/Internal/Setup.lean b/Complexitylib/Models/TuringMachine/Repetition/Internal/Setup.lean index 51afeb31..bb0a28a8 100644 --- a/Complexitylib/Models/TuringMachine/Repetition/Internal/Setup.lean +++ b/Complexitylib/Models/TuringMachine/Repetition/Internal/Setup.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Models.TuringMachine.Repetition.Internal.Schedule public import Complexitylib.Models.TuringMachine.Repetition.Internal.Trial +import Std.Tactic.BVDecide.Normalize.BitVec /-! # Setup boundary for fixed-time repetition diff --git a/Complexitylib/Models/TuringMachine/Repetition/Internal/VoteStep.lean b/Complexitylib/Models/TuringMachine/Repetition/Internal/VoteStep.lean index ac2af90d..536349d4 100644 --- a/Complexitylib/Models/TuringMachine/Repetition/Internal/VoteStep.lean +++ b/Complexitylib/Models/TuringMachine/Repetition/Internal/VoteStep.lean @@ -8,6 +8,8 @@ module public import Complexitylib.Models.TuringMachine.Repetition.Internal.Finish public import Complexitylib.Models.TuringMachine.Repetition.Internal.Frame public import Complexitylib.Models.TuringMachine.Repetition.Internal.Votes +import Std.Tactic.BVDecide.Normalize.BitVec +import Std.Tactic.BVDecide.Normalize.Prop /-! # Finish-step vote semantics for fixed-time repetition diff --git a/Complexitylib/Models/TuringMachine/Repetition/Internal/Votes.lean b/Complexitylib/Models/TuringMachine/Repetition/Internal/Votes.lean index 2002116e..8d6b9cbb 100644 --- a/Complexitylib/Models/TuringMachine/Repetition/Internal/Votes.lean +++ b/Complexitylib/Models/TuringMachine/Repetition/Internal/Votes.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.TuringMachine.Repetition.Internal +import Std.Tactic.BVDecide.Normalize.Prop /-! # Vote bookkeeping for fixed-time repetition diff --git a/Complexitylib/Models/TuringMachine/SingleTape.lean b/Complexitylib/Models/TuringMachine/SingleTape.lean index 798b385d..a8de7237 100644 --- a/Complexitylib/Models/TuringMachine/SingleTape.lean +++ b/Complexitylib/Models/TuringMachine/SingleTape.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine public import Complexitylib.Models.TuringMachine.SingleTape.Internal.Pad public import Complexitylib.Models.TuringMachine.SingleTape.Internal public import Complexitylib.Models.TuringMachine.SingleTape.Internal.Sim diff --git a/Complexitylib/Models/TuringMachine/SingleTape/Internal/Correctness.lean b/Complexitylib/Models/TuringMachine/SingleTape/Internal/Correctness.lean index 0d1df3a4..2f9c7bbb 100644 --- a/Complexitylib/Models/TuringMachine/SingleTape/Internal/Correctness.lean +++ b/Complexitylib/Models/TuringMachine/SingleTape/Internal/Correctness.lean @@ -8,6 +8,8 @@ module public import Complexitylib.Models.TuringMachine.SingleTape.Internal.Delta public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic public import Complexitylib.Models.TuringMachine.Internal +import Std.Tactic.BVDecide.Normalize.BitVec +import Std.Tactic.BVDecide.Normalize.Prop /-! # Single-tape simulation — correctness internals diff --git a/Complexitylib/Models/TuringMachine/SingleTape/Internal/Sim.lean b/Complexitylib/Models/TuringMachine/SingleTape/Internal/Sim.lean index 69ae97be..29772d09 100644 --- a/Complexitylib/Models/TuringMachine/SingleTape/Internal/Sim.lean +++ b/Complexitylib/Models/TuringMachine/SingleTape/Internal/Sim.lean @@ -6,8 +6,6 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.TuringMachine.SingleTape.Internal -public import Mathlib.Data.Fintype.Prod -public import Mathlib.Data.Fintype.Sum public import Mathlib.Data.Finite.Prod public import Mathlib.Data.Finite.Sum diff --git a/Complexitylib/Models/TuringMachine/SpaceTime/Internal/Observation.lean b/Complexitylib/Models/TuringMachine/SpaceTime/Internal/Observation.lean index aa878237..5f29f090 100644 --- a/Complexitylib/Models/TuringMachine/SpaceTime/Internal/Observation.lean +++ b/Complexitylib/Models/TuringMachine/SpaceTime/Internal/Observation.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.TuringMachine.SpaceTime.Defs +import Std.Tactic.BVDecide.Normalize.BitVec /-! # Bounded-observation extensionality — proof internals diff --git a/Complexitylib/Models/TuringMachine/SpaceTime/Internal/Snapshot.lean b/Complexitylib/Models/TuringMachine/SpaceTime/Internal/Snapshot.lean index b201a7ba..e6b429c5 100644 --- a/Complexitylib/Models/TuringMachine/SpaceTime/Internal/Snapshot.lean +++ b/Complexitylib/Models/TuringMachine/SpaceTime/Internal/Snapshot.lean @@ -8,6 +8,8 @@ module public import Complexitylib.Models.TuringMachine.SpaceTime.Internal.Observation public import Complexitylib.Models.TuringMachine.SpaceTime.Internal.OutputFrontier public import Complexitylib.Models.TuringMachine.Internal +import Std.Tactic.BVDecide.Normalize.BitVec +import Std.Tactic.BVDecide.Normalize.Prop /-! # Reduced transducer snapshot dynamics — proof internals diff --git a/Complexitylib/Models/TuringMachine/Subroutines.lean b/Complexitylib/Models/TuringMachine/Subroutines.lean index 78633ddd..a41593a9 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.TuringMachine.Combinators +import Std.Tactic.BVDecide.Normalize.Prop /-! # TM Subroutines diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryAdd/Internal.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryAdd/Internal.lean index 34f04a5b..b2ad1de4 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryAdd/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryAdd/Internal.lean @@ -5,10 +5,7 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Seq -public import Complexitylib.Models.TuringMachine.Hoare.Space public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAdd.Defs -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Internal.Control public import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc public import Complexitylib.Models.TuringMachine.Subroutines.ClearWork diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryAddConst/Internal.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryAddConst/Internal.lean index 06372834..6a043d59 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryAddConst/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryAddConst/Internal.lean @@ -5,8 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Seq -public import Complexitylib.Models.TuringMachine.Hoare.Space public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst.Defs public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryCopy/Internal.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryCopy/Internal.lean index c29e6dd5..079e0f1c 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryCopy/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryCopy/Internal.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine.Hoare.Space public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy.Defs public import Complexitylib.Models.TuringMachine.Subroutines.ClearWork diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryEq/Defs.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryEq/Defs.lean index f331e952..d5d2a783 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryEq/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryEq/Defs.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Models.TuringMachine.Subroutines public import Complexitylib.Models.TuringMachine.Tape.Encoding +import Std.Tactic.BVDecide.Normalize.Prop /-! # Binary work-tape equality — definitions diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryEq/Internal.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryEq/Internal.lean index 1179b578..dc30f770 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryEq/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryEq/Internal.lean @@ -7,6 +7,8 @@ module public import Complexitylib.Models.TuringMachine.Subroutines.BinaryEq.Defs public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +import Std.Tactic.BVDecide.Normalize.BitVec +import Std.Tactic.BVDecide.Normalize.Prop /-! # Binary work-tape equality — proof internals diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor/Defs.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor/Defs.lean index ce1cc191..7e2511fd 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor/Defs.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Canonical binary count-up loops — definitions diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor/Internal/Comparison.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor/Internal/Comparison.lean index 7e069302..b6359a4e 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor/Internal/Comparison.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor/Internal/Comparison.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Internal.Control public import Complexitylib.Mathlib.NatBits +import Std.Tactic.BVDecide.Normalize.BitVec /-! # Canonical binary count-up loops — comparison internals diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor/Internal/Loop.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor/Internal/Loop.lean index 3407e8cd..ff810692 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor/Internal/Loop.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryFor/Internal/Loop.lean @@ -5,8 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine.Internal -public import Complexitylib.Models.TuringMachine.SpaceTime.Internal.Reachability public import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Defs public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Internal diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryLength/Internal.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryLength/Internal.lean index a2472703..3272f377 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryLength/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryLength/Internal.lean @@ -7,8 +7,6 @@ module public import Complexitylib.Asymptotics public import Complexitylib.Mathlib.NatBits -public import Complexitylib.Models.TuringMachine.Combinators.ForInput.Internal -public import Complexitylib.Models.TuringMachine.Hoare.Space public import Complexitylib.Models.TuringMachine.Experimental.Routine.Internal public import Complexitylib.Models.TuringMachine.Subroutines.BinaryLength.Defs public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryMulAdd/Internal.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryMulAdd/Internal.lean index 7fc82aef..d7574352 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryMulAdd/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryMulAdd/Internal.lean @@ -5,15 +5,8 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Seq -public import Complexitylib.Models.TuringMachine.Hoare.Space -public import Complexitylib.Models.TuringMachine.SpaceTime.Internal.Reachability public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAdd -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor.Internal.Control -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryFor public import Complexitylib.Models.TuringMachine.Subroutines.BinaryMulAdd.Defs -public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc -public import Complexitylib.Models.TuringMachine.Subroutines.ClearWork /-! # Canonical binary multiply-add — proof internals diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryPolynomial/Defs.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryPolynomial/Defs.lean index 51201801..5443c6c2 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryPolynomial/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryPolynomial/Defs.lean @@ -8,7 +8,6 @@ module public import Mathlib.Algebra.Polynomial.Eval.Degree public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst.Defs public import Complexitylib.Models.TuringMachine.Subroutines.BinaryMulAdd.Defs -public import Complexitylib.Models.TuringMachine.Subroutines.ClearWork.Defs /-! # Canonical binary evaluation of a fixed natural polynomial — definitions diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryPolynomial/Internal.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryPolynomial/Internal.lean index 21720269..0b88b4e6 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryPolynomial/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryPolynomial/Internal.lean @@ -6,11 +6,10 @@ Authors: Samuel Schlesinger module public import Complexitylib.Asymptotics -public import Complexitylib.Models.TuringMachine.Hoare.Space public import Complexitylib.Models.TuringMachine.Subroutines.BinaryAddConst public import Complexitylib.Models.TuringMachine.Subroutines.BinaryMulAdd public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPolynomial.Defs -public import Complexitylib.Models.TuringMachine.Subroutines.ClearWork +import Std.Tactic.BVDecide.Normalize.Prop /-! # Canonical binary evaluation of a fixed natural polynomial — proof internals diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryPred/Defs.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryPred/Defs.lean index 71f42202..d2d2ce86 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryPred/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryPred/Defs.lean @@ -5,9 +5,8 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine.Combinators public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs -public import Mathlib.Data.Nat.Size +import Std.Tactic.BVDecide.Normalize.Prop /-! # Little-endian binary predecessor — definitions diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryPred/Internal.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryPred/Internal.lean index facd7e8f..8b6b769d 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryPred/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryPred/Internal.lean @@ -6,9 +6,9 @@ Authors: Samuel Schlesinger module public import Complexitylib.Mathlib.NatBits -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic public import Complexitylib.Models.TuringMachine.Hoare.Space public import Complexitylib.Models.TuringMachine.Subroutines.BinaryPred.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Little-endian binary predecessor — proof internals diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Defs.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Defs.lean index 4a4bf559..b3899e08 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Defs.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Models.TuringMachine.Subroutines public import Mathlib.Data.Nat.Size +import Std.Tactic.BVDecide.Normalize.Prop /-! # Linear-time canonical binary addition -- definitions diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Pure.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Pure.lean index f574b960..d3317c84 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Pure.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Pure.lean @@ -6,6 +6,8 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Defs +import Std.Tactic.BVDecide.Normalize.Bool +import Std.Tactic.BVDecide.Normalize.Prop /-! # Linear-time canonical binary addition -- pure proofs diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Scan.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Scan.lean index 44ec8ae7..d293fb60 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Scan.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Scan.lean @@ -5,10 +5,10 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Defs public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Internal.Pure public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic public import Complexitylib.Models.TuringMachine.Tape.Encoding +import Std.Tactic.BVDecide.Normalize.Prop /-! # Linear-time canonical binary addition -- scan proof diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Sem.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Sem.lean index b887e8a3..10e5e668 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Sem.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleAdd/Internal/Sem.lean @@ -5,12 +5,11 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine.Hoare.Space public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Internal.Bounds -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Internal.Pure public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Internal.Rewind public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Internal.Scan public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc +import Std.Tactic.BVDecide.Normalize.Prop /-! # Linear-time canonical binary addition -- composed semantics diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Defs.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Defs.lean index ca6e2e52..cc9ce708 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Defs.lean @@ -8,6 +8,7 @@ module public import Complexitylib.Models.TuringMachine.Subroutines public import Complexitylib.Models.TuringMachine.Tape.Encoding public import Mathlib.Data.Nat.Size +import Std.Tactic.BVDecide.Normalize.Prop /-! # Linear-time canonical binary subtraction -- definitions diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Backward.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Backward.lean index 42620bfe..3b38cef8 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Backward.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Backward.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Internal.Pure +import Std.Tactic.BVDecide.Normalize.Prop /-! # Linear-time canonical binary subtraction -- backward cleanup diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Pure.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Pure.lean index 7eac5e03..46c9fbd7 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Pure.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Pure.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Mathlib.NatBits public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Defs +import Std.Tactic.BVDecide.Normalize.Bool /-! # Linear-time canonical binary subtraction -- pure proofs diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Scan.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Scan.lean index 529d9b2a..d183edec 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Scan.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Scan.lean @@ -5,9 +5,9 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Defs public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Internal.Pure public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +import Std.Tactic.BVDecide.Normalize.Prop /-! # Linear-time canonical binary subtraction -- forward scan proof diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Sem.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Sem.lean index 3e6c5dd1..67502088 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Sem.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryRippleSub/Internal/Sem.lean @@ -5,11 +5,11 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine.Hoare.Space public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Internal.Backward public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Internal.Rewind public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Internal.Scan public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc +import Std.Tactic.BVDecide.Normalize.Prop /-! # Linear-time canonical binary subtraction -- composed semantics diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryShiftMul/Internal/Out.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryShiftMul/Internal/Out.lean index ce386ca2..dd34da01 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryShiftMul/Internal/Out.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryShiftMul/Internal/Out.lean @@ -8,7 +8,6 @@ module public import Complexitylib.Models.TuringMachine.Combinators.ForBinaryWork public import Complexitylib.Models.TuringMachine.Combinators.WorkSymbolBranch public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd public import Complexitylib.Models.TuringMachine.Subroutines.BinaryShiftMul.Defs public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinaryShiftMul/Internal/Sem.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinaryShiftMul/Internal/Sem.lean index 39efaa1c..14afcc75 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinaryShiftMul/Internal/Sem.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinaryShiftMul/Internal/Sem.lean @@ -8,9 +8,9 @@ module public import Complexitylib.Models.TuringMachine.Combinators.ForBinaryWork public import Complexitylib.Models.TuringMachine.Combinators.WorkSymbolBranch public import Complexitylib.Models.TuringMachine.Subroutines.BinaryCopy -public import Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd public import Complexitylib.Models.TuringMachine.Subroutines.BinaryShiftMul.Internal.Pure public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany +import Std.Tactic.BVDecide.Normalize.Prop /-! # Width-driven binary shift-and-add multiplication -- composed semantics diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinarySucc/Defs.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinarySucc/Defs.lean index e3f09fa6..a55300ab 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinarySucc/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinarySucc/Defs.lean @@ -8,6 +8,7 @@ module public import Complexitylib.Models.TuringMachine.Combinators public import Complexitylib.Models.TuringMachine.Tape.Encoding public import Mathlib.Data.Nat.Size +import Std.Tactic.BVDecide.Normalize.Prop /-! # Little-endian binary successor — definitions diff --git a/Complexitylib/Models/TuringMachine/Subroutines/BinarySucc/Internal.lean b/Complexitylib/Models/TuringMachine/Subroutines/BinarySucc/Internal.lean index ceacd9a6..8d2d0e9d 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/BinarySucc/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/BinarySucc/Internal.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic public import Complexitylib.Models.TuringMachine.Hoare.Space public import Complexitylib.Models.TuringMachine.Subroutines.BinarySucc.Defs diff --git a/Complexitylib/Models/TuringMachine/Subroutines/CopyOutput.lean b/Complexitylib/Models/TuringMachine/Subroutines/CopyOutput.lean index d7b19089..44d40dd7 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/CopyOutput.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/CopyOutput.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine.Subroutines public import Complexitylib.Models.TuringMachine.Subroutines.Internal.CopyOutput /-! diff --git a/Complexitylib/Models/TuringMachine/Subroutines/Counter.lean b/Complexitylib/Models/TuringMachine/Subroutines/Counter.lean index a4f87970..c43b2bf5 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/Counter.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/Counter.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic public import Complexitylib.Models.TuringMachine.Hoare.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Counter-building TM subroutines diff --git a/Complexitylib/Models/TuringMachine/Subroutines/GuessBounded.lean b/Complexitylib/Models/TuringMachine/Subroutines/GuessBounded.lean index f532083e..96b8ac3b 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/GuessBounded.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/GuessBounded.lean @@ -8,6 +8,8 @@ module public import Complexitylib.Models.TuringMachine.Subroutines.Counter public import Complexitylib.Models.TuringMachine.Tape.Encoding public import Complexitylib.Models.TuringMachine.Trace +import Std.Tactic.BVDecide.Normalize.BitVec +import Std.Tactic.BVDecide.Normalize.Prop /-! # Nondeterministic TM subroutines diff --git a/Complexitylib/Models/TuringMachine/Subroutines/Internal.lean b/Complexitylib/Models/TuringMachine/Subroutines/Internal.lean index 61a332f3..c621fa48 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/Internal.lean @@ -8,8 +8,7 @@ module public import Complexitylib.Models.TuringMachine.Subroutines public import Complexitylib.Models.TuringMachine.Tape.Encoding public import Complexitylib.Models.TuringMachine.Hoare -public import Complexitylib.Models.TuringMachine.Hoare.Defs -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +import Std.Tactic.BVDecide.Normalize.Prop /-! # TM Subroutines: proof internals diff --git a/Complexitylib/Models/TuringMachine/Subroutines/Internal/CopyWorkOutput.lean b/Complexitylib/Models/TuringMachine/Subroutines/Internal/CopyWorkOutput.lean index 651f93a8..a0044549 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/Internal/CopyWorkOutput.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/Internal/CopyWorkOutput.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.TuringMachine.Subroutines.Internal +import Std.Tactic.BVDecide.Normalize.Prop /-! # Copy a raw work-tape output — proof internals diff --git a/Complexitylib/Models/TuringMachine/Subroutines/PairEmit/Defs.lean b/Complexitylib/Models/TuringMachine/Subroutines/PairEmit/Defs.lean index fb6e4a59..c9b78168 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/PairEmit/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/PairEmit/Defs.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.TuringMachine.Combinators +import Std.Tactic.BVDecide.Normalize.Prop /-! # Pair emission from the input and a work tape diff --git a/Complexitylib/Models/TuringMachine/Subroutines/PairSplit/Defs.lean b/Complexitylib/Models/TuringMachine/Subroutines/PairSplit/Defs.lean index 772dfa1b..ef2f6996 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/PairSplit/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/PairSplit/Defs.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.TuringMachine.Combinators +import Std.Tactic.BVDecide.Normalize.Prop /-! # Pair-splitting machine — definitions diff --git a/Complexitylib/Models/TuringMachine/Subroutines/PairSplit/Internal.lean b/Complexitylib/Models/TuringMachine/Subroutines/PairSplit/Internal.lean index 8cff0d6f..6571908a 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/PairSplit/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/PairSplit/Internal.lean @@ -10,6 +10,7 @@ public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic public import Complexitylib.Models.TuringMachine.Trace public import Complexitylib.Models.TuringMachine.Subroutines.PairSplit.Defs public import Mathlib.Tactic.Ring +import Std.Tactic.BVDecide.Normalize.Prop /-! # Pair-splitting machine — proof internals diff --git a/Complexitylib/Models/TuringMachine/Subroutines/PairValidate.lean b/Complexitylib/Models/TuringMachine/Subroutines/PairValidate.lean index 50a7f374..b656ca2a 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/PairValidate.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/PairValidate.lean @@ -5,8 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine.Lift -public import Complexitylib.Models.TuringMachine.Hoare public import Complexitylib.Models.TuringMachine.Subroutines.PairValidate.Defs public import Complexitylib.Models.TuringMachine.Subroutines.PairValidate.Internal diff --git a/Complexitylib/Models/TuringMachine/Subroutines/PairValidate/Defs.lean b/Complexitylib/Models/TuringMachine/Subroutines/PairValidate/Defs.lean index d198ba1c..b309c69e 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/PairValidate/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/PairValidate/Defs.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Encoding.Pairing public import Complexitylib.Models.TuringMachine.Combinators +import Std.Tactic.BVDecide.Normalize.Prop /-! # Pair-encoding validator — definitions diff --git a/Complexitylib/Models/TuringMachine/Subroutines/PairValidate/Internal.lean b/Complexitylib/Models/TuringMachine/Subroutines/PairValidate/Internal.lean index 23b98922..0b1e2a84 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/PairValidate/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/PairValidate/Internal.lean @@ -9,6 +9,7 @@ public import Complexitylib.Models.TuringMachine.Combinators.Internal.Scanner public import Complexitylib.Models.TuringMachine.Hoare public import Complexitylib.Models.TuringMachine.Lift public import Complexitylib.Models.TuringMachine.Subroutines.PairValidate.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Pair-encoding validator — proof internals diff --git a/Complexitylib/Models/TuringMachine/Subroutines/ResetBinary.lean b/Complexitylib/Models/TuringMachine/Subroutines/ResetBinary.lean index fbe9f35c..19ac094a 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/ResetBinary.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/ResetBinary.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine.Hoare.Space public import Complexitylib.Models.TuringMachine.Subroutines.ClearWork public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary.Defs public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary.Internal diff --git a/Complexitylib/Models/TuringMachine/Subroutines/ResetBinary/Internal.lean b/Complexitylib/Models/TuringMachine/Subroutines/ResetBinary/Internal.lean index db205396..1850c2d0 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/ResetBinary/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/ResetBinary/Internal.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine.Hoare public import Complexitylib.Models.TuringMachine.Registers public import Complexitylib.Models.TuringMachine.Subroutines.Internal public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary.Defs diff --git a/Complexitylib/Models/TuringMachine/Subroutines/ResetBinaryMany.lean b/Complexitylib/Models/TuringMachine/Subroutines/ResetBinaryMany.lean index f939466f..4db6107c 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/ResetBinaryMany.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/ResetBinaryMany.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine.Hoare.Space public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany.Defs public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany.Internal diff --git a/Complexitylib/Models/TuringMachine/Subroutines/ResetBinaryMany/Internal.lean b/Complexitylib/Models/TuringMachine/Subroutines/ResetBinaryMany/Internal.lean index 964612ba..3651a8da 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/ResetBinaryMany/Internal.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/ResetBinaryMany/Internal.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinary public import Complexitylib.Models.TuringMachine.Subroutines.ResetBinaryMany.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Resetting several binary work tapes — proof internals diff --git a/Complexitylib/Models/TuringMachine/Subroutines/ScanRight.lean b/Complexitylib/Models/TuringMachine/Subroutines/ScanRight.lean index 31ce64d1..9636521b 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/ScanRight.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/ScanRight.lean @@ -5,10 +5,7 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine.Hoare.Defs -public import Complexitylib.Models.TuringMachine.Subroutines public import Complexitylib.Models.TuringMachine.Subroutines.Internal.ScanRight -public import Complexitylib.Models.TuringMachine.Tape.Encoding /-! # Frame-preserving right scan diff --git a/Complexitylib/Models/TuringMachine/Subroutines/UnaryLength/Defs.lean b/Complexitylib/Models/TuringMachine/Subroutines/UnaryLength/Defs.lean index 75bfebfd..58ad3ca9 100644 --- a/Complexitylib/Models/TuringMachine/Subroutines/UnaryLength/Defs.lean +++ b/Complexitylib/Models/TuringMachine/Subroutines/UnaryLength/Defs.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.TuringMachine.Combinators +import Std.Tactic.BVDecide.Normalize.Prop /-! # Unary input-length transducer — definitions diff --git a/Complexitylib/Models/TuringMachine/Tape/Encoding.lean b/Complexitylib/Models/TuringMachine/Tape/Encoding.lean index 9a9b1e8e..4886a8de 100644 --- a/Complexitylib/Models/TuringMachine/Tape/Encoding.lean +++ b/Complexitylib/Models/TuringMachine/Tape/Encoding.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.TuringMachine +import Std.Tactic.BVDecide.Normalize.Prop /-! # Binary string encodings on Turing-machine tapes diff --git a/Complexitylib/Models/TuringMachine/Trace.lean b/Complexitylib/Models/TuringMachine/Trace.lean index 097f71ab..72254c0f 100644 --- a/Complexitylib/Models/TuringMachine/Trace.lean +++ b/Complexitylib/Models/TuringMachine/Trace.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine public import Complexitylib.Models.TuringMachine.Trace.Internal /-! diff --git a/Complexitylib/Models/TuringMachine/UTM/Clock.lean b/Complexitylib/Models/TuringMachine/UTM/Clock.lean index 71dc9291..584d1482 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Clock.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Clock.lean @@ -6,9 +6,9 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.TuringMachine.Lift -public import Complexitylib.Models.TuringMachine.Hoare.Defs public import Complexitylib.Models.TuringMachine.Registers public import Complexitylib.Models.TuringMachine.UTM.Internal.VTape +import Std.Tactic.BVDecide.Normalize.Prop /-! # Clock infrastructure for the time-bounded universal machine diff --git a/Complexitylib/Models/TuringMachine/UTM/ClockConstructible.lean b/Complexitylib/Models/TuringMachine/UTM/ClockConstructible.lean index 0715a6ca..a0908ec5 100644 --- a/Complexitylib/Models/TuringMachine/UTM/ClockConstructible.lean +++ b/Complexitylib/Models/TuringMachine/UTM/ClockConstructible.lean @@ -7,6 +7,7 @@ module public import Mathlib.Tactic.Ring public import Complexitylib.Models.TuringMachine.Registers.Arith +import Std.Tactic.BVDecide.Normalize.Prop /-! # Clock constructibility for the time hierarchy theorem diff --git a/Complexitylib/Models/TuringMachine/UTM/ClockedUtm.lean b/Complexitylib/Models/TuringMachine/UTM/ClockedUtm.lean index 5fd55c70..b2f17fcf 100644 --- a/Complexitylib/Models/TuringMachine/UTM/ClockedUtm.lean +++ b/Complexitylib/Models/TuringMachine/UTM/ClockedUtm.lean @@ -8,6 +8,7 @@ module public import Complexitylib.Models.TuringMachine.UTM.Internal.SimClocked public import Complexitylib.Models.TuringMachine.UTM.Internal.SeekFrontier public import Complexitylib.Models.TuringMachine.Subroutines.Internal +import Std.Tactic.BVDecide.Normalize.Prop /-! # The clocked universal machine diff --git a/Complexitylib/Models/TuringMachine/UTM/Diagonal.lean b/Complexitylib/Models/TuringMachine/UTM/Diagonal.lean index 8ba255ae..19bf2a66 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Diagonal.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Diagonal.lean @@ -12,6 +12,7 @@ public import Complexitylib.Models.TuringMachine.UTM.Internal.NegOut public import Complexitylib.Models.TuringMachine.UTM.HierarchySupport public import Complexitylib.Models.TuringMachine.UTM.ClockConstructible public import Complexitylib.Models.TuringMachine.Combinators.Internal.Retarget +import Std.Tactic.BVDecide.Normalize.Prop /-! # The time-hierarchy diagonalizer `diagTM` diff --git a/Complexitylib/Models/TuringMachine/UTM/Encoding.lean b/Complexitylib/Models/TuringMachine/UTM/Encoding.lean index 15ae608d..c5323d74 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Encoding.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Encoding.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Models.TuringMachine public import Complexitylib.Mathlib.NatBits +import Std.Tactic.BVDecide.Normalize.Prop /-! # TM State Normalization and Binary Encoding diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/Body.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/Body.lean index 2d02d220..217a945b 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/Body.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/Body.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine public import Complexitylib.Models.TuringMachine.Combinators public import Complexitylib.Models.TuringMachine.UTM.Internal.Desc public import Complexitylib.Models.TuringMachine.UTM.Internal.VTape @@ -14,7 +13,6 @@ public import Mathlib.Tactic.FinCases public import Mathlib.Data.Fintype.Sigma public import Mathlib.Data.Fintype.Prod public import Mathlib.Data.Fintype.Option -public import Mathlib.Data.Fintype.Sum /-! # The universal machine's loop body diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/BodyApply.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/BodyApply.lean index 38f019c4..82cb10b9 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/BodyApply.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/BodyApply.lean @@ -6,7 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.TuringMachine.UTM.Internal.BodyInternal -public import Complexitylib.Models.TuringMachine.UTM.Internal.VTape +import Std.Tactic.BVDecide.Normalize.Prop /-! # Body machine: peek, default-move, and apply phases diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/BodyLookup.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/BodyLookup.lean index 8ea8890e..b389fa1b 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/BodyLookup.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/BodyLookup.lean @@ -7,6 +7,8 @@ module public import Complexitylib.Models.TuringMachine.UTM.Internal.Verdict public import Complexitylib.Models.TuringMachine.UTM.Internal.BodyApply +import Std.Tactic.BVDecide.Normalize.BitVec +import Std.Tactic.BVDecide.Normalize.Prop /-! # Match-loop ↔ lookup correspondence (pure list level) diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/BodyLoop.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/BodyLoop.lean index 7ce23013..ff5c3c22 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/BodyLoop.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/BodyLoop.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Models.TuringMachine.UTM.Internal.BodyAssembly public import Complexitylib.Models.TuringMachine.UTM.Internal.BodyLookup +import Std.Tactic.BVDecide.Normalize.Prop /-! # Body machine: the match-loop induction diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/ClockFrontier.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/ClockFrontier.lean index 3e4e0b39..43a03f8d 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/ClockFrontier.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/ClockFrontier.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.TuringMachine.UTM.Clock +import Std.Tactic.BVDecide.Normalize.Prop /-! # Frontier-parked clock machines for the time-bounded universal machine diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/Desc.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/Desc.lean index f66cb419..b6400229 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/Desc.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/Desc.lean @@ -5,8 +5,8 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine public import Complexitylib.Models.TuringMachine.UTM.Encoding +import Std.Tactic.BVDecide.Normalize.Prop /-! # Machine descriptions for the universal Turing machine diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/DescLayout.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/DescLayout.lean index efe6dae1..f608e966 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/DescLayout.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/DescLayout.lean @@ -5,9 +5,8 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine.UTM.Internal.VTape -public import Complexitylib.Models.TuringMachine.UTM.Internal.Desc public import Complexitylib.Models.TuringMachine.UTM.Internal.HaltTest +import Std.Tactic.BVDecide.Normalize.Prop /-! # Description-tape layout diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/Extract.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/Extract.lean index 1aa28beb..39c3257b 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/Extract.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/Extract.lean @@ -8,6 +8,7 @@ module public import Complexitylib.Models.TuringMachine.Hoare.Defs public import Complexitylib.Models.TuringMachine.UTM.Internal.VTape public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +import Std.Tactic.BVDecide.Normalize.Prop /-! # UTM extraction phase: `extractTM` diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/HaltTest.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/HaltTest.lean index 66b4886d..e10efa13 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/HaltTest.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/HaltTest.lean @@ -9,6 +9,7 @@ public import Complexitylib.Models.TuringMachine.Hoare.Defs public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic public import Complexitylib.Models.TuringMachine.UTM.Internal.VTape public import Complexitylib.Models.TuringMachine.UTM.Internal.Desc +import Std.Tactic.BVDecide.Normalize.Prop /-! # The UTM halt test machine diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/Init.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/Init.lean index 8e2e8fc7..d25dd071 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/Init.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/Init.lean @@ -10,6 +10,7 @@ public import Complexitylib.Models.TuringMachine.UTM.Internal.VTape public import Complexitylib.Models.TuringMachine.Hoare.Defs public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic public import Complexitylib.Encoding.Pairing +import Std.Tactic.BVDecide.Normalize.Prop /-! # UTM initialization machine diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/Interp.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/Interp.lean index f49b8132..4a756899 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/Interp.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/Interp.lean @@ -6,7 +6,6 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.TuringMachine.UTM.Internal.Desc -public import Complexitylib.Models.TuringMachine.UTM.Encoding /-! # Interpreting machine descriptions diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/NegOut.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/NegOut.lean index cf3b9e0a..39a5f6fe 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/NegOut.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/NegOut.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Models.TuringMachine.Hoare.Defs public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic +import Std.Tactic.BVDecide.Normalize.Prop /-! # Output negation phase: `negOutTM` diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/SeekFrontier.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/SeekFrontier.lean index ab2576b6..8ee729f2 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/SeekFrontier.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/SeekFrontier.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.TuringMachine.UTM.Clock +import Std.Tactic.BVDecide.Normalize.Prop /-! # Frontier-seeking clock machine for the time-bounded universal machine diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/Sim.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/Sim.lean index e96a7e3c..c7cd4237 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/Sim.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/Sim.lean @@ -7,7 +7,7 @@ module public import Complexitylib.Models.TuringMachine.UTM.Machine public import Complexitylib.Models.TuringMachine.UTM.Internal.BodyAssembly -public import Complexitylib.Models.TuringMachine.UTM.Internal.Init +import Std.Tactic.BVDecide.Normalize.Prop /-! # Universal machine: simulation bridges diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/SimClocked.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/SimClocked.lean index 3c5a13cc..69ee9aa5 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/SimClocked.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/SimClocked.lean @@ -7,6 +7,7 @@ module public import Complexitylib.Models.TuringMachine.UTM.Internal.SimLoop public import Complexitylib.Models.TuringMachine.UTM.Internal.ClockFrontier +import Std.Tactic.BVDecide.Normalize.Prop /-! # Universal machine: the clocked (time-bounded) simulate/halt-test loop diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/SimLoop.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/SimLoop.lean index 86e6013b..d1da4da1 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/SimLoop.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/SimLoop.lean @@ -7,8 +7,8 @@ module public import Complexitylib.Models.TuringMachine.UTM.Internal.BodyIteration public import Complexitylib.Models.TuringMachine.UTM.Internal.Sim -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Loop public import Complexitylib.Models.TuringMachine.Hoare +import Std.Tactic.BVDecide.Normalize.Prop /-! # Universal machine: the simulate/halt-test loop diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/TermCheck.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/TermCheck.lean index 07218643..350544bb 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/TermCheck.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/TermCheck.lean @@ -7,6 +7,8 @@ module public import Complexitylib.Models.TuringMachine.UTM.Internal.BodyIteration public import Complexitylib.Models.TuringMachine.Registers +import Std.Tactic.BVDecide.Normalize.BitVec +import Std.Tactic.BVDecide.Normalize.Prop /-! # `termCheckTM`: deciding `TerminatedRegion` by a single input scan diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/Terminated.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/Terminated.lean index fe412bb5..a0baf306 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/Terminated.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/Terminated.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.TuringMachine.UTM.Internal.BodyIteration +import Std.Tactic.BVDecide.Normalize.Prop /-! # `TerminatedRegion` for encoded descriptions diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/VTape.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/VTape.lean index 095f0e1c..b7de9d69 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/VTape.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/VTape.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.TuringMachine +import Std.Tactic.BVDecide.Normalize.Prop /-! # Virtual tapes: the +1 shift representation diff --git a/Complexitylib/Models/TuringMachine/UTM/Internal/Verdict.lean b/Complexitylib/Models/TuringMachine/UTM/Internal/Verdict.lean index ba3a831d..78b6e3a1 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Internal/Verdict.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Internal/Verdict.lean @@ -6,8 +6,8 @@ Authors: Samuel Schlesinger module public import Complexitylib.Models.TuringMachine.UTM.Internal.Interp -public import Complexitylib.Mathlib.NatBits public import Complexitylib.Models.TuringMachine.UTM.Internal.HaltTest +import Std.Tactic.BVDecide.Normalize.Prop /-! # Halt-test verdict correspondence diff --git a/Complexitylib/Models/TuringMachine/UTM/Machine.lean b/Complexitylib/Models/TuringMachine/UTM/Machine.lean index 1ba7c394..284440b6 100644 --- a/Complexitylib/Models/TuringMachine/UTM/Machine.lean +++ b/Complexitylib/Models/TuringMachine/UTM/Machine.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine.Combinators public import Complexitylib.Models.TuringMachine.UTM.Internal.Init public import Complexitylib.Models.TuringMachine.UTM.Internal.Body public import Complexitylib.Models.TuringMachine.UTM.Internal.HaltTest diff --git a/Complexitylib/SAT/CookLevin.lean b/Complexitylib/SAT/CookLevin.lean index f96f7821..80a3478b 100644 --- a/Complexitylib/SAT/CookLevin.lean +++ b/Complexitylib/SAT/CookLevin.lean @@ -9,6 +9,8 @@ public import Complexitylib.SAT.Headline public import Complexitylib.SAT.Rename public import Complexitylib.Classes.NP.Reduction public import Complexitylib.Models.TuringMachine.SingleTape +import Std.Tactic.BVDecide.Normalize.BitVec +import Std.Tactic.BVDecide.Normalize.Prop /-! # Cook–Levin tableau core diff --git a/Complexitylib/SAT/CookLevin/Internal/Emitter.lean b/Complexitylib/SAT/CookLevin/Internal/Emitter.lean index c47f87de..450152ac 100644 --- a/Complexitylib/SAT/CookLevin/Internal/Emitter.lean +++ b/Complexitylib/SAT/CookLevin/Internal/Emitter.lean @@ -6,7 +6,6 @@ Authors: Samuel Schlesinger module public import Complexitylib.SAT.CookLevin -public import Complexitylib.Models.TuringMachine.Registers.MixedRadix public import Complexitylib.Models.TuringMachine.Registers.DecReg /-! diff --git a/Complexitylib/SAT/CookLevin/Internal/EmitterFamilies.lean b/Complexitylib/SAT/CookLevin/Internal/EmitterFamilies.lean index 0ba9f0b7..8f53a2ff 100644 --- a/Complexitylib/SAT/CookLevin/Internal/EmitterFamilies.lean +++ b/Complexitylib/SAT/CookLevin/Internal/EmitterFamilies.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.SAT.CookLevin.Internal.EmitterLoop +import Std.Tactic.BVDecide.Normalize.Prop /-! # The clause-family emitters diff --git a/Complexitylib/SAT/CookLevin/Internal/EmitterStart.lean b/Complexitylib/SAT/CookLevin/Internal/EmitterStart.lean index 05c0dee2..11bc21ac 100644 --- a/Complexitylib/SAT/CookLevin/Internal/EmitterStart.lean +++ b/Complexitylib/SAT/CookLevin/Internal/EmitterStart.lean @@ -7,6 +7,7 @@ module public import Complexitylib.SAT.CookLevin.Internal.EmitterFamilies public import Complexitylib.Models.TuringMachine.Registers.Probe +import Std.Tactic.BVDecide.Normalize.Prop /-! # The start-clause family emitter diff --git a/Complexitylib/SAT/Encoding.lean b/Complexitylib/SAT/Encoding.lean index 03ef8f7c..3705adb9 100644 --- a/Complexitylib/SAT/Encoding.lean +++ b/Complexitylib/SAT/Encoding.lean @@ -7,7 +7,7 @@ module public import Complexitylib.SAT.Semantics public import Mathlib.Tactic.Ring -public import Mathlib.Tactic.Linarith +import Std.Tactic.BVDecide.Normalize.Prop /-! # SAT: Encoding Layer diff --git a/Complexitylib/SAT/Internal/GuessVerify.lean b/Complexitylib/SAT/Internal/GuessVerify.lean index 3b7a45a6..14cdd8b6 100644 --- a/Complexitylib/SAT/Internal/GuessVerify.lean +++ b/Complexitylib/SAT/Internal/GuessVerify.lean @@ -6,12 +6,9 @@ Authors: Samuel Schlesinger module public import Complexitylib.SAT.Language -public import Complexitylib.Asymptotics public import Complexitylib.Classes.NP.Internal.PairBuildTM public import Complexitylib.Models.TuringMachine.Subroutines.GuessBounded -public import Complexitylib.Models.TuringMachine.Subroutines.Internal -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Retarget -public import Complexitylib.Models.TuringMachine.Trace +import Std.Tactic.BVDecide.Normalize.Prop /-! # SAT-specialized guess-and-verify NTM diff --git a/Complexitylib/SAT/Language.lean b/Complexitylib/SAT/Language.lean index 81c86d0e..4b69f3af 100644 --- a/Complexitylib/SAT/Language.lean +++ b/Complexitylib/SAT/Language.lean @@ -5,10 +5,7 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.SAT.Semantics public import Complexitylib.SAT.Encoding -public import Complexitylib.Classes.Pairing -public import Complexitylib.Classes.FNP public import Complexitylib.Classes.NP.Witness /-! diff --git a/Complexitylib/SAT/QBF.lean b/Complexitylib/SAT/QBF.lean index 9a444ab8..ef56a35b 100644 --- a/Complexitylib/SAT/QBF.lean +++ b/Complexitylib/SAT/QBF.lean @@ -5,10 +5,8 @@ Authors: Samuel Schlesinger -/ module -public import Mathlib.Data.Nat.Basic -public import Mathlib.Data.Bool.Basic -public import Mathlib.Logic.Function.Basic public import Mathlib.Data.Finset.Basic +import Std.Tactic.BVDecide.Normalize.Bool /-! # Quantified Boolean formulas diff --git a/Complexitylib/SAT/Resolution.lean b/Complexitylib/SAT/Resolution.lean index be7682c0..e108d62b 100644 --- a/Complexitylib/SAT/Resolution.lean +++ b/Complexitylib/SAT/Resolution.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.SAT.Semantics +import Std.Tactic.BVDecide.Normalize.BitVec /-! # Resolution diff --git a/Complexitylib/SAT/Semantics.lean b/Complexitylib/SAT/Semantics.lean index 129d2309..4b7225c3 100644 --- a/Complexitylib/SAT/Semantics.lean +++ b/Complexitylib/SAT/Semantics.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Mathlib.Data.List.Basic public import Mathlib.Data.Fintype.Pi public import Mathlib.Tactic.Linarith diff --git a/Complexitylib/SAT/ThreeCNF.lean b/Complexitylib/SAT/ThreeCNF.lean index 6f978623..d9014d4f 100644 --- a/Complexitylib/SAT/ThreeCNF.lean +++ b/Complexitylib/SAT/ThreeCNF.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.SAT.Rename +import Std.Tactic.BVDecide.Normalize.Prop /-! # 3-CNF formulas diff --git a/Complexitylib/SAT/ThreeSAT.lean b/Complexitylib/SAT/ThreeSAT.lean index 86ceeec8..99cefe74 100644 --- a/Complexitylib/SAT/ThreeSAT.lean +++ b/Complexitylib/SAT/ThreeSAT.lean @@ -7,6 +7,7 @@ module public import Complexitylib.SAT.ThreeCNF public import Complexitylib.SAT.Verifier +import Std.Tactic.BVDecide.Normalize.Bool /-! # Encoded CNF-SAT and 3SAT languages diff --git a/Complexitylib/SAT/ThreeSAT/Completeness.lean b/Complexitylib/SAT/ThreeSAT/Completeness.lean index 087e177c..5a709f72 100644 --- a/Complexitylib/SAT/ThreeSAT/Completeness.lean +++ b/Complexitylib/SAT/ThreeSAT/Completeness.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Classes.NP.Reduction public import Complexitylib.SAT.CookLevin.Assembly public import Complexitylib.SAT.ThreeSAT.Headline public import Complexitylib.SAT.Tseitin.Machine diff --git a/Complexitylib/SAT/ThreeSAT/Syntax.lean b/Complexitylib/SAT/ThreeSAT/Syntax.lean index 17a9e76e..5edce170 100644 --- a/Complexitylib/SAT/ThreeSAT/Syntax.lean +++ b/Complexitylib/SAT/ThreeSAT/Syntax.lean @@ -6,8 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.SAT.ThreeSAT -public import Complexitylib.Classes.P -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Scanner +import Std.Tactic.BVDecide.Normalize.Prop /-! # Regular syntax checker for exact 3-CNF encodings diff --git a/Complexitylib/SAT/ThreeSAT/Verifier.lean b/Complexitylib/SAT/ThreeSAT/Verifier.lean index 97227a83..b0f04344 100644 --- a/Complexitylib/SAT/ThreeSAT/Verifier.lean +++ b/Complexitylib/SAT/ThreeSAT/Verifier.lean @@ -6,8 +6,6 @@ Authors: Samuel Schlesinger module public import Complexitylib.SAT.ThreeSAT.Syntax -public import Complexitylib.Classes.Pairing -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Scanner /-! # Exact-3 syntax on paired verifier inputs diff --git a/Complexitylib/SAT/Tseitin/Internal/Correctness.lean b/Complexitylib/SAT/Tseitin/Internal/Correctness.lean index 1c1d5451..77cd5367 100644 --- a/Complexitylib/SAT/Tseitin/Internal/Correctness.lean +++ b/Complexitylib/SAT/Tseitin/Internal/Correctness.lean @@ -7,6 +7,8 @@ module public import Complexitylib.SAT.Tseitin.Internal.FunctionSemantics public import Complexitylib.SAT.Tseitin.Internal.Shape +import Std.Tactic.BVDecide.Normalize.Bool +import Std.Tactic.BVDecide.Normalize.Prop /-! # Correctness of Tseitin clause splitting diff --git a/Complexitylib/SAT/Tseitin/Internal/EncodingBounds.lean b/Complexitylib/SAT/Tseitin/Internal/EncodingBounds.lean index 3ce2c2f6..171de5fb 100644 --- a/Complexitylib/SAT/Tseitin/Internal/EncodingBounds.lean +++ b/Complexitylib/SAT/Tseitin/Internal/EncodingBounds.lean @@ -7,6 +7,7 @@ module public import Complexitylib.SAT.Encoding public import Complexitylib.SAT.Tseitin.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Encoding-size support for Tseitin splitting diff --git a/Complexitylib/SAT/Tseitin/Internal/FunctionSemantics.lean b/Complexitylib/SAT/Tseitin/Internal/FunctionSemantics.lean index 9a2e2760..31aee0fa 100644 --- a/Complexitylib/SAT/Tseitin/Internal/FunctionSemantics.lean +++ b/Complexitylib/SAT/Tseitin/Internal/FunctionSemantics.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.SAT.Tseitin.Defs +import Std.Tactic.BVDecide.Normalize.Bool /-! # Total-function semantics for Tseitin splitting diff --git a/Complexitylib/SAT/Tseitin/Internal/Shape.lean b/Complexitylib/SAT/Tseitin/Internal/Shape.lean index 58a3d286..e16400f3 100644 --- a/Complexitylib/SAT/Tseitin/Internal/Shape.lean +++ b/Complexitylib/SAT/Tseitin/Internal/Shape.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.SAT.Tseitin.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Structural properties of Tseitin clause splitting diff --git a/Complexitylib/SAT/Tseitin/Internal/StateBounds.lean b/Complexitylib/SAT/Tseitin/Internal/StateBounds.lean index ec2c1826..8aa54d8e 100644 --- a/Complexitylib/SAT/Tseitin/Internal/StateBounds.lean +++ b/Complexitylib/SAT/Tseitin/Internal/StateBounds.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.SAT.Tseitin.Internal.Streaming +import Std.Tactic.BVDecide.Normalize.Prop /-! # Register bounds for the streaming Tseitin transformation diff --git a/Complexitylib/SAT/Tseitin/Machine.lean b/Complexitylib/SAT/Tseitin/Machine.lean index 1857c939..e2e9a737 100644 --- a/Complexitylib/SAT/Tseitin/Machine.lean +++ b/Complexitylib/SAT/Tseitin/Machine.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Classes.P.NormalForm public import Complexitylib.SAT.Tseitin.Machine.Controller public import Complexitylib.SAT.Tseitin.Machine.Internal.PolynomialTime diff --git a/Complexitylib/SAT/Tseitin/Machine/Controller.lean b/Complexitylib/SAT/Tseitin/Machine/Controller.lean index ae1328ed..dfe2e37f 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Controller.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Controller.lean @@ -6,7 +6,6 @@ Authors: Samuel Schlesinger module public import Complexitylib.SAT.Tseitin.Machine.Defs -public import Mathlib.Data.Fintype.Sigma /-! # Streaming controller for the CNF-to-3CNF reduction machine diff --git a/Complexitylib/SAT/Tseitin/Machine/Defs.lean b/Complexitylib/SAT/Tseitin/Machine/Defs.lean index c9cf7335..f29aad85 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Defs.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Defs.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine.Lift public import Complexitylib.Models.TuringMachine.Registers.InputLen public import Complexitylib.SAT.ThreeSAT diff --git a/Complexitylib/SAT/Tseitin/Machine/Internal/BufferSpecs.lean b/Complexitylib/SAT/Tseitin/Machine/Internal/BufferSpecs.lean index 9fe8c371..a18eeb5f 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Internal/BufferSpecs.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Internal/BufferSpecs.lean @@ -7,7 +7,6 @@ module public import Complexitylib.Models.TuringMachine.Experimental.EmitSpec public import Complexitylib.SAT.Tseitin.Machine.Defs -public import Mathlib.Tactic.FinCases /-! # Hoare specifications for Tseitin literal buffers and emitters diff --git a/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerLift.lean b/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerLift.lean index 66da55ed..026c3c13 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerLift.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerLift.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic public import Complexitylib.SAT.Tseitin.Machine.Controller /-! diff --git a/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerRead.lean b/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerRead.lean index f7e95377..6ee213ec 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerRead.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerRead.lean @@ -6,6 +6,8 @@ Authors: Samuel Schlesinger module public import Complexitylib.SAT.Tseitin.Machine.Internal.ControllerLift +import Std.Tactic.BVDecide.Normalize.BitVec +import Std.Tactic.BVDecide.Normalize.Prop /-! # Concrete read paths for the Tseitin streaming controller diff --git a/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerSemantics.lean b/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerSemantics.lean index 9ed8f0c6..e3465d56 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerSemantics.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerSemantics.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.SAT.Tseitin.Machine.Internal.ControllerInvariant public import Complexitylib.SAT.Tseitin.Machine.Internal.RuntimeBounds /-! diff --git a/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerToken.lean b/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerToken.lean index f1a8c4a1..eb71817d 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerToken.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Internal/ControllerToken.lean @@ -8,7 +8,6 @@ module public import Complexitylib.SAT.Tseitin.Machine.Internal.ControllerCalls public import Complexitylib.SAT.Tseitin.Machine.Internal.ControllerRead public import Complexitylib.SAT.Tseitin.Machine.Internal.ControllerSemantics -public import Complexitylib.SAT.Tseitin.Machine.Internal.RuntimeBounds /-! # One-token simulation for the Tseitin streaming controller diff --git a/Complexitylib/SAT/Tseitin/Machine/Internal/PolynomialTime.lean b/Complexitylib/SAT/Tseitin/Machine/Internal/PolynomialTime.lean index 9ee7e6ba..7fd10e6f 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Internal/PolynomialTime.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Internal/PolynomialTime.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Asymptotics public import Complexitylib.SAT.Tseitin public import Complexitylib.SAT.Tseitin.Machine.Internal.EmitterSpec public import Complexitylib.SAT.Tseitin.Machine.Internal.InvalidBranchSpec diff --git a/Complexitylib/SAT/Tseitin/Machine/Internal/RuntimeBounds.lean b/Complexitylib/SAT/Tseitin/Machine/Internal/RuntimeBounds.lean index 2dffd034..dd2b17ae 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Internal/RuntimeBounds.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Internal/RuntimeBounds.lean @@ -8,6 +8,7 @@ module public import Complexitylib.Models.TuringMachine.Registers.Horner public import Complexitylib.SAT.Tseitin.Internal.StateBounds public import Complexitylib.SAT.Tseitin.Machine.Internal.ControllerInvariant +import Std.Tactic.BVDecide.Normalize.Prop /-! # Coarse runtime bounds for the streaming Tseitin controller diff --git a/Complexitylib/SAT/Tseitin/Machine/Internal/Setup.lean b/Complexitylib/SAT/Tseitin/Machine/Internal/Setup.lean index d476647c..8bfe960f 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Internal/Setup.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Internal/Setup.lean @@ -5,7 +5,6 @@ Authors: Samuel Schlesinger -/ module -public import Complexitylib.Models.TuringMachine.Subroutines.Internal public import Complexitylib.SAT.Tseitin.Machine.Defs /-! diff --git a/Complexitylib/SAT/Tseitin/Machine/Internal/Validation.lean b/Complexitylib/SAT/Tseitin/Machine/Internal/Validation.lean index f8240466..b9f1317c 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Internal/Validation.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Internal/Validation.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.SAT.Tseitin.Machine.Defs +import Std.Tactic.BVDecide.Normalize.Prop /-! # Correctness of the pure Tseitin input validator diff --git a/Complexitylib/SAT/Tseitin/Machine/Internal/ValidationFramed.lean b/Complexitylib/SAT/Tseitin/Machine/Internal/ValidationFramed.lean index 55a8f57e..d1860171 100644 --- a/Complexitylib/SAT/Tseitin/Machine/Internal/ValidationFramed.lean +++ b/Complexitylib/SAT/Tseitin/Machine/Internal/ValidationFramed.lean @@ -6,6 +6,7 @@ Authors: Samuel Schlesinger module public import Complexitylib.SAT.Tseitin.Machine.Defs +import Std.Tactic.BVDecide.Normalize.BitVec /-! # Framed execution of the Tseitin syntax validator diff --git a/Complexitylib/SAT/Verifier.lean b/Complexitylib/SAT/Verifier.lean index 40b21940..58fb97e1 100644 --- a/Complexitylib/SAT/Verifier.lean +++ b/Complexitylib/SAT/Verifier.lean @@ -6,6 +6,8 @@ Authors: Samuel Schlesinger module public import Complexitylib.SAT.Language +import Std.Tactic.BVDecide.Normalize.BitVec +import Std.Tactic.BVDecide.Normalize.Prop /-! # SAT verifier specification diff --git a/Complexitylib/SAT/VerifierTM.lean b/Complexitylib/SAT/VerifierTM.lean index b53f6964..72386025 100644 --- a/Complexitylib/SAT/VerifierTM.lean +++ b/Complexitylib/SAT/VerifierTM.lean @@ -7,13 +7,8 @@ module public import Complexitylib.SAT.Verifier public import Complexitylib.Models.TuringMachine.Subroutines.PairSplit -public import Complexitylib.Models.TuringMachine.Subroutines.Counter -public import Complexitylib.Models.TuringMachine.Combinators -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Retarget -public import Complexitylib.Models.TuringMachine.Combinators.Internal.Generic -public import Complexitylib.Models.TuringMachine.Hoare -public import Complexitylib.Models.TuringMachine.Hoare.Defs -public import Complexitylib.Models.TuringMachine.Tape.Encoding +import Std.Tactic.BVDecide.Normalize.BitVec +import Std.Tactic.BVDecide.Normalize.Prop /-! # SAT verifier TMs diff --git a/Complexitylib/TimeConstructible.lean b/Complexitylib/TimeConstructible.lean index 32af8b01..77eee262 100644 --- a/Complexitylib/TimeConstructible.lean +++ b/Complexitylib/TimeConstructible.lean @@ -7,7 +7,6 @@ module public import Complexitylib.Models.TuringMachine public import Complexitylib.Asymptotics -public import Mathlib.Data.Nat.Bits /-! # Time-constructible functions diff --git a/scripts/noshake.json b/scripts/noshake.json new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/scripts/noshake.json @@ -0,0 +1 @@ +{}