cardinality

Counting Data

The stored-value side of the calculator: how many values a type can hold. This is a reference, not a tutorial. The evidence register carries the derivation behind each rule; the final section maps the rules to code and tests.

The rules are an implementation-oriented condensation of Alex Knvl's β€œCounting type inhabitants” (November 24, 2018). They describe the mathematical target, not a claim that the current calculator implements every rule.

1. What are we counting?

Count observationally distinct, total, pure values, not expressions, allocation identities, or implementations. 1 + 1 and 2 are the same inhabitant; two functions are the same when no permitted observation distinguishes their results. Ignore execution time, exceptions, nontermination, side effects, and unsafe casts. In particular, a throwing expression does not make Nothing inhabited.

Write |A|=a for the cardinality of type A. Write A≅B for an isomorphism: functions in both directions whose compositions are identities. Isomorphic types have equal cardinalities. In the formulas, 0, 1, and 2 denote types with that many values, not Scala literal types: Scala's type 3 has one value.

The polymorphic rules additionally require parametricity: implementations cannot inspect a type argument, reflect on it, or invent a value of an arbitrary type. They must work uniformly for every instantiation.

Important boundaries:

2. Base types, sums, and products

Type or construction Cardinality Reason
Nothing 0 No total values
Unit, EmptyTuple, a singleton 1 One value
Boolean 2 false or true
Byte; Short or Char; Int; Long 28; 216; 232; 264 Fixed-width integral values
Either[A, B] a+b Disjoint, tagged alternatives
Option[A] 1+a None plus each Some(a)
(A, B) aβ‹…b Independent choices of both fields
(A, B, C) aβ‹…bβ‹…c Extend the product to all fields
ADT with constructors Ci(𝑓𝑖𝑒𝑙𝑑𝑠i) βˆ‘i∏j 𝑓𝑖𝑒𝑙𝑑ij

An empty product is 1: a constructor with no fields contributes one value. An empty sum is 0: a data type with no constructors contributes no values. For example, Bar | Baz(Boolean) | Baf(Int) has 1+2+232 values. Constructors with an uninhabited field contribute zero.

Useful normalization laws:

a+0=aaβ‹…0=0aβ‹…1=aaβ‹…(b+c)=aβ‹…b+aβ‹…ca+b=b+aaβ‹…b=bβ‹…a(a+b)+c=a+(b+c)(aβ‹…b)β‹…c=aβ‹…(bβ‹…c)

These laws reduce nested ADTs to sums of products. Constructor tags matter: Either[Boolean, Boolean] has four values, not two.

The calculator keeps those laws for the finite counts and reports every sum as a polynomial aβ‹…Ξ΅0+bβ‹…Ο‰+n over three tiers (Β§4). Addition is the natural sum: coefficients are kept, so Either[String, String] is 2Ο‰ rather than one absorbed Ο‰. That matches πΈπ‘–π‘‘β„Žπ‘’π‘Ÿ[A,B]β‰…πΈπ‘–π‘‘β„Žπ‘’π‘Ÿ[B,A] and lets two definitions be compared more finely than "both infinite". Products and powers stay coarse above the finite tier: 2β‹…Ο‰=Ο‰, so Either[String, String] (2Ο‰) and (String, String) (Ο‰) differ even though the two types are isomorphic. Recursive widening and lazy-type completion also deliberately lose precision (Β§8); neither changes general addition.

Scala unions are not tagged sums. For finite types, the cardinality of the union type A | B is |A|+|B|βˆ’|A&B|: overlapping members must not be counted twice. Intersection cardinality is not generally min⁑(a,b) either; that shortcut needs a proven subtype relationship, and neither overlap nor subtyping can be inferred from the two cardinalities alone.

3. Functions are exponentials

For fixed, non-polymorphic types:

|A⇒B|=ba

Choose one output from B independently for every input from A. This counts extensional, total functions, not distinct function bodies. For a function with multiple arguments, first multiply the argument cardinalities.

The zero and one rules are essential, not exceptional failures:

|Aβ‡’π‘ˆπ‘›π‘–π‘‘|=1a=1|π‘π‘œπ‘‘β„Žπ‘–π‘›π‘”β‡’B|=0including 00=0|Aβ‡’π‘π‘œπ‘‘β„Žπ‘–π‘›π‘”|=0a=0when a>0|π‘ˆπ‘›π‘–π‘‘β‡’B|=b1=b

The identities hold for the infinite tiers too: b0=1, b1=b, 1b=1 and 0b=0 for every nonzero b, b=Ο‰ included. A finite base over an infinite domain stays countable (2Ο‰=Ο‰ in the ordinal arithmetic of Β§4), and an infinite base over an infinite exponent is Ξ΅0.

The empty-domain rule departs from set-theoretic arithmetic, where b0=1 counts the single empty function. Scala is eager: applying a function evaluates its argument first, and no argument of type Nothing can ever be evaluated. A function from Nothing can therefore never run, so it contributes no values, Nothing => Nothing included. This is a constructivist approach: a value counts only when it can be exhibited in use, and a function is exhibited only by applying it to an argument someone has actually constructed. This applies to function types only: Set[Nothing] and Map[Nothing, V] still hold their one empty value.

Normalize function types with these isomorphisms:

((A,B))β‡’Cβ‰…Aβ‡’Bβ‡’CAβ‡’(B,C)β‰…(Aβ‡’B,Aβ‡’C)πΈπ‘–π‘‘β„Žπ‘’π‘Ÿ[A,B]β‡’Cβ‰…(Aβ‡’C,Bβ‡’C)

Their cardinal forms are caβ‹…b=(cb)a, (bβ‹…c)a=baβ‹…ca, and ca+b=caβ‹…cb. Do not distribute an arrow into a sum in its result: A => Either[B, C] is not generally Either[A => B, A => C].

Worked finite cases

Scala type Calculation Count
(Boolean, Unit) 2β‹…1 2
(Boolean, Boolean, Boolean) 2β‹…2β‹…2 8
(Nothing, Int) 0β‹…232 0
(Int, Int) 232β‹…232 264 (same as Long)
Either[Boolean, Option[Boolean]] 2+(1+2) 5
Boolean => Boolean 22 4
Option[Boolean] => Boolean 2(1+2) 8
Boolean => Option[Boolean] (1+2)2 9
(Boolean, Boolean, Boolean) => Unit 18 1
Boolean => Boolean => Either[Boolean, Boolean] => Boolean 2(2β‹…2β‹…(2+2)) 65,536

The article's last calculation writes 2β‹…2 for the Either subexpression. It happens to equal 2+2 here; the general rule for Either is still addition.

4. Sets, lists, and infinity

For a finite element type with a values:

|𝑆𝑒𝑑k[A]|=(ak)=a!k!(aβˆ’k)!for 0≀k≀a|𝑆𝑒𝑑k[A]|=0for k>a|𝑆𝑒𝑑[A]|=βˆ‘k(ak)=2a

Sets ignore order and repeated elements. For a nonempty A, a subset is equivalently represented by its membership predicate A => Boolean; for Nothing the empty set still exists while the predicate does not (Β§3). Thus Set[Nothing], Set[Unit], Set[Boolean], and Set[Option[Boolean]] have 1, 2, 4, and 8 values. These are abstract sets with observational equality, not object-identity-based sets.

Lists preserve order and repetition and permit every finite length:

|𝐿𝑖𝑠𝑑[A]|=βˆ‘n=0∞an|𝐿𝑖𝑠𝑑[π‘π‘œπ‘‘β„Žπ‘–π‘›π‘”]|=1only Nil|𝐿𝑖𝑠𝑑[π‘ˆπ‘›π‘–π‘‘]|=β„΅0one list per natural-number length

Finite lists over a nonempty finite or countably infinite alphabet are countably infinite (β„΅0). This is a least-fixed-point/finite-value interpretation, not a statement about potentially infinite lazy streams; those are greatest fixed points (Β§8).

For infinite sets of values, cardinal arithmetic and this page part ways:

Two arguments motivate keeping the distinction, neither of which makes it a cardinal inequality:

Sizes are therefore written as polynomials over the three tiers:

aβ‹…Ξ΅0+bβ‹…Ο‰+na,b,nβ‰₯0

n is the finite component of Β§2: exact up to 127, then a rounded bit capacity. Two countable families read 2Ο‰, one countable family beside three values reads Ο‰+3, and comparison is lexicographic β€” the Ξ΅0 coefficient first, then Ο‰, then the finite part. 2Ξ΅0+Ο‰ is larger than Ξ΅0+Ο‰, which is larger than 3Ο‰+100.

The article's predicate/powerset shortcut is safe for finite element types. For infinite types the same exponentiation applies, with the rules above.

5. Negation and inhabitance

Let Not[A] = A => Nothing. With the eager empty-domain rule of Β§3, negation is uninhabited for every A:

Condition Cardinality of Not[A] Cardinality of Not[Not[A]]
a = 0 0 (empty domain) 0 (empty domain)
a > 0 0 (no result) 0 (empty domain)

So negation does not detect inhabitance here: Not[Not[Boolean]] has no inhabitants, and neither does Not[Not[Nothing]]. The set-theoretic reading, where 00=1 makes double negation 1 exactly for nonempty A, is deliberately not the model: under the constructivist approach of Β§3, a negation would have to be applied to a constructed A to be exhibited, and it has no result to give back. Decide whether a recursive constructor can produce a finite value with the fixed-point rule of Β§8 instead.

6. Universal quantification and Yoneda

βˆ€A.T[A] denotes one implementation working uniformly for every type A (Scala 3 polymorphic function syntax includes [A] => A => A). Do not assign a guessed cardinality to A and then apply ordinary exponentiation.

Under totality, purity, and parametricity:

βˆ€X.(F[X],G[X])β‰…(βˆ€X.F[X],βˆ€X.G[X])βˆ€X.πΈπ‘–π‘‘β„Žπ‘’π‘Ÿ[F[X],G[X]]β‰…πΈπ‘–π‘‘β„Žπ‘’π‘Ÿ[βˆ€X.F[X],βˆ€X.G[X]]βˆ€X.Aβ‡’F[X]β‰…Aβ‡’(βˆ€X.F[X])if X does not occur in A

The sum rule relies on a uniform choice of constructor, not a choice that varies with the runtime type argument.

Yoneda rules eliminate a quantified variable:

βˆ€X.(Aβ‡’X)β‡’F[X]β‰…F[A]if F is a covariant functorβˆ€X.(Xβ‡’A)β‡’F[X]β‰…F[A]if F is a contravariant functor

Variance is a precondition. Function arguments reverse variance; results preserve it. An arbitrary expression using X is not automatically covariant. Useful corollaries:

βˆ€X.F[X]β‰…F[π‘π‘œπ‘‘β„Žπ‘–π‘›π‘”]if F is covariantβˆ€X.F[X]β‰…F[π‘ˆπ‘›π‘–π‘‘]if F is contravariantβˆ€X.Cβ‰…Cif X does not occur in C (phantom)

Polymorphic regression targets

Arrows below associate to the right and quantifiers cover the whole following type. The table uses the article's βˆ€ notation; the Scala 3 spelling of βˆ€A.Aβ‡’A is [A] => A => A.

Type Count Interpretation
βˆ€A.Aβ‡’A 1 Identity only
βˆ€AB.((A,B))β‡’A 1 First projection only
βˆ€A.((A,A))β‡’A 2 Select either input
βˆ€A.((A,A))β‡’(A,A) 4 Independently select each output
βˆ€ABC.(Aβ‡’C)β‡’Bβ‡’Aβ‡’C 1 Apply the function, ignore B
βˆ€ABC.(Aβ‡’B)β‡’(Bβ‡’C)β‡’Aβ‡’C 1 Composition
βˆ€AB.(Aβ‡’B)β‡’Bβ‡’Aβ‡’B 2 Apply the function or return the supplied B
βˆ€ABC.(Aβ‡’B)β‡’Bβ‡’Aβ‡’C 0 Cannot manufacture C
βˆ€A.(π‘π‘œπ‘‘β„Žπ‘–π‘›π‘”β‡’A)β‡’Aβ‡’π‘π‘œπ‘‘β„Žπ‘–π‘›π‘” 0 Cannot manufacture Nothing
βˆ€AB.((Aβ‡’π‘π‘œπ‘‘β„Žπ‘–π‘›π‘”,B))β‡’(π΅π‘œπ‘œπ‘™π‘’π‘Žπ‘›,B) 0 A => Nothing is empty for every A (Β§5)
βˆ€A.(Aβ‡’π‘π‘œπ‘‘β„Žπ‘–π‘›π‘”)β‡’π‘π‘œπ‘‘β„Žπ‘–π‘›π‘” 0 No universally available A
βˆ€A.(Aβ‡’π‘π‘œπ‘‘β„Žπ‘–π‘›π‘”)β‡’Aβ‡’π‘π‘œπ‘‘β„Žπ‘–π‘›π‘” 0 No contradiction can be supplied (Β§5)
βˆ€A.((Aβ‡’π‘π‘œπ‘‘β„Žπ‘–π‘›π‘”,Aβ‡’π‘π‘œπ‘‘β„Žπ‘–π‘›π‘”))β‡’(Aβ‡’π‘π‘œπ‘‘β„Žπ‘–π‘›π‘”) 0 Neither can a pair of them
βˆ€A.π‘‚π‘π‘‘π‘–π‘œπ‘›[A]β‡’π‘‚π‘π‘‘π‘–π‘œπ‘›[A] 2 Identity or always None
βˆ€AB.(Aβ‡’B)β‡’π‘‚π‘π‘‘π‘–π‘œπ‘›[A]β‡’π‘‚π‘π‘‘π‘–π‘œπ‘›[B] 2 Ordinary map or always None

Instantiation is not a general bound on a polymorphic count: identity has one polymorphic inhabitant but Boolean => Boolean has four; the two polymorphic projections collapse to one at A = Unit or A = Nothing.

7. Representable functors, containers, and laws

A representable functor has F[X]≅R⇒X. For example, Unit, X, and (X, X, X) have position types R = 0, 1, and 3. Yoneda gives:

βˆ€X.F[X]β‡’G[X]β‰…G[R]for covariant G

A container is a sum over shapes, with a position type for each shape: F[X]β‰…βˆ‘i(Riβ‡’X). Generalizing:

βˆ€X.F[X]β‡’G[X]β‰…βˆiG[Ri]for covariant G

For Option, the shapes have zero or one positions, so βˆ€X.π‘‚π‘π‘‘π‘–π‘œπ‘›[X]β‡’π‘‚π‘π‘‘π‘–π‘œπ‘›[X]β‰…π‘‚π‘π‘‘π‘–π‘œπ‘›[0]β‹…π‘‚π‘π‘‘π‘–π‘œπ‘›[1], with 1β‹…2=2 inhabitants. For List, shapes are lengths n with n positions.

The article's list-map signature becomes ∏n𝐿𝑖𝑠𝑑[𝐹𝑖𝑛n]: for each input length, choose a finite list of input indices, allowing reordering, duplication, or discarding. Its filter signature becomes ∏n(𝑆𝑒𝑑[𝐹𝑖𝑛n]⇒𝐿𝑖𝑠𝑑[𝐹𝑖𝑛n]): predicate answers can also guide that choice. The signatures alone do not require ordinary map or filter behavior.

Additional laws reduce the space of implementations. For example, map(identity) = identity rules out the always-None implementation of Option map. A lawful-functor count is a different question from a signature-only count; do not silently impose such laws. The article does not give a general algorithm for counting implementations subject to arbitrary laws.

8. Recursive types are fixed points: least when eager, greatest when lazy

The evaluation strategy of the recursive position decides which fixed point a recursive type denotes. Do not merely solve the numeric equation x=F(x); that can have multiple solutions, and the least and greatest ones differ exactly by the infinite values.

A recursive type is coinductive only through its lazy positions: a cycle through at least one lazy occurrence admits infinite values, while recursion through strict positions alone stays inductive. case class Rose(label: Int, kids: LazyList[Rose]) has trees of infinite depth and width; case class Tree(l: Tree, r: Tree) has no values at all.

Eager recursion: least fixed points

Write ΞΌX.F[X] for the least fixed point: values built by finitely many constructor applications.

For the covariant inductive constructions considered in the article:

ΞΌX.F[X]β‰…βˆ€X.(F[X]β‡’X)β‡’XΞΌX.F[X] is inhabited iff F[π‘π‘œπ‘‘β„Žπ‘–π‘›π‘”] is inhabited

Examples:

Construction Equation / encoding Count
Wrapper that requires another wrapper ΞΌX.X 0
Peano naturals (Zero or Succ) ΞΌX.(1+X) Ο‰
Finite lists of A ΞΌX.(1+Aβ‹…X) 1 if a=0; Ο‰ if 0<a≀ω
Church numerals βˆ€A.(Aβ‡’A)β‡’Aβ‡’A Ο‰
Endofunction without a seed βˆ€A.(Aβ‡’A)β‡’A 0
Iteration with an extra argument βˆ€AB.(Aβ‡’Bβ‡’A)β‡’Aβ‡’Bβ‡’A Ο‰

Church numerals include zero iterations (identity), then one application, two, and so on. Without a seed or base constructor, recursion alone cannot make a total finite value.

A productive recursive constructor plus a base constructor gives arbitrarily large values. Concluding countably infinite additionally needs countably many constructor/label choices and finite arity. Do not generalize the article's informal infinity argument to infinitely branching trees or uncountable labels. An impossible recursive branch, such as Nothing * X, adds no values.

Lazy recursion: greatest fixed points

Write Ξ½X.F[X] for the greatest fixed point: every value that can be observed one constructor at a time, including values that never bottom out. Laziness does not change the count of a non-recursive use: => A behaves as Unit => A, whose cardinality is a1=a (Β§3). It changes only what recursion can build.

For the covariant coinductive constructions:

Ξ½X.F[X]β‰…βˆƒX.(X,Xβ‡’F[X])a seed and a step that unfolds itΞ½X.F[X] is inhabited iff F[π‘ˆπ‘›π‘–π‘‘] is inhabited

The inhabitance rule is the dual of the eager one: a constructor whose non-recursive fields are all inhabited can be repeated forever, so the recursive fields no longer need a base case.

Construction Equation Count
Lazy wrapper that requires another (next: => Loop) Ξ½X.X 1: the value lazy val l: Loop = Loop(l)
Conaturals (pred: => Option[CoNat]) Ξ½X.(1+X) Ο‰: finite depths and the single infinite one, normalized at completion
LazyList[A] Ξ½X.(1+Aβ‹…X) 1 if a=0; Ο‰ if a is nonempty and finite; Ξ΅0 if a=Ο‰
Stream without an end (head: A, tail: => Stream[A]) Ξ½X.(Aβ‹…X) 0 if a=0; 1 if a=1; Ο‰ if a is finite and β‰₯2; Ξ΅0 if a=Ο‰
Unfolding that branches per argument (One(e: => E), Two(i: Int => E)) Ξ½X.(X+(𝐼𝑛𝑑→X)) Ξ΅0 β€” a function field is also never demanded while constructing, so lazy val e = One(Two(_ => e)) and per-int choices all unfold further; a Two lap continues through one input and holds any E (Ο‰ of them) at the others, a label like any other. An empty per-lap label space stays 0
Holes without a label (R(l: => R, r: => R), F(f: Int => F)) Ξ½X.Xβ‹…X, Ξ½X.X𝐼𝑛𝑑 1: every value is the one knot lazy val r: R = R(r, r); holes alone choose nothing

Compare the eager rows: ΞΌX.X is 0 but Ξ½X.X is 1, and a stream without an end has no finite values at all. With aβ‰₯2 an infinite stream is a function β„•β‡’A, so it follows Β§4 exactly: Ο‰ for a finite A (only the streams a finite program can produce), Ξ΅0 for a countably infinite A (ωω).

Lazy-type completion policy (B). The counts in this table are approximations, not exact cardinal or ordinal arithmetic. On completing each lazy/coinductive type, combine its finite-value ΞΌ estimate with its infinite contribution. If the total contains an Ξ΅0 term, return one EffectiveEpsilon0; otherwise, if it contains an Ο‰ term, return one EffectiveOmega. Purely finite totals, including 0 and 1, are unchanged. Here β€œfinite-value” describes finite unfoldings, whose ΞΌ estimate can itself be infinite.

The finite and infinite families still exist; their breakdown is deliberately discarded at this boundary. Conaturals therefore report Ο‰, not Ο‰+1; LazyList[Unit], LazyList[Boolean], and Scala's Stream[Boolean] report Ο‰. LazyList[String] and Scala's Stream[String] report Ξ΅0, not Ξ΅0+Ο‰. LazyList[Nothing] is still 1, a pure lazy self-wrapper Ξ½X.X is still 1, and blocked or empty cycles whose total is 0 stay 0.

This normalization is only for completion of each lazy/coinductive type. It is not a rule of Size.+, enclosing sums or source totals: Either[String, String] remains 2Ο‰, and Either[LazyList[String], LazyList[String]] is 2Ξ΅0, not Ξ΅0. Source aggregates add the completed contributions normally.

A recursive equation whose estimate keeps growing never reaches a fixed point under coefficient-preserving addition: the estimate for ΞΌX.(1+X) climbs 1,2,3,… for ever. The calculator settles it by widening the component to the tier it has grown into, once the growth is recognized as productive, so ΞΌX.(1+X) is Ο‰; Ξ½X.(1+X) also reports Ο‰ after lazy-type completion normalizes the finite depths plus the infinite tower. Only a name that can reach itself through the equations is widened, so however long a chain of forward references is, it settles exactly, and a widening never turns an Ξ΅0 estimate back into Ο‰. Widening and lazy-type completion are separate approximations, not rules of general addition: + keeps the infinite-tier coefficients.

9. Higher kinds and rank-N types

The article only sketches this area. One target, for arbitrary type constructors F with no covariance or other operations assumed, is:

βˆ€F.F[A]β‡’F[B]β‰…(A=B)

This requires type-equality evidence: for fixed equal types there is the identity; for distinct types there is no general conversion. The method side reads a plain higher-kinded binder exactly so (a rigid constructor over nominal argument keys β€” see higher-kinded binders); variance-annotated or bounded constructor binders and nested quantifiers still require their own binding/variance-aware analysis. Neither sampling instantiations nor treating an unknown constructor as infinite implements these rules.

10. Implementation status and test contract

The current API and representation have important limits:

ArticleCardinalitySpec is the article-focused regression suite. Together with SizeSpec and CardinalitySpec, it separates implemented rules from executable targets:

Area Test contract
Base types, sums, products, and ADT normal forms Asserted counts (or explicitly identified bit capacities)
Exponentials, currying, distributivity, the 0/1 rules, double negation Asserted against independently known results
Finite powersets and finite-list boundary cases Asserted for empty, singleton, and nontrivial element types
Polynomial sums across the three tiers Asserted: Ο‰+Ο‰=2Ο‰, lexicographic comparison, coarse products and powers, and the zero/one identities
Parametric identity, projections, composition, contradiction, Option transformations Pending: needs parametricity, which the type traversal does not model
Recursive types (eager) with no base constructor Asserted: least fixed points of the equation system; ΞΌX.X counts 0
Recursive types (eager) with a base constructor Asserted: productive recursion widened to Ο‰, and an Ξ΅0 payload never demoted
Lazy (coinductive) recursion through recognized continuations β€” holes, strict Option[X] fields, inhabited function fields D => X, sealed-parent pass-throughs Asserted: each cycle adds its per-lap label space raised to Ο‰, then lazy-type completion normalizes the combined total (Ξ½X.X=1, conaturals =Ο‰, endless Ξ½X.(2β‹…X)=Ο‰, LazyList[String] =Ξ΅0); a cycle's label space counts its choices, not its holes (Ξ½X.Xβ‹…X=1; a second hole holds any value of its node, so Boolean-labelled binary trees are Ξ΅0), an empty label space stays 0, and a chain of consumers sees the settled value
Coiteration blocked by a strict self argument (x: X) or a mention nested past the recognized forms (tuples, Set[X], function domains, Either) Totals keep the least-fixed-point value; rows on a blocked cycle a by-name or function field closes are ? (lazy cycle not completed), never the under-count
Union and intersection overlap beyond identical syntax Pending: needs overlap and subtyping information
Functions from countably infinite domains Asserted at Ο‰ into a finite codomain and Ξ΅0 into an infinite one (Β§4)
Containers, rank-N and higher-kinded types, counts under extra laws Targets with nothing behind them yet

A pending example is a keyed expectation: it fails today, so specs2 reports it as pending and prints the count the article derives next to the count the calculator returned. When the rule is implemented the example starts holding, which specs2 turns into a failure, so support cannot land behind a stale marker. A test that merely gets an infinity marker back for a polymorphic or recursive type is not evidence that the rule is implemented: the same marker also means "unresolved".

Implementation priorities are: keep exact, approximate, and unknown results distinct; apply the finite algebra and the empty-type identities; resolve names and constructor structure across compilation units; carry the greatest-fixed-point analysis through Either and deeper-nested lazy continuations, and let a cycle's label space depend on its own unfolding; then add binding- and variance-aware polymorphic reductions.

Run the focused regressions or the full suite with:

sbt 'testOnly ArticleCardinalitySpec SizeSpec'
sbt test