Theory ArityTransform

theory ArityTransform
imports ArityAnalysisSig AbstractTransform ArityEtaExpansionSafe
theory ArityTransform
imports ArityAnalysisSig AbstractTransform ArityEtaExpansionSafe
begin

context ArityAnalysisHeapEqvt
begin
sublocale AbstractTransformBound
  "λ a . inc⋅a"
  "λ a . pred⋅a"
  "λ Δ e a . (a, Aheap Δ e⋅a)"
  "fst"
  "snd"
  "λ _. 0"
  "Aeta_expand"
  "snd"
apply standard
apply (((rule eq_reflection)?, perm_simp, rule)+)
done

abbreviation transform_syn ("𝒯_") where "𝒯a ≡ transform a"

lemma transform_simps:
  "𝒯a (App e x) = App (𝒯inc⋅a e) x"
  "𝒯a (Lam [x]. e) = Lam [x]. 𝒯pred⋅a e"
  "𝒯a (Var x) = Var x"
  "𝒯a (Let Γ e) = Let (map_transform Aeta_expand (Aheap Γ e⋅a) (map_transform (λa. 𝒯a) (Aheap Γ e⋅a) Γ)) (𝒯a e)"
  "𝒯a (Bool b) = Bool b"
  "𝒯a (scrut ? e1 : e2) = (𝒯0 scrut ? 𝒯a e1 : 𝒯a e2)"
  by simp_all
end


end