Theory Abstract_Substitution.Substitution_First_Order_Term
theory Substitution_First_Order_Term
  imports
    Substitution
    "First_Order_Terms.Unification"
begin
abbreviation is_ground_trm where
  "is_ground_trm t ≡ vars_term t = {}"
lemma is_ground_iff: "is_ground_trm (t ⋅ γ) ⟷ (∀x ∈ vars_term t. is_ground_trm (γ x))"
  by (induction t) simp_all
lemma is_ground_trm_iff_ident_forall_subst: "is_ground_trm t ⟷ (∀σ. t ⋅ σ = t)"
proof(induction t)
  case Var
  then show ?case
    by auto
next
  case Fun
  moreover have "⋀xs x σ. ∀σ. map (λs. s ⋅ σ) xs = xs ⟹ x ∈ set xs ⟹ x ⋅ σ = x"
    by (metis list.map_ident map_eq_conv)
  ultimately show ?case
    by (auto simp: map_idI)
qed