proof: typing_free_of_absent_region (Qed) — Brief C kernel#151
Merged
Conversation
Adds the static-shadowing-prevention lemma referenced by the comment
at Semantics.v:9096 (post-MIDDLE narrowing diagnostic block):
Lemma typing_free_of_absent_region :
forall R G e T G' r,
R; G |- e : T -| G' ->
~ In r R ->
expr_free_of_region r e.
Proved by structural induction on the typing derivation (26 cases,
~50 LOC). Each typing rule's region premise is incompatible with
[~In r R] when applied at [r]: T_Loc and T_StringNew force the [r0 <> r]
case via their In r0 R premise; T_Region's body recurses under
r0 :: R where ~In r (r0 :: R) still holds when r <> r0;
T_Region_Active contradicts directly when r = r0.
Does NOT close any preservation admit on its own — the touches_region
RIGHT cases have In r R (not ~In r R) by construction. But this lemma
is the kernel of Brief C's structural recursion: any closure path that
traces an exited region back to its introducing ERegion via
inversion-on-Hstep will need this fact to establish sibling-disjointness
from the inner T_Region's ~In premise.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the static-shadowing-prevention lemma referenced by the forward comment at
formal/Semantics.v:9096(post-MIDDLE-narrowing diagnostic block):Proved by structural induction on the typing derivation (26 cases, ~50 LOC). Each typing rule's region premise is incompatible with
~In r Rwhen applied atr:r0 <> rcase via theirIn r0 Rpremise.r0 :: Rwhere~In r (r0 :: R)still holds whenr <> r0.r = r0.Why this matters
Does not close any preservation admit on its own — the touches_region RIGHT cases have
In r R(not~In r R) by construction. But this lemma is the kernel of Brief C's structural recursion: any closure path that traces an exited region back to its introducing ERegion via inversion-on-Hstep will need this fact to establish sibling-disjointness from the inner T_Region's~Inpremise.Lands as a Qed building block alongside
region_shrink_preserves_typing_dup(also adjunct), available for Brief C work to pull in.Test plan
make -f Makefile.coq Semantics.voclean rebuild onrocqtoolchain → exits 0grep -c "^Admitted\." formal/Semantics.v== 1 (onlypreservation)4A03639C1EB1F86C7F0C97A91835A14A2867091E)Refs ephapax#146.
🤖 Generated with Claude Code