Coinductive types: a ν-scheme over polynomial codes, with dischargeable coinduction - #43
Merged
Conversation
…n on observations
…similarity reflects into equality
… infinite naturals
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Coinductive types for Nova, specified and implemented end to end: a ν-scheme over one-hole polynomial codes — the smallest useful dual of the QIIT scheme — with observation, corecursion, one-step β, and a dischargeable coinduction principle.
Theory (
docs/NovaFoundation.txt)𝔽 ::= 𝕏 | K a | 𝔽 ⨯ 𝔽 | 𝔽 ⊎ 𝔽 | El a ⨯ 𝔽 | El a → 𝔽— one-hole strictly positive codes, checked bypoly-*rules; positivity is grammatical. Every polynomial is small, soν 𝔽always has a code.ν 𝔽(carried polynomial, structural identity — iso-recursive, like a QIIT's𝒮),outas the eliminator,corec 𝔽 a f xas the introduction (the polynomial and carrier are carried: β consumesmap_𝔽, so the redex is self-contained). Canonical forms are corec-headed;outforces lazily — Π's polarity, not ℕ's.el-nu-beta(one observation step through the ≜-defined functorial actionmap_𝔽) andel-nu-eta(uniqueness of the corecursor — the coinduction principle, judgemental under the extensional discipline, with bisimulation-implies-equality as corollary).el-nu-coind— the admissible relational form ofel-nu-eta(theel-squash-e-eqprecedent), via a fourth ≜-meta-operation, the relatorlift_𝔽(R): relation lifting per former, sums by dependent⊎-elimat motive Ω (definitional collapse on the diagonal), dependent pairs with no transport (the instance equation reflects from its own binder). The subset-carrier derivation fromel-nu-etais sketched in place.ν 𝔽by the ℕ-indexed limit with the largest bisimulation as the relation; everyν 𝔽is definable by that limit internally, so the scheme is conservative — retained for structural identity, one-step β, and the uniform η, exactly the status of ℕ,⊎and(/).Kernel and elaborator
docs/NovaKernel.txt/docs/NovaElaboration.txtupdated rule for rule;Polyin the core syntax withreflectPoly/mapPoly/liftPolyas meta-operations; β in all three normalizers; formation, inference, checking, typed descent, path replay, and structural ν-conversion (nuCong-style decomposition of carried polynomials).el-nu-coindrides⋆as a skeleton payload (invariant, endpoint proof, one-step closure — three checked terms; the closure's type is kernel-computed from𝔽andR, never elaborator-supplied). Surface formcoind (x y. R) p (x y h. q).squash-elimbinds for conjunction and existential invariants), and variable-definition hypotheses (☐ₙ ≡ t,☐ₙ ∉ t) are admitted as rewrite rules despite growing — each application strictly removes an occurrence.Corpus
stream.nova— streams and conaturals:hd/tl/cons/iterate/mapS, β-driven observation lemmas,tlConsby graph-invariant coinduction, and conat's∞ ≡ ∞ + 1(the relator's sum clause, collapsing definitionally on theinj₂diagonal).streamEq.nova— observational equality in Ω (obsEq, squash of a Π over ℕ of equations), with map-id and map-fusion proved by induction on observation depth.streamBisim.nova— bisimilarity as the impredicative gfp in Ω (union of post-fixed points), unfold laws, equivalence withobsEqin both directions, andbisimReflect: bisimilarity implies equality, upgrading map-id and map-fusion to judgemental equations.Tests
127/127 golden tests, 26/26 corpus elaborations. New coverage: parser goldens for the ν formers, evaluation goldens for
el-nu-beta(includingtake Nof a finite colist with padding and of the infinite naturals), elaboration goldens for acceptance, for coinduction at every polynomial class (sum, exponent, dependent pair), and a negative test showing a non-closing invariant surfaces as an ordinary obligation rather than an error.