Translation validation via linear recursion schemes
Download
1 / 15

Translation Validation via Linear Recursion Schemes - PowerPoint PPT Presentation


  • 117 Views
  • Uploaded on

Translation Validation via Linear Recursion Schemes. Master Seminar Tobias Tebbi. Translation Validation. Goal Verified Compiler Method Implement Validator that checks if input and output of compiler pass are equivalent.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Translation Validation via Linear Recursion Schemes' - kedem


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Translation validation via linear recursion schemes

Translation Validation via Linear Recursion Schemes

Master Seminar

Tobias Tebbi


Translation validation
Translation Validation

  • Goal Verified Compiler

  • Method Implement Validator that checks if input and output of compiler pass are equivalent.

  • Needs Decidable sufficient criterion for program equivalence


CPS

Control Flow Graph

Continuation Passing Style



Program equivalence
Program Equivalence

  • If trees equal, then programs equivalent.

  • This is decidable! [Sabelfeld2000]

  • Many optimizations do not change the tree.

  • It does not matter

    • which arguments/variables/registers are used.

    • when values are computed.

  • But the branching structure does matter, e.g. which test is done first.


Linear recursion scheme
Linear Recursion Scheme

  • Restriction with polynomial equivalence check

interpreted procedures

linear: nesting forbidden

uninterpretedfunctions

e.g. +, <, if-then-else, return, …


Simplifications for this talk
Simplifications for this Talk

  • Just oneuninterpretedfunction/operator

  • Simple terms

  • Terms

  • Onlyproceduresofthe form

  • Thus

    • All proceduresproduce infinite trees

    • Onlybinarytreeswhere all innernodesarelabelledwithandleavesarelabelledwith variables orconstants

    • Every subtree is described by a term or


Equality of infinite trees
Equality of Infinite Trees

  • Binary infinite trees equal All subtrees at same position and with infinite parent-subtrees are both infinite or equal


Equality of infinite trees1
Equality of Infinite Trees

  • Binary infinite trees equal All subtrees at same position and with infinite parent-subtrees are both infinite or equal

  • To check equivalenceofand, we generate all such pairs of subtrees with the inductively defined relation :

    • If

      with and ,

      then and

  • is consistent iffor all , both and are procedure calls or .

  • iff is consistent.


Substitutions
Substitutions

  • A substitution is a function from variables to simple terms.

  • S is the term where every occurrence of a variable is replaced by .

  • The instantiation pre-order on terms:

    And on pairs of terms:

    A


Finite equivalence proofs

  • If

    • with and ,

    • then and

Finite Equivalence Proofs

  • If there is a consistent superset of , then .

  • We want to construct a finite representation of such a set to serve as an equivalence proof.

  • Consider a finite, consistent relation such that

    • for some

    • If

      with and ,

      then for , is a simple term or for some

      Lemma:

  • The constraint on is decidable. Thus we have a method to prove equivalence.


Unification

  • If

    • with and ,

    • then and

Unification

  • is unifier of and if

  • We write for

    Lemma:

  • Thus, is consistent iff is consistent iff

    • for all simple pairs ,

    • all other pairs consist of procedure calls only

  • This is a classical first-order unification problem

  • Thus we have most general unifiers (MGUs) :

    For every other unifier , we have


Universal finite equivalence proofs

  • for some

  • If with and , then for , is a simple termor for some

Universal Finite Equivalence Proofs

  • Consider an MGU of and . Then iffwhere

  • Then is a finite equivalence proof for all equivalent terms and .

  • Thus equivalence of terms is semi-decidable.


Decidability of equivalence
Decidability of Equivalence

  • Equivalence of terms is semi-decidable.

  • Non-equivalence is semi-decidable too: the trees must differ at some finite level.

  • Thus equivalence is decidable.

  • In the next talks, I will present an efficient procedure to decide equivalence by reducing the problem to a fragment of semi-unification.


Literature
Literature

Fokkink, W. Unification for infinite sets of equations between finite terms.Information processing letters 62, 4 (1997), 183–188.

Sabelfeld, V. The tree equivalence of linear recursion schemes. Theoretical Computer Science 238, 1–2 (2000), 1–29.


ad