proof/: partially close the dictionary-insertion gap (StarForth_Defining_Words.thy)

Every prior file in the word-source sweep only ever read the abstract
dictionary table; none modelled insertion. dict_insert_entry now models
the word_id-assignment/dictionary-table/latest_id/word_id_next-counter
portion of vm_create_word (dictionary_management.c:379-470), reusing
word_id_next :: nat -- a field already declared in StarForth_Base.thy but
never previously written by any theory. Applied to :, CREATE, VARIABLE,
CONSTANT (StarForth_Defining_Words.thy) and DEFER (StarForth_Defer_Words.thy)
via forth_*_entry_half definitions, each named to keep visible what's
still not modelled: the TIB name-parse dependency, the DF (data-field)
write each word does afterward, and (for :) vm->compiling_word tracking,
none of which have a vm_state counterpart. Pin-shadow conflicts are
sidestepped via an explicit pinned_conflict :: bool parameter, the same
technique already used for the XT-pop gap elsewhere in this suite.

Full suite (54 theories) verifies green.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Robert Allan James
2026-08-14 22:31:26 -04:00
co-authored by Claude Sonnet 5
parent dfdabcc2d7
commit cc46cf83f1
3 changed files with 256 additions and 43 deletions
+23 -2
View File
@@ -1,5 +1,5 @@
theory StarForth_Defer_Words
imports StarForth_Base
imports StarForth_Base StarForth_Defining_Words
begin
(* =========================================================================
@@ -66,7 +66,28 @@ lemma is_guard_rest_not_modelled: True
query in this model), and the DF store (gap b). See file header.\<close>
by simp
lemma defer_not_modelled: True \<comment> \<open>DEFER: vm_create_word (gap a) + DF zero-init (gap b).\<close>
(* ── DEFER: entry-creation half, gap (a) PARTIALLY CLOSED 2026-08-14 ─────
`word_defer` (src/word_source/defer_words.c:73-101) calls
`vm_create_word(vm, name, len, defer_runtime)` with no extra flags set
afterward -- same shape as StarForth_Defining_Words.thy's CREATE/
VARIABLE/CONSTANT, reusing `dict_insert_entry 0` directly. NOT modelled:
the name parse (TIB gap), and the DF zero-init that follows (gap b). *)
definition forth_defer_entry_half :: "bool \<Rightarrow> vm_state \<Rightarrow> vm_state" where
"forth_defer_entry_half pinned_conflict vm = dict_insert_entry 0 pinned_conflict vm"
lemma defer_entry_half_populates_dictionary:
assumes "\<not> pinned_conflict"
shows "\<exists>e. dictionary (forth_defer_entry_half pinned_conflict vm) (word_id_next vm) = Some e
\<and> de_flags e = 0"
using assms by (simp add: forth_defer_entry_half_def dict_insert_entry_def Let_def)
lemma defer_entry_half_pinned_conflict_errors:
assumes "pinned_conflict"
shows "vm_error (forth_defer_entry_half pinned_conflict vm)"
using assms by (simp add: forth_defer_entry_half_def dict_insert_entry_def set_error_def)
lemma defer_not_modelled: True \<comment> \<open>DEFER beyond the entry-creation half: name parse (TIB gap) + DF zero-init (gap b). See forth_defer_entry_half above for what IS now modelled.\<close>
by simp
lemma defer_runtime_not_modelled: True \<comment> \<open>defer_runtime: DF read (gap b) + call-through (gap c).\<close>
by simp