dannypsnl/violet
2
8
Fork
You've already forked violet
0

Universe Polymorphism #6

Merged
dannypsnl merged 1 commit from universe into main 2026年05月13日 14:11:48 +02:00
  • Add Level module: normal-form ≤ solver and equality
  • Level: discharge LHS const via RHS atoms; add soundness tests
  • Thread Level through Core.Universe (default LZero, behavior unchanged)
  • Add universe declaration: lexer, parser, surface AST, level-var context, resolution
  • Make check_type accept any universe; keep unify strict on levels

check_type now infers the pretype and accepts any Universe head, instead of
pinning the expected universe to LZero. The Pi case in infer (and the
constructor/eliminator type checks) route through check_type, so user-written
"data Nat : U" no longer collides with LZero during elaboration.

Unification keeps strict Level.equal as the primary rule, but admits LZero
against any other universe as a Phase B (type-in-type) bridge for synthetic
motives built from Surface.Universe. Two genuinely-distinct user levels
(LVar "U" vs LVar "V") still mismatch, preserving the invariant Task 12 negative
tests depend on. Both relaxation lines are tagged for removal once
Task 6 (Pi at lmax) and Task 7 (Lift in kernel) land.

  • Pi codomain universe = lmax of bound and body levels
  • Add Lift type and lift/unlift terms in kernel with iso cancellation
  • Elaborator: insert Lift on universe ≤-mismatch with no level metas
  • Add sigma example and negative universe-polymorphism tests
  • Check inductive's declared return sort against inferred Pi-tower sort
- Add Level module: normal-form ≤ solver and equality - Level: discharge LHS const via RHS atoms; add soundness tests - Thread Level through Core.Universe (default LZero, behavior unchanged) - Add universe declaration: lexer, parser, surface AST, level-var context, resolution - Make check_type accept any universe; keep unify strict on levels check_type now infers the pretype and accepts any Universe head, instead of pinning the expected universe to LZero. The Pi case in infer (and the constructor/eliminator type checks) route through check_type, so user-written "data Nat : U" no longer collides with LZero during elaboration. Unification keeps strict Level.equal as the primary rule, but admits LZero against any other universe as a Phase B (type-in-type) bridge for synthetic motives built from Surface.Universe. Two genuinely-distinct user levels (LVar "U" vs LVar "V") still mismatch, preserving the invariant Task 12 negative tests depend on. Both relaxation lines are tagged for removal once Task 6 (Pi at lmax) and Task 7 (Lift in kernel) land. - Pi codomain universe = lmax of bound and body levels - Add Lift type and lift/unlift terms in kernel with iso cancellation - Elaborator: insert Lift on universe ≤-mismatch with no level metas - Add sigma example and negative universe-polymorphism tests - Check inductive's declared return sort against inferred Pi-tower sort
Sign in to join this conversation.
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
dannypsnl/violet!6
Reference in a new issue
dannypsnl/violet
No description provided.
Delete branch "universe"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?