Specification

Phase 2, Section 1: Scope, Milestones, and Exit Criteria

Phase 2: AD as an Effect — algebraic effect and handler infrastructure. Section 1 of 4: Scope, Milestones, and Exit Criteria.


1. What this section commits to

This section defines the scope boundaries, intermediate milestones, risk management metrics, and final exit criteria for Phase 2 of the Kina research program. Specifically, it establishes:


2. Scope Boundaries

Phase 2 shifts kina from a pure functional language to a staged effectful language. To prevent scope creep, we enforce strict boundaries:

In Scope

Deferred (Out of Scope)


3. Milestones

Phase 2 is executed in three sequential milestones:

Milestone 1 (Infrastructure) ──> Milestone 2 (AD PoC) ──> Milestone 3 (Control Flow & Stdlib)

Milestone 1: Effect Handler Infrastructure

Goal: Implement row-polymorphic effect typing in the compiler and fiber-like execution in the runtime.

Milestone 2: The AD-as-Handler PoC (Load-Bearing)

Goal: Verify that reverse-mode AD is expressible as a language-level handler with correct numeric outputs.

Milestone 3: Control Flow & Standard Library Integration

Goal: Integrate structured loop constructs and expand the standard library to be fully AD-aware.


4. Risks and Abandonment Criteria

To keep the research program falsifiable, we commit to the following abandonment thresholds:

1. Handler Performance Overhead

2. SMT / Z3 Unification Complexity

3. PoC Numeric Correctness Failure


5. Exit Criteria

Phase 2 is complete when a release candidate satisfies all the following criteria:

Compiler & Type-Checker

Runtime & Execution

Automatic Differentiation

Documentation & Packaging