Theory Instance
section ‹Instantiation of Syntax-Independent Logic Infrastructure›
theory Instance
imports "Syntax_Independent_Logic.Standard_Model" "Syntax_Independent_Logic.Deduction_Q" Robinson_Arithmetic
begin
subsection ‹Preliminaries›
inductive_set num :: "trm set" where
zer[intro!,simp]: "zer ∈ num"
|suc[simp]: "t ∈ num ⟹ suc t ∈ num"
definition ground_aux :: "trm ⇒ atom set ⇒ bool"
where "ground_aux t S ≡ (supp t ⊆ S)"
abbreviation ground :: "trm ⇒ bool"
where "ground t ≡ ground_aux t {}"
definition ground_fmla_aux :: "fmla ⇒ atom set ⇒ bool"
where "ground_fmla_aux A S ≡ (supp A ⊆ S)"
abbreviation ground_fmla :: "fmla ⇒ bool"
where "ground_fmla A ≡ ground_fmla_aux A {}"
lemma ground_aux_simps[simp]:
"ground_aux zer S = True"
"ground_aux (Var k) S = (if atom k ∈ S then True else False)"
"ground_aux (suc t) S = (ground_aux t S)"
"ground_aux (pls t u) S = (ground_aux t S ∧ ground_aux u S)"
"ground_aux (tms t u) S = (ground_aux t S ∧ ground_aux u S)"
unfolding ground_aux_def
by (simp_all add: supp_at_base)
lemma ground_fmla_aux_simps[simp]:
"ground_fmla_aux fls S = True"
"ground_fmla_aux (t EQ u) S = (ground_aux t S ∧ ground_aux u S)"
"ground_fmla_aux (A OR B) S = (ground_fmla_aux A S ∧ ground_fmla_aux B S)"
"ground_fmla_aux (A AND B) S = (ground_fmla_aux A S ∧ ground_fmla_aux B S)"
"ground_fmla_aux (A IFF B) S = (ground_fmla_aux A S ∧ ground_fmla_aux B S)"
"ground_fmla_aux (neg A) S = (ground_fmla_aux A S)"
"ground_fmla_aux (exi x A) S = (ground_fmla_aux A (S ∪ {atom x}))"
by (auto simp: ground_fmla_aux_def ground_aux_def supp_conv_fresh)
lemma ground_fresh[simp]:
"ground t ⟹ atom i ♯ t"
"ground_fmla A ⟹ atom i ♯ A"
unfolding ground_aux_def ground_fmla_aux_def fresh_def
by simp_all
definition "Fvars t = {a :: name. ¬ atom a ♯ t}"
lemma Fvars_trm_simps[simp]:
"Fvars zer = {}"
"Fvars (Var a) = {a}"
"Fvars (suc x ) = Fvars x"
"Fvars (pls x y) = Fvars x ∪ Fvars y"
"Fvars (tms x y) = Fvars x ∪ Fvars y"
by (auto simp: Fvars_def fresh_at_base(2))
lemma finite_Fvars_trm[simp]:
fixes t :: trm
shows "finite (Fvars t)"
by (induct t rule: trm.induct) auto
lemma Fvars_fmla_simps[simp]:
"Fvars (x EQ y) = Fvars x ∪ Fvars y"
"Fvars (A OR B) = Fvars A ∪ Fvars B"
"Fvars (A AND B) = Fvars A ∪ Fvars B"
"Fvars (A IMP B) = Fvars A ∪ Fvars B"
"Fvars fls = {}"
"Fvars (neg A) = Fvars A"
"Fvars (exi a A) = Fvars A - {a}"
"Fvars (all a A) = Fvars A - {a}"
by (auto simp: Fvars_def fresh_at_base(2))
lemma finite_Fvars_fmla[simp]:
fixes A :: fmla
shows "finite (Fvars A)"
by (induct A rule: fmla.induct) auto
lemma subst_trm_subst_trm[simp]:
"x ≠ y ⟹ atom x ♯ u ⟹ subst y u (subst x t v) = subst x (subst y u t) (subst y u v)"
by (induct v rule: trm.induct) auto
lemma subst_fmla_subst_fmla[simp]:
"x ≠ y ⟹ atom x ♯ u ⟹ (A(x::=t))(y::=u) = (A(y::=u))(x::=subst y u t)"
by (nominal_induct A avoiding: x t y u rule: fmla.strong_induct) auto
lemma Fvars_empty_ground[simp]: "Fvars t = {} ⟹ ground t"
by (induct t rule: trm.induct) auto
lemma Fvars_ground_aux: "Fvars t ⊆ B ⟹ ground_aux t (atom ` B)"
by (induct t rule: trm.induct) auto
lemma ground_Fvars: "ground t ⟷ Fvars t = {}"
apply (rule iffI)
subgoal by (auto simp only: Fvars_def ground_fresh) []
by auto
lemma Fvars_ground_fmla_aux: "Fvars A ⊆ B ⟹ ground_fmla_aux A (atom ` B)"
apply (induct A arbitrary: B rule: fmla.induct)
subgoal by (auto simp: Diff_subset_conv Fvars_ground_aux)
subgoal by (auto simp: Diff_subset_conv Fvars_ground_aux)
subgoal by (auto simp: Diff_subset_conv Fvars_ground_aux)
subgoal by (metis Diff_subset_conv Fvars_fmla_simps(7) Un_insert_left
Un_insert_right ground_fmla_aux_simps(7)
image_insert sup_bot.left_neutral sup_bot.right_neutral) .
lemma ground_fmla_Fvars: "ground_fmla A ⟷ Fvars A = {}"
apply (rule iffI)
subgoal by (auto simp only: Fvars_def ground_fresh)
by (auto intro: Fvars_ground_fmla_aux[of A "{}", simplified])
lemma obtain_const_trm:
obtains t where "eval_trm e t = x" "t ∈ num"
apply (induct x)
using eval_trm.simps(1) eval_trm.simps(3) num.suc by blast+
lemma ex_eval_fmla_iff_exists_num:
"eval_fmla e (exi k A) ⟷ (∃t. eval_fmla e (A(k::=t)) ∧ t ∈ num)"
by (auto simp: eval_subst_fmla) (metis obtain_const_trm)
lemma exi_ren: "y ∉ Fvars φ ⟹ exi x φ = exi y (φ(x::=Var y))"
using exi_ren_subst_fresh Fvars_def by blast
lemma all_ren: "y ∉ Fvars φ ⟹ all x φ = all y (φ(x::=Var y))"
by (simp add: exi_ren)
lemma Fvars_num[simp]: "t ∈ num ⟹ Fvars t = {}"
by (induct t rule: trm.induct) (auto elim: num.cases)
subsection ‹Instantiation of the generic syntax and deduction relation›