Theory First_Order_Clause.IsaFoR_Ground_Term
theory IsaFoR_Ground_Term
imports
"Regular_Tree_Relations.Ground_Terms"
Parallel_Induct
begin
type_synonym 'f ground_term = "'f gterm"
no_notation Term_Context.position_par (infixl ‹⊥› 67)
abbreviation positions⇩G where
"positions⇩G ≡ gposs"
notation gsubt_at (infixl ‹!⇩t⇩G› 64)
lemma parallel_induct_first_in_positions⇩G [case_names parallel p⇩1_in_t base step]:
assumes
parallel: "p⇩1 ⊥ p⇩2" and
p⇩1_in_t: "p⇩1 ∈ positions⇩G t" and
base:
"⋀p⇩1 p⇩2 i j q⇩1 q⇩2 t f ts.
p⇩1 = i # q⇩1 ⟹
p⇩2 = j # q⇩2 ⟹
i ≠ j ⟹
t = GFun f ts ⟹
i < length ts ⟹ P p⇩1 p⇩2 t" and
step:
"⋀p⇩1 p⇩2 p k i j q⇩1 q⇩2 t f ts.
p⇩1 = k # p @ i # q⇩1 ⟹
p⇩2 = k # p @ j # q⇩2 ⟹
i ≠ j ⟹
t = GFun f ts ⟹
k < length ts ⟹
p⇩1 ∈ positions⇩G t ⟹
P (p @ i # q⇩1) (p @ j # q⇩2) (ts ! k) ⟹
P p⇩1 p⇩2 t"
shows "P p⇩1 p⇩2 t"
using p⇩1_in_t
proof (induction arbitrary: t rule: parallel_induct[OF parallel])
case base': (1 p⇩1 p⇩2 i j q⇩1 q⇩2 t)
then obtain f ts where "t = GFun f ts" "i < length ts"
by (cases t, auto)
then show ?case
using base' base
by metis
next
case step': (2 p⇩1 p⇩2 p k i j q⇩1 q⇩2 t)
then obtain f ts where t: "t = GFun f ts" and k: "k < length ts"
by (cases t, auto)
show ?case
proof (rule step[OF step'(1, 2, 3) t k step'(5)])
let ?p⇩1 = "p @ i # q⇩1"
let ?p⇩2 = "p @ j # q⇩2"
from step' have "?p⇩1 ∈ positions⇩G (ts ! k)"
unfolding t
by simp
then show "P ?p⇩1 ?p⇩2 (ts ! k)"
using step'.IH
by blast
qed
qed
lemma parallel_induct_second_in_positions⇩G [case_names base step]:
assumes
parallel: "p⇩1 ⊥ p⇩2" and
p⇩2_in_t: "p⇩2 ∈ positions⇩G t" and
base:
"⋀p⇩1 p⇩2 i j q⇩1 q⇩2 t f ts.
p⇩1 = i # q⇩1 ⟹
p⇩2 = j # q⇩2 ⟹
i ≠ j ⟹
t = GFun f ts ⟹
j < length ts ⟹ P p⇩1 p⇩2 t" and
step:
"⋀p⇩1 p⇩2 p k i j q⇩1 q⇩2 t f ts.
p⇩1 = k # p @ i # q⇩1 ⟹
p⇩2 = k # p @ j # q⇩2 ⟹
i ≠ j ⟹
t = GFun f ts ⟹
k < length ts ⟹
p⇩2 ∈ positions⇩G t ⟹
P (p @ i # q⇩1) (p @ j # q⇩2) (ts ! k) ⟹
P p⇩1 p⇩2 t"
shows "P p⇩1 p⇩2 t"
using p⇩2_in_t
proof (induction arbitrary: t rule: parallel_induct[OF parallel])
case base': (1 p⇩1 p⇩2 i j q⇩1 q⇩2 t)
then obtain f ts where "t = GFun f ts" "j < length ts"
by (cases t, auto)
then show ?case
using base' base
by metis
next
case step': (2 p⇩1 p⇩2 p k i j q⇩1 q⇩2 t)
then obtain f ts where t: "t = GFun f ts" and k: "k < length ts"
by (cases t, auto)
show ?case
proof (rule step[OF step'(1, 2, 3) t k step'(5)])
let ?p⇩1 = "p @ i # q⇩1"
let ?p⇩2 = "p @ j # q⇩2"
from step' have "?p⇩2 ∈ positions⇩G (ts ! k)"
unfolding t
by simp
then show "P ?p⇩1 ?p⇩2 (ts ! k)"
using step'.IH
by blast
qed
qed
lemma parallel_induct_in_positions⇩G [case_names parallel p⇩1_in_t p⇩2_in_t base step]:
assumes
parallel: "p⇩1 ⊥ p⇩2" and
p⇩1_in_t: "p⇩1 ∈ positions⇩G t" and
p⇩2_in_t: "p⇩2 ∈ positions⇩G t" and
base:
"⋀p⇩1 p⇩2 i j q⇩1 q⇩2 t f ts.
p⇩1 = i # q⇩1 ⟹
p⇩2 = j # q⇩2 ⟹
i ≠ j ⟹
t = GFun f ts ⟹
j < length ts ⟹
i < length ts ⟹
P p⇩1 p⇩2 t" and
step:
"⋀p⇩1 p⇩2 p k i j q⇩1 q⇩2 t f ts.
p⇩1 = k # p @ i # q⇩1 ⟹
p⇩2 = k # p @ j # q⇩2 ⟹
i ≠ j ⟹
t = GFun f ts ⟹
k < length ts ⟹
p⇩1 ∈ positions⇩G t ⟹
p⇩2 ∈ positions⇩G t ⟹
P (p @ i # q⇩1) (p @ j # q⇩2) (ts ! k) ⟹
P p⇩1 p⇩2 t"
shows "P p⇩1 p⇩2 t"
using p⇩1_in_t p⇩2_in_t
proof (induction arbitrary: t rule: parallel_induct[OF parallel ])
case base': (1 p⇩1 p⇩2 i j q⇩1 q⇩2 t)
then obtain f ts where "t = GFun f ts" "j < length ts" "i < length ts"
by (cases t, auto)
then show ?case
using base' base
by metis
next
case step': (2 p⇩1 p⇩2 p k i j q⇩1 q⇩2 t)
then obtain f ts where t: "t = GFun f ts" and k: "k < length ts"
by (cases t, auto)
show ?case
proof (rule step[OF step'(1, 2, 3) t k step'(5, 6)])
let ?p⇩1 = "p @ i # q⇩1"
let ?p⇩2 = "p @ j # q⇩2"
from step' have "?p⇩1 ∈ positions⇩G (ts ! k)" "?p⇩2 ∈ positions⇩G (ts ! k)"
unfolding t
by simp_all
then show "P ?p⇩1 ?p⇩2 (ts ! k)"
using step'.IH
by blast
qed
qed
end