Skip to content

Solo kernel: switch additive & to lazy evaluation when recursion/effects land #107

Closed

Description

@hyperpolymath

Context

Per ADR-008 (.machine_readable/6a2/META.a2ml), the additive product & (TWith) currently uses eager evaluation in the Coq/Idris solo-core: With t1 t2 is a value only once both components are values, and Fst/Snd project from that value (Soundness.v: VWith, S_With1, S_With2, S_Fst, S_Snd).

This is type-safe and, under the current strongly-normalising kernel (no recursion/fixpoint), observationally equivalent to the canonical lazy & semantics — so progress and preservation hold for it as-is.

The change (when it becomes necessary)

The canonical additive-& semantics is lazy: ⟨t1, t2⟩ is immediately a value (a thunk pair), and Fst ⟨t1,t2⟩ → t1 evaluates the chosen component only when projected. The two semantics diverge once divergence/effects exist: lazy lets Snd ⟨loop, 5⟩ = 5, eager loops.

So: the moment recursion, general fixpoint, or effects enter the language, switch & to lazy — otherwise & no longer means what it should.

Sketch

  • value: VWith : value (With t1 t2) unconditionally (always a value).
  • step: S_Fst : step (Fst (With t1 t2)) t1, S_Snd : step (Snd (With t1 t2)) t2 (no value premise); drop S_With1/S_With2.
  • canon_with and the progress/preservation With/Fst/Snd cases adjust accordingly.

Acceptance

  • & is lazy; progress + preservation re-proven, axiom-free.
  • The multiplicative ⊗ stays strict (it already is).
  • ADR-008 updated to "superseded — lazy adopted".

Blocked-until: recursion/effects exist in the kernel (not yet). Flagged so it isn't forgotten.

Activity

  1. hyperpolymath commented on Aug 12, 2026

    @hyperpolymath
    OwnerAuthor

    DESIGN DECISION BLOCKED. Issue tracks switching additive & TWith from eager to lazy evaluation when recursion/effects land. Currently observationally equivalent under strong normalisation (no recursion/fixpoint). The change is flagged so it isn't forgotten. Blocked-until: recursion/effects exist in the kernel. Related to issue #93 (product elimination form) and ADR-008. Cannot proceed without kernel changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions