Abstract
The problem of inverse computation has many potential applications such as serialization/deserialization, providing support for undo, and test-case generation for software testing. In this paper, we propose an inverse computation method that always terminates for a class of functions known as parameter-linear macro tree transducers, which involve multiple data traversals and the use of accumulations. The key to our method is the observation that a function in the class can be regarded as a non-accumulative context-generating transformation without multiple data traversals. Accordingly, we demonstrate that it is easy to achieve terminating inverse computation for the class by context-wise memoization of the inverse computation results. We also show that when we use a tree automaton to express the inverse computation results, the inverse computation runs in time polynomial to the size of the original output and the textual program size.
Highlights
The problem of inverse computation [1, 2, 20, 21, 23, 30, 37, 40, 49]—finding an input s for a program f and a given output t such that f (s) = t —has many potential applications, including test-case generation in software testing, supporting undo/redo, and obtaining a deserialization from a serialization program.Let us illustrate the problem with an example
We propose an inverse computation method that can handle a class of accumulative functions like eval that have multiple data traversals, namely deterministic macro tree transducers [15] with the restriction of parameter-linearity
We assumed that the programs are deterministic and showed that a tractable inverse computation is possible for parameter-linear macro tree transducer (MTT)
Summary
(We basically follow the Haskell syntax [6] even though we target an untyped first-order functional language with call-by-value semantics.). Data Val = Z | S(Val) data Exp = Zero | One | Add(Exp, Exp) | Dbl(Exp). An evaluator eval :: Exp → Val of the expressions can be implemented as follows. The function evalAcc satisfies the invariant that evalAcc(e, m) = eval(e) + m, where “+” is the addition operator for values. This invariant enables us to read the definition intuitively; e.g., the case of Dbl can be read as eval(Dbl(x)) + y = eval(x) + eval(x) + y
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have