Commit c17b2ee
Phase 1b foundation: store typing (StoreWellTyped + lemmas) (#112)
## What
Adds the **store-typing relation** that bridges the static `TypeEnv` and
the
runtime `Env` — the invariant every statement-execution preservation
theorem
is stated against — plus the three lemmas the statement dynamics rest
on.
```lean
def StoreWellTyped (Γ : TypeEnv) (ρ : Env) : Prop :=
∀ x t, Γ x = some t → ∃ v, ρ x = some v ∧ HasType emptyTypeEnv (.lit v) t
```
| Lemma | Statement |
|---|---|
| `store_wellTyped_empty` | the empty store types against the empty
context |
| `store_wellTyped_lookup` | a typed variable resolves to a value of its
type |
| `store_wellTyped_extend` | extending context+store in lockstep
(exactly a `varDecl`) preserves store typing |
## Why this, and why now
Per the agreed sequencing rule — *land the lowest-complexity, safe,
**complete**
unit first* — this is the foundational piece of **roadmap Phase 1b
(statement
dynamics)**. The statement-*execution* relation itself is the next,
higher-complexity
step: the expression `Step` is closed-term-only, so variable resolution
needs design.
That lands in a follow-up; this store-typing layer is the stable base it
builds on
(notably `store_wellTyped_extend` is the key step for `varDecl`
preservation).
## Verification
- `lean docs/proofs/verification/WokeLang.lean` exits 0 (Lean 4.30.0,
Mathlib-free, single-file).
- Hole-free: `#print axioms` reports **`propext`** only for
`store_wellTyped_empty`,
and **no axioms** for `store_wellTyped_lookup` /
`store_wellTyped_extend`.
No `sorryAx`, no project-specific assumptions.
## Scope
`docs/proofs/verification/WokeLang.lean` (the three lemmas + the
`StoreWellTyped`
def) and a Progress entry in `docs/proofs/VERIFICATION-ROADMAP.md`. No
changes to
existing proofs or to the shipping implementation.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_015oyMquf4daB6hMhmqB1wAL
---
_Generated by [Claude
Code](https://claude.ai/code/session_015oyMquf4daB6hMhmqB1wAL)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent cb54027 commit c17b2ee
2 files changed
Lines changed: 45 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
140 | 148 | | |
141 | 149 | | |
142 | 150 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1473 | 1473 | | |
1474 | 1474 | | |
1475 | 1475 | | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
1476 | 1512 | | |
1477 | 1513 | | |
1478 | 1514 | | |
| |||
0 commit comments