Pith. sign in

REVIEW 2 major objections 4 minor 15 references

A Transformational Approach to Resource Analysis with Typed-norms Inference

T0 review · 2 major / 4 minor · reviewed 2026-08-14 · deepseek-v4-flash

Pith's one-line read The paper proves that replacing data by typed-norm sizes in a rule-based program preserves the step-by-step shape of every trace, so upper and lower cost bounds computed on the abstract program are automatically valid for the original…

desk verdict The program transformation and its soundness theorem are solid, but the paper overstates the completeness of its relevant-types inference: Theorem 3 is not valid as written for non-recursive types whose constructors select different trace branches. read the letter →

arxiv 1908.02078 v1 pith:32GWBN37 submitted 2019-08-06 cs.PL cs.LO

classification cs.PLcs.LO
keywords resourceanalysistyped-normsdata-flowprogramtransformationcostsizeabstractionupperboundspolymorphictypes
verification ladder T0 review T1 audit T2 compute T3 formal

The pith

A machine-rendered reading of the paper's core claim, the machinery that carries it, and where it could break.

The reading

Resource analyzers need to know how data sizes change as a program runs, and the choice of size measure (norm) determines how precise the inferred cost bounds are. This paper proposes to measure each data value by several typed-norms—norms that count constructors of a specific recursive type inside the value—and to decide automatically which norms are relevant. The method transforms a program, written in a small rule-based form, into an abstract program where every variable is replaced by one integer per relevant norm; the paper proves that this transformation preserves the sequence of evaluation steps, so any upper or lower cost bound obtained on the abstract program is a valid bound on the concrete program. A companion data-flow analysis infers a smallest set of relevant typed-norms by propagating, through guards and calls, the types that can influence whether a recursive step is taken. Experiments on list-manipulation and object-oriented benchmarks show bounds orders of magnitude tighter than term-size norms, at comparable analysis times.

What carries the argument

The central object is a symbolic typed-norm \|t\|_T and its sum variant, which count how many constructors of type T occur inside a term, using max when the term's own type differs. The abstraction function (·)^α rewrites guards and assignments into linear constraints over abstract size variables, and the data-flow functions gen_P, genS, and genG compute which types must be tracked by propagating type relevance through match guards and procedure calls; the least fixed point of gen_P yields the relevant types. What carries the argument is the trace-preservation theorem: the abstract operational semantics mimics every concrete step with identical decorations, so the subsequent cost-relation solver can be treated as a black box.

What would settle it

Run the paper's data-flow inference on a program where a nullary constructor of a non-recursive type selects between a terminating base rule and a recursive rule. Definition 17 declares that type useful because replacing the constructor changes the set of trace steps, while Section 4.1's match rule deliberately ignores non-recursive types, so the inference output will omit the type. Observing a concrete trace whose step count changes when only that constructor changes, with no typed-norm size changing, directly falsifies Theorem 3.

Watch

Extended reading notes

Core claim

The central claim is that typed-norm-based size abstraction can be made both sound and automatic. Given a rule-based program, the transformation replaces each variable x by one abstract integer variable X_T for each relevant type T in the constituent types of x, with equalities such as X_{IntList} = 1 + X'_{IntList} for a match on Cons. The soundness theorem shows that for every concrete trace there is an abstract trace with exactly the same step decorations and consistent size constraints, which transfers worst-case upper bounds and best-case lower bounds from the abstract program back to the original. The second claim is that the relevant typed-norms are computable: a monotone data-flow analysis over rules, guards, and calls reaches a least fixed point, and a soundness result states that every 'useful' type—one whose variation changes the set of trace steps—is included in the inferred relevant types. The paper also extends the framework to polymorphic types by monomorphisation and to context-sensitive norms by annotating non-recursive type occurrences with their positions.

Load-bearing premise

The proof that every useful type is inferred assumes that any change in program behavior that alters cost is reflected as a change in the size of some value under a typed-norm; a flag-like constructor that is never counted by a norm would violate this.

Editorial extensions

If this is right

  • Any cost bound proven on the abstract program—upper on worst case or lower on best case—automatically holds for the original program, because every concrete trace has an abstract mirror with the same sequence of steps.
  • Tracking several typed-norms per value yields materially tighter bounds than a single term-size norm: on list benchmarks the evaluated bounds are often an order of magnitude smaller, while total analysis time stays comparable.
  • Discarding irrelevant typed-norms before solving does more than save time: by shrinking the number of size variables it can change which ranking functions the solver finds, so the inferred bound can differ and in the experiments is usually smaller.
  • Because the framework is defined on a rule-based representation, the same transformation applies to functional, imperative, and logic programs; logic programs only need matching to be read as unification.
  • Polymorphic procedures can be analyzed by instantiating each type variable to a fresh monomorphic type, and context-sensitive norms refine the bound when one non-recursive type appears in several positions of a data structure.

Reading between the lines

Editorial extensions of the paper, not claims the author makes directly.

  • Editorial inference: the proof of Theorem 3 appears to overreach—a nullary constructor of a non-recursive type can switch between a base rule and a recursive rule, changing trace steps while leaving every typed-norm size unchanged; restricting 'useful' to recursive and integer types, or counting branch-selecting constructors, would make the theorem valid as stated.
  • Editorial inference: since the soundness theorem preserves full step sequences, not just total cost, the transformation is also a candidate front-end for amortized analyses, which need per-step potential rather than only aggregate bounds.
  • Editorial inference: the position annotations for context-sensitive norms are a finite set of paths through a type tree; the same data-flow machinery might infer these paths automatically, making context sensitivity a derived feature rather than an input annotation.
Share X Bluesky LinkedIn Reddit HN

Signed reviews

No signed human review yet.

Editorial analysis

A structured set of objections, weighed in public.

Desk editor's note, referee report, and a circularity audit.

Referee Report

2 major / 4 minor

Summary. The paper presents a transformational framework for resource analysis in which programs in a rule-based representation are abstracted to constraint programs using typed-norms. For each variable, the relevant types are inferred by a data-flow analysis, and the abstract program is generated with respect to these types. The authors prove soundness of the transformation (Theorem 1), prove termination and a so-called soundness of the relevant-type inference (Theorems 2 and 3), extend the framework to polymorphic types and context-sensitive norms, and evaluate it in the SACO system against RAML and sized-types benchmarks.

Significance. If the claims held, the paper would make a solid contribution: it provides a clean separation between the size-abstraction phase and the cost solver, formal proofs in Appendix A for the trace-preservation result, and an automatic method for pruning typed-norms that is validated on external benchmarks. The experimental comparison is honest and includes cases where the approach fails, such as hanoi. However, the completeness guarantee for relevant-type inference, which is a central advertised contribution, is not valid as stated: Definition 17 and the inference function genG in Section 4.1 are inconsistent for non-recursive discriminator types. The soundness of Theorem 1 is unaffected, but the 'smallest sets' claim and the inference soundness theorem need repair.

major comments (2)
  1. [Section 4.1, Definition 17, Theorem 3] The inference function genG^P_i(match(x,p),sigma) in Figure 6 adds type_i(x) only when type_i(x) is recursive, and the surrounding text states that non-recursive types are ignored because they cannot directly affect the number of recursions. This is false for nullary constructors of non-recursive types. Consider data Dir = Up | Down and rules f(x) <- match(x,Up), base; f(x) <- match(x,Down), f(x). In the first rule, Dir is not recursive and the pattern has no variables, so lfp(gen_P)(1)(x) contains no Dir. Yet varying x from Up to Down changes the set of trace steps, so useful_Dir_1(x) holds by Definition 17. Theorem 3 therefore fails as written. The same issue arises for nonmatch(x,p), whose genG clause also omits type_i(x). The fix is either to restrict Definition 17 to types whose variation is observable by the typed norms, or to extend genG to track non-recursive types that discriminate between rules, and to update Theorem 3 accordingly.
  2. [Section 4.2, Definitions 16-17, Theorem 3] Even if the counterexample above were excluded, the theorem is stronger than what the algorithm can deliver because Definition 17 defines usefulness in terms of arbitrary value variations and trace sets, not in terms of changes in any typed-norm size. A value variation of a type T can change the control flow without changing any ||.||_T or ||.||+_T value, since Up and Down both have size 1. Because the abstraction in Section 3.2 only tracks numeric sizes, a type that is useful under Definition 17 may be invisible to the abstract program. Conversely, the algorithm may also infer types that are not useful under Definition 17, since genG adds every recursive type of x in match guards regardless of whether the procedure is recursive; the text acknowledges this in practice but the formal definition does not. The paper's claim that the inferred sets are the 'smallest sets' of relevant typed-norms that preserve precision is therefore not supported in either direction.
minor comments (4)
  1. [Definition 15] The definition of rule mapping combination contains the typo 'integerdividedom' in two places; it should be set difference.
  2. [Figure 8] Line 32 of Figure 8 writes 'main(<> x <r'>)' using a multiplication symbol instead of the angle-bracket separator used elsewhere; this is a typographical error.
  3. [Section 4.2] Theorem 3 is labeled 'Soundness', but it is a completeness statement: it says every useful type is inferred. The authors should rename it to avoid confusion with the soundness of the transformation in Theorem 1.
  4. [Section 3.2, after Example 7] The Dir/Up/Down example already shows that non-recursive discriminator types collapse in the abstraction; this observation should be reconciled with the claims of Section 4, since the mismatch is not merely a proof gap but a substantive overclaim.

Circularity Check

0 steps flagged · score 0.0 of 10

No significant circularity: the abstraction and relevant-type inference are proved independently of the experimental benchmarks, and no fitted parameter is relabeled as a prediction.

full rationale

The paper's central derivation chain is self-contained rather than circular. Section 3 fixes typed-norms in Definition 8 and the symbolic abstraction in Definition 9, then proves Theorem 1 by induction on the concrete operational semantics, explicitly constructing an abstract trace with the same step decorations and showing the accumulated constraints are satisfiable. The relevant-type inference in Section 4 is defined as a monotone data-flow analysis (Figure 6) and its soundness is argued in Section 4.2; the inferred rtypes are not obtained by fitting the experimental results, and the cost bounds are compared against external RAML and sized-types benchmarks in Section 6. The only self-citations are contextual: the removal of useless variables is credited to the authors' prior work (Albert et al. 2008) and the article extends the authors' LOPSTR 2013 paper, but the formal soundness proofs in this manuscript do not reduce to those citations. The skeptical observation about Theorem 3, concerning nullary constructors of non-recursive types being useful under Definition 17 yet never inferred, points to a possible correctness gap in the completeness statement, not to circularity: the theorem's conclusion is not definitionally equivalent to its assumptions, and the soundness of the cost abstraction (Theorem 1) does not depend on that completeness claim. Therefore no circular step meets the evidentiary standard required by the review rules.

Assumptions & free parameters 0 free parameters · 4 assumptions · 0 invented entities

There are no fitted constants and no new physical or semantic entities. The abstract size variables are analysis artifacts, not invented program entities. The main fragility is the assumption that cost-relevant control flow is always visible in typed-norm sizes, which enters in Section 4.1.

assumptions (4)
  • domain assumption RBR programs are well-typed with monomorphic types and recursive types in direct recursive form.
    Section 2.1, Definitions 1 and 2. The abstraction and inference are defined over these types; mutually recursive types are collapsed into the same type.
  • standard math The program is finite and type sets are finite, so the mapping lattice is finite and gen_P has a least fixed point.
    Section 4.1, Theorem 2 depends on standard Tarski/Kleene fixed-point results over finite lattices.
  • domain assumption Typed norms are compatible with term and guard evaluation, as stated in Lemmas 1 and 2.
    Appendix A uses these lemmas as the bridge between the concrete operational semantics and the abstract constraint semantics; any norm satisfying them yields a sound transformation.
  • ad hoc to paper Non-recursive types cannot directly affect the number of recursions, so they are omitted in match guards.
    Section 4.1, definition of genG for match(x,p). This is the fragile premise: a nullary constructor of a non-recursive type can select between a base and a recursive branch, changing trace steps without changing any typed-norm size, which makes Theorem 3 false as stated.

how reviews work

0 comments
Cite this review

Pith. "Pith review of A Transformational Approach to Resource Analysis with Typed-norms Inference." pith.science (2026). https://pith.science/paper/32GWBN37

@misc{pith2026190802078,
  author       = {Pith},
  title        = {Pith review of: A Transformational Approach to Resource Analysis with Typed-norms Inference},
  year         = {2026},
  howpublished = {\url{https://pith.science/paper/32GWBN37}},
  note         = {Machine review of arXiv:1908.02078}
}
read the original abstract

In order to automatically infer the resource consumption of programs, analyzers track how data sizes change along program's execution. Typically, analyzers measure the sizes of data by applying norms which are mappings from data to natural numbers that represent the sizes of the corresponding data. When norms are defined by taking type information into account, they are named typed-norms. This article presents a transformational approach to resource analysis with typed-norms that are inferred by a data-flow analysis. The analysis is based on a transformation of the program into an intermediate abstract program in which each variable is abstracted with respect to all considered norms which are valid for its type. We also present the data-flow analysis to automatically infer the required, useful, typed-norms from programs. Our analysis is formalized on a simple rule-based representation to which programs written in different programming paradigms (e.g., functional, logic, imperative) can be automatically translated. Experimental results on standard benchmarks used by other type-based analyzers show that our approach is both efficient and accurate in practice. Under consideration in Theory and Practice of Logic Programming (TPLP).

Figures

Figures reproduced from arXiv: 1908.02078 by the authors.

Figure 1
Figure 1. RBR program. (1) b ≡ x:=t evalt(t, lv) = v hp, b·bs, lvi·C ❀ hp, bs, lv[x 7→ v]i·C (2) b ≡ m(¯x, y¯) m(x¯′ , y¯′) ← g, b1 · · · bk ∈ P fresh lv1 ≡ [x ′ 7→ lv(x)] evalg (g, lv1 ) = lv2 hp, b·bs, lvi·C ❀ hm, b1 · · · bk , lv1 ⊎ lv2 i·hp[y ′ ∼ y], bs, lvi·C (3) hm, ǫ, lv1 i·hp[y ′ ∼ y], bs, lvi·C ❀ hp, bs, lv[y 7→ lv1 (y ′)]i·C [PITH_FULL_IMAGE:figures/full_fig_p006_1.png] view at source ↗
Figure 2
Figure 2. Operational semantics of rule-based programs [PITH_FULL_IMAGE:figures/full_fig_p006_2.png] view at source ↗
Figure 3
Figure 3. Size abstraction for guards, statements, rules, and proc [PITH_FULL_IMAGE:figures/full_fig_p014_3.png] view at source ↗
Figures from the paper (15 more)
Figure 4
Figure 4. Figure 4: Abstraction of a fragment of the RBR program from Figure 1 [PITH_FULL_IMAGE:figures/full_fig_p016_4.png]
Figure 5
Figure 5. Figure 5: Operational semantics of abstract rule-based programs [PITH_FULL_IMAGE:figures/full_fig_p017_5.png]
Figure 6
Figure 6. Figure 6: Functions for inferring typed-norms. Next we explain the inference algorithm, which is based on the definition of genP that is given in [PITH_FULL_IMAGE:figures/full_fig_p022_6.png]
Figure 7
Figure 7. Figure 7: RBR program with polymorphic types. Example 12 (Polymorphic list) Using the syntax presented in Definition 18 we can define the data type of a polymorphic list (ListhAi) as follows: data ListhAi = Nil | Cons(A, ListhAi) The type IntList in Definition 1 can be represent…
Figure 8
Figure 8. Figure 8: Transformed RBR program. Notice that, in this example, the number of arguments of head and tail procedures in the different instantiated versions of [PITH_FULL_IMAGE:figures/full_fig_p026_8.png]
Figure 9
Figure 9. Figure 9: Abstraction of the polymorphic RBR program. [PITH_FULL_IMAGE:figures/full_fig_p027_9.png]
Figure 10
Figure 10. Figure 10: Unrolled type definition tree view of type [PITH_FULL_IMAGE:figures/full_fig_p028_10.png]
Figure 11
Figure 11. Figure 11: Abstraction of RBR program with context-sensitive norms [PITH_FULL_IMAGE:figures/full_fig_p029_11.png]
Figure 12
Figure 12. Figure 12: Median number of steps when evaluating the upper bounds fo [PITH_FULL_IMAGE:figures/full_fig_p030_12.png]
Figure 13
Figure 13. Figure 13: Median number of steps when evaluating the upper bounds fo [PITH_FULL_IMAGE:figures/full_fig_p030_13.png]
Figure 14
Figure 14. Figure 14: Median number of steps when evaluating the upper bounds fo [PITH_FULL_IMAGE:figures/full_fig_p031_14.png]
Figure 15
Figure 15. Figure 15: Time (milliseconds) to obtain upper bounds for the list manipula [PITH_FULL_IMAGE:figures/full_fig_p033_15.png]
Figure 16
Figure 16. Figure 16: Time (milliseconds) to obtain upper bounds for Chat methods [PITH_FULL_IMAGE:figures/full_fig_p033_16.png]
Figure 17
Figure 17. Figure 17: Time (milliseconds) to obtain upper bounds for ETICS method [PITH_FULL_IMAGE:figures/full_fig_p034_17.png]
Figure 18
Figure 18. Figure 18: Complexity order of the upper bounds obtained by [PITH_FULL_IMAGE:figures/full_fig_p035_18.png]

Discussion (0). Continue with ORCID to comment.

Reference graph

Works this paper leans on

15 extracted references · 15 canonical work pages

  1. [1]

    (X =X ′∧gα∧ψn−1)∧ (lv α 1∧ lv α 2∧ ~ψn−1 ) = ψn∧ ~ψn⁄|= false, from the soundness theorem

  2. [2]

    We will focus only on the first statement as it implies the second one by Prop

    (X =X ′∧gα∧ψn−1)⁄|= false, i.e., the abstract step is valid. We will focus only on the first statement as it implies the second one by Prop. 3. By Prop. 4 we have that ( X =X ′∧ψn−1)∧ (lv α 1∧ ~ψn−1 )⁄|= false, because: — ⋀ x∈x,T ∈rtypes(x){XT = ‖lv (x )‖T} ∈ ~ψn−1, with ‖lv (x )‖T ∈ Z, by definition of configuration transformation, and — lv α 1 = [x ′↦→lv (...

  3. [3]

    C ′ 0 =⟨p, b·bs, lv ′⟩· C ′ with lv ′ = lv [x↦→v ] and lv (x )⊲T v

  4. [4]

    ∧ lv α k )⁄|= false, from the soundness theorem

    ψn∧ ~ψn = (ψn−1∧Y =Y ′)∧ (lv α∧ Yi = zi∧ lv α 1∧ lv α 2∧... ∧ lv α k )⁄|= false, from the soundness theorem

  5. [5]

    The first statement implies the second one by Prop

    ψn−1∧Y =Y ′⁄|= false, i.e., the abstract step is valid. The first statement implies the second one by Prop. 3, so we focus o nly on the first one. By IH we haveψn−1∧ ~ψn−1⁄|= false, so we can apply Prop. 4 and obtain that ψn−1∧Yi =Y ′ i∧ ~ψn−1∧Yi =zi⁄|= false, i.e.,ψn−1∧Yi =Y ′ i∧lv α 0∧lv α∧lv α 1∧lv α 2∧...∧lv α k∧Yi = zi⁄|= false. By Prop. 3 we can remov...

  6. [6]

    x⇒T x1 in some step Cp1 ❀ Cp1 +1 ,

  7. [7]

    x1⇒T x2 in some subsequent step Cp2 ❀ Cp2 +1 , . . . (k-1). xk−2⇒T xk−1 in some subsequent step Cpk −1 ❀ Cpk −1 +1 , k. xk−1⇒T y in step Cpk ❀ Cpk +1 with pk >p k−1 Finally, we will use an extended notion of value variations for variable mappings and configurations. We will say that lv ′ is a variation of lv , written lv⊲T lv ′, if lv ′ = lv [ xi↦→v ′ i ] ...

  8. [8]

    The typed-norms of any input variable for any rule of m (including rule number j) will be propagated to the arguments ¯ xk of the call m(¯x, ¯y) in rule i

    For the parameter passing, we have T∈σ(i)(xk) directly by the second equation of genS P i (setA). The typed-norms of any input variable for any rule of m (including rule number j) will be propagated to the arguments ¯ xk of the call m(¯x, ¯y) in rule i

Show all 15 references
  1. [9]

    Thus there is a sequence of match guards match(x′ k,p 1)∧ match(z1,p 2)∧

    Assume a variable zm in some guard such that xk⇒T zm and T∈σ(i)(zm). Thus there is a sequence of match guards match(x′ k,p 1)∧ match(z1,p 2)∧... ∧ match(zm−1,p m) such that zi∈ vars(pi)—note that we can safely ignore e1 op e2 as they do not define new variables. Then by definiti...

  2. [10]

    C0 =⟨p, b·bs, lv⟩· C ′ containing statements from the i-th rule of P

  3. [12]

    We will focus only on the first case, as the second one is similar

    Tr(C0 )⁄= Tr(C ′ 0 ) From point 4 we know that Tr(C0 )⁄⊆Tr(C ′ 0 ) or Tr(C0 )⁄⊇Tr(C ′ 0 ). We will focus only on the first case, as the second one is similar. Since Tr(C0 )⁄⊆Tr(C ′ 0 ) we know that there is a trace T ∈Tr(C0 ) such that T ⁄∈Tr(C ′ 0 ). However, Tr(C ′ 0 ) will c...

  4. [13]

    T∈σ(j)(z) Therefore by Lemma 7 we have that T∈σ(i)(x). 48 E. Albert, S. Genaim, R. Guti´ errez and E. Martin-Martin Lemma 6 Consider a configuration C0 =⟨pi, b·bs, lv⟩· C containing statements from the i-th rule of P , and a variant configuration C0≡⟨ pi, b·bs, lv⟩· C ⊲T⟨pi,b·bs...

  5. [14]

    xk⇒∗T z for some xk∈{ ¯x}

  6. [15]

    • Base Case: n = 0 In this case C0 ❀r1 C1 but C ′ 0⁄❀r1 C ′ 1 , where lv⊲T lv ′

    T∈σ(j)(z) Proof By induction on the length n of the traces. • Base Case: n = 0 In this case C0 ❀r1 C1 but C ′ 0⁄❀r1 C ′ 1 , where lv⊲T lv ′. According to the rules in Fig. 2 the only rule that can prevent such a step is (2): (2) b≡m(¯x, ¯y) m( ¯x′, ¯y′)←g,b 1··· bk∈P fresh lv1...

  7. [2294]

    Grobauer, B

    Springer, 123–138. Grobauer, B. 2001. Cost recurrences for DML programs. In I nternational Conference on Functional Programming. 253–264. Hermenegildo, M. V. , Bueno, F. , Carro, M. , L´opez, P. , Mera, E. , Morales, J. , and Puebla, G. 2012. An Overview of Ciao and its Design...

Pith tools

Reviewed August 14, 2026 · model on record in the stance chip above.