Theory Substitution_First_Order_Term
theory Substitution_First_Order_Term
imports
Based_Substitution
"First_Order_Terms.Unification"
"Regular_Tree_Relations.Ground_Terms"
begin
section ‹Substitutions for first order terms›
subsection ‹Interpretations for first order terms›
abbreviation (input) apply_subst where
"apply_subst x σ ≡ σ x"
abbreviation (input) is_ground where
"is_ground t ≡ vars_term t = {}"
global_interpretation "term": base_substitution where
comp_subst = "(∘⇩s)" and id_subst = Var and subst = "(⋅)" and vars = vars_term and
apply_subst = apply_subst and is_ground = is_ground
proof unfold_locales
fix x :: 'v
show "vars_term (Var x) = {x}"
by simp
next
fix σ σ' :: "('f, 'v) subst" and x
show "(σ ∘⇩s σ') x = σ x ⋅ σ'"
unfolding subst_compose_def ..
next
fix t :: "('f, 'v) term" and ρ :: "('f, 'v) subst"
show "vars_term (t ⋅ ρ) = ⋃ (vars_term ` ρ ` vars_term t)"
using vars_term_subst .
next
fix t :: "('f, 'v) term"
assume "vars_term t = {}"
then show "∀σ. t ⋅ σ = t"
by (simp add: ground_term_subst)
next
fix t and γ :: "('f, 'v) subst"
assume "is_ground (t ⋅ γ)"
then show "∀x∈vars_term t. is_ground (γ x)"
by (meson ground_substD ground_vars_term_empty)