Theory ArityAnalysisSig

theory ArityAnalysisSig
imports Launchbury.Terms AEnv "Arity-Nominal" "Launchbury.Nominal-HOLCF"  Launchbury.Substitution
begin

locale ArityAnalysis =
  fixes Aexp :: "exp  Arity  AEnv"
begin
  abbreviation Aexp_syn ("𝒜⇘_")where "𝒜⇘ae  Aexp ea"
  abbreviation Aexp_bot_syn ("𝒜_")
    where "𝒜ae  fup(Aexp e)a"

end

locale ArityAnalysisHeap =
  fixes Aheap :: "heap  exp  Arity  AEnv"

locale EdomArityAnalysis = ArityAnalysis + 
  assumes Aexp_edom: "edom (𝒜⇘ae)  fv e"
begin

  lemma fup_Aexp_edom: "edom (𝒜ae)  fv e"
    by (cases a) (auto dest:subsetD[OF Aexp_edom])
  
  lemma Aexp_fresh_bot[simp]: assumes "atom v  e" shows "𝒜⇘ae v = "
  proof-
    from assms have "v  fv e" by (metis fv_not_fresh)
    with Aexp_edom have "v  edom (𝒜⇘ae)" by auto
    thus ?thesis unfolding edom_def by simp
  qed
end

locale ArityAnalysisHeapEqvt = ArityAnalysisHeap + 
  assumes Aheap_eqvt[eqvt]: "π  Aheap = Aheap"

end