Theory Ground_Context

theory Ground_Context
  imports Ground_Term_Extra
begin

type_synonym 'f ground_context = "('f, 'f gterm) actxt"

abbreviation (input) GHole (G) where
  "G  "

abbreviation ctxt_apply_gterm (‹__G [1000, 0] 1000) where
  "CsG  GFunC;s"

lemma le_size_gctxt: "size t  size (ctG)"
  by (induction c) simp_all

lemma lt_size_gctxt: "c    size t < size ctG"
  by (induction c) force+

lemma gctxt_ident_iff_eq_GHole[simp]: "ctG = t  c = "
proof (rule iffI)
  assume "ctG = t"

  hence "size (ctG) = size t"
    by argo

  thus "c = "
    using lt_size_gctxt[of c t]
    by linarith
next
  show "c =   ctG = t"
    by simp
qed

end