Skip to content

Factor the TypeOK inductive step out as LEMMA TypeOKStep - #217

Open
lemmy wants to merge 1 commit into
masterfrom
mku-rwp
Open

Factor the TypeOK inductive step out as LEMMA TypeOKStep#217
lemmy wants to merge 1 commit into
masterfrom
mku-rwp

Conversation

@lemmy

@lemmy lemmy commented Jul 29, 2026

Copy link
Copy Markdown
Member

SafetyStep re-derived TypeOK /\ [Next]_vars => TypeOK' inline: the step existed only inside the proof of THEOREM TypeCorrect, and proof steps are not citable from another theorem, while Spec => []TypeOK is temporal and SafetyStep assumes no temporal hypothesis.

Hoist the step to a top-level lemma; TypeCorrect's <1>2 and SafetyStep's <1>typok now both cite it. The proof body is unchanged, step levels included. tlapm --nofp proves all 199 obligations.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, it is nonsense to copy the proof of type preservation in this proof. Factoring out this step as an extra lemma is one solution. The one that I tend to use, given that Spec => []TypeOK has already been established, is to set up the subsequent invariant proof as follows:

THEOREM Spec => []Safety
<1>1. Init => Safety
<1>2. TypeOK /\ TypeOK' /\ Safety => Safety'
<1>. QED
  BY <1>1, <1>2, TypeCorrect, PTL DEF Spec

The extra hypotheses TypeOK and TypeOK' are justified by the type-correctness theorem. This saves you from defining the extra predicate Inv as the conjunction of the two invariants.

SafetyCorrect went through Inv == TypeOK /\ Safety, whose inductive step had to
re-establish TypeOK' and so duplicated the proof already given for TypeCorrect.
Since Spec => []TypeOK is established, TypeOK can enter the step as a hypothesis
and be discharged in the QED step by citing TypeCorrect:

  <1>2. TypeOK /\ Safety /\ [Next]_vars => Safety'
  <1>. QED  BY <1>1, <1>2, TypeCorrect, PTL DEF Spec

The TypeOK step becomes LEMMA TypeOKStep. The case analyses are unchanged;
tlapm --nofp proves all 193 obligations.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Markus Alexander Kuppe <github.com@lemmster.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants