proof/: complete parse+insert composition for :, CREATE, VARIABLE, DEFER
Extends the CONSTANT worked example from the previous commit to all five name-parsing/entry-creating words. Each now has a forth_*_full definition composing the real C order end to end, up to but not including the data-field write (gap b, still open): - forth_create_full: parse -> dict_insert_entry -> forth_align (reused directly from StarForth_Dictionary_Words.thy's ALIGN model). - forth_variable_full: parse -> forth_align -> forth_vm_allot_raw (new -- models the raw vm_allot() C helper VARIABLE calls directly, bounds- checked against DICTIONARY_MEMORY_SIZE exactly like vm_align, distinct from the FORTH word ALLOT's own VM_MEMORY_SIZE-bounded forth_allot) -> dict_insert_entry. - forth_colon_full: nested-':' guard (checked before the parse, matching real C order) -> parse -> forth_colon_entry_half (mode-set + WORD_SMUDGED insert). Added forth_parse_word_preserves_vm_mode/dictionary/ word_id_next to StarForth_Base.thy to support this composition cleanly. - forth_defer_full: parse -> dict_insert_entry, the simplest of the five. dict_insert_entry's callers (the four forth_*_entry_half definitions) still take the parsed name as a caller parameter for standalone use. Full suite (54 theories) verifies green. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
1aca77d55c
commit
d3d66fb608
@@ -730,6 +730,18 @@ lemma forth_parse_word_preserves_data_stack:
|
||||
"data_stack (snd (forth_parse_word max_len vm)) = data_stack vm"
|
||||
by (simp add: forth_parse_word_def Let_def)
|
||||
|
||||
lemma forth_parse_word_preserves_vm_mode:
|
||||
"vm_mode (snd (forth_parse_word max_len vm)) = vm_mode vm"
|
||||
by (simp add: forth_parse_word_def Let_def)
|
||||
|
||||
lemma forth_parse_word_preserves_dictionary:
|
||||
"dictionary (snd (forth_parse_word max_len vm)) = dictionary vm"
|
||||
by (simp add: forth_parse_word_def Let_def)
|
||||
|
||||
lemma forth_parse_word_preserves_word_id_next:
|
||||
"word_id_next (snd (forth_parse_word max_len vm)) = word_id_next vm"
|
||||
by (simp add: forth_parse_word_def Let_def)
|
||||
|
||||
lemma forth_parse_word_never_sets_error: True
|
||||
\<comment> \<open>vm_parse_word's own C body never touches vm->error -- callers check
|
||||
the returned length themselves and set it. Faithfully NOT set here
|
||||
|
||||
Reference in New Issue
Block a user