Theory TTreeAnalysisSpec

theory TTreeAnalysisSpec
imports TTreeAnalysisSig ArityAnalysisSpec "Cardinality-Domain-Lists"
begin

locale TTreeAnalysisCarrier = TTreeAnalysis + EdomArityAnalysis +
  assumes carrier_Fexp: "carrier (Texp ea) = edom (Aexp ea)"

locale TTreeAnalysisSafe = TTreeAnalysisCarrier +
  assumes Texp_App: "many_calls x ⊗⊗ (Texp e)(inca)  Texp (App e x)a"
  assumes Texp_Lam: "without y (Texp e(predn))  Texp (Lam [y]. e)  n"
  assumes Texp_subst: "Texp (e[y::=x])a  many_calls x ⊗⊗ without y ((Texp e)a)"
  assumes Texp_Var: "single v  Texp (Var v)a"
  assumes Fun_repeatable: "isVal e  repeatable (Texp e0)"
  assumes Texp_IfThenElse: "Texp scrut0 ⊗⊗ (Texp e1a ⊕⊕ Texp e2a)  Texp (scrut ? e1 : e2)a"

locale TTreeAnalysisCardinalityHeap = 
  TTreeAnalysisSafe + ArityAnalysisLetSafe + 
  fixes Theap :: "heap  exp  Arity  var ttree"
  assumes carrier_Fheap: "carrier (Theap Γ ea) = edom (Aheap Γ ea)"
  assumes Theap_thunk: "x  thunks Γ  p  paths (Theap Γ ea)  ¬ one_call_in_path x p  (Aheap Γ ea) x = up0"
  assumes Theap_substitute: "ttree_restr (domA Δ) (substitute (FBinds Δ(Aheap Δ ea)) (thunks Δ) (Texp ea))  Theap Δ ea"
  assumes Texp_Let: "ttree_restr (- domA Δ) (substitute (FBinds Δ(Aheap Δ ea))  (thunks Δ) (Texp ea))  Texp (Terms.Let Δ e)a"


end