Skip to content

feat(formal): grow P-2 to the STLC with functions + the substitution lemma#629

Merged
hyperpolymath merged 1 commit into
mainfrom
claude/lucid-cray-4a22dp
Jun 21, 2026
Merged

feat(formal): grow P-2 to the STLC with functions + the substitution lemma#629
hyperpolymath merged 1 commit into
mainfrom
claude/lucid-cray-4a22dp

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

What

P-2, Wave 1: the STLC with functions. Adds what the first-order P2_Progress.v lacked — functions, binders, and the substitution lemma. Full progress + preservation for the simply-typed lambda calculus (base type TUnit + ), call-by-value, named (nat) variables.

Axiom-free and funext-free

The substitution lemma's abstraction case normally wants context equality (update_shadow/update_permute), which needs functional_extensionalityan axiom. This development avoids it entirely: contexts are compared only on a term's free variables (free_in_context + context_invariance), so it uses no functional_extensionality and Print Assumptions stays "Closed under the global context". No Admitted.

Contents

free_in_context · context_invariance · subst_preserves_typing (the substitution lemma) · canonical forms · progress (induction on typing) · preservation (induction on the step relation). Discharges the Siblings_Stated P2 statements at the closed-term (empty-context) instantiation, as P2_Progress.v does.

Scope (honest)

Simply-typed only — the QTT/affine quantities (the substructural context-splitting discipline, the heart of "AffineScript is affine") are the remaining increment on top of this.

Track status

10 files, 16 closure reports, zero axioms. P2_Progress.v stays as the first-order seed; P2_Stlc.v is the grown STLC (the K1/K1Let, P3Sound/P3Graph pattern). justfile/_CoqProject build it; .hypatia-ignore extends the Coq-.v-isn't-V-lang carve-out; README + PROOF-NEEDS.adoc P-2 row updated.

just -f formal/justfile check

🤖 Generated with Claude Code

https://claude.ai/code/session_01KPG9mEQXFyA3k7NWAzMNMr


Generated by Claude Code

…Stlc.v)

Wave-1 increment for P-2: adds what the first-order P2_Progress.v lacked —
**functions, binders, and the substitution lemma**. Full progress +
preservation for the simply-typed lambda calculus (base type TUnit + ->),
call-by-value, named (nat) variables.

Funext-free, so axiom-free (Print Assumptions: "Closed under the global
context"; no Admitted): contexts are compared only on a term's FREE variables
(free_in_context + context_invariance), never by function equality, so the
development uses no functional_extensionality.

Contents: free_in_context, context_invariance, subst_preserves_typing
(the substitution lemma), canonical forms, progress (induction on typing),
preservation (induction on the step relation). Discharges the Siblings_Stated
P2 statements at the closed-term (empty-context) instantiation, as P2_Progress.

Scope: simply-typed only — the QTT/affine quantities (substructural
context-splitting discipline) are the remaining increment.

Track now 10 files, 16 closure reports, no axioms. justfile/_CoqProject build
P2_Stlc; .hypatia-ignore extends the Coq-not-V-lang carve-out; README +
PROOF-NEEDS P-2 row updated (P2_Progress = first-order, P2_Stlc = STLC grown).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KPG9mEQXFyA3k7NWAzMNMr
@github-actions

Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 41 issues detected

Severity Count
🔴 Critical 2
🟠 High 23
🟡 Medium 16

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Action denoland/setup-deno@v2 needs attention",
    "type": "unpinned_action",
    "file": "publish-jsr.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in instant-sync.yml",
    "type": "secret_action_without_presence_gate",
    "file": "instant-sync.yml",
    "action": "peter-evans/repository-dispatch",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Shell execution -- validate input before passing to shell (1 occurrences, CWE-78)",
    "type": "js_exec_sync",
    "file": "/home/runner/work/affinescript/affinescript/packages/affinescript-cli/mod.js",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "high"
  },
  {
    "reason": "Shell execution -- validate input before passing to shell (2 occurrences, CWE-78)",
    "type": "js_exec_sync",
    "file": "/home/runner/work/affinescript/affinescript/packages/affine-vscode/mod.js",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "high"
  },
  {
    "reason": "Shell execution -- validate input before passing to shell (1 occurrences, CWE-78)",
    "type": "js_exec_sync",
    "file": "/home/runner/work/affinescript/affinescript/affinescript-vite/src/affine-plugin-improved.js",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "high"
  },
  {
    "reason": "expect() in hot path (32 occurrences, CWE-754)",
    "type": "expect_in_hot_path",
    "file": "/home/runner/work/affinescript/affinescript/affinescriptiser/src/codegen/wasm_gen.rs",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "medium"
  },
  {
    "reason": "expect() in hot path (29 occurrences, CWE-754)",
    "type": "expect_in_hot_path",
    "file": "/home/runner/work/affinescript/affinescript/affinescriptiser/src/codegen/affine_gen.rs",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "medium"
  },
  {
    "reason": "unsafe block -- requires SAFETY comment (2 occurrences, CWE-676)",
    "type": "unsafe_block",
    "file": "/home/runner/work/affinescript/affinescript/runtime/src/panic.rs",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "medium"
  },
  {
    "reason": "unsafe block -- requires SAFETY comment (1 occurrences, CWE-676)",
    "type": "unsafe_block",
    "file": "/home/runner/work/affinescript/affinescript/runtime/src/alloc.rs",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "medium"
  },
  {
    "reason": "unsafe block -- requires SAFETY comment (3 occurrences, CWE-676)",
    "type": "unsafe_block",
    "file": "/home/runner/work/affinescript/affinescript/runtime/src/ffi.rs",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "medium"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

@hyperpolymath hyperpolymath marked this pull request as ready for review June 21, 2026 13:48
@hyperpolymath hyperpolymath merged commit 12618eb into main Jun 21, 2026
16 checks passed
@hyperpolymath hyperpolymath deleted the claude/lucid-cray-4a22dp branch June 21, 2026 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant