Theory PhiSem_Symbol
theory PhiSem_Symbol
imports PhiSem_Base
abbrevs "<symbol>" = "ππππ»ππ
"
begin
text βΉSemantic symbol type is a literal string which cannot be modified runtime and has fixed range
during compilation time and runtime. Some languages have such notion in their semantics, like Ruby,
while such notion can also be used as a pure tool for semantics formalization, for example,
to model the attributes or the field names of a structure. βΊ
section βΉSemanticsβΊ
debt_axiomatization ππππ»ππ
:: TY
and sem_mk_symbol :: βΉsymbol β VALβΊ
and sem_dest_symbol :: βΉVAL β symbolβΊ
where WT_symbol [simp]: βΉWell_Type ππππ»ππ
= { sem_mk_symbol sym | sym. True } βΊ
and can_eqcmp_aint[simp]: βΉCan_EqCompare res (sem_mk_symbol s1) (sem_mk_symbol s2)βΊ
and eqcmp_aint[simp]: βΉEqCompare (sem_mk_symbol s1) (sem_mk_symbol s2) β· s1 = s2βΊ
and zero_aint[simp]: βΉZero ππππ»ππ
= Some (sem_mk_symbol SYMBOL(zero))βΊ
lemma sem_mk_symbol_inj[simp]:
βΉsem_mk_symbol x = sem_mk_symbol y β· x = yβΊ
by (metis eqcmp_aint)
lemma [Οreason add]:
βΉ Is_Type_Literal ππππ»ππ
βΊ
unfolding Is_Type_Literal_def ..
lemma has_Zero_ππππ»ππ
[simp]:
βΉ has_Zero ππππ»ππ
βΊ
unfolding has_Zero_def
by simp
section βΉΟ-TypesβΊ
Οtype_def Symbol :: "(VAL, symbol) Ο"
where βΉs β¦ Symbol β‘ sem_mk_symbol s β¦ ItselfβΊ
deriving Basic
and Abstract_Domainβ©L
and Functionality
and βΉππππΎππΏ Symbol = ππππ»ππ
βΊ
and βΉSemantic_Zero_Val ππππ»ππ
Symbol SYMBOL(zero)βΊ
and Inhabited
and Equiv_Class
lemma [Οreason 1000]:
"ΟEqual Symbol (Ξ»x y. True) (=)"
unfolding ΟEqual_def by simp
section βΉInstructionsβΊ
text βΉThere is no semantic instruction to make a symbol, because they are merely literal string
known during compilation time.βΊ
lemma [Οreason %Οsynthesis_literal]:
βΉX πππΊπππΏππππ s β¦ ππΊπ
[semantic_literal (sem_mk_symbol s)] Symbol ππΎππΊπππ X @tag synthesisβΊ
for X :: assn
unfolding Transformation_def semantic_literal_def Action_Tag_def
by clarsimp
lemma "_intro_symbol_":
βΉS πππΊπππΏππππ S β s β¦ ππΊπ
[semantic_literal (sem_mk_symbol s)] SymbolβΊ
unfolding Transformation_def semantic_literal_def
by clarsimp
Οlang_parser literal_symbol (%Οparser_unique, %Οlang_push_val) ["<string>"]
(βΉCurrentConstruction programming_mode ?blk ?H ?SβΊ) βΉ
fn (oprs,(ctxt,sequent)) => Parse.string >> (fn s => fn _ =>
(oprs, (ctxt, #transformation_rule Phi_Working_Mode.programming
OF [sequent, Thm.instantiate
(TVars.empty, Vars.make [((("s",0),\<^typ>βΉsymbolβΊ),
Thm.cterm_of ctxt (Phi_Tool_Symbol.mk_symbol s))])
@{thm "_intro_symbol_"}])))
βΊ
end