sum_cases and pkg_coherence_lite #
Cycle-free home for the exhaustive Sum-case-splitter (sum_cases) and a
lightweight SMC-coherence closer (pkg_coherence_lite) built from it.
This file depends only on Lean core metaprogramming — nothing from
CatCrypt/Core, CatCrypt/Bridge, or CatCrypt/Category. That lets it be
imported by foundational files such as Bridge/SemPkg.lean and
Category/Affine.lean, which sit below PkgCoherence / UCCoherence in
the dependency DAG.
Main contents #
sumCasesCore— recursively case-splitsSum-typed hypotheses, eliminatingEmptybranches viacases.sum_cases— elab wrapper.pkg_coherence_lite—funext _; sum_cases; all_goals rfl.- Variants
funext _ _/funext _ _ _for goals with deeper curry structure.
When to use #
Goals of shape f = g where both sides are handler-like functions built
from Sum-indexed data constructors, and the leaves are definitionally
equal. Typical sites: MonoidalCategoryStruct field definitions
(associator, unitors, braidings, pentagon / hexagon coherence),
TypedHandler.pair/fst/snd laws, Affine-category coherence.
For richer closers that additionally normalize SPComp monad chains or
reach into the deep embedding, see Tactics/SPNormalize.lean and
Tactics/PkgCoherenceBang.lean.
Recursively case-split all Sum-typed variables in the local context,
eliminating Empty branches via cases. Terminates because each
recursive call strictly reduces the total Sum nesting depth.
Exhaustive Sum-case split on the local context. Recursively unpacks
nested sums and eliminates Empty branches.
Equations
- CatCrypt.Tactics.tacticSum_cases = Lean.ParserDescr.node `CatCrypt.Tactics.tacticSum_cases 1024 (Lean.ParserDescr.nonReservedSymbol "sum_cases" false)
Instances For
Lightweight SMC-coherence closer for Sum-indexed handler equalities.
Tries in order:
rfl.funext _; sum_cases; all_goals rfl.funext _ _; sum_cases; all_goals rfl(deeper curry).funext _ _ _; sum_cases; all_goals rfl.
Use for MonoidalCategoryStruct / SymmetricCategory field goals
over Sum-indexed packaged-interface tensors, where the structure
morphisms reduce by case-analysis plus definitional equality.
Equations
- CatCrypt.Tactics.tacticPkg_coherence_lite = Lean.ParserDescr.node `CatCrypt.Tactics.tacticPkg_coherence_lite 1024 (Lean.ParserDescr.nonReservedSymbol "pkg_coherence_lite" false)