137
RISC-Linz Research Institute for Symbolic Computation Johannes Kepler University A-4040 Linz, Austria, Europe Fifth International Symposium on Symbolic Computation in Software Science SCSS 2013 Symposium Proceedings July 5-6, 2013 Research Institute for Symbolic Computation Johannes-Kepler University Linz, Austria Laura Kov´ acs and Temur Kutsia (Editors) RISC-Linz Report Series No. 13-06 Editors: RISC-Linz Faculty K. Bosa, B. Buchberger, R. Hemmecke, T. Jebelean, M. Kauers, T. Kutsia, G. Landsmann, F. Lichtenberger, P. Paule, V. Pillwein, N. Popov, H. Rolletschek, J. Schicho, C. Schneider, W. Schreiner, W. Windsteiger, F. Winkler. Supported by: the strategical program Innovative Upper Austria 2010 Plus and the Doctoral Program “Computational Mathematics” (W1214) - DK1 project. Copyright notice: Permission to copy is granted provided the title page is also copied.

Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,

RISC-LinzResearch Institute for Symbolic ComputationJohannes Kepler UniversityA-4040 Linz Austria Europe

Fifth International Symposium on

Symbolic Computation in

Software Science

SCSS 2013

Symposium Proceedings

July 5-6 2013

Research Institute for Symbolic Computation

Johannes-Kepler University Linz Austria

Laura Kovacs and Temur Kutsia

(Editors)

RISC-Linz Report Series No 13-06

Editors RISC-Linz FacultyK Bosa B Buchberger R Hemmecke T Jebelean M Kauers T KutsiaG Landsmann F Lichtenberger P Paule V Pillwein N Popov H RolletschekJ Schicho C Schneider W Schreiner W Windsteiger F Winkler

Supported by the strategical program Innovative Upper Austria 2010 Plus and the DoctoralProgram ldquoComputational Mathematicsrdquo (W1214) - DK1 project

Copyright notice Permission to copy is granted provided the title page is also copied

Fifth International Symposium on

Symbolic Computation in

Software Science

SCSS 2013

Symposium Proceedings

July 5-6 2013

Research Institute for Symbolic Computation

Johannes-Kepler University Linz Austria

Preface

Symbolic Computation is the science of computing with symbolic objects (terms formulaeprograms representations of algebraic objects etc) Powerful symbolic algorithms have beendeveloped during the past decades like theorem proving automated reasoning software veri-fication model checking rewriting formalization of mathematics network security Grobnerbases characteristic sets telescoping for recurrence relations etc

The purpose of the International Symposium on Symbolic Computation in Software Science- SCSS is to promote research on theoretical and practical aspects of symbolic computationin software sciences The symposium provides a forum for active dialog between researchersfrom several fields of computer algebra algebraic geometry algorithmic combinatorics compu-tational logic and software analysis and verification

This yearrsquos SCSS edition is the fifth in the SCSS workshop series and is organized at theResearch Institute for Symbolic Computation (RISC) of the Johannes Kepler University Linzduring July 5-6 2013 With the focus of promoting the exchange of ideas and experiences fromapplications of symbolic computation in software science SCSS 2013 has attracted researchersfrom across a number of fields including computer algebra algebraic geometry term rewritingprocess algebras and program verification

We are very excited to have three excellent keynote speakers Bruno Buchberger (RISC-Linz) Wei Li (Beihang University) and Joel Ouaknine (Oxford University) Our invited speak-ers have significant research expertise and insights into the challenges and opportunities for thegrowing SCSS community

We would like to thank the program committee members and reviewers for all their effortsThanks also go to the steering committee members for their valuable advice and guidanceWe would also like to thank Andrei Voronkov for his help on EasyChair Finally we alsoacknowledge partial funding from the strategical program Innovative Upper Austria 2010 Plusand the Doctoral Program ldquoComputational Mathematicsrdquo (W1214) - DK1 project

Laura Kovacs Programme ChairTemur Kutsia Symposium Chair

Symposium Organization

Symposium Chair

Temur Kutsia Research Institute for Symbolic Computa-

tion - RISC Austria

Program Chair

Laura Kovacs Chalmers University of Technology Sweden

Program Committee

Marıa Alpuente Technical University of Valencia Spain

Serge Autexier DFKI Germany

Nikolaj Bjorner Microsoft Research USA

Adel Bouhoula Ecole superieure des communications de Tu-

nis Tunisia

Iliano Cervesato Carnegie Mellon University - Qatar Cam-

pus Qatar

Horatiu Cirstea Loria France

Jurgen Giesl RWTH Aachen Germany

Tetsuo Ida Tsukuba University Japan

Paul Jackson School of Informatics University of Edin-

burgh UK

Tudor Jebelean Research Institute for Symbolic Computa-

tion - RISC Austria

Cezary Kaliszyk University of Innsbruck Austria

Fairouz Kamareddine Heriot-Watt University UK

Laura Kovacs Chalmers University of Technology Sweden

Temur Kutsia Research Institute for Symbolic Computa-

tion - RISC Austria

Stephan Merz INRIA-LORIA Nancy France

Ali Mili New Jersey Institute of Technology USA

Yasuhiko Minamide University of Tsukuba Japan

Pierre-Etienne Moreau INRIA-LORIA Nancy France

Andre Platzer Carnegie Mellon University USA

Stefan Ratschan Czech Academy of Sciences The Czech Re-

public

Rachid Rebiha University of Lugano Switzerland and IC

Unicamp Brazil

Enric Rodrıguez Car-

bonell

Technical University of Catalonia Spain

Sorin Stratulat Universite Paul Verlaine France

Thomas Sturm Max Planck Institute for Informatics Ger-

many

Additional Reviewers

Cabarcas Daniel

Eder Christian

Gay Simon

Ghorbal Khalil

Ghourabi Fadoua

Kredel Heinz

Martins Joao G

Vigneron Laurent

Table of Contents

Invited Papers

Mathematics of 21st Century A Personal View 1

Bruno Buchberger

A Semantic Framework for Program Debugging 2

Wei Li

Decision Problems for Linear Recurrence Sequences 3

Joel Ouaknine

Regular Papers

Parametric Exploration of Rewriting Logic Computations 4

Marıa Alpuente Demis Ballis Francisco Frechina and Julia

Sapina

Automatic Inference of Term Equivalence in Term Rewriting

Systems 19

Marco Comini and Luca Torella

A Condensed Goal-Independent Fixpoint Semantics Modeling

the Small-Step Behavior of Rewriting 31

Marco Comini and Luca Torella

Logical and Algebraic Views of a Knot Fold of a Regular

Heptagon 50

Fadoua Ghourabi Tetsuo Ida and Kazuko Takahashi

Automated Verification of Equivalence on Quantum

Cryptographic Protocols 64

Takahiro Kubota Yoshihiko Kakutani Go Kato Yasuhito

Kawano and Hideki Sakurada

A modified parallel F4 algorithm for shared and distributed

memory architectures 70

Severin Neumann

Generating Asymptotically Non-terminant Initial Variable

Values for Linear Diagonalizable Programs 81

Rachid Rebiha Nadir Matringe and Arnaldo Moura

Data Conversion Method between a Natural Number and a

Binay Tree for an Inductive Proof and Its Application 93

Kazuko Takahashi Shizuo Yoshimaru and Mizuki Goto

Computer algebra investigation of known primitive

triangle-free strongly regular graphs 108

Matan Ziv-Av and Mikhail Klin

Short Papers

Usage of Invariants for Symbolic Verification of Requirements 124

Alexander Letichevsky Alexander Godlevsky Anton Guba

Alexander Kolchin Oleksandr Letychevskyi and Vladimir

Peschanenko

Lebesgue Constants and Optimal Node Systems via Symbolic

Computations 125

Robert Vajda

Mathematics of 21st Century

A Personal View

Bruno Buchberger

Research Institute for Symbolic Computation - RISC

Johannes Kepler University Linz Austria

BrunoBuchbergerriscuni-linzacat

Extended Abstract

Mathematics of 19th century and before was rich in content intuition strong ideas motivationfrom natural sciences and had a coherent view of all fields of mathematics (geometry algebraanalysis number theory )

Mathematics of 20th century added three important aspects mathematical logic as themathematical meta-theory of mathematics formalism and abstractness and reduction to firstprinciples (ldquoBourbakismrdquo) and the notion of computing (both as an exact mathematicalnotion and as the foundation of the revolutionary device rdquoprogrammable computerrdquo) In factthe three aspects have a lot to do with each other and are fundamentally interrelated Howeverin practice the three aspects were (and still are) pursued by three different communities Thedeep insights of logicians on the nature of mathematics are hardly used in ever-day practiceof ldquoworking mathematiciansrdquo ldquopure mathematiciansrdquo are often proud that they do not touchthe computer except for writing e-mails typing in LaTeX and using web search and computerscientists often think that what they are doing does not need mathematics or even is oppositeto mathematics

In my view as indicated by trends in late 20th century in 21st century mathematics willevolve as - or return to be - a unified body of mathematical logic abstract structural math-ematics and computer mathematics with no boundaries between the three aspects ldquoWorkingmathematiciansrdquo will have to master the three aspects equally well and integrate them in theirdaily work More specifically working in mathematics will proceed on the ldquoobject levelrdquo ofdeveloping new mathematical content (abstract knowledge and computational methods) andat the same time on the ldquometa-levelrdquo of developing automated reasoning methods for support-ing research on the object level This ldquomassage of the mathematical brainrdquo by jumping backand forth between the object and the meta-level will guide mathematics onto a new level ofsophistication

Symbolic computation is just a way of expressing this general view of mathematics of the21st century and it also should be clear that software science is just another way of expressingthe algorithmic aspect of this view

In the talk we will exemplify the spirit of this new type of mathematics by a report onthe Theorema system being developed in the speakerrsquos research group Theorema is both alogic and a software frame for doing mathematics in the way sketched above On the objectlevel Theorema allows to prove and program within the same logical frame and on the meta-level it allows to formulate reasoning techniques that help proving and programming on theobject level In particular we will show how this type of doing mathematics allows to mimicthe invention process behind the speakerrsquos theory of Grobner bases which provides a generalmethod for dealing with multivariate nonlinear polynomial systems

1

A Semantic Framework for Program Debugging

Wei Li

State Key Laboratory of Software Development Environment

School of Computer Science and Engineering

Beihang University China

liweinlsdebuaaeducn

Abstract

This work aims to build a semantic framework for automated debugging A debugging pro-

cess consists of tracing locating and fixing processes consecutively The first two processes

are accomplished by a tracing procedure and a locating procedure respectively The tracing

procedure reproduces the execution of a failed test case with well-designed data structures and

saves necessary information for locating bugs The locating procedure will use the informa-

tion obtained from the tracing procedure to locate ill-designed statements and to generate a

fix-equation the solution of which is a function that will be used to fix the bugs A structural

operational semantics is given to define the functions of the tracing and locating procedure

Both procedures are proved to terminate and produces one fix-equation The main task of

fixing process is to solve the fix-equation It turns out that for a given failed test case there

exist three different types of solutions 1 the bug is solvable there exists a solution of the

fix-equation and the program can be repaired 2 There exists a non-linear error in the pro-

gram the fix-equation generated at each round of the locating procedure is solvable but a new

bug will arise when the old bug is being fixed 3 There exists a logical design error and the

fix-equation is not solvable

2

Decision Problems for Linear Recurrence

Sequences

Joel Ouaknine

Department of Computer Science

Oxford University United Kingdom

JoelOuakninecsoxacuk

Abstract

Linear recurrence sequences (LRS) such as the Fibonacci numbers permeate vast areas ofmathematics and computer science In this talk we consider three natural decision problemsfor LRS namely the Skolem Problem (does a given LRS have a zero) the Positivity Problem

(are all terms of a given LRS positive) and the Ultimate Positivity Problem (are all but finitelymany terms of a given LRS positive) Such problems (and assorted variants) have applicationsin a wide array of scientific areas such as theoretical biology (analysis of L-systems pop-ulation dynamics) economics (stability of supply-and-demand equilibria in cyclical marketsmultiplier-accelerator models) software verification (termination of linear programs) proba-bilistic model checking (reachability and approximation in Markov chains stochastic logics)quantum computing (threshold problems for quantum automata) discrete linear dynamicalsystems (reachability and invariance problems) as well as combinatorics statistical physicsterm rewriting formal languages cellular automata generating functions etc

We shall see that these problems have deep and fascinating connections to rich mathematicalconcepts and conjectures particularly in the fields of analytic and algebraic number theorydiophantine geometry and approximation real algebraic geometry mathematical logic andcomplexity theory

3

Parametric Exploration of

Rewriting Logic Computations lowast

M Alpuente1 D Ballis2 F Frechina1 and J Sapina1

1 DSIC-ELP Universitat Politecnica de ValenciaCamino de Vera sn Apdo 22012 46071 Valencia Spain

alpuenteffrechinajsapinadsicupves2 DIMI Universita degli Studi di Udine

Via delle Scienze 206 33100 Udine Italy demisballisuniudit

Abstract

This paper presents a parameterized technique for the inspection of Rewriting Logiccomputations that allows the non-deterministic execution of a given rewrite theory to befollowed up in different ways Starting from a selected state in the computation tree theexploration is driven by a user-defined inspection criterion that specifies the explorationmode By selecting different inspection criteria one can automatically derive useful debug-ging facilities such as program steppers and more sophisticated dynamic trace slicers thatfacilitate the detection of control and data dependencies across the computation tree Ourmethodology which is implemented in the Anima graphical tool allows users to capture theimpact of a given criterion validate input data and detect improper program behaviors

1 Introduction

Program animation or stepping refers to the very common debugging technique of executingcode one step at a time allowing the user to inspect the program state and related databefore and after the execution step This allows the user to evaluate the effects of a givenstatement or instruction in isolation and thereby gain insight into the program behavior (ormisbehavior) Nearly all modern IDEs debuggers and testing tools currently support this modeof execution optionally where animation is achieved either by forcing execution breakpointscode instrumentation or instruction simulation

Rewriting Logic (RWL) is a very general logical and semantic framework which is particu-larly suitable for formalizing highly concurrent complex systems (eg biological systems [7] andWeb systems [2 6]) RWL is efficiently implemented in the high-performance system Maude [9]Roughly speaking a rewriting logic theory seamlessly combines a term rewriting system (TRS)together with an equational theory that may include equations and axioms (ie algebraic lawssuch as commutativity associativity and unity) so that rewrite steps are performed modulo theequations and axioms

In recent years debugging and optimization techniques based on RWL have received growingattention [1 13 16 17] but to the best of our knowledge no practical animation tool forRWLMaude has been formally developed To debug Maude programs Maude has a basictracing facility that allows the user to advance through the program execution letting himherselect the statements to be traced except for the application of algebraic axioms that are not

lowastThis work has been partially supported by the EU (FEDER) and the Spanish MEC project ref TIN2010-21062-C02-02 and by Generalitat Valenciana ref PROMETEO2011052 This work was carried out during thetenure of D Ballisrsquo ERCIM lsquoAlain Bensoussanrdquo Postdoctoral Fellowship The research leading to these resultshas received funding from the European Union Seventh Framework Programme (FP72007-2013) under grantagreement n 246016 F Frechina was supported by FPU-ME grant AP2010-5681

4

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

under user control and are never recorded as execution steps in the trace All rewrite steps thatare obtained by applying the equations or rules for the selected function symbols are shown inthe output trace so that the only way to simplify the displayed view of the trace is by manuallyfixing the traceable equations or rules Thus the trace is typically huge and incomplete andwhen the user detects an erroneous intermediate result it is difficult to determine where theincorrect inference started Moreover this trace is either directly displayed or written to afile (in both cases in plain text format) thus only being amenable for manual inspection bythe user This is in contrast with the enriched traces described below which are complete (allexecution steps are recorded by default) and can be sliced automatically so that they can bedramatically simplified in order to facilitate a specific analysis Also the trace can be directlydisplayed or delivered in its meta-level representation which is very useful for further automatedmanipulation

Contributions This paper presents the first parametric (forward) exploration technique forRWL computations Our technique is based on a generic animation algorithm that can be tunedto work with different modalities including incremental stepping and automated forward slicingThe algorithm is fully general and can be applied for debugging as well as for optimizing anyRWL-based tool that manipulates RWL computations Our formulation takes into account theprecise way in which Maude mechanizes the rewriting process and revisits all those rewrite stepsin an instrumented fine-grained way where each small step corresponds to the application ofan equation equational axiom or rule This allows us to explain the input execution trace withregard to the set of symbols of interest (input symbols) by tracing them along the executiontrace so that in the case of the forward slicing modality all data that are not descendants ofthe observed symbols are simply discarded

Related Work Program animators have existed since the early years of programmingAlthough several steppers have been implemented in the functional programming community(see [10] for references) none of these systems applies to the animation and forward slicing ofMaude computations An algebraic stepper for Scheme is defined and formally proved in [10]which is included in the DrScheme programming environment The stepper reduces Schemeprograms to values (according to the reduction semantics of Scheme) and is useful for explainingthe semantics of linguistic facilities and for studying the behavior of small programs It explainsa programrsquos execution as a sequence of reduction steps based on the ordinary laws of algebra forthe functional core of the language and more general algebraic laws for the rest of the languageIn order to discover all of the steps that occur during the program evaluation the stepperrewrites (or rdquoinstrumentsrdquo) the code The inserted code uses a mechanism called ldquocontinuationmarksrdquo to store information about the programrsquos execution as it is running and makes calls tothe stepper before after and during the evaluation of each program expression Continuationmarks allow the stepper to reuse the underlying Scheme implementation without having to re-implement the evaluator The stepperrsquos implementation technique also applies to both ML andHaskell since it supports states continuations multiple threads of control and lazy evaluation[10]

In [4 5] an incremental backward trace slicer was presented that generates a trace slice ofan execution trace T by tracing back a set of symbols of interest along (an instrumented versionof) T while data that are not required to produce the target symbols are simply discarded Thiscan be very helpful in debugging since any information that is not strictly needed to delivera critical part of the result is discarded which helps answer the question of what programcomponents might affect a lsquoselected computationrdquo However for the dual problem of ldquowhatprogram components might be affected by a selected computationrdquo a kind of forward expansionis needed which has been overlooked to date

5

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

Plan of the paper Section 2 recalls some fundamental notions of RWL and Section 3summarizes the rewriting modulo equational theories defined in Maude Section 4 formulatesthe exploration as a parameterized procedure that is completely controlled by the user whileSection 5 formalizes three different inspection techniques that are obtained as an instance ofthe generic scheme Finally Section 6 reports on a prototypical implementation of the proposedtechniques and Section 7 concludes

2 Preliminaries

Let us recall some important notions that are relevant to this work We assume some basicknowledge of term rewriting [18] and Rewriting Logic [14] Some familiarity with the Maudelanguage [9] is also required

We consider an order-sorted signature Σ with a finite poset of sorts (Slt) that models theusual subsort relation [9] We assume an S-sorted family V = VssisinS of disjoint variable setsτ(ΣV)s and τ(Σ)s are the sets of terms and ground terms of sort s respectively We writeτ(ΣV) and τ(Σ) for the corresponding term algebras The set of variables that occur in a termt is denoted by Var(t) In order to simplify the presentation we often disregard sorts when noconfusion can arise

A position w in a term t is represented by a sequence of natural numbers that addressesa subterm of t (Λ denotes the empty sequence ie the root position) By notation w1w2we denote the concatenation of positions (sequences) w1 and w2 Positions are ordered by theprefix ordering that is given the positions w1 and w2 w1 le w2 if there exists a position u suchthat w1u = w2

Given a term t we let Pos(t) denote the set of positions of t By t|w we denote the subtermof t at position w and t[s]w specifies the result of replacing the subterm t|w by the term s

A substitution σ equiv x1t1 x2t2 is a mapping from the set of variables V to the set ofterms τ(ΣV) which is equal to the identity almost everywhere except over a set of variablesx1 xn The domain of σ is the set Dom(σ) = x isin V | xσ 6= x By id we denote theidentity substitution The application of a substitution σ to a term t denoted tσ is defined byinduction on the structure of terms

tσ =

xσ if t = x x isin V

f(t1σ tnσ) if t = f(t1 tn) n ge 0

For any substitution σ and set of variables V σ |V denotes the substitution obtained from σby restricting its domain to V (ie σ |V (x) = xσ if x isin V otherwise σ |V (x) = x) Given twoterms s and t a substitution σ is a matcher of t in s if sσ = t The term t is an instance ofthe term s iff there exists a matcher σ of t in s By matchs(t) we denote the function thatreturns a matcher of t in s if such a matcher exists

A (labelled) equation is an expression of the form [l] λ = ρ where λ ρ isin τ(ΣV) V ar(ρ) subeV ar(λ) and l is a label ie a name that identifies the equation A (labelled) rewrite rule isan expression of the form [l] λ rarr ρ where λ ρ isin τ(ΣV) V ar(ρ) sube V ar(λ) and l is a labelWhen no confusion can arise rule and equation labels are often omitted The term λ (resp ρ)is called left-hand side (resp right-hand side) of the rule λrarr ρ (resp equation λ = ρ)

6

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

3 Rewriting Modulo Equational Theories

An order-sorted equational theory is a pair E = (Σ∆cupB) where Σ is an order-sorted signature∆ is a collection of (oriented) equations and B is a collection of equational axioms (ie algebraiclaws such as associativity commutativity and unity) that can be associated with any binaryoperator of Σ The equational theory E induces a congruence relation on the term algebraτ(ΣV) which is denoted by =E A rewrite theory is a triple R = (Σ∆ cup BR) where(Σ∆ cupB) is an order-sorted equational theory and R is a set of rewrite rules

Example 31The following rewrite theory encoded in Maude specifies a close variant of the fault-tolerantclient-server communication protocol of [15]

mod CLIENT-SERVER-TRANSF is inc INT + QID sorts Content State Msg Cli Serv Addressee

Sender Data CliName ServName Question Answer subsort Msg Cli Serv lt State subsort Addressee Sender CliName ServName lt Qid subsort Question Answer Data lt Nat

ops Srv Srv-A Srv-B Cli Cli-A Cli-B -gt Qid op null -gt State op _amp_ State State -gt State [assoc comm id null] op _lt-_ Addressee Content -gt Msg op __ Sender Data -gt Content op [____] CliName ServName Question Answer -gt Cli op na -gt Answer op [_] ServName -gt Serv [ctor] op f ServName CliName Data -gt Data

vars C S Addr Qid vars Q D A Nat var CNT [Content]

eq [succ] f(S C Q) = s(Q)

rl [req] [C S Q na] =gt[C S Q na] amp S lt- C Q

rl [reply] S lt- C Q amp [S] =gt[S] amp C lt- S f(S C Q)

rl [rec] C lt- S D amp [C S Q A] =gt[C S Q A]

rl [dupl] (Addr lt- CNT) =gt(Addr lt- CNT) amp (Addr lt- CNT)

rl [loss] (Addr lt- CNT) =gt null endm

The specification models an environment where several clients and servers coexist Eachserver can serve many clients while for the sake of simplicity we assume that each clientcommunicates with a single server

The names of clients and servers belong to the sort Qid Clients are represented as 4-tuplesof the form [C S Q D] where C is the clientrsquos name S is the name of the server it wants tocommunicate with Q is a natural number that identifies a client request and D is either a naturalnumber that represents the server response or the constant value na (not available) when theresponse has not been yet received Servers are stateless and are represented as structures [S]with S being the serverrsquos name All messages are represented as pairs of the form Addr lt- CNTwhere Addr is the addresseersquos name and CNT stands for the message contents Such contentsare pairs AddrN with Addr being the senderrsquos name and N being a number that representseither a request or a response

The server S uses a function f (only known to the server itself) that given a question Q

from client C the call f(S C Q) computes the answer s(Q) where s(Q) is the successor of Q Thisfunction is specified by means of the equation succ

Program states are formalized as a soup (multiset) of clients servers and messages whereasthe system behavior is formalized through five rewrite rules that model a faulty communicationenvironment in which messages can arrive out of order can be duplicated and can be lostSpecifically the rule req allows a client C to send a message with request Q to the server SThe rule reply lets the server S consume the client request Q and send a response messagethat is computed by means of the function f The rule rec specifies the client reception of aserver response D that should be stored in the client data structure Indeed the right-handside [C S Q A] of the rule includes an intentional barely perceptible bug that does not let theclient structure be correctly updated with the incoming response D The correct right-hand sideshould be [C S Q D] Finally the rules dupl and loss model the faulty environment and have

7

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

the obvious meaning messages can either be duplicated or lost

Given a rewrite theory (Σ ER) with E = ∆ cup B the rewriting modulo E relation (insymbols rarrRE) can be defined by lifting the usual rewrite relation on terms [12] to the E-congruence classes [t]E on the term algebra τ(ΣV) that are induced by =E [8] that is [t]Eis the class of all terms that are equal to t modulo E Unfortunately rarrRE is in generalundecidable since a rewrite step t rarrRE tprime involves searching through the possibly infiniteequivalence classes [t]E and [tprime]E

The exploration technique formalized in this work is formulated by considering the preciseway in which Maude proves the rewrite steps (see Section 52 in [9]) Actually the Maudeinterpreter implements rewriting modulo E by means of two much simpler relations namelyrarr∆B and rarrRB These allow rewrite rules and equations to be intermixed in the rewritingprocess by simply using an algorithm of matching modulo B We define rarrRcup∆B as rarrRB

cup rarr∆B Roughly speaking the relation rarr∆B uses the equations of ∆ (oriented from leftto right) as simplification rules thus for any term t by repeatedly applying the equations assimplification rules we eventually reach a normalized term tdarr∆ to which no further equationscan be applied The term t darr∆ is called a canonical form of t wrt ∆ On the other handthe relation rarrRB implements rewriting with the rules of R which might be non-terminatingand non-confluent whereas ∆ is required to be terminating and Church-Rosser modulo B inorder to guarantee the existence and unicity (modulo B) of a canonical form wrt ∆ for anyterm [9]

Formally rarrRB and rarr∆B are defined as follows given a rewrite rule r = (λ rarr ρ) isin R(resp an equation e = (λ = ρ) isin ∆) a substitution σ a term t and a position w of t

trσwrarrRB tprime (resp t

eσwrarr∆B tprime) iff λσ =B t|w and tprime = t[ρσ]w When no confusion can arise we

simply write trarrRB tprime (resp trarr∆Btprime) instead of t

rσwrarrRB tprime (resp t

eσwrarr∆B tprime)

Under appropriate conditions on the rewrite theory a rewrite step modulo E on a term t canbe implemented without loss of completeness by applying the following rewrite strategy [11](i) reduce t wrt rarr∆B until the canonical form t darr∆ is reached (ii) rewrite t darr∆ wrt rarrRB

A computation C in the rewrite theory (Σ∆ cupBR) is a rewrite sequence

s0 rarrlowast∆B s0darr∆ rarrRB s1 rarrlowast

∆B s1darr∆

that interleaves rarr∆B rewrite steps and rarrRB rewrite steps following the strategy mentionedabove Terms that appear in computations are also called (program) states

A computation tree TR(s) for a term s and a rewrite theory R is a tree-like representationof all the possible computations in R that originate from the initial state s More preciselyTR(s) is a labelled tree whose root node label identifies the initial state s and whose edges arelabelled with rewrite steps of the form t rarrRcup∆B tprime so that any node in TR(s) represents aprogram state of a computation stemming from s

Example 32

Consider the rewrite theory of Example 31 together with the initial state [Srv-A] amp [Cli-A

Srv-A7na] amp [Cli-BSrv-A17na] In this case the computation tree consists of severalinfinite computations that start from the considered initial state and model interactions betweenclients Cli-A and Cli-B and server Srv-A The computed tree is depicted in the following picturewhere for the sake of simplicity we only display the equations and rules that have been appliedat each rewrite step while other information such as the computed substitution and the rewrite

8

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

position are omitted in the depicted tree

Query Go

Go

Go

Go

Go

Go

GoGoBack

Back

Back

Back

Back

Back

BackBack Anima

[Srv-A] amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]s0

req[Srv-A] amp (Srv-A lt- Cli-A7) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s1 req[Srv-A] amp (Srv-A lt- Cli-B17) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s2

reply[Srv-A] amp (Cli-A lt- Srv-Af(Serv-ACli-A7)) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s3 reqdupl[Srv-A] amp (Srv-A lt- Cli-A7) amp (Srv-A lt- Cli-A7) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s4 req[Srv-A] amp (Srv-A lt- Cli-A7) amp (Srv-A lt- Cli-B17) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s5 loss[Srv-A] amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s6

succ[Srv-A] amp (Cli-A lt- Srv-A8) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s7

Options

Given a computation C it is always possible to expand C in an instrumented computationCinst in which each application of the matching modulo B algorithm is mimicked by the explicitapplication of a suitable equational axiom which is also oriented as a rewrite rule [3]

Also typically hidden inside the B-matching algorithms some flatunflat transformationsallow terms that contain operators that obey associative-commutative axioms to be rewrittenThese transformations allow terms to be reordered and correctly parenthesized in order toenable subsequent rewrite steps Basically this is achieved by producing a single auxiliaryrepresentative of their AC congruence class [3] For example consider a binary AC operatorf together with the standard lexicographic ordering over symbols Given the B-equivalencef(b f(f(b a) c)) =B f(f(b c) f(a b)) we can represent it by using the ldquointernal sequencerdquo

of transformations f(b f(f(b a) c))flatminusrarr lowast

Bf(a b b c)unflatminusrarr lowast

Bf(f(b c) f(a b)) where the firstsubsequence corresponds to a flattening transformation sequence that obtains the AC canonicalform while the second one corresponds to the inverse unflattening transformation This wayany given instrumented computation consists of a sequence of (standard) rewrites using theequations (rarr∆) rewrite rules (rarrR) equational axioms and flatunflat transformations (rarrB)By abuse of notation since equations and axioms are both interpreted as rewrite rules in ourformulation we often abuse the notation λrarr ρ to denote rules as well as (oriented) equationsand axioms Given an instrumented computation Cinst by |Cinst| we denote its length mdashthat isthe number of rewrite steps that occur in Cinst We use the functions head(Cinst) and tail(Cinst)to respectively select the first rewrite step in Cinst and the instrumented computation yieldedby removing the first rewrite step from Cinst In the sequel we also assume the existence of afunction instrument(C) which takes a computation C and delivers its instrumented counterpart

Example 33Consider the rewrite theory of Example 31 together with the following computation

C = [Cli Srv 7 na] amp [Srv] amp Cli lt- Srv f(Srv Cli 7) rarr∆B

[Cli Srv 7 na]amp [Srv] amp Cli lt- Srv 8 rarrRB

[Cli Srv 7 7] amp [Srv]

The corresponding instrumented computation Cinst which is produced by instrument(C) isgiven by 1) suitably parenthesizing states by means of flatteningunflattening transformations

9

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

when needed and 2) making commutative ldquostepsrdquo explicit by using the (oriented) equationalaxiom (X amp Y rarr Y amp X) in B that models the commutativity property of the (juxtaposition)operator amp Note these transformations are needed to enable the application of the rule rec

(of R) to the seventh state

Cinst = [Cli Srv 7 na] amp [Srv] amp Cli lt- Srv f(Srv Cli 7)succminusrarr∆

[Cli Srv 7 na] amp [Srv] amp Cli lt- Srv 8unflatminusrarrB

[Cli Srv 7 na] amp ([Srv] amp Cli lt- Srv 8)commminusrarrB

[Cli Srv 7 na] amp (Cli lt- Srv 8 amp [Srv])flatminusrarrB

[Cli Srv 7 na] amp Cli lt- Srv 8 amp [Srv]unflatminusrarrB

([Cli Srv 7 na] amp Cli lt- Srv 8) amp [Srv]commminusrarrB

(Cli lt- Srv 8 amp [Cli Srv 7 na]) amp [Srv]recminusrarrR

[Cli Srv 7 7] amp [Srv]

4 Exploring the Computation Tree

Computation trees are typically large and complex objects to deal with because of the highly-concurrent nondeterministic nature of rewrite theories Also their complete generation andinspection are generally not feasible since some of their branches may be infinite as they encodenonterminating computations

However one may still be interested in analysing a fragment of a given computation tree fordebugging or program comprehension purposes This section presents an exploration techniquethat allows the user to incrementally generate and inspect a portion T bull

R(sbull) of a computationtree TR(s) by expanding (fragments of) its program states into their descendants starting fromthe root node The exploration is an interactive procedure that is completely controlled by theuser who is free to choose the program state fragments to be expanded

41 Expanding a Program State

A state fragment of a state s is a term sbull that hides part of the information in s that is theirrelevant data in s are simply replaced by special bull-variables of appropriate sort denoted bybulli with i = 0 1 2 Given a state fragment sbull a meaningful position p of sbull is a positionp isin Pos(sbull) such that sbull|p 6= bulli for all i = 0 1 By MPos(sbull) we denote the set thatcontains all the meaningful positions of sbull Symbols that occur at meaningful positions of astate fragment are called meaningful symbols By Varbull(exp) we define the set of all bull-variablesthat occur in the expression exp

Basically a state fragment records just the information the user wants to observe of a givenprogram state

The next auxiliary definition formalizes the function fragment(t P ) that allows a statefragment of t to be constructed wrt a set of positions P of t The function fragment relies onthe function freshbull whose invocation returns a (fresh) variable bulli of appropriate sort which isdistinct from any previously generated variable bullj

Definition 41 Let t isin τ(ΣV) be a state and let P be a set of positions st P sube Pos(t)Then the function fragment(t P ) is defined as follows

fragment(t P ) = recfrag(t PΛ) where

10

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

function inspect(sbull Cinstr I)1 if |Cinstr | = 1 then2 return I(sbull Cinstr )3 elseif |Cinstr | gt 14 if I(sbull head(Cinstr ))= nil then5 return inspect(I(sbull head(Cinstr ))

tail(Cinstr ) I)6 else7 return nil8 end9 endendf

function expand(sbull sR I)1 Ebull

R = empty

2 for each srσwrarrRcup∆B t

with w isin MPos(sbull)

3 Cinst = instrument(srσwrarrRcup∆B t)

4 tbull = inspect(sbull Cinst I)

5 if tbull 6= nil then EbullR = Ebull

R cup sbullrrarr tbull

6 end7 return Ebull

R

endf

Figure 1 The inspect function Figure 2 The expand function

recfrag(t P p) =

f(recfrag(t1 P p1) recfrag(tn P pn))

if t=f(t1 tn) and p isin P

t if t isin V and p isin P

freshbull otherwise

and P = u | u le p and p isin P is the prefix closure of P

Roughly speaking fragment(t P ) yields a state fragment of t wrt a set of positions P thatincludes all symbols of t that occur within the paths from the root to any position in P whileeach maximal subterm t|p with p 6isin P is replaced by means of a freshly generated bull-variable

Example 42Let t = d(f(g(a h(b)) c) a) be a state and let P = 11 12 be a set of positions of t Byapplying Definition 41 we get the state fragment tbull = fragment(t P ) = d(f(g(bull1 bull2) c) bull3)and the set of meaningful positions MPos(tbull) = Λ 1 11 12

An inspection criterion is a function I(sbull srσwrarrK t) that given a rewrite step s

rσwrarrK t with

K isin ∆ RB and a state fragment sbull of s computes a state fragment tbull of the state t Roughlyspeaking an inspection criterion controls the information content conveyed by term fragmentsresulting from the execution of standard rewrite steps Hence distinct implementations of the

inspection criteria I(sbull srσwrarrK t) may produce distinct fragments sbull

rrarr tbull of the considered

rewrite step We assume that the special value nil is returned by the inspection criterionwhenever no fragment tbull can be delivered Several examples of inspection criteria are shown inSection 5

The function inspect of Figure 1 allows an inspection criterion I to be sequentially appliedalong an instrumented computation Cinstr in order to generate the fragment of the last stateof the computation Specifically given an instrumented computation s0 rarrK s1 rarrK rarr snn gt 0 the computation is traversed and the inspection criterion I is recursively applied oneach rewrite step si rarrK si+1 wrt the input fragment sbulli to generate the next fragment sbulli+1

The expansion of a single program state is specified by the function expand(sbull sR I) ofFigure 2 which takes as input a state s and its fragment sbull to be expanded wrt a rewritetheory R and an inspection criterion I Basically expand unfolds the state fragment sbull wrt

all the possible rewrite steps srσwrarrRcup∆B t that occur at the meaningful positions of sbull and

stores the corresponding fragments of sbullrrarr tbull in the set Ebull Note that to compute the state

11

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

fragment tbull for a rewrite step srσwrarrRcup∆B t and a state fragment sbull expand first generates the

instrumented computation Cinst of the considered step and then applies the inspection criterionI over C by using the inspect function

42 Computing a Fragment of the Computation Tree

The construction of a fragment T bullR(sbull0) of a computation tree TR(s0) is specified by the function

explore given in Figure 3 Essentially explore formalizes an interactive procedure that startsfrom a tree fragment (built using the auxiliary function createTree) which only consists of theroot node sbull0 and repeatedly uses the function expand to compute rewrite step fragments thatcorrespond to the visited tree edges wrt a given inspection criterion The tree T bull

R(sbull0) is builtby choosing at each loop iteration of the algorithm the tree node that represents the statefragment to be expanded by means of the auxiliary function pickLeaf (T bull

R(sbull0)) which allowsthe user to freely select a node sbull from the frontier of the current tree T bull

R(sbull0) Then T bullR(sbull0)

is augmented by calling addChildren(T bullR(sbull0) s

bull expand(sbull sR I)) This function call adds allthe edges sbull rarr tbull which are obtained by expanding sbull to the tree T bull

R(sbull0)The special value EoE (End of Exploration) is used to terminate the inspection process

when the function pickLeaf (T bullR(sbull0)) is equal to EoE no state to be expanded is selected and

the exploration terminates delivering the computed fragment T bullR(sbull0)

function explore(sbull0 s0R I)1 T bull

R(sbull0) = createTree(sbull0)2 while(sbull = pickLeaf (T bull

R(sbull0)) 6= EoE) do3 T bull

R(sbull0) = addChildren(T bullR(sbull0) s

bull expand(sbull sR I))4 od5 return T bull

R(sbull0)endf

Figure 3 The explore function

5 Particularizing the Exploration

The methodology given in Section 4 provides a generic scheme for the exploration of com-putation trees wrt a given inspection criterion I that must be provided by the user Inthis section we show three implementations of the criterion I that produce three distinct ex-ploration strategies In the first case the considered criterion allows an interactive programstepper to be derived in which rewriting logic computations of interest can be animated Inthe second case we implement a partial stepper that allows computations with partial inputsto be animated Finally in the last example the chosen inspection criterion implements anautomated forward slicing technique that allows relevant control and data information to beextracted from computation trees

51 Interactive Stepper

Given a computation tree TR(s0) for an initial state s0 and a rewrite theory R the stepwiseinspection of the computation tree can be directly implemented by instantiating the explorationscheme of Section 4 with the inspection criterion

Istep(sbull s

rσwrarr K t) = t

12

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

that always returns the reduced state t of the rewrite step srσwrarr K t with K isin ∆ RB

This way by starting the exploration from a state fragment that corresponds to the wholeinitial state s0 (ie sbull0 = s0) the call explore(s0R Istep) generates a fragment T bull

R(sbull0) of thecomputation tree TR(s0) whose topology depends on the program states that the user decidesto expand during the exploration process

Example 51Consider the rewrite theoryR in Example 31 and the computation tree in Example 32 Assumethe user starts the exploration by calling explore(s0R Istep) which allows the first level of thecomputation tree to be unfolded by expanding the initial state s0 wrt the inspection criterion

Istep This generates the tree TbullR(s0) containing the edges s0

reqrarr s1 s0

reqrarr s2 Now if the user

carries on with the exploration of program state s1 and then quits s1 will be expanded and thetree T bull

R(s0) will be augmented accordingly Specifically the resulting T bullR(s0) will include the

following edges s0reqrarr s1 s0

reqrarr s2 s1

succrarr s3 s1

reqrarr s4 s1

duplrarr s4 s1

reqrarr s5 s1

lossrarr s6

It is worth noting that all the program state fragments produced by the program stepperdefined above are ldquoconcreterdquo (ie state fragments that do not include bull-variables) Howeversometimes it may be useful to work with partial information and hence with state fragmentsthat abstract ldquoconcreterdquo program states by using bull-variables This approach may help to focususerrsquos attention on the parts of the program states that the user wants to observe disregardingunwanted information and useless rewrite steps

Example 52Consider the following two rewrite rules [r1] f(x b) rarr g(x) and [r2] f(a y) rarr h(y) togetherwith the initial state f(a b) Then the computation tree in this case is finite and only contains

the tree edges f(a b)r1xaΛ

rarr g(a) and f(a b)r2ybΛ

rarr h(b) Now consider the state fragmentf(bull1 b) where only the second input argument is relevant If we decided to expand the initialstate fragment f(bull1 b) we would get the tree fragment represented by the single rewrite step

f(bull1 b)r1rarr g(bull1) since the partial input encoded into f(bull1 b) cannot be rewritten via r2

In light of Example 52 and our previous considerations we define the following inspectioncriterion

Ipstep(sbull s

rσwrarr K t) = if sbull

rσbullwrarr K tbull then return tbull else return nil

Roughly speaking given a rewrite step micro srσwrarr K t with K isin ∆ RB the criterion

Ipstep returns a state fragment tbull of the reduced state t whenever sbull can be rewritten to tbull

using the very same rule r and position w that occur in microThe particularization of the exploration scheme with the criterion Ipstep allows an interac-

tive partial stepper to be derived in which the user can work with state information of interestthereby producing more compact and focused representations of the visited fragments of thecomputation trees

52 Forward Trace Slicer

Forward trace slicing is a program analysis technique that allows computations to be simplifiedwrt a selected fragment of their initial state More precisely given a computation C withinitial state s0 and a state fragment sbull0 of s0 forward slicing yields a simplified view Cbull of Cin which each state s of the original computation is replaced by a state fragment sbull that only

13

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

function Islice(sbull s

λrarrρσwrarr t)

1 if w isin MPos(sbull) then2 θ = xfreshbull | x isin V ar(λ)3 λbull = fragment(λMPos(Varbull(sbull|w)) cap Pos(λ))

4 ψλ = 〈|θmatchλbull(sbull|w)|〉

5 tbull = sbull[ρψλ]w6 else7 tbull = nil8 fi9 return tbull

endf

Figure 4 Inspection criterion that models forward slicing of a rewrite step

records the information that depends on the meaningful symbols of sbull0 while unrelated dataare simply pruned away

In the following we define an inspection criterion Islice that implements the forward slicingof a single rewrite step The considered criterion takes two parameters as input namely a

rewrite step micro = (srσwrarr K t) (with r = λ rarr ρ and K isin ∆ RB) and a state fragment

sbull of a state s It delivers the state fragment tbull which includes only those data that arerelated to the meaningful symbols of sbull Intuitively the state fragment tbull is obtained fromsbull by ldquorewritingrdquo sbull at position w with the rule r and a suitable substitution that abstractsunwanted information of the computed substitution with bull-variables A rigorous formalizationof the inspection criterion Islice is provided by the algorithm in Figure 4

Note that by adopting the inspection criterion Islice the exploration scheme of Section 4automatically turns into an interactive forward trace slicer that expands program states usingthe slicing methodology encoded into the inspection criterion Islice In other words given acomputation tree TR(s0) and a user-defined state fragment sbull0 of the initial state s0 any branchsbull0 rarr sbull1 rarr sbulln in the tree T bull

R(sbull0) which is computed by the explore function is the slicedcounterpart of a computation s0 rarrRcup∆B s1 rarrRcup∆B sn (wrt the state fragment sbull0) thatappears in the computation tree TR(s0)

Roughly speaking the inspection criterion Islice works as follows When the rewrite stepmicro occurs at a position w that is not a meaningful position of sbull (in symbols w 6isin MPos(sbull))trivially micro does not contribute to producing the meaningful symbols of tbull This amounts tosaying that no relevant information descends from the state fragment sbull and hence the functionreturns the nil value

On the other hand when w isin MPos(sbull) the computation of tbull involves a more in-depthanalysis of the rewrite step which is based on a refinement process that allows the descendantsof sbull in tbull to be computed The following definition is auxiliary

Definition 53 (substitution update) Let σ1 and σ2 be two substitutions The update ofσ1 wrt σ2 is defined by the operator 〈| |〉 as follows

〈|σ1 σ2|〉 = σ|Dom(σ1) where

xσ =

xσ2 if x isin Dom(σ1) capDom(σ2)xσ1 otherwise

The operator 〈|σ1 σ2|〉 updates (overrides) a substitution σ1 with a substitution σ2 where bothσ1 and σ2 may contain bull-variables The main idea behind 〈| |〉 is that for the slicing of the

14

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

rewrite step micro all variables in the applied rewrite rule r are naıvely assumed to be initiallybound to irrelevant data bull and the bindings are incrementally updated as we apply the rule r

More specifically we initially define the substitution θ = xfreshbull | x isin V ar(ρ) thatbinds each variable in λ rarr ρ to a fresh bull-variable This corresponds to assuming that all theinformation in micro which is introduced by the substitution σ can be marked as irrelevant Thenθ is refined as follows

We first compute the state fragment λbull = fragment(λMPos(Varbull(sbull|w))capPos(λ)) that onlyrecords the meaningful symbols of the left-hand side λ of the rule r wrt the set of meaningfulpositions of sbull|w Then by matching λbull with sbull|w we generate a matcher matchλbull(sbull|w) thatextracts the meaningful symbols from sbull|w Such a matcher is then used to compute ψλ which

is an update of θ wrt matchλbull(sbull|w) containing the meaningful information to be trackedFinally the state fragment tbull is computed from sbull by replacing its subterm at position w withthe instance ρψλ of the right-hand side of the applied rule r This way we can transfer all therelevant information marked in sbull into the fragment of the resulting state tbull

Example 54Consider the computation tree of Example 32 whose initial state is

s0 = [Srv-A] amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

Let sbull0 = bull amp [Cli-Abull7 bull ] amp bull be a state fragment1 of s0 where only request 7 of ClientCli-A is considered of interest By sequentially expanding the nodes sbull0 s

bull1 s

bull3 and s

bull5 wrt

the inspection criterion Islice we get the following fragment of the given computation tree

Query Go

Go

Go

Go

Go

Go

GoGoBack

Back

Back

Back

Back

Back

BackBack AnimaOptions

bull amp [Cli-Abull7bull] amp bullsbull0

reqbull amp (bull lt- Cli-A7) amp [Cli-Abull7na] amp bullsbull1

reqduplbull amp (bull lt- Cli-A7) amp (bull lt- Cli-A7) amp [Cli-Abull7na] amp bull

sbull2 reply[bull] amp (Cli-A lt- bullf(bullCli-A7)) amp [Cli-Abull7na] amp bull

sbull3 lossbull amp [Cli-Abull7na] amp bullsbull4

succ[bull] amp (Cli-A lt- bull8) amp [Cli-Abull7na] amp bullsbull5

req[bull] amp (bull lt- Cli-A7) amp(Cli-A lt- bull8) amp [Cli-Abull7na] amp bull

sbull6 dupl[bull] amp (Cli-A lt- bull8) amp(Cli-A lt- bull8) amp [Cli-Abull7na] amp bull

sbull7 loss[bull] amp [Cli-Abull7na] amp bullsbull8 rec

[bull] amp [Cli-Abull77] amp bullsbull9

Note that the slicing process automatically computes a tree fragment that represents apartial view of the protocol interactions from client Cli-Arsquos perspective Actually irrelevantinformation is hidden and rules applied on irrelevant positions are directly ignored whichallows a simplified fragment to be obtained favoring its inspection for debugging and analysispurposes In fact if we observe the highlighted computation in the tree we can easily detectthe wrong behaviour of the rule rec Specifically by inspecting the state fragment sbull9 = ([bull]amp [Climinus A bull 7 7] amp bull) which is generated by an application of the rule rec we immediatelyrealize that the response 8 produced in the parent state sbull5 has not been stored in sbull9 whichclearly indicates a buggy implementation of the considered rule

1Throughout the example we omit indices from the considered bull-variables to keep notation lighter andimprove readability So any variable bulli i = 0 1 is simply denoted by bull

15

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

Finally it is worth noting that the forward trace slicer implemented via the criterion Islicediffers from the partial stepper given at the end of Section 51 Given a state fragment sbull and

a rewrite steprσwrarrK t Islice always yields a fragment tbull when the rewrite occurs at a meaningful

position By contrast the inspection criterion Ipstep encoded in the partial stepper may fail toprovide a computed fragment tbull when sbull does not rewrite to tbull

Example 55

Consider the same rewrite rules and initial state f(bull1 b) of Example 52 By expanding f(bull1 b)wrt the inspection criterion Islice we get the computation tree fragment with tree edgesf(bull1 b)

r1rarr g(bull1) and f(bull1 b)r2rarr h(b) whereas the partial stepper only computes the tree edge

f(bull1 b)r1rarr g(bull1) as shown in Example 52

6 Implementation

The exploration methodology developed in this paper has been implemented in the Anima

tool which is publicly available at httpsafe-toolsdsicupvesanima The underlyingrewriting machinery of Anima is written in Maude and consists of about 150 Maude functiondefinitions (approximately 1600 lines of source code)

Anima also comes with an intuitive Web user inter-

Database

Anima Client

JAX-RS API

Initial State Rewriting LogicSpecification Animation

Anima Web Service

Anima Core

Figure 5 Anima architecture

face based on AJAX technology which allows usersto graphically display and animate computation treefragments The core exploration engine is specified asa RESTful Web service by means of the Jersey JAX-RS API

The architecture of Anima is depicted in Figure 5and consists of five main components Anima ClientJAX-RS API AnimaWeb Service Database and An-ima Core The Anima Client is purely implementedin HTML5 and JSP It represents the front-end layerof our tool and provides an intuitive versatile Webuser interface which interacts with the Anima Web Service to invoke the capabilities of theAnima Core and save partial results in the Database component

A screenshot that shows the Anima tool at work on the case study that is described inExample 54 is given in Figure 6

These are the main features provided by Anima

1 Inspection strategies The tool implements the three inspection strategies described inSection 5 As shown in Figure 6 the user can select a strategy by using the selectorprovided in the option pane

2 ExpandingFolding program states The user can expand or fold states by right-clicking onthem with the mouse and by selecting the ExpandFold Node options from the contextualmenu For instance in Figure 6 a state fragment on the frontier of the computed treehas been selected and is ready to be expanded through the Expand Node option

3 Selecting meaningful symbols State fragments can be specified by highlighting the statesymbols of interest either directly on the tree or in the detailed information window

16

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

GoGoGoGoGoBackBackBackBackBack Anima

Options

View

Rule Labels

State Labels

Zoom 100

- +

Interactive StepperInteractive StepperInteractive StepperInteractive StepperInteractive Stepper

Simple Advanced

ON OFF

ON Transition information from state to sbull1 sbull2

Rule

rl [reply] S lt- C Q amp [S] =gt [S] amp C lt- S f(S C Q)

amp [Cli-Abull7na]

bull amp [Cli-Abull7bull] amp bull

sbull0

req

bull amp (bull lt- Cli-A7) amp [Cli-Abull7na] amp bull

sbull1

reqdupl

bull amp (bull lt- Cli-A7) amp (bull

lt- Cli-A7) amp [Cli-Abull

7na] amp bull

sbull2 reply

[bull] amp (Cli-A lt- bullf(bullCl

i-A7))

amp bull

sbull3 loss

bull amp [Cli-Abull7na] amp bull

sbull4

Expand node

Fold node

Show full information

Show transition information

Expand view

Collapse view

Figure 6 Anima at work

4 Search mechanism The search facility implements a pattern language that allows stateinformation of interest to be searched on huge states and complex computation trees Theuser only has to provide a filtering pattern (the query) that specifies the set of symbols thatheshe wants to search for and then all the states matching the query are automaticallyhighlighted in the computation tree

5 Transition information Anima facilitates the inspection of a selected rewrite step s rarr tthat occurs in the computation tree by underlining its redex in s and the reduced subtermin t Some additional transition information is also displayed in the transition informa-tion window (eg the ruleequation applied the rewrite position and the computedsubstitution of the considered rewrite step) by right-clicking on the corresponding option

7 Conclusions

The analysis of execution traces plays a fundamental role in many program analysis approachessuch as runtime verification monitoring testing and specification mining We have presenteda parametrized exploration technique that can be applied to the inspection of rewriting logiccomputations and that can work in different ways Three instances of the parameterized ex-ploration scheme (an incremental stepper an incremental partial stepper and a forward traceslicer) have been formalized and implemented in the Anima tool which is a novel program an-imator for RWL The tool is useful for Maude programmers in two ways First it concretelydemonstrates the semantics of the language allowing the evaluation rules to be observed inaction Secondly it can be used as a debugging tool allowing the users to step forward andbackward while slicing the trace in order to validate input data or locate programming mis-takes

17

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

References

[1] M Alpuente D Ballis M Baggi and M Falaschi A FoldUnfold Transformation Frameworkfor Rewrite Theories extended to CCT In Proc 2010 ACM SIGPLAN Workshop on PartialEvaluation and Program Manipulation PEPM 2010 pages 43ndash52 ACM 2010

[2] M Alpuente D Ballis J Espert and D Romero Model-checking Web Applications with Web-TLR In Proc of 8th Intrsquol Symposium on Automated Technology for Verification and Analysis(ATVA 2010) volume 6252 of LNCS pages 341ndash346 Springer-Verlag 2010

[3] M Alpuente D Ballis J Espert and D Romero Backward Trace Slicing for Rewriting LogicTheories In Proc CADE 2011 volume 6803 of LNCSLNAI pages 34ndash48 Springer-Verlag 2011

[4] M Alpuente D Ballis F Frechina and D Romero Backward Trace Slicing for ConditionalRewrite Theories In Proc LPAR-18 volume 7180 of LNCS pages 62ndash76 Springer-Verlag 2012

[5] M Alpuente D Ballis F Frechina and J Sapina Slicing-Based Trace Analysis of RewritingLogic Specifications with iJulienne In Matthias Felleisen and Philippa Gardner editors Procof 22nd European Symposium on Programming ESOP 2013 volume 7792 of Lecture Notes inComputer Science pages 121ndash124 Springer 2013

[6] M Alpuente D Ballis and D Romero Specification and Verification of Web Applications inRewriting Logic In Formal Methods Second World Congress FM 2009 volume 5850 of LNCSpages 790ndash805 Springer-Verlag 2009

[7] M Baggi D Ballis and M Falaschi Quantitative Pathway Logic for Computational Biology InProc of 7th Intrsquol Conference on Computational Methods in Systems Biology (CMSB rsquo09) volume5688 of LNCS pages 68ndash82 Springer-Verlag 2009

[8] R Bruni and J Meseguer Semantic Foundations for Generalized Rewrite Theories TheoreticalComputer Science 360(1ndash3)386ndash414 2006

[9] M Clavel F Duran S Eker P Lincoln N Martı-Oliet J Meseguer and C Talcott MaudeManual (Version 26) Technical report SRI Intrsquol Computer Science Laboratory 2011 Availableat httpmaudecsuiucedumaude2-manual

[10] J Clements M Flatt and M Felleisen Modeling an Algebraic Stepper In Proc 10th EuropeanSymposium on Programming volume 2028 of LNCS pages 320ndash334 Springer-Verlag 2001

[11] F Duran and J Meseguer A Maude Coherence Checker Tool for Conditional Order-SortedRewrite Theories In Proc of 8th International Workshop on Rewriting Logic and Its Applications(WRLArsquo10) number 6381 in LNCS pages 86ndash103 Springer-Verlag 2010

[12] JW Klop Term Rewriting Systems In S Abramsky D Gabbay and T Maibaum editorsHandbook of Logic in Computer Science volume I pages 1ndash112 Oxford University Press 1992

[13] N Martı-Oliet and J Meseguer Rewriting Logic Roadmap and Bibliography Theoretical Com-puter Science 285(2)121ndash154 2002

[14] J Meseguer Conditional Rewriting Logic as a Unified Model of Concurrency Theoretical Com-puter Science 96(1)73ndash155 1992

[15] J Meseguer The Temporal Logic of Rewriting A Gentle Introduction In Concurrency Graphsand Models Essays Dedicated to Ugo Montanari on the Occasion of his 65th Birthday volume5065 pages 354ndash382 Berlin Heidelberg 2008 Springer-Verlag

[16] A Riesco A Verdejo R Caballero and N Martı-Oliet Declarative Debugging of RewritingLogic Specifications In Recent Trends in Algebraic Development Techniques 19th Intrsquol WorkshopWADT 2008 volume 5486 of LNCS pages 308ndash325 Springer-Verlag 2009

[17] A Riesco A Verdejo and N Martı-Oliet Declarative Debugging of Missing Answers for MaudeIn 21st Intrsquol Conference on Rewriting Techniques and Applications RTA 2010 volume 6 of LIPIcspages 277ndash294 Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik 2010

[18] TeReSe editor Term Rewriting Systems Cambridge University Press Cambridge UK 2003

18

Automatic Inference of Term Equivalence in

Term Rewriting Systems

Marco Comini1 and Luca Torella2

1 DIMI University of Udine Italymarcocominiuniudit

2 DIISM University of Siena Italylucatorellaunisiit

Abstract

In this paper we propose a method to automatically infer algebraic property-orientedspecifications from Term Rewriting Systems Namely having three semantics with suitableproperties given the source code of a TRS we infer a specification which consists of a setof most general equations relating terms that rewrite for all possible instantiations to thesame set of constructor terms

The semantic-based inference method that we propose can cope with non-constructor-based TRSs and considers non-ground terms Particular emphasis is put on avoiding thegeneration of ldquoredundantrdquo equations that can be a logical consequence of other ones

1 Introduction

In the last years there has been a growing interest in the research on automatic inference ofhigh-level specifications from an executable or the source code of a system This is probablydue to the fact that the size of software systems is growing over time and certainly one cangreatly benefit from the use of automatic tools There are several proposals like [1 7 6] whichhave proven to be very helpful

Specifications have been classified by their characteristics [8] It is common to distin-guish between property-oriented specifications and model-oriented or functional specificationsProperty-oriented specifications are of higher description level than other kinds of specificationsthey consist of an indirect definition of the systemrsquos behavior by stating a set of propertiesusually in the form of axioms that the system must satisfy [11 10] In other words a specifi-cation does not represent the functionality of the program (the output of the system) but itsproperties in terms of relations among the operations that can be invoked in the program (ieidentifies different calls that have the same behavior when executed) This kind of specifica-tions is particularly well suited for program understanding the user can realize non-evidentinformation about the behavior of a given function by observing its relation to other functionsMoreover the inferred properties can manifest potential symptoms of program errors which canbe used as input for (formal) validation and verification purposes

We can identify two mainstream approaches to perform the inference of specifications glass-box and black-box The glass-box approach [1] assumes that the source code of the programis available In this context the goal of inferring a specification is mainly applied to documentthe code or to understand it Therefore the specification must be more succinct and compre-hensible than the source code itself The inferred specification can also be used to automatethe testing process of the program or to verify that a given property holds [1] The black-boxapproach [7 6] works only by running the executable This means that the only informationused during the inference process is the input-output behavior of the program In this setting

19

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

the inferred specification is often used to discover the functionality of the system (or services ina network) [6] Although black-box approaches work without any restriction on the consideredlanguage ndash which is rarely the case in a glass-box approach ndash in general they cannot guaranteethe correctness of the results (whereas indeed semantics-based glass-box approaches can)

For this work we developed a (glass-box) semantic-based algebraic specification synthesismethod for the Term Rewriting Systems formalism that is completely automatic ie needsonly the source TRS to run Moreover the outcomes are very intuitive since specifications aresets of equations of the form e1 = e2 where e1 e2 are generic TRS expressions so the userdoes not need any kind of extra knowledge to interpret the results The underpinnings of ourproposal are radically different from other works for functional programming since the presenceof non-confluence or non-constructor-based TRSs poses several additional problems

11 Notations

We assume that the reader is familiar with the basic notions of term rewriting For a thoroughdiscussion of these topics see [9] In the paper we use the following notations V denotes a(fixed) countably infinite set of variables and T (ΣV) denotes the terms built over signatureΣ and variables V T (Σempty) are ground terms Substitutions over T (Σempty) are called groundsubstitutions Σ is partitioned in D the defined symbols and C the constructor symbols

T (CV) are constructor terms Substitutions over T (CV) are said constructor substitutionsC[t1 tn] denotes the replacement of t1 tn in context C A TRS R is a set of rules l rarr r

where l = f(t1 tn) l r isin T (ΣV) var(r) sube var(l) and f isin D t1 tn are the argumentpatterns of l rarr r and need not necessarily be in T (CV) unlike in functional programmingwhere only constructor-based TRSs are considered (with ti isin T (CV))

2 Many notions of equivalence

In the functional programming paradigm an equation e1 = e2 is typically interpreted as aproperty that holds for any well-typed constructor ground instance of the variables occurringin the equation Namely for all bindings of variables with well-typed (constructor ground)terms ϑ the constructor term computed for the calls e1ϑ and e2ϑ is the same In functionalprogramming we can consider only constructor instances because by having constructor-basedconfluent TRSs the set of values for non-constructor instances is the same as for constructorones

Differently from the functional programming case the TRS formalism admits variables ininitial terms and defined symbols in the patterns of the rules moreover rules are evaluatednon-deterministically and can rewrite to many constructor terms Thus an equation can beinterpreted in many different ways We will discuss the key points of the problem by means ofa (very simple) illustrative example

Example 21 Consider the following (non constructor based) TRS R where we provide a prettystandard definition of the arithmetic operations + - and (modulo)

0 + x -gt x x - 0 -gt x x s(y) -gt (x - s(y)) s(y)

s(x) + y -gt s(x+y) s(x) - s(y) -gt x - y (0 - s(x)) s(y) -gt y - x

Note that since the TRS formalism is untyped a term like 0 + a is admissible and is evaluatedto constructor term a

20

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

For this TRS one could expect to have in its property-oriented specification equations like

(x + y) + z = x + (y + z) (21)

x - (y + z) = (x - y) - z (22)

(x - y) - z = (x - z) - y (23)

0 + x = x (24)

x + 0 = x (25)

x + y = y + x (26)

These equations of the form e1 = e2 can be read as the (observable) outcomes of e1 are thesame of e2 The first essential thing is to formalize the meaning of ldquoobservable outcomesrdquo ofthe evaluation of an expression e (which contains variables) In the TRS formalism we haveseveral possible combinations First it is technically possible to literally interpret variables ine and decide to observe either the set of normal forms of e or the set of constructor terms ofe However as can be quickly verified only (24) is valid in either of these forms Indeedconsider for example terms x - (y + z) and (x - y) - z For both terms no rule can beapplied hence they are both (non constructor) normal forms and thus (22) is not literally validClearly this is quite a radical choice An interesting alternative would be to request that forany possible interpretation of variables with any term the expressions rewrite to the same setof constructor terms Formally by defining the rewriting behavior of a term t as

BJtRK ∶= ϑ sdot s∣ tϑETHrarrR

lowast s s isin T (CV) ϑ∶V rarr T (ΣV) dom(ϑ) sube var(t) (27)

we can interpret e1 = e2 as e1 =RB e2 ∶lArrrArr BJe1RK = BJe2RK In the following we call thisequivalence rewriting behavior equivalence Actually eqs (21) to (24) are valid wrt =RB

Note that if we would have chosen to use normal forms instead of constructor terms in (27)(ie s rarr instead of s isin T (CV)) then we would still have the same situation described beforewhere only (24) holds

The other equations (eqs (25) and (26)) are not valid in this sense For instance BJx + 0K =xt sdot si(0)∣tETHrarrlowast si(0) 1 while BJxK = xt sdot v∣tETHrarr

R

lowast v v isin T (CV) (and then ε sdot x isin BJxK ∖

BJx + 0K) These equations are not valid essentially because we have variables which cannotbe instantiated but if we consider ground constructor instancies which ldquotriggerrdquo in either terman evaluation to constructor terms then we actually obtain the same constructor terms Forexample for t1 = x and t2 = x + 0 for all ϑi = xsi(0) we have BJt1ϑiK = BJt2ϑiK = ε sdot si(0)∣Thus (25) holds in this sense

Decidedly also this notion of equivalence is interesting for the user We can formalize it ast1 =G t2 ∶lArrrArr forallϑ ground constructor BJt1ϑK cupBJt2ϑK sube ε sdot t∣t isin T (CV)rArr BJt1ϑK = BJt2ϑK Wewill call it ground constructor equivalence Note that =G is the only possible notion in the purefunctional paradigm where we can just have evaluations of ground terms and where we haveonly confluent constructor-based TRSs In this case the latter definition boils down to twoexpressions are equivalent if all its ground constructor instances rewrite to the same constructorterm This fact allows one to have an intuition of the reason why the problem of specificationsynthesis is definitively more complex in the full TRS paradigm

Since we do not consider only constructor-based TRSs there is another very relevant differ-ence wrt the pure functional case For instance let us consider the TRS Q obtained by addingthe rule g((x - y) - z) -gt x - (y + z) to TRS R of Example 21 Let t1 = x - (y + z)

1Here by si(0) we mean i repeated applications of s to 0 including the degenerate case for i = 0

21

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

and t2 = (x-y)-z We have BJt1QK = BJt2QK = x0 y0 z0 sdot 0xs(0) y0 z0 sdot s(0)xs(0) ys(0) z0 sdot 0xs(0) y0 zs(0) sdot 0 ∣ While the term g(t2) has this same be-havior BJg(t1)QK = empty

In general in the case of the TRS formalism terms embedded within a context do notnecessarily manifest the same behavior Thus it is also interesting to additionally ask to theequivalence notion =RB that the behaviors must be the same also when the two terms areembedded within any context Namely e1 =C e2 ∶lArrrArr forall contextC BJC[e1]RK = BJC[e2]RKWe call this equivalence contextual equivalence We can see that =C is (obviously) strongerthan =RB which is in turn stronger than =G Actually they are strictly stronger Indeed onlyeqs (21) and (24) are valid wrt =C (while eqs (22) and (23) are not)

We believe that all these notions are interesting for the user thus we formalize our notionof (algebraic) specification as follows

Definition 22 A specification S is a set of (sequences of) equations of the form t1 =K t2 =K =K tn with K isin CRB G and t1 t2 tn isin T (ΣV)

Thus for TRS Q we would get the following (partial) specification

(x + y) + z =C x + (y + z) 0 + x =C x

x - (y + z) =RB (x - y) - z (x - y) - z =RB (x - z) - y

x + y =G y + x x + 0 =G x

(x + y) z =G ((x z) + (y z)) z (x + y) y =G x y

(x - y) z =G (((x + z) z) - (y z)) z

In the following we present a first proposal of a semantics-based method that infers such spec-ifications for TRSs and tackles the presented issues (and discuss about its limitations) It isan adaptation for the TRS paradigm of ideas from [2] for the Functional Logic paradigm Thisadaptation is not straightforward since the Functional Logic paradigm is quite similar to theFunctional paradigm but considerably different from the TRS paradigm Moreover this worksignificantly extends the inference process by tackling equations like f(x y) = f(y x) which arereally important

3 Deriving specifications from TRSs

The methodology we are about to present is parametric wrt three semantics evaluation func-tions which need to enjoy some properties Namely

ERBJt RK gives the rewriting behavior (RB) semantics of term t with (definitions from) TRSR This semantics has to be fully abstract wrt rewriting behavior equivalence Namelywe require that ERBJt1 RK = ERBJt2 RK lArrrArr t1 =RB t2

EC Jt RK gives the contextual (C) semantics of the term t with the TRS R This semantics hasto be fully abstract wrt contextual equivalence Namely EC Jt1 RK = EC Jt2 RK lArrrArrt1 =C t2

EGJt RK gives the ground (G) semantics of the term t with the TRS R This semanticshas to be fully abstract wrt ground constructor equivalence Namely EGJt1 RK =EGJt2 RK lArrrArr t1 =G t2

22

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

The idea underlying the process of inferring specifications is that of computing the semanticsof various terms and then identify all terms which have the same semantics However not allequivalences are as important as others given the fact that many equivalences are simplelogical consequences of others For example if ti =C si then for all constructor contexts CC[t1 tn] =C C[s1 sn] thus the latter derived equivalences are uninteresting and shouldbe omitted Indeed it would be desirable to synthesize the minimal set of equations from whichby deduction all valid equalities can be derived This is certainly a complex issue in testingapproaches With a semantics-based approach it is fairly natural to produce just the relevantequations The (high level) idea is to proceed bottom-up by starting from the evaluation ofsimpler terms and then newer terms are constructed (and evaluated) by using only semanticallydifferent arguments Thus by construction only non-redundant equations are produced

There is also another source of redundancy due to the inclusion of relations =K For examplesince =C is the finer relation t =C s implies t =RB s and t =G s To avoid the generation of coarserredundant equations a simple solution is that of starting with =C equivalences and once theseare all settled to proceed only with the evaluation of the =RB equivalences of non =C equivalentterms Thereafter we can evaluate the =G equivalences of non =RB equivalent terms

Clearly the full computation of a programsrsquo semantics is not feasible in general For themoment for the sake of comprehension we prefer to present the conceptual framework leavingout of the picture the issues related to decidability We will show a possible decidable instanceof the method in Section 31

Let us describe in more detail the specification inference process The input of the processconsists of a TRS to be analyzed and two additional parameters a relevant API Σr and amaximum term size max size The relevant API allows the user to choose the operations inthe program that will be present in the inferred specification whereas the maximum term sizelimits the size of the terms in the specification As a consequence these two parameters tunethe granularity of the specification both making the process terminating and allowing the userto keep the specification concise and easy to understand

The output consists of a set of equations represented by equivalence classes of terms (withdistinct variables) Note that inferred equations may differ for the same program dependingon the considered API and on the maximum term size Similarly to other property-orientedapproaches the computed specification is complete up to terms of size max size ie it includesall the properties (relations) that hold between the operations in the relevant API and that areexpressible by terms of size less or equal than max size

Terms are classified by their semantics into a data structure which we call classificationconsisting (conceptually) of a set of equivalence classes (ec) formed by

bull sem(ec) the semantics of (all) the terms in that classbull rep(ec) the representative term of the class (rep(ec) isin terms(ec))bull terms(ec) the set of terms belonging to that equivalence classbull epoch(ec) an integer to record the moment of introduction of that equivalence class

The representative term is the term which is used in the construction of nested expressionswhen the equivalence class is considered To output smaller equations it is better to choose thesmallest term in the class (wrt the function size) but any element of terms(ec) can be used

The inference process consists of successive phases one for each kind of equality (in orderof discriminating power ie C RB G) as depicted in Figure 1

Computation of the initial classification (epochs 0 and 1) The first phase of the algo-rithm is the computation of the initial classification that is needed to compute the classificationwrt =C We initially create a classification which contains

23

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

Inference Process

Computation of the initial classification

Generation of =C -classification

Generation of =RB -classification

Generation of =G -classification

Generation of =C -equations

Generation of =RB -equations

Generation of =G -equations

Specification

TRS

Program

API

max size

Figure 1 A general view of the inference process

bull one class for a free (logical) variable ⟨EC JxK x x 0⟩bull the classes for any constructor symbol ie for all cn

2 isin C and x1 xn distinct variables

⟨EC JtK t t 0⟩ where t = c(x1 xn)

Then for all symbols fn of the relevant API Σr and distinct variables x1 xn we add

to classification the term t = f(x1 xn) with semantics s = EC Jt RK and epoch m = 1This operation denoted addEC (t sm) is the most delicate part of the method If we wouldnot consider the generation of ldquopermutedrdquo equations like f(x y) = f(y x) then the wholeactivity would just boil down to look for the presence of s in some equivalence class and thenupdating the classification accordingly (like in [2]) Handling of permutations cannot be done bynaıvely adding all (different) permutations of s In this way we would generate many redundantequations Consider for instance the TRS Q

f(abc) -gt 0

f(bac) -gt 0

f(acb) -gt 0

f(bca) -gt 0

f(cab) -gt 0

f(cba) -gt 0

From the minimal set f(x y z) =C f(y x z) =C f(x z y) we can generate all other valid per-mutations like f(x y z) =C f(y z x) =C f(z x y) Thus in this case we should only generatepermutated equations where we just swap two variables However for the TRS R

f(abc) -gt 0 f(bca) -gt 0 f(cab) -gt 0

f(x y z) neC f(y x z) neC f(x z y) but f(x y z) =C f(y z x) Moreover f(x y z) =C f(z x y)can be deduced by this Thus in this case we should only generate permutated equations witha rotation of three variables since all other rotations of three variables are just a consequence

Thus not all permutations have to be considered while adding a semantics to a classificationand it is not necessary to look for all permutations within the semantics already present in theclassification To generate only a minimal set of necessary permutated equations we need toconsider for each k variables a set Πn

k of generators of the permutations of n variables whichdo not move n minus k variables (note that Πn

1 = id ) Then for a term t = f(x1 xn) westart sequentially for i from 1 to n and look if for some π isin Πn

i we have an equivalence classec in the current classification whose semantics coincides with sπ (ie ec = ⟨sπ tprime T mprime⟩) Ifit is found then the term tπminus1 is added to the set of terms in ec (ie ec is transformed inecprime = ⟨sπ tprime T cup tπminus1 mprime⟩) and we stop Otherwise we iterate with next i If all fails a newequivalence class ⟨s t T m⟩ has to be created but we have to determine the right term set

2Following the standard notation fn denotes a function f of arity n

24

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

T (to possibly generate equations like f(x y) = f(y x)) We initially start with T = t andj = n and sequentially for i from 2 to j we check if for some π isin Πj

i we have s = sπ If wefind it we add tπ to T and decrement j by i minus 1 (i variables are now used in a valid equationand thus from this moment on i minus 1 variables have no longer to be considered) Otherwise wecontinue with next i The final T is used for the new equivalence class

For example for t = f(x y z) in TRS Q we start with variables x y z and T = t Nowconsider for instance π = (xy) isin Π3

2 Since EC JtK = EC JtπK then T = f(x y z) f(y x z)and then we drop x and remain with variables y z Now we have only πprime = (y z) isin Π2

2 andsince EC JtK = EC JtπprimeK then T = f(x y z) f(y x z) f(x z y) we drop y and (thus) finishInstead for t = f(x y z) in TRS R we start with variables x y z and T = t Now considerfor instance π1 = (xy) isin Π3

2 Since EC JtK ne EC Jtπ1K then we consider π2 = (y z) isin Π3

2 and sinceEC JtK ne EC Jtπ2K we increase i Now we have only π3 = (xy z) isin Π3

3 and since EC JtK = EC Jtπ3Kthen T = f(x y z) f(y z x) we drop x y and (thus) finish

Generation of =C classification (epochs 2 and above) The second phase of the algo-rithm is the (iterative) computation of the successive epochs until we complete the constructionof the classification of terms wrt =C At each iteration (with epoch k) for all symbols fnof the relevant API Σr we select from the current classification all possible combinations of nequivalence classes ec1 ecn such that at least one eci was newly produced in the previousiteration (ie whose epoch is k minus 1) We build the term t = f(rep(ec1) rep(ecn)) whichby construction has surely not been considered yet Then if size(t) le max size we computethe semantics s = EC Jt RK and update the current classification by adding to classification theterm t and its semantics s (addEC (t s k)) as described before

If we have produced new equivalence classes then we continue to iterate This phase eventu-ally terminates because at each iteration we consider by construction terms which are differentfrom those already existing in the classification and whose size is strictly greater than the sizeof its subterms (but the size is bounded by max size)

The following example illustrates how the iterative process works

Example 31 Let us use the program R of Example 21 and choose as relevant API the func-tions + - and In the first step the terms

t11 = x + y t12 = x - y t13 = x y

are built Since (all permutations of) the semantics of all these terms are different and differentfrom the other semantics already in the initial classification three new classes are added to theinitial classification

During the second iteration the following two terms (among others) are built

bull the term t21 = (xrsquo + yrsquo) + y is built as the instantiation of x in t11 with (a renamedapart variant of) t11 and

bull the term t22 = x + (xrsquo + yrsquo) as the instantiation of y in t11 with t11

The semantics of these two terms is the same s but it is different from the semantics of theexisting equivalence classes Thus during this iteration (at least) the new equivalence classecprime ∶= ⟨s t21 t21 t22 n⟩ is computed Hereafter only the representative of the class will beused for constructing new terms Since we have chosen t21 instead of t22 as the representativeterms like (x + (xrsquo + yrsquo)) z will never be built

Thanks to the closedness wrt context of the semantics this strategy for generating terms issafe In other words when we avoid to build a term it is because it is not able to produce a

25

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

behavior different from the behaviors already included by the existing terms thus we are notlosing completeness

Generation of the =C specification Since by construction we have avoided much redun-dancy thanks to the strategy used to generate the equivalence classes we now have only to takeeach equivalence class with more than one term and generate equations for these terms

Generation of =RB equations The third phase of the algorithm works on the former clas-sification by first transforming each equivalence class ec by replacing the C-semantics sem(ec)with ERBJrep(ec) RK and terms(ec) with the (singleton) set rep(ec) After the transforma-tion some of the previous equivalence classes which had different semantic constructor termsmay now have the same RB -semantics and then we merge them making the union of the termsets terms(ec)

Thanks to the fact that before merging all equivalence classes were made of just singletonterm sets we cannot generate (again) equations t1 =RB t2 when an equation t1 =C t2 had beenalready issued Let us clarify this phase by an example

Example 32 Assume we have a classification consisting of three equivalence classes with C-semantics s1 s2 and s3 and representative terms t11 t22 and t31

ec1 = ⟨s1 t11t11 t12 t13⟩ ec2 = ⟨s2 t22t21 t22⟩ ec3 = ⟨s3 t31t31⟩

We generate equations t11 =C t12 =C t13 and t21 =C t22Now assume that ERBJt11K = w0 and ERBJt22K = ERBJt31K = w1 Then (since t12 t13 and

t21 are removed) we obtain the new classification

ec4 = ⟨w0 t11 t11 n⟩ ec5 = ⟨w1 t22 t22 t31 n⟩

Hence the only new equation is t22 =RB t31 Indeed equation t11 =RB t12 is uninterestingsince we already know t11 =C t12 and equation t21 =RB t31 is redundant (because t21 =C t22 andt22 =RB t31)

The resulting (coarser) classification is then used to produce the =RB equations as donebefore by generating equations for all non-singletons term sets

Generation of the =G equations In the last phase we transform again the classificationby replacing the RB -semantics with the G-semantics (and terms(ec) with the set rep(ec))Then we merge eventual equivalence classes with the same semantics and finally we generate=G equations for non singleton term sets

Theorem 33 (Correctness) For all equations e1 = e2 generated in the second third andforth phase we have that e1 =C e2 e1 =RB e2 and e1 =G e2 respectively

Proof By construction of equivalence classes in the second phase an equation t1 = t2 isgenerated if and only if the semantics EC Jt1 RK = EC Jt2 RK Then since EC Jt1 RK =EC Jt2 RK lArrrArr t1 =C t2 the first part of thesis follows immediately Then by the succes-sive trasformation and reclassification in the third phase we issue an equation t1 = t2 if andonly if ERBJt1 RK = ERBJt2 RK Then since ERBJt1 RK = ERBJt2 RK lArrrArr t1 =RB t2 we havethe second part of thesis The proof of the third part of thesis since EGJt1 RK = EGJt2 RK lArrrArrt1 =G t2 is analogous

26

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

Example 34 Let us recall (again) the programR of Example 21 The terms x + y and y + xbefore the transformation belong to two different equivalence classes (since their rewritingbehavior is different) Anyway after the transformation the two classes are merged since theirG-semantics is the same namely x0 y0 sdot 0xs(0) y0 sdot s(0)x0 ys(0) sdot s(0) ∣

We now present some examples to show how our proposal deals with non-contructor basedor non-confluent TRS plus some to show that we can infer several non-trivial equations

Example 35 Consider the definition for the boolean data type with constructor terms trueand false and boolean operations and or not and imp

and(true x) -gt x

and(false x) -gt false

or(true x) -gt true

or(false x) -gt x

not(true) -gt false

not(false) -gt true

imp(false x) -gt true

imp(true x) -gt x

This is a pretty standard ldquoshort-cutrdquo definition of boolean connectives With our method weget the following equations

not(or(xy)) =C and(not(x)not(y)) imp(xy) =C or(not(x)y)

not(and(xy)) =C or(not(x)not(y)) not(not(x)) =G x

and(xand(yz)) =C and(and(xy)z) and(xy) =G and(yx)

Example 36 Let us consider the following non-constructor based TRS implementing someoperations over the naturals in Peano notation

x - 0 -gt x

s(x) - s(y) -gt x - y

g(x) -gt chk(x - s(x))

chk(0) -gt 0

chk(s(x)) -gt s(x)

chk(0 - s(x)) -gt err

The definition of - is a standard definition of the minus operation over naturals The chk

function simply returns the natural passed as argument or returns err if the argument is anot defined subtraction It is easy to see that the TRS is not constructor-based because ofthe presence of the - in the pattern of a rule The artificial function g which checks if thesubtraction of a number by its successor is a natural number is doomed to return err Withour classification we actually derive equation g(x) =C err

Example 37 Let us consider the following (artificial) non-orthogonal TRS

coin -gt 0

coin -gt 1

d(x) -gt g(xx)

g(01) -gt true

t(x) -gt k(xxx)

k(101) -gt true

The coin function can return both 0 and 1 The functions d and t call an auxiliary functionduplicating and triplicating (respectively) the variable received as argument Functions f andg require a specific combination of 0 and 1 to return the constructor term true Notice thatto reach the constructor term true from d and t respectively it is necessary to use a nondeterministic function able to rewrite to both 0 and 1 Some of the inferred equations for thisTRS are t(x) =C d(x) and t(coin) =C g(coincoin) =C k(coincoincoin) =C d(coin)

27

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

Example 38 Let us consider the following TRS that computes the double of numbers inPeano notation

double (0) -gt 0

double(s(x)) -gt s(s(double(x)))

dbl(x) -gt plus(xx)

plus(0y) -gt y

plus(s(x)y) -gt s(plus(xy))

Some of the inferred equations for the TRS are

dbl(dbl(double(x))) =G dbl(double(dbl(x))) (31)

double(x) =G dbl(x) (32)

dbl(dbl(x)) =G dbl(double(x))=Gdouble(dbl(x)) =G double(double(x)) (33)

plus(double(x)y) =G plus(dbl(x)y) (34)

We can observe that all equations hold with the =G relation and not with the =RB relationThis is due to the fact that the two functions dbl and dbl even if at a first sight could seemto evaluate the same constructor terms can behave differently For instance if we add to theTRS the two rules coin -gt 0 and coin -gt s(0) we can notice that the terms double(coin)and dbl(coin) return different constructor terms This is due to the non determinism ofthe coin function that exploits the right non-linearity of function dbl While double(coin)

evaluates to 0 and s(s(0)) the term dbl(coin) can be reduced even to s(0) (by dbl(coin)

rarr plus(coincoin) rarr2 plus(0s(0)) rarr s(0))This characteristic of the program is not easy to realize by just looking at the code

Example 39 Let us consider the following TRS defining two functions over an extension ofthe Peano notation able to handle negative integers

abs(-(x)) -gt abs(x)

abs(s(x)) -gt s(x)

abs(0) -gt 0

f(-(-(x))) -gt f(x)

f(0) -gt 0

f(s(x)) -gt s(x)

f(-(s(x))) -gt 0

Function abs is a standard definition of the absolute value function f returns its input if it isa positive number and 0 if it is not Some of the inferred equations are f(f(x)) =C abs(f(x))

and f(abs(x)) =C abs(abs(x))

Example 310 Let us consider the following program which implements a two-sided queue in a(non-trivial) efficient way The queue is implemented as two lists where the first list correspondsto the first part of the queue and the second list is the second part of the queue reversed Theinl function adds the new element to the head of the first list whereas the inr function addsthe new element to the head of the second list (the last element of the queue) The outl (outr)function drops one element from the left (right) list unless the list is empty in which case itreverses the other list and then swaps the two lists before removal

new -gt Q(Nil Nil)

inl(xQ(xs ys)) -gt Q((xxs)ys)

inr(xQ(xs ys)) -gt Q(xs (xys))

outl(Q(Nil ys)) -gt

Q(tail(rev(ys))Nil)

outl(Q((xxs)ys)) -gt Q(xsys)

outr(Q(xs Nil)) -gt

Q(Nil tail(rev(xs)))

outr(Q(xs (yys))) -gt Q(xsys)

null(Q((xxs)ys)) -gt False

null(Q(Nil (xxs))) -gt False

null(Q(Nil Nil)) -gt True

28

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

tail ((xxs)) -gt xs

rev(xs) -gt rv rsquo(xs Nil)

rv rsquo(Nil ys) -gt ys

rv rsquo((xxs)ys) -gt rv rsquo(xs (xys))

With our method (amongst others) we derive

null(new) =C True (35)

new =C outl(inl(xnew)) =C outr(inr(xnew)) (36)

outl(inl(xq)) =C outr(inr(xq)) (37)

inr(xinl(yq)) =C inl(yinr(xq)) (38)

inl(xoutl(inl(yq))) =C outr(inl(xinr(yq))) (39)

null(inl(xnew)) =C null(inr(xnew)) =C False (310)

We can see different kinds of non-trivial equations eqs (36) and (37) state that adding andremoving one element produces always the same result independently from the side in which weadd and remove it Equations (38) and (39) show a sort of restricted commutativity betweenfunctions

31 An effective instance of the presented method

In a semantics-based approach one of the main problems to be tackled is effectiveness Thesemantics of a program is in general infinite and thus some approximation has to be used inorder to have a terminating method To experiment on the validity of our proposal we startedby using a novel (condensed) fixpoint semantics which we have developed for left-linear TRSsthat is fully abstract wrt =C

3 Such semantics is defined as the fixpoint of an immediateconsequences operator P JRK We have opted for this semantics because it has some propertieswhich are very important from a pragmatical point of view

bull it is condensed meaning that denotations are the smallest possible (between all thosesemantics which induce the same program equivalence) This is a very relevant (if notessential) feature to develop a semantic-based tool which has to compute the semantics

bull The semantics ERB can be obtained directly by transforming the EC semantics concretelyjust by loosing internal structure Therefore no (costly) computation of ERB is needed

We have implemented the basic functionality of the proposed methodology in a prototype writ-ten in Haskell TRSynth available at httpsafe-toolsdsicupvestrsynth (for a detaileddescription see [4]) The implementation of =G equality is still ongoing work because we arelacking of a suitable implementation of the G-semantics

To achieve termination the prototype computes a fixed number k of steps of P JRK Thenit proceeds with the classification as described in Section 3 Clearly in presence of terms withinfinite solutions with such a rough approximation we may loose both correctness (by mis-takenly equating terms which become semantically different after k iterates) and completeness(by mistakenly not equating terms which will become semantically equivalent) Neverthelessthe results are encouraging For instance TRSynth detects all =C and =RB which we showed inexamples (except of Example 38 because of a bug in the computation of the semantics)

3The writing of articles related to the formal definition of this semantics is in progress [3]

29

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

4 Conclusions and future work

This paper discusses about the issues that arise for the automatic inference of high-levelproperty-oriented (algebraic) specifications because of non-confluent or non-constructor basedTRS Then a first proposal which overcomes these issues is presented

Our method computes a concise specification of program properties from the source code ofa TRS We hope to have convinced the reader (with all examples) that we reached our maingoal that is to get a concise and clear specification (that is useful for the programmer in orderto discover unseen properties or detect possible errors)

We have developed a prototype that implements the basic functionality of the approach Weare aware that many other attempts to guarantee termination could be used in other instanciesof the presented method Certainly given our know-how in the future we will experiment withabstractions obtained by abstract interpretation [5] (our novel semantics itself has been obtainedas an abstract interpretation) Actually we already have an ongoing work to implement thedepth(k) abstract version of our semantics In the depth(k) abstraction terms (occurring in thenodes of the semantic trees) are ldquocutrdquo at depth k by replacing them with cut variables distinctfrom program variables Hence for a given signature Σ the universe of abstract semantic treesis finite (although it increases exponentially wrt k) Therefore the finite convergence of thecomputation of the abstract semantics is guaranteed

References

[1] G Ammons R Bodık and J R Larus Mining specifications In 29th ACM SIGPLAN-SIGACTsymposium on Principles of programming languages (POPLrsquo02) pages 4ndash16 New York NY USA2002 Acm

[2] G Bacci M Comini M A Feliu and A Villanueva Automatic Synthesis of Specifications forFirst Order Curry Programs In Proceedings of the 14th symposium on Principles and practice ofdeclarative programming pages 25ndash34 New York NY USA 2012 ACM

[3] M Comini and L Torella A Condensed Goal-Independent Fixpoint Semantics Modeling theSmall-Step Behavior of Rewriting Technical Report DIMI-UD012013RR Dipartimento diMatematica e Informatica Universita di Udine 2013

[4] M Comini and L Torella TRSynth a Tool for Automatic Inference of Term Equivalence inLeft-linear Term Rewriting Systems In E Albert and S-C Mu editors PEPM rsquo13 Proceedingsof the ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation pages 67ndash70Acm 2013

[5] P Cousot and R Cousot Abstract Interpretation A Unified Lattice Model for Static Analysisof Programs by Construction or Approximation of Fixpoints In Proceedings of the 4th ACMSIGACT-SIGPLAN symposium on Principles of programming languages Los Angeles CaliforniaJanuary 17ndash19 pages 238ndash252 New York NY USA 1977 ACM Press

[6] C Ghezzi A Mocci and M Monga Synthesizing intensional behavior models by graph trans-formation In 31st International Conference on Software Engineering (ICSErsquo09) pages 430ndash4402009

[7] J Henkel C Reichenbach and A Diwan Discovering Documentation for Java Container ClassesIEEE Transactions on Software Engineering 33(8)526ndash542 2007

[8] A A Khwaja and J E Urban A property based specification formalism classification TheJournal of Systems and Software 832344ndash2362 2010

[9] TeReSe editor Term Rewriting Systems Cambridge University Press Cambridge UK 2003

[10] H van Vliet Software EngineeringndashPrinciples and Practice John Wiley 1993

[11] J M Wing A specifierrsquos introduction to formal methods Computer 23(9)10ndash24 1990

30

A Condensed Goal-Independent Fixpoint

Semantics Modeling the Small-Step Behavior of

Rewriting

Marco Comini1 and Luca Torella2

1 DIMI University of Udine Italy mdash marcocominiuniudit

2 DIISM University of Siena Italy mdash lucatorellaunisiit

Abstract

In this paper we present a novel condensed narrowing-like semantics that contains theminimal information which is needed to describe compositionally all possible rewritings ofa term rewriting system We provide its goal-dependent top-down definition and moreimportantly an equivalent goal-independent bottom-up fixpoint characterization

We prove soundness and completeness wrt the small-step behavior of rewriting forthe full class of term rewriting systems

1 Introduction

Nowadays the formalism of Term Rewriting Systems (TRSs) is used besides for functionalprogramming also for many other applications (like specification of communication protocolsto mention one) There has been a lot of research on the development of tools for the formalverification and (in general) automatic treatmentmanipulation of TRSs Within the proposalsthere are semantics-based approaches which can guarantee correctness by construction How-ever they cannot employ directly the construction of the semantics since in general it is infiniteThus some kind of approximation has to be used

Given the potentiality of application of the TRS formalism we have turned our attentiontoward the development of semantics-based TRS manipulation tools with the intention to useAbstract Interpretation theory as fundament to devise semantics approximations correct byconstruction However as also noted by [9] defining a suitable (concrete) semantics is usuallythe first crucial step in adapting the general methodology of Abstract Interpretation to thesemantic framework of the programming language at hand When a concrete semantics isused to define via abstract interpretation abstract (approximate) semantics to be employedto develop semantics-based manipulation tools it is particularly relevant if it is condensedand defined compositionally In the literature a semantics is said to be condensing when thesemantics of an instance of an expression (term goal call) can be obtained with a semanticoperation directly from the semantics of the (un-instantiated) expression In such a situationonly the semantics for most general expressions can be maintained in denotations We saythat a semantics is condensed when the denotations themselves do not contain redundancy iewhen it is not possible to semantically derive the components of a denotation from the othercomponents Indeed the abstract semantics operations which are obtained from a condensedconcrete semantics involve the use of the join operation (of the abstract domain) at each iterationin parallel onto all components of rules instead of using several subsequent applications for allcomponents This has a twofold benefit On one side it speeds up convergence of the abstractfixpoint computation On the other side it considerably improves precision

In [2] we developed an automatic debugging methodology for the TRS formalism based onabstract interpretation of the big-step rewriting semantics that is most commonly considered

31

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

in functional programming ie the set of constructor termsnormal forms However theresulting tool was inefficient The main reason for this inefficiency is because the chosen concretesemantics is not condensing and thus because of its accidental high redundancy it causes thealgorithms to use and produce much redundant information at each stage In contrast thesame methodology gave good results in [5] because it was applied to a condensed semantics

The constructor termsnormal forms semantics is not condensed because it contains allpossible rewritings but there are many possible rewritings which can be obtained by someother ones since rewriting is closed under substitution (stability) and replacement (t ETHrarr

R

lowast s

implies C[t]p ETHrarrR

lowast C[s]p) Thus in [1] we tried to directly devise a semantics fully abstract

wrt the big-step rewriting semantics with the specific objective to avoid all redundancy whilestill characterizing the rewritings of any term In particular we searched a semantics which

bull has a compositional goal-independent definitionbull is the fixpoint of a bottom-up constructionbull is as condensed as possible

Unfortunately (in [1]) we just partially achieved this goal since the semantics is defined only forsome classes of TRSs In the meantime for a (quite) different language in [4 3] we obtainedmdashfor the full languagemdasha semantics with the mentioned characteristics by following a differentapproach

1 Define a denotation fully abstract wrt the small-step behavior of evaluation of expres-sions which enjoys the mentioned properties

2 Obtain by abstraction of this small-step semantics a denotation (which enjoys the men-tioned properties) correct wrt the big-step behavior

This approach has the additional advantage that the small-step semantics can be reused alsoto develop other semantics more concrete than the big-step one (for instance semantics whichcan model functional dependencies that are suitable to develop pre-post verification methods)

Unfortunately in the case of the TRS formalism we do not have a suitable small-step se-mantics to start with For Curry we defined the small-step semantics by collecting just themost general traces of the small-step operational semantics which correspond (in our case) tothe rewriting derivations of the terms f(x1 xn) The problem is that we cannot obtainjust from the traces of all f(x1 xn) the rewriting derivations of all (nested) terms withoutusing again (directly or indirectly) the rewriting mechanism In fact usually f(x1 xn) isimmediately a normal form because we cannot instantiate variables however there are manyinstances which can trigger the rules Narrowing [7] can seem a possible solution to this prob-lem but we have an issue related to the interference of non-confluence (ie non-determinism)with non-linearity as shown by this example

Example 11Let us consider the following TRS R

coin rarr Tail Head ne Tail rarr True diff (x)rarr x ne xcoin rarrHead Tail ne Head rarr True

We have rewriting derivations diff (x) ETHrarr x ne x ↛ diff (Head) ETHrarr Head ne Head ↛ diff (Tail) ETHrarrTail ne Tail ↛ while diff (coin)ETHrarrlowast True Moreover we have the narrowing derivation diff (x) ε

x ne x 32

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

Narrowing can instantiate variables (according to rules) but a variable is instantiated with thesame term in all of its occurrences (it would make little sense to do differently for a top-downresolution mechanism) However Example 11 shows that it is not possible to retrieve thatdiff (coin) ETHrarrlowast True from all possible narrowing derivations of diff (x) since the only narrowingderivation (of diff (x)) does not reach True

In this paper we define a variation of narrowing (linearizing narrowing) which admits dif-ferent instances of variables with multiple occurrences With linearizing narrowing we definea denotation fully abstract wrt the small-step behavior of rewriting which enjoys the men-tioned properties for generic TRSs without restrictions The outline to achieve this is thefollowing

bull We gather all linearizing narrowing derivations into trees (Definition 310)bull We show that all possible rewritings can be reconstructed from linearizing narrowing trees(Theorem 314)

bull We define top-down condensed denotations OJRK by collecting just the linearizing nar-rowing trees of most general terms (f(ETHrarrxn)) and we prove that with a suitable semanticevaluation function E we can reconstruct any linearizing narrowing tree starting from

OJRK (Theorem 323)bull By using E we define a (bottom-up) immediate consequence operator whose least fixpointF JRK is equal to OJRK (Theorem 330) Thus from F JRK we can reconstruct all possiblerewritings of R and we have full abstraction wrt the rewriting behavior (Corollary 331)

Note that the proofs of all results are in the appendix

2 Preliminaries

We assume that the reader is familiar with the basic notions of term rewriting For a thoroughdiscussion of these topics see [10] In the paper we use the following notions and notations

We writeETHrarron for the list of syntactic objects o1 on Given a monotonic function F ∶ Lrarr Lover lattice L whose bottom is and lub is ⊔ by F uarrk we denote function λxF k(x) and byF uarrω function λx⊔F k(x)∣k isin N By lfp(F ) we denote the least fixed point of F (and recallthat for a continuos F lfp(F ) = F uarrω)Terms and Substitutions

Σ denotes a signature and V denotes a (fixed) countably infinite set of variables T (ΣV)denotes the terms built over signature Σ and variables V Σ is partitioned in D the definedsymbols (also called operations) and C the constructor symbols (also called data constructors)

T (CV) are called constructor terms The set of variables occurring in a term t is denoted byvar(t) while the sequence (in order) of variables occurring in a term t is denoted by ETHrarrvar(t) Aterm is linear if it does not contain multiple occurrences of any variable LT (ΣV) denotes theset of linear terms

t∣p denotes the subterm of t at position p and t[s]p denotes the result of replacing thesubterm t∣p by the term s

Given a substitution ϑ = x1t1 xntn we denote by dom(σ) and range(σ) the domainset x1 xn and the range set ⋃n

i=1 var(ti) respectively The identity substitution is denotedby ε By tσ we denote the application of σ to t σV denotes the restriction of substitution σto set V sube V σϑ denotes the composition of ϑ and σ ie the substitution st x(σϑ) = (xσ)ϑfor any x isin V Given two substitutions ϑ1 and ϑ2 and two terms t1 and t2 we say that ϑ1

33

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

(respectively t1) is more general than ϑ2 (respectively t2) denoted ϑ1 ⪯ ϑ2 (respectively t1 ⪯ t2)if and only if there exists a substitution σ st ϑ1σ = ϑ2 (respectively t1σ = t2) We denote by≃ the induced equivalence ie ϑ ≃ σ if and only if there exists a renaming ρ st ϑρ = σ (andσρminus1 = ϑ) With σ uarr σprime we indicate the lub (wrt ⪯) of σ and σprime

A substitution ϑ is an unifier for terms t and s if tϑ = sϑ t and s unifyare unifiable whenthere exists a unifier A unifier σ for t and s is a most general unifier denoted as σ =mgu(t s)when σ ⪯ ϑ for any unifier ϑ of t and s

Rewriting

A term rewriting system (TRS for short) R is a set of rules l rarr r where l r isin T (ΣV) var(r) subevar(l) l = f(t1 tn) and f isin D t1 tn are the argument patterns of l rarr r and neednot necessarily be in T (CV) unlike in functional programming where only constructor-basedTRSs are considered (ie with ti isin T (CV)) We denote by RΣ the set of all TRSs defined onsignature Σ

Given TRS R a rewrite step tpETHrarrR

tprime is defined if there are a position p in t l rarr r isin R and

a substitution η with dom(η) sube var(l) such that t∣p = lη and tprime = t[rη]p As usual we omit towrite position p when it is not relevant and omit R when is clear from the context Moreoverwe use ETHrarrlowast to denote the transitive and reflexive closure of the rewriting relation ETHrarr

A term t is called a normal form denoted by t↛ if there is no term s such that tETHrarrlowast sA substitution x1t1 xntn is R-normalized (wrt a TRS R) if all ti are normal forms

(which trivially includes the case when ti isin T (CV))Full Narrowing

In the paper with s≪X we denote a renamed apart variant s of an element belonging to a setof syntactic objects X ie a renaming of variable names of some x isin X that does not containvariables that appear in the context of the definition where s ≪ X is used (this is also calledldquousing fresh variables names in srdquo)

The combination of variable instantiation and rewriting is called narrowing [7] Formally a

(full) narrowing step tσp

Rtprime is defined if there is a position p in t l rarr r ≪R and σ =mgu(t∣p l)

such that t∣p notin V and tprime = (t[r]p)σ In such a case we have that tσpETHrarrR

tprime Again we omit to

write position p when it is not relevant and omit R when is clear from the contextt denotes that there is no term s such that t s

3 Modeling the small-step rewriting behavior

In this section we introduce the concrete semantics which is suitable to model the small-steprewriting behavior In order to formally state such relationship we first need to formally definethe concept of small-step rewriting behavior

Definition 31 (Rewriting behavior) Given t0 isin T (ΣV) and R isin RΣ the small-step rewrit-ing behavior of t0 in R is

BssJt0 in RK ∶= t0 ETHrarrR

t1 ETHrarrR⋯ETHrarrR

tnminus1 ETHrarrR

tn∣forallti isin T (ΣV) (31)

and the small-step rewriting behavior of R is BssJRK ∶= ⋃tisinT (ΣV)BssJt in RK

34

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

This notion of observable behavior induces the definition of TRS equivalence

forallR1 R2 isin RΣR1 asympss R2 ∶lArrrArr BssJR1 K = BssJR2 K (32)

Thanks to the following property we can restrain the check of Bss equivalence of two TRSs tolinear terms Moreover in the sequel we will also restrict our attention only to denotations forlinear terms

Proposition 32 Let R1 R2 isin RΣ Then R1 asympss R2 lArrrArr R1 is a variant of R2 lArrrArr forallt isinLT (ΣV) BssJt in R1 K = BssJt in R2 K

31 The semantic domain

We now define a notion of ldquohypothetical rewritingrdquo which resembles full narrowing [7] butit ldquodecouplesrdquo multiple occurrences of variables This way we maintain the potentiality tochoose different evolutions of the rewritings of redexes once variables are instantiated with nonconstructor terms

The semantic domain of our semantics will be made of trees with all possible derivations ofthis variation of narrowing

311 Linearizing Narrowing

Definition 33 (Term Linearization) Let t isin T (ΣV) r isin LT (ΣV) and σ∶ V rarr V We saythat (r σ) is a linearization of t denoted (r σ) = lin(t) if rσ = t and var(t) sube var(r) Thesubstitution σ will be called delinearizator

If a term is linear then lin(t) = (t ε) while for non-linear terms we can have different possibilities(for instance lin(f(xx)) = (f(x y)yx) = (f(z x)zx) = ) However the followingconstructions which involve linearization are actually independent upon the particular choiceof linearization in the sense that all possible different results are variants (analogously to whathappens for the choice of different mgursquos)

It may be useful to note that a delinearizer σ has one binding for each (further) multipleoccurrence of a variable

Definition 34 (Linearizing Narrowing Derivation) Let t s isin LT (ΣV) and R isin RΣ There

exists a linearizing narrowing step tθp

OcircrArrσR

s if there exist a position p of t l rarr r ≪ R

θprime =mgu(t∣p l) and σ∶ V rarr V such that

t∣p notin V (s σ) = lin(t[rθprime]p) θ = θprimevar(t)We omit to write position p when it is not relevant and omit R when is clear from the context

A sequence t0θ1

OcircrArrσ1

t1 θn

OcircrArrσn

tn is called linearizing narrowing derivation With t0θ

OcircrArrσ

lowast tn we

denote the existence of a linearizing narrowing derivation such that θ = θ1⋯θn and σ = σ1⋯σnNote that in linearizing narrowing derivations we do not apply mgu θ to all reduct (t[r]p)θ asnarrowing does This would not make any difference since terms are kept linear by constructionand thus θ cannot alter the context outside positions being reduced

Linearizing narrowing is correct wrt rewriting (as narrowing is) as proven by the followingtheorem which is the analogous of Theorem 38 of [8] (Theorem 1 of [7]) where we use linearizing

35

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

narrowing instead of narrowing Actually linearizing narrowing is more general than narrowingin the sense that when we have a narrowing derivation then we will surely have a linearizingnarrowing derivation which possibly compute more general instances (in case there are non-linear terms)

Theorem 35 Let R isin RΣ s0 isin LT (ΣV) t0 isin T (ΣV) η0 an R-normalized substitution suchthat t0 = s0η0 and V sub V such that var(s0) cup dom(η0) sube V If t0 ETHrarrlowast tn then there exist a termsn isin LT (ΣV) and substitutions ηn θ σ such that

s0θ

OcircrArrσ

lowast sn tn = snσηn (θηn)V = η0V ηn is R-normalized

where s0θ

OcircrArrσ

lowast sn and t0 ETHrarrlowast tn employ the same rewrite rules at the same positions

Note that while it is always possible to transform rewrite derivations into linearizing narrowingderivations (in the sense of Theorem 35) the opposite does not hold in general as we will showin Example 37 As anticipated we gather all linearizing narrowing derivations (of the sameterm t) into a tree

Definition 36 (Linearizing Narrowing Trees) Let t isin LT (ΣV) A linearizing narrowingtree T for t is a (not necessarily finite) labelled tree which is rooted in t and where

1 paths are linearizing narrowing derivations2 sibling subtrees have the same root terms if and only if their incoming arcs have different

substitutions

We denote with LNTΣ (or simply LNT when clear from the context) the set of all thelinearizing narrowing trees (over Σ) Moreover for any t isin LT (ΣV) we denote with LNTt theset of all linearizing narrowing trees for t

Point 2 ensures that all sibling steps in a linearizing tree are pairwise distinct and thus that wecannot have two different paths of the tree with the same terms and labels

Example 37Consider TRS R of Example 11 The linearizing narrowing tree starting from term diff (x) is

diff (x) x ne x1True

xHead x1Tailε

TruexTa

il x1Head

εε

x1x

This linearizing narrowing derivation diff (x) xHeadx1Tail

OcircOcircOcircOcircOcircOcircrArrx1x

lowast True can be read as if there is a

term t that can rewrite both to Head and Tail then diff (t) rewrites to True Indeed diff (coin)does rewrite to True (a possible rewriting derivation is diff (coin) ETHrarr coin ne coin ETHrarr Head necoin ETHrarr Head ne Tail ETHrarr True)

In this case is not possible to transform these linearizing narrowing derivations into rewritederivations (since diff (x)ETHrarr x ne x↛ as well as diff (t)ETHrarr t ne t↛ for all t isin T (CV))

This example also shows that linearizing narrowing can have longer derivations wrt (stan-dard) narrowing since diff (x) ε

x ne x

36

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

Definition 38 (Variance on LNT) Let t isin LT (ΣV) and T1 T2 isin LNTt We say that T1 andT2 are local variants if there exists a renaming ρ such that T1ρ = T2Two linearizing narrowing trees are local variants if and only if they have the same root t andtheir steps are equal up to renaming of variables which do not occur in t

Note Since the actual choices of local variable names is completely irrelevant from now onwith an abuse of notation by LNT we will actually indicate its quotient wrt localvariance Moreover all linearizing narrowing trees presented in the sequel will actuallybe an arbitrary representative of an equivalence class

Definition 39 (Order on LNT) Let denote with paths(T ) the set of all the paths of T start-ing from the root

Given T1 T2 isin LNT we define T1 ⊑ T2 if and only if paths(T1) sube paths(T2)Given a set T sube LNTt the least upper bound ⊔T is the tree whose paths are ⋃T isinT paths(T )

Dually for the greatest lower bound ⊓It is worth noticing that for any t isin LT (ΣV) LNTt is a complete lattice

By Point 2 of Definition 36 paths is injective thus it establishes an order preserving iso-

morphism (LNTt ⊑) minusminusminusminusminusminusminusminusminusrarrETHrarrlarrlarrETHminusminusminusminusminusminusminusminusminuspaths

prfxtree (paths(LNTt) sube) where the adjoint of paths prfxtree builds

a tree from a set of paths (by merging all common prefixes) So we have two isomorphic rep-resentations of linearizing narrowing trees and in the sequel we can simply write d isin T ford isin paths(T ) The set representation is very convenient for technical definitions while forexamples the tree representation is better suited

Definition 310 (Linearizing Narrowing Tree of a term) Let t isin LT (ΣV) and R isin RΣA linearizing narrowing tree NJt in RK for term t in TRS R is

NJt in RK ∶= d isin LNTt∣d uses rules from RIntuitively NJt in RK denotes the linearizing narrowing behavior of linear term t in TRS Rmodulo local variance (ie local variables are up to renaming)

Example 311Given the following TRS R

m(H (x))rarr d(xK(x)) d(C (x)K (E(y)))rarr f(xx y y)f (A x y F)rarr B(y y) f (E(x) y AA)rarrK(E(y))

The linearizing narrowing tree NJm(x) in RK is

m(x) d(x1K(x2)) f(x3 x4 y y1)B(y y2)

x3Ay1Fy2y

K(E(x4))x3E(x5)

yAy1A

ε

x1C(x3)x2E(y)

x4x3 y1y

xH(x1)

x2x1

Linearizing narrowing trees ldquocapturerdquo the behavioral TRS equivalence asympss since the TRSequivalence induced by N coincides with asympss

Theorem 312 Let R1 R2 isin RΣ Then R1 asympss R2 if and only if for every t isin LT (ΣV)NJt in R1 K =NJt in R2 K

37

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

Even more from linearizing narrowing trees we can completely reconstruct the small-steprewriting behavior To formally prove this we need to introduce the following operation to buildrewriting derivations from linearizing narrowing derivations

Definition 313 Let R isin RΣ and d = s0 θ1OcircrArrσ1

s1θ2OcircrArrσ2

θnOcircrArrσn

sn be a linearizing narrowing deriva-

tion The linear narrowing to rewriting operator is defined as

lfloordrfloor ∶= t0 ETHrarr t1 ETHrarr tk ∣ ξ is an R-normalized substitution 0 le k le nη = θ1 uarr σ1 uarr uarr θk uarr σk forall0 le i le k ti = siηξ (33)

We abuse notation and lift lfloorsdotrfloor also to sets as lfloorSrfloor ∶= ⋃disinSlfloordrfloorIntuitively this operation takes a prefix d of a linear narrowing derivation and if it can simulta-neously satisfy all its computed answers and delinearizators with substitution η then it buildsa rewriting sequence by applying ηξ to all terms of d for any R-normalized substitution ξ

Theorem 314 Let R isin RΣ and t isin LT (ΣV) Then BssJt in RK = lfloorNJt in RKrfloorHence NJt inRK is indeed a condensed representation of BssJt inRK Now the next step for theconstruction of a semantics with the desired characteristics is to achieve compositionality Todo so we should look for a denotation for most general terms f (ETHrarrxn) (of a TRS R) which couldbe used to retrieve with suitable semantic operations NJt in RK for any t isin LT (ΣV)32 Operational denotations of TRSs

The operational denotation of a TRS can be defined as an interpretation giving meaning to thedefined symbols over linearizing narrowing trees ldquomodulo variancerdquo Essentially we define thesemantics of each function in D over formal parameters (whose names are actually irrelevant)

Definition 315 (Interpretations) Let MGTD ∶= f (ETHrarrxn) ∣ fn isin D ETHrarrxn are distinct variablesTwo functions I J ∶MGTD rarr LNTΣ are (global) variants denoted by I cong J if for each

π isinMGTD there exists a renaming ρ such that (I(π))ρ = J(πρ)An interpretation is a function I ∶MGTD rarr LNTΣ modulo variance2 such that for every

π isinMGTD I(π) is a linearizing narrowing tree for πThe semantic domain IΣ (or simply I when clear from the context) is the set of all inter-

pretations ordered by the pointwise extension of ⊑The partial order on I formalizes the evolution of the computation process (I ⊑) is a completelattice and its least upper bound and greatest lower bound are the pointwise extension of ⊔and ⊓ respectively In the sequel we abuse the notations for LNT for I as well The bottomelement of I is I ∶= λππ (for each π isin MGTD) In the sequel we abuse the notations forLNT for I as well

It is important to note that MGTD (modulo variance) has the same cardinality of D (andis then finite) and thus each interpretation is a finite collection (of possibly infinite elements)Hence we will often explicitly write interpretations by cases like

I ∶=⎧⎪⎪⎪⎪⎨⎪⎪⎪⎪⎩

π1 ↦ T1

πn ↦ Tn

for

I(π1) ∶= T1⋮

I(πn) ∶= Tn2ie a family of elements of LNTΣ indexed by MGTD modulo variance

38

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

In the following any I isin I is implicitly considered as an arbitrary function MGT rarr LNT

obtained by choosing an arbitrary representative of the elements of I in the equivalence classgenerated by cong Actually in the sequel all the operators that we use on I are also independentof the choice of the representative Therefore we can define any operator on I in terms of itscounterpart defined on functions MGT rarr LNT

Moreover we also implicitly assume that the application of an interpretation I to a specificπ isin MGT denoted by I(π) is the application I(π) of any representative I of I which is

defined exactly on π For example if I = (λf (x y) f(x y) xc(z)

OcircOcircOcircrArrε

c(y z))congthen I(f(u v)) =

f(u v) uc(z)

OcircOcircOcircrArrε

c(v z)While defined symbols have to be interpreted according to TRS rules constructor symbols

are meant to be interpreted as themselves In order to treat them as a generic case of functionapplication we assume that any interpretation I is also implicitly extended on constructors asI(c(ETHrarrxn)) ∶= c(ETHrarrxn) In the sequel we will use ϕ when we refer to a generic (either constructoror defined) symbol whence f for defined symbols and c for constructor ones

Definition 316 (Operational denotation of TRSs) Let R isin RΣ Then the operationaldenotation of R is

OJRK ∶= (λf (ETHrarrxn) NJf(ETHrarrxn) in RK)cong

(34)

Intuitively O collects the linearizing narrowing tree of each f (ETHrarrxn) in R abstracting from theparticular choice of the variable names ETHrarrxn

Example 317The operational denotation of TRS R of Example 11 is

OJRK =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

coin ↦ coin

Tail

Head

εεεε

x ne y ↦ x ne yTrue

True

xTail yH

ead

εxHead yTailε

diff (x)↦ diff (x) x ne x1True

True

ε

x1x

xHead x1T

ail

εxTail x

1Headε

The (small-step) rewriting behavior of any term t can be ldquoreconstructedrdquo from OJRK bymeans of the following evaluation function E 321 Evaluation Function

When we have the interpretation with the linearizing narrowing tree of f (ETHrarrxn) we can easily

reconstruct the rewriting behavior of any f (ETHrarrtn) for (renamed apart)

ETHrarrtn isin LT (CV) by sim-

ply replacing the most general bindings along a derivation with constructor terms ti (clearly

39

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

pruning branches with inconsistent instances) However with non-constructor nested termsthings gets more involved In practice we have an interleaving of parts of all sub-derivationscorresponding to the evaluation of arguments leaded by the derivation of f (ETHrarrxn) Intuitively thebasic building block of our proposal is the definition of a semantics embedding operation thatmimics parameter passing Namely taken two linearizing narrowing trees T1 T2 and a variablex of (the root of) T1 the tree-embedding operation T1[xT2] transforms T1 by modifying itssteps accordingly to steps of T2 which provides specific actual parameter values to x in placeswhere x in T1 was originally ldquofreelyrdquo instantiated

In order to define T1[xT2] we need to introduce an auxiliary (technical) relation whichworks on single derivations Note that in the sequel to shorten definitions when we adornlinearizing narrowing derivations or trees with a term s like ds or Ts we mean that the headof ds or the root of Ts is term s

Definition 318 Let π isin LT (ΣV) dg be a linearizing narrowing derivation with head g andTb isin LNTb Then dgπTb ⊢ d is the least relation that satisfies the rules

dtπTs ⊢ tmicromicro = larrETHETHmgu(s π) (35a)

dtπTsprime ⊢ d

dtπTs ⊢ tmicroθq

OcircrArrσ

dmicro = larrETHETHmgu(s π) s

θp

OcircrArrσ

Tsprime isin Ts existq s∣p = tmicro∣q (35b)

dt0 π0Ts0 ⊢ dt1 dtn πnTsn ⊢ dtn+1

(t θp

OcircrArrσ

dt0)πTs0 ⊢ tmicro θprimep

OcircrArrσprimeprime

dtn+1

micro = larrETHETHmgu(s0 π)θprime = larrETHETHmgu(tmicro tθ)var(tmicro) x1y1 xnyn = proj (var(πθ) σ)Ts1 Tsn ≪ Ts0

π0 = πθ foralli isin 1 n πi = π0yixiforallj isin 0 n ETHrarrvj =ETHrarrvar(sj)

σprimeprime = (σ cup

n

⋃i=1

ETHrarrvi ETHrarrv0)var(tn+1)

(35c)

where

bull proj (Vσ) = xy isin σ ∣ y isin V bulllarrETHETHmgu(t s) is an mgu θ of t and s such that forallx isin var(t) xθ isin V

Broadly speaking the role of π in a statement dtπTs ⊢ d is that of the ldquoparameter patternrdquoresponsible to constrain ldquofreelyrdquo instantiated formal parameters in dt to the actual parametersvalues which are actually ldquocomingrdquo from Ts More specifically Rules 35 govern the inlaying ofthe steps of a linearizing narrowing tree Ts into a derivation dt In particular

bull The axiom 35a stops any further possible inlayingbull The rule 35b considers the case when we want to proceed with an inner linearizingnarrowing step employing a step coming from Ts In this case t plays the role of contextand the inner step is done accordingly to the one chosen from Ts Note that is it possibleto do the step only if exists q such that s∣p = tmicro∣q Namely the defined symbol over whichthe step is done needs to be ldquovisiblerdquo in tmicro

bull The rule 35c considers the case when we want to do an outermost step First the stephas to be compatible with the way we instantiated t so far namely exists mgu(tmicro tθ)Then we choose from σ only the delinearizers that depend on the variable from whichwe started the embedding Each of these delinearizer comes from the linearization of amultiple occurrence of a same variable z Thus for each rename zprime of z we sequentiallyembed into zprime a (possibly different) sub-derivation coming from a renamed apart variant of

40

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

Ts Note that if we would not have multiple occurrences of z (ie proj (var(πθ) σ) = empty)the rule would simply be

dt0 π0Ts0 ⊢ dt1(t θpOcircrArr

σ

dt0)πTs0 ⊢ tmicro θprimepOcircrArrσ

dt1

micro = larrETHETHmgu(s0 π) θprime = larrETHETHmgu(tmicro tθ)var(tmicro)

π0 = πθ

Note that in Rules 35 we use a selected form of mgu (ie larrETHETHmgu which does not rename variablesin the left argument) in order to avoid to change variable names along the way

Example 319Consider OJRK of Example 317 Let Tcoin ∶= OJRK(coin) and d0 ∶= diff (x) ε

OcircOcircrArrx1x

d1 isinOJRK(diff (x)) where d1 = x ne x1 xHeadx1Tail

OcircOcircOcircOcircOcircOcircOcircrArrε

True

Let us build a proof tree to find a derivation d such that d0xTcoin ⊢ d We have to startwith an application of rule (35c) which (in this case) has two premises since the delinearizatorx1x in the first step of d0 has one binding The first subtree which embeds the Head branchof Tcoin into x is

(35a)TrueHead Head ⊢ True

(35c)d1xHead ⊢ Head ne x1 x1Tail

OcircOcircOcircrArrε

True(35b)

d1xTcoin ⊢ coin ne x1 ε

OcircrArrε

Head ne x1 x1Tail

OcircOcircOcircrArrε

True

acutesup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1cedilsup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1parad3

(PT)

Now we can build the full proof tree (by building the second subtree which starting from d3can finish to embed the Tail branch of Tcoin into x1)

(PT)

(35a)TrueTail Tail ⊢ True

(35c)d2 x1Tail ⊢ Head ne Tail ε

OcircrArrε

True(35b)

d2 x1Tcoin ⊢ Head ne coin ε

OcircrArrε

Head ne Tail ε

OcircrArrε

True(35c)

d3 x1Tcoin ⊢ coin ne coin ε

OcircrArrε

Head ne coin ε

OcircrArrε

Head ne Tail ε

OcircrArrε

True(35c)

d xTcoin ⊢ diff (coin) ε

OcircrArrε

coin ne coin ε

OcircrArrε

Head ne coin ε

OcircrArrε

Head ne Tail ε

OcircrArrε

True

We have analogous proof tree for d xTcoin ⊢ diff (coin) ε

OcircrArrε

coin ne coin ε

OcircrArrε

Tail ne coin ε

OcircrArrε

Tail neHead

ε

OcircrArrε

True In total we have ten possible proof trees four of whom that have derivations

which reach True

Tree-embedding is simply defined by collecting all contributes of dxT ⊢ dprime

Definition 320 (Tree-embedding) Let Tg isin LNTg and Tb isin LNTg such that

1 Tg and Tb do not share any local variable2 x is a variable which does not occur in Tb

Then the tree-embedding operation Tg[xTb] is defined as Tg[xTb] ∶= d∣dg isin Tg dgxTb ⊢ d41

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

The evaluation function is obtained by repeated application of tree-embedding

Definition 321 (Evaluation Function) Let t isin LT (ΣV) and I isin I The evaluation of twrt I denoted E JtKI is defined by induction on the structure of t as follows

E JxKI ∶= x (36a)

E Jϕ(ETHrarrtn)KI ∶= I(ϕ(ETHrarrxn))[x1 E Jt1KI ] [xn E JtnKI ] ETHrarrxn renamed apart distinct (36b)

Example 322Consider OJRK of Example 317 The evaluation of E Jdiff (coin)KOJRK is

E Jdiff (coin)KOJRK = [ by Equation (36b) with n = 1 ]OJRK(diff (x))[x E JcoinKOJRK] = [ by Equation (36b) with n = 0 ]OJRK(diff (x))[xOJRK(coin)]

Then by completing what shown in Example 319 we have that E Jdiff (coin)KOJRK is

diff (coin)

diff (Head)Head ne Head

εεε

ε

coin ne coin

Head ne coinHead ne Head

εε

Head ne Tail Trueεεε

ε

εε

Tail ne coinTail ne Head True

εε

εε

Tail ne Tailεε

εε

coin ne HeadHead ne Head

εε

Tail ne Head Trueεεε

ε

εε

coin ne TailHead ne Tail True

εε

εε

Tail ne Tailεε

εε

εε

diff (Tail)Tail ne Tail

εε

εε

322 Properties of the TRS operational denotation

The following result states formally that from OJRK the evaluation function E can reconstructthe linearizing narrowing tree of any linear term

Theorem 323 For all R isin RΣ and t isin LT (ΣV) E JtKOJRK =NJt in RK

A straightforward consequence of Theorems 323 and 312 is

Corollary 324 For all R1 R2 isin RΣ OJR1 K = OJR2 K if and only if R1 asympss R2

Thus semantics O is fully abstract wrt asympss

33 Fixpoint denotations of TRSs

We will now define a bottom-up goal-independent denotation which is equivalent to O and thus(by Corollary 324) adequate to characterize the small-step behavior for TRSs It is definedas the fixpoint of an abstract immediate operator over interpretations P JRK This operatoris essentially given in terms of evaluation E of right hand sides of rules Namely given aninterpretation I it essentially consists in

42

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

bull building an initial linearizing narrowing step for a most general term according to rulesrsquoleft hand side

bull applying the evaluation operator E to the right hand side of the rule over I Definition 325 Let R isin RΣ P JRK∶ I rarr I is defined for all f isin D (of arity n) as

P JRKI (f(ETHrarrxn)) ∶=⊔f(ETHrarrxn) θ

OcircrArrσ

E JrprimeKI ∣ f(ETHrarrxn)θ rarr r ≪R

(rprime σ) = lin(r) (37)

Moreover we define our fixpoint semantics as F JRK ∶= lfp P JRK

F JRK is well defined since P JRK is continuous

Proposition 326 Let R isin RΣ Then P JRK is continuous

Example 327Let us consider the (artificial) TRS R ∶= g rarr f(h(a)) h(a) rarr h(b) f (h(b)) rarr a taken from[1] which is neither constructor-based nor confluent The evaluation of the right hand sidesof all rules is E Jf(h(a))KI = I(f(x))[x E Jh(a)KI ] = f(x)[xh(a)] = f(h(a)) E Jh(b)KI =h(x)[xb] = h(b) and E JaKI = a Hence

I1∶= P JRKuarr1 =

⎧⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎩

g ↦ g f(h(a))εε

h(x)↦ h(x) h(b)xa

ε

f(x)↦ f(x) axh(b)

ε

In the next iteration we have to evaluate E Jf(h(a))KI1= I

1(f(x))[x E Jh(a)KI

1] Since E Jh(a)KI

1=

I1(h(x))[x E JaKI

1] = h(a) ε

OcircrArrε

h(b) we have

P JRKuarr2 =⎧⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎩

g ↦ g f(h(a)) f(h(b)) aεε

εε

εε

h(x)↦ h(x) h(b)xa

ε

f(x)↦ f(x) axh(b)

ε

Now since P JRKuarr3 = P JRKuarr2 this is also the fixpoint F JRK

Example 328Consider TRS R of Example 11 The iterates of P JRK are

P JRKuarr1 =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

coin ↦ coin

Tail

Head

εεεε

x ne y ↦ x ne yTrue

True

xTail yH

ead

εxHead yTailε

diff (x)↦ diff (x) x ne x1ε

x1x

43

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

P JRKuarr2 =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

coin ↦ coin

Tail

Head

εεεε

x ne y ↦ x ne yTrue

True

xTail yH

ead

εxHead yTailε

diff (x)↦ diff (x) x ne x1True

True

ε

x1x

xHead x1T

ail

εxTail x

1Headε

Now since P JRKuarr3 = P JRKuarr2 this is also the fixpoint F JRK

Example 329Let us consider the TRS R ∶= zeros rarr ∶(0 zeros) take(0 x) rarr nil take(s(n) ∶(y z))) rarr∶(y take(n z)) f (n)rarr take(n zeros) The first two iterates of P JRK are

P JRKuarr1 =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

zeros ↦ zeros ∶(0 zeros)εε

take(x1 y1)↦ take(x1 y1 )

nil

x10

ε ∶(y0 take(x0 z))

x1s(x

0)y1 ∶(y

0 z)ε

f(x0)↦ f(x0) take(x0 zeros)εε

P JRKuarr2 =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

zeros ↦ zeros ∶(0 zeros) ∶(0 ∶(0 zeros))εε

εε

take(x2 y2)↦ take(x2 y2 )

nil

x20

ε ∶(y1 take(x1 z1))∶(y1nil)

εε ∶(y1 ∶(y0 take(x0 z0)))

x1s(x

0)z1 ∶(y

0 z0)

ε

x2s(x

1)y2 ∶(y

1 z1)ε

f(x1)↦ f(x1)

take(x1 zeros)

nil

x10

ε

take(x1 ∶(0 zeros))

nil

x10

ε

∶(0 take(x0 zeros))x

1s(x0)

ε

εε

εε

Note that to highlight the construction order of the various subtrees we used indices in variablesnames that respect the order of introduction and boxed the subtrees which correspond to the

44

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

previous iterate By continuing the computation of the iterates we obtain

F JRK =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

zeros ↦ zeros ∶(0 zeros) ∶(0 ∶(0 zeros))εε

εε

take(x y)↦ take(x y)

nil

x0

ε ∶(yprime take(xprime z))∶(yprimenil)

εε ∶(yprime ∶(yprimeprime take(xprimeprime zprime)))

x primes(x primeprime)z ∶(y primeprime z prime)ε

xs(x prime)y ∶(y prime z)ε

f(x)↦ f(x)

take(x zeros)

nil

x0

ε

take(x ∶(0 zeros))nil

x0

ε

take(x ∶(0 ∶(0 zeros)))εε ∶(0 take(xprime zeros))

∶(0nil)xprime 0

ε

∶(0 take(xprimeprime ∶(0 zeros)))

x primes(x primeprime)

ε

xs(x prime)ε

εε

εε

We can observe that since terms in R are linear the linearizing narrowing trees have justε as delinearizers and actually they are isomorphic to full narrowing trees

331 Properties of the TRS fixpoint denotation

The top-down goal-dependent denotation O and the bottom-up goal-independent denotationF are actually equivalent

Theorem 330 (Equivalence of denotations) Let R isin RΣ Then OJRK = F JRK

A straightforward consequence of Theorem 330 and Corollary 324 is

Corollary 331 (Correctness and full abstraction of F ) Let R1 R2 isin RΣ Then F JR1 K =F JR2 K if and only if R1 asympss R2

4 Conclusions

We have presented a condensed compositional bottom-up semantics for the full class of termrewriting systems which is fully abstract wrt the small-step behavior of rewriting

We are going to use this semantics to define by abstraction a condensed bottom-up se-mantics for the full class of term rewriting systems which is fully abstract wrt the big-stepbehavior of rewriting and thus suitable for semantic-based program manipulation tools Actu-ally we have developed a first proposal of such a semantics (by following this approach) but

45

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

restricted to the class of left-linear TRSs We already used it to develop a semantics-basedautomatic specification synthesis prototype [6] which is giving promising results

However we believe that our notion of linearized narrowing which differently from nar-rowing represents faithfully the small-step behavior of rewriting (in a compact way) could beinteresting for other applications as well

References

[1] M Alpuente M Comini S Escobar M Falaschi and J Iborra A Compact Fixpoint Semanticsfor Term Rewriting Systems Theoretical Computer Science 411(37)3348ndash3371 2010

[2] M Alpuente M Comini S Escobar M Falaschi and S Lucas Abstract Diagnosis of FunctionalPrograms In M Leuschel editor Logic Based Program Synthesis and Transformation ndash 12th

International Workshop LOPSTR 2002 Revised Selected Papers volume 2664 of Lecture Notes

in Computer Science pages 1ndash16 Berlin 2003 Springer-Verlag

[3] G Bacci An Abstract Interpretation Framework for Semantics and Diagnosis of Lazy Functional-

Logic Languages PhD thesis Dipartimento di matematica e Informatica Universita di Udine2011

[4] G Bacci and M Comini A Fully-Abstract Condensed Goal-Independent Bottom-Up FixpointModeling of the Behaviour of First Order Curry Submitted for Publication 2012

[5] M Comini G Levi M C Meo and G Vitiello Abstract Diagnosis Journal of Logic Program-

ming 39(1-3)43ndash93 1999

[6] M Comini and L Torella TRSynth a Tool for Automatic Inference of Term Equivalence inLeft-linear Term Rewriting Systems In E Albert and S-C Mu editors PEPM rsquo13 Proceedings

of the ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation pages 67ndash70Acm 2013

[7] J-M Hullot Canonical Forms and Unification In Proceedings of the 5th International Conference

on Automated Deduction volume 87 of Lecture Notes in Computer Science pages 318ndash334 Berlin1980 Springer-Verlag

[8] A Middeldorp and E Hamoen Completeness results for basic narrowing Applicable Algebra in

Engineering Communication and Computing 5213ndash253 1994 101007BF01190830

[9] H R Nielson and F Nielson Infinitary Control Flow Analysis a Collecting Semantics for ClosureAnalysis In Symposium on Principles of Programming Languages pages 332ndash345 1997

[10] TeReSe editor Term Rewriting Systems Cambridge University Press Cambridge UK 2003

A Technical Proofs

Proof of Proposition 32

Point 1 Implication lArrOcirc is straightforward We prove OcircrArr by reduction to absurd Supposethat R1 asympss R2 and R1 is not a variant of R2 Then there is at least one rule which isdifferent in R1 wrt R2 (or vice versa) Thus by Equation (31) we can have rewritingsteps which employ that rule in BssJR1 K which cannot be in BssJR2 K which is absurd

Point 2 Similarly to previous point but restricting to initial linear terms

In the sequel we use the following results

46

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

Proposition A1 ([8]) Suppose we have substitutions θ ρ ρprime and sets A B of variables suchthat (B minus dom(θ)) cup range(θ) sube A If ρA = ρprimeA then (θρ)A = (θρprime)AProposition A2 ([8]) Let R be a TRS and suppose we have substitutions θ ρ ρprime and setsA B of variables such that the following conditions are satisfied

ρA R-normalized θρprimeA = ρA B sube (A minus dom(θ)) cup range(θA)Then ρprimeB is also R-normalized

Proof of Theorem 35 We prove the thesis by induction on the length of the rewriting derivationfrom t0 to tn The case of length zero is straightforward

Suppose t0 ETHrarr t1 ETHrarr ETHrarr tn is a rewriting derivation of length n gt 0 We may assumewithout loss of generality that var(l) cap V = empty We have (s0η0)∣p = s0∣pη0 = τ l for somesubstitution τ with dom(τ) sube var(l) Let micro ∶= τ cup η0 We have s0∣pmicro = s0∣pη0 = lτ = lmicro so s0∣pand l are unifiable Let θprime

1∶= mgu(s0∣p l) and θ1 ∶= θprime1var(s0∣p) Clearly dom(θ1) cup range(θ1) sube

var(s0∣p) cup var(l) Moreover there exists a substitution ψ such that

θ1ψ = micro (1)

Now let (s1 σ1) ∶= lin(s0[rθprime1]p) By Definition 34

s0θ1p

OcircOcircrArrσ1 lrarrr

s1 (2)

Let V1 ∶= (V minus dom(θ1)) cup range(θ1) cup dom(σ1) andη1 ∶= (σ1ψ)V1

(3)

Clearly dom(η1) sube V1 We have var(s1) = dom(σ1)cup var(s0[rθ1]p) sube dom(σ1)cup var(s0[lθ1]p) =dom(σ1) cup var(s0θ1) sube V1 Therefore var(s1) cup dom(θ1) sube V1 By (1) and (3) we have s1σ1η1 =s1σ1ψ = s0[rθ1]pψ = s0[r]pθ1ψ = s0[r]pmicro = s0micro[rmicro]p Since V cap dom(τ) = empty we have

microV = η0V (4)

Likewise microvar(r) = η0var(r) Hence s0micro[rmicro]p = s0η0[rτ]p = t0[rτ]p = t1 Thust1 = s1σ1η1 (5)

Next we have to verify that (θ1η1)V = η0V By (3) and by Proposition A1 we have that(θ1η1)V = (θ1σ1ψ)V By (1) and (4) (θ1η1)V = (θ1σ1ψ)V Since dom(σ1) notin V we havethat (θ1σ1ψ)V = (θ1ψ)V = microV = η0V Thus

(θ1η1)V = η0V (6)

Now we show that η1 is R-normalized Since dom(η1) sube V1 it suffices to show that η1V1isR-normalized Let B ∶= (V minusdom(θ1))cuprange(θ1V ) Proposition A2 yields the normalization

of η1B Recall that range(θ1) sube var(s0∣p) cup var(l) Let x isin range(θ1) since θ1 is idempotentclearly x notin dom(θ1) If x isin var(s0∣p) sube V then x isin V minus dom(θ1) sube B If x isin var(l) thenx isin var(lθ1) = var(s0∣pθ1) thus x isin range(θ1V ) sube B Thus range(θ1) sube B and then V1 =B cup dom(σ1) By this and (3) since η1B is R-normalized η1V1

is R-normalized as well

47

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

By inductive hypothesis we have a term sn and substitutions θprime σprime and ηn such that

s1θprimeOcircrArrσprime

lowast sn (7)

tn = snσprimeηn (8)

(θprimeηn)V1= η1V1

(9)

ηn is R-normalized (10)

Moreover s1θprimeOcircOcircrArr

σprimeR

lowast sn and t1 ETHrarrR

lowast tn apply the same rewrite rules at the same positions

Let θ ∶= θ1θprime and σ = σ1σprime By (2) and (7) we obtain s0θ

OcircrArrσ

lowast sn By construction this

narrowing derivation makes use of the same rewriting rules at the same positions as the rewritingderivation t0 ETHrarr

R

lowast tn It remains to show that (θηn)V = η0V By (9) and Proposition A1

(θ1θprimeηn)V = (θ1η1)V Therefore by (6) (θηn)V = (θ1η1)V = η0V Proof of Theorem 312 We prove OcircrArr by reduction to absurd Suppose that R1 asympss R2 andexistt isin LT (ΣV) NJt in R1 K neNJt in R2 K This means that there is at least one derivation whichbelongs to NJt in R1 K and not to NJt in R2 K (or vice versa) Hence there is at least a rulewhich is not in common to the two programs Thus R1 asympss R2 which is absurd

We prove lArrOcirc by reduction to absurd Suppose that forallt isin LT (ΣV) NJt inR1 K =NJt inR2 Kand R1 asympss R2 Then there is at least one rule which is different in R1 wrt R2 Thus byEquation (31) and Theorem 35 NJt in R1 K neNJt in R2 K which is absurd

Proof of Theorem 314 We prove the two inclusions separately Inclusion supe is immediate byDefinition 313

Inclusion sube is proved by reduction to absurd Assume that there exists a derivation t0 ETHrarrR

lowast tn

such that it does not belong to lfloorNJt0 inRKrfloor Then by Theorem 35 taken η0 = ε there exists arelaxed narrowing derivation of the form s0

θ1

OcircrArrσ1

θn

OcircrArrσn

sn Note that for each i isin 1n θi andσi are just renaming ηi = ε and ti = siσi σ0 Let η ∶= η0 = ε It is easy to see that there existsηprime such that ηprime = θ1 uarr σ1 uarr uarr θn uarr σn By Definition 313 there exists a rewriting derivationtprime0ETHrarrR

lowast tprimen where tprimei = siηprime for each i isin 1n Moreover dom(σk) isin var(si) for each k isin i+ 1nand θi = (σj)dom(θi) or θi = (σj)dom(θi) for some j Hence siη

prime = siσi σ0 Thus tprimei = ti foreach i isin 1n which is absurd

Lemma A3 Let R a TRS x isin V and t s isin T (ΣV) such that they do not share variables andx isin t x isin s Then NJt in RK[xNJs in RK] =NJtxs in RK

Proof It is sufficient to prove that given dt isin NJt in RK and Ts = NJs in RK if dtxTs ⊢ dthen d isin NJtxs in RK To this aim we will prove a stronger result let π isin T (CV) letTs = NJs in RK and for any dt isin NJt in RK such that dtπTs ⊢ d then d isin NJtη in RK whereη =larrETHETHmgu(s π) We proceed by structural induction on the proof tree

rule 35a) straightforward

rule 35b) By inductive hypothesis dtπTsprime ⊢ dtmicro lArrrArr dtmicro isinNJtmicro inRK If it exists dtmicro then

tmicro∣p = s∣p Moreover existmicroprime such that microprime = larrETHETHmgu(sprime π) and tmicroprime∣p = sprime∣p Thus tmicroθp

OcircrArrσ

dtmicro isinNJtmicro in RK

48

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

rule 35c) By inductive hypothesis we have that dt0 π0Ts0 ⊢ dt1 lArrrArr dt1 isin NJtmicro0 inRK dtn πnTsn ⊢ dtn+1 lArrrArr dtn+1 isin NJtmicron in RK where micro0 = larrETHETHmgu(s0 π0) micron =larrETHETHmgu(sn πn) We know that exists a linearizing narrowing step t

θp

OcircrArrσ

t0 where θ2 =mgu(t∣p l) θ = θ2var(t) (s σ) = lin(rθ2) tmicro = t[s]p We need to prove that it exists the

linearizing narrowing step tmicroθprimep

OcircrArrσprimeprime

tn+1 Since it exists mgu(t∣p l) and mgu(tmicro tθ) thenit exists θ3 such that θ3 = mgu((tmicro)∣p l) Now let θprime ∶= θ3var(tmicro) and (sprime σprime) = lin(rθ3)then tmicro[sprime]p = t Let us observe that t1 = t0micro0 t2 = t0micro0micro1 tn+1 = t0micro0 micron wheremicro0 =larrETHETHmgu(s0 π0) micron =larrETHETHmgu(sn πn) Let microlowast = micro0 micron then tn+1 = t0microlowast = tmicrolowast[smicrolowast]p =tmicro[smicrolowast]p = t

Proof of Theorem 323 We proceed by structural induction on term t

t = x Immediate by Equation (36a)

t = ϕ(ETHrarrtn)

E Jϕ(ETHrarrtn)KOJRK =[ by Equation (36b) ]

= OJRK(ϕ(ETHrarrxn))[x1 E Jt1KOJRK] [xn E JtnKOJRK] =[ by inductive hypothesis ]

=NJϕ(ETHrarrxn) in RK[x1NJt1 in RK] [xnNJtn in RK] =[ by Lemma A3 ]

=NJϕ(ETHrarrtn) in RK

Proof of Proposition 326 It is straightforward to prove that P JP K is monotone and finitarythus it is continuous

Proof of Theorem 330 We prove the two inclusions separately

⊑) Let indicate with Ok all derivations of OJRK with length le k by induction we prove thatforallk Ok ⊑ P JRKuarrk

k = 0) immediate

k gt 0) foralld isin Ok we have that d = f(x) θΛ

OcircrArrσ

dprime such that (by Theorem 323) dprimet isin E JtKOkminus1

Thus by monotonicity of E we have that dprimet isin E JtKP JRKuarrkminus1 By the definition of P d isin P JP KP JRKuarrkminus1 = P JRKuarrk

Thus by Proposition 326 OJRK = ⊔kge0Ok ⊑ ⊔kge0P JRKuarrk = F JRK

⊒) We need to prove that f(ETHrarrxn) θΛ

OcircrArrσ

E JrprimeKOJRK ⊑NJf(ETHrarrxn) inRK By Theorem 323 E JrprimeKOJRK

is a linearizing narrowing tree Since θ = mgu(f(ETHrarrxn l))ETHrarrxnand (σ rprime) = lin(r) we can

conclude that f(ETHrarrxn) θΛ

OcircrArrσ

E JrprimeKOJRK ⊑NJf(ETHrarrxn) in RK

49

Logical and Algebraic Views of a Knot Fold of a

Regular Heptagon

Fadoua Ghourabi1 Tetsuo Ida2 and Kazuko Takahashi1

1 Kwansei Gakuin University Japanghourabikwanseiacjp ktkakwanseiacjp

2 University of Tsukuba Japanidai-eosorg

Abstract

Making a knot on a rectangular origami or more generally on a tape of a finite lengthgives rise to a regular polygon We present an automated algebraic proof that makingtwo knots leads to a regular heptagon Knot fold is regarded as a double fold operationcoupled with Huzitarsquos fold operations We specify the construction by describing thegeometrical constraints on the fold lines to be used for the construction of a knot Thealgebraic interpretation of the logical formulas allows us to solve the problem of howto find the fold operations ie to find concrete fold lines The logical and algebraicframework incorporated in a system called Eos (e-origami system) is used to simulate theknot construction as well as to prove the correctness of the construction based on algebraicproof methods

1 Introduction

From the early history of mathematics the correspondence between geometry and algebra hasbeen recognized and has been the subject of constant study In some sense ancient geometrywas a mother of algebra In particular solving algebraic equations has been related to therealm of Euclidean geometry Early mathematicians notably Khawarizmi and Khayyam gavegeometrical meanings to the solutions of equations Khayyamrsquos insight was that solutions ofcertain cubic equations are points of intersections of conic sections [1] Seven centuries laterafter freeing algebra from geometrical thinking Wantzel proved that solving cubic solutionsis impossible by Euclidean tools ie compass and straightedge [2] Further tools have beeninvented and used to perform constructions that are impossible by Euclidean tools

Paper folding ie origami allows solving cubic equations and hence geometrical construc-tions such as trisection of an arbitrary angle or a regular heptagon are realizable Given anorigami paper what we can do by hand is to construct creases and points The creases areconstructed by folding the paper along the lines which we call fold lines The points are con-structed by the intersection of lines Huzita presented a set of fold operations (known also asHuzitarsquos axioms in literature) with which he showed how to obtain fold lines [3] Huzitarsquos foldoperations are simple to perform by hand but powerful enough to solve cubic equations [4]

The geometrical construction of a regular heptagon has a unique history in that it belongsto the famous classical impossible problems by Euclidean tools Using paper folding the con-struction was shown to be possible In this paper we show another method of constructing aregular heptagon based on an extension of Huzitarsquos fold operations by introducing knottingThe constructions of regular n-gons (in particular of regular pentagon and heptagon) by makingknots have not been rigorously specified and the observation that their constructions purportto problems of solving geometrical constraints is missing

50

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

We investigate the geometrical constraints of the knot fold towards constructions of regu-lar polygons and proofs of the correctness of these constructions The knot fold operation isspecified by an existentially quantified formula of the first-order predicate logic The formulais then translated into a set of algebraic equalities and disequalities which then are solved byspecialized solvers based on Grobner basis theory andor CAD (Cylindrical Algebraic Decom-position) We have developed a computational origami system called Eos [5] using computeralgebra system Mathematica In brief it is an e-origami system which allows us to do virtualorigami It has capabilities of constructing and visualizing origami geometrical objects alge-braically analyzing origami folds and proving the correctness of origami constructions Eos

supports Huzitarsquos fold operations and has been extended to include multi-fold operations Weuse Eos to assist us with our mathematical study of the knot fold

The rest of the paper is organized as follows In Sect 2 we give the notations that we useIn Sect 3 we present Huzitarsquos fold operations and their extensions In Sect 4 we explain thegeometrical properties of the knot fold The construction of regular heptagon by Eos is shownin Sect 5 and its formal and algebraic proof is discussed in Sect 6 In Sect 7 we summarizeour results and point out a direction of further research

2 Notations

In this paper we restrict the use of geometrical objects to points segments and lines Pointsare denoted by a single capital letter of the Latin alphabet eg A B C D X Y etc Linesare denoted by m n t u and v Let X and Y be two points then XY denotes the line passingthrough points X and Y For brevity we often write XY to refer to the line passing through Xand Y We use the same notation to denote the segment between points X and Y Althoughthe meaning of the notation XY should be clear from the context we precede the notation XYwith either the word ldquosegmentrdquo or the word ldquolinerdquo to emphasize which objects we are working

with We also useminusminusrarrXY to denote a vector from point X to point Y The distance between two

points X and Y is denoted by |XY |Since we use Cartesian coordinate system in this paper a line is represented by a linear

equation ax+ by+ c = 0 in variables x and y The sets of all points and lines are denoted by Πand L respectively Abusing the set notation we use X isin m to mean that point X is incidentto line m and X1 Xp sub m to mean that all the points X1 Xp are incident to m

When an origami is folded along a line m some of the points are moved to superpose withtheir reflections across m We denote by Xm the reflection of point X across line m

A simple knot is denoted by K Ki denotes the ith knot The notation K = 〈mn t〉 meansthat the knot K is defined by 3 fold lines (to be explained in Sect 4)m n and t and furthermoreK is obtained by folding along the lines following the order of their appearance in 〈mn t〉

3 Origami Geometrical Construction

31 Huzitarsquos Fold Operations

By O we denote an origami An origami O is supposed to represent a square sheet of paperwith four points on the corners and four edges that is subject to folding1 We call A B Cand D the points on the corner Some intersections of lines may not fit on the square paper

1We could take O to be any convex polygon that can be constructed from a square sheet of paper Howeverthis could be an unnecessary generalization in our study

51

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

As we want to work with these points we consider O to be a sufficiently large (bounded) 2Dplane so that all the points and lines of interest are on O Huzita observed that the degreeof freedom of paper fold by fold lines can be made finite by specifying how certain points andlines are superposed Then he gave the following operations (O1) sim (O6) which serve as basicoperations in the geometrical construction of origamis Operation (O7) was added later byJustin [6] We call collectively (O1) sim (O7) Huzitarsquos fold operations

(O1) Given two distinct points P and Q fold O along the unique line that passes through Pand Q

(O2) Given two distinct points P and Q fold O along the unique line to superpose P and Q

(O3) Given two distinct lines m and n fold O along a line to superpose m and n

(O4) Given a line m and a point P fold O along the unique line passing through P to superposem onto itself

(O5) Given a line m a point P not on m and a point Q fold O along a line passing throughQ to superpose P and m

(O6) Given two lines m and n a point P not on m and a point Q not on n where m and n aredistinct or P and Q are distinct fold O along a line to superpose P and m and Q and n

(O7) Given two linesm and n and a point P not onm fold O along the unique line to superposeP and m and n onto itself

We note that the above statements are slightly different from the original ones To formalizethe above statements with the view to rigorous geometrical construction we restate Huzitarsquosoperations by carefully adding and removing side conditions of degeneracy and incidence [7]In essence treating origamis with a program requires rigorous specification of these operations

Huzitarsquos fold operations determine fold lines by specifying superpositions of constructedpoints and lines In Eos these specifications are formulas in a language of many-sorted first-order predicate logic By the algebraic interpretation of the formulas we derive polynomialequalities The problem of finding fold line(s) is therefore reduced to solving constraints ex-pressed in multi-variate polynomials of degree 3 over the field of origami constructible numbers[8 5]

32 Extensions

The contribution of Huzitarsquos fold operations is powerful enough to perform relevant geometri-cal constructions by way of solving algebraic equations of degree up to 3 Examples of suchconstructions are trisecting an arbitrary angle constructing a regular heptagon etc Somestudies have explored possible extensions of Huzitarsquos fold operations in an attempt to increasethe power of paper folding ie to solve higher degree equations

Alperin and Lang proposed multi-fold method where the origami is folded along more thanone fold line simultaneously [9] The idea is to find fold lines that are mutually dependentThe multi-fold construction allows solving higher degree equations We presented a construc-tion method of angle trisection using 2-fold operation [5] and angle quintisection using 4-foldoperation [10] Although the p-fold method generates an arbitrarily high degree polynomialaccurately folding an origami by p lines simultaneously would be difficult to do by hand evenfor p = 2

52

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

Folding polygonal knots has been traditionally used in Japan For example folding a broadsash for a kimono by a pentagon is a common practice of daily life However it is unknownwhen the knot fold was first mathematically studied The earliest contributions of which weare aware are those of Cundy and Rollett [11] Brunton [12] and Sakaguchi [13] Cundy andRollett showed models of knots that make some regular polygons Brunton elaborated themathematical study of the knot fold and showed that the number of necessary knots dependson the number of the edges of the polygon

4 Knot Fold

In order to determine the geometrical constraints of knot fold we first analyze key geometricalproperties of a knot

41 Geometrical Properties

(a) (b) (c)

Figure 1 Knot-fold of regular pentagon FEIHG

Let us examine the operation of knotting in Fig 1 We make one simple knot by tyingtogether the two ends of the origami tape in Fig 1(a) Note that we use a rectangular shapeof an origami When the height of the tape ie |AD| and |BC| is infinitesimal and both endsof the paper are connected the tape becomes a curve ie an object of study in knot theoryThe knot with 3 crossings is the most basic one in knot theory When we bring the height backto the original without distorting the tape except for folds we obtain the polygonal knot Awell fastened and well flattened knot becomes a polygonal shape as depicted in Fig 1(c) Theobtained polygonal shape exhibits a regular pentagonal form As it is inferred from the knottheory making the knot in Fig 1(c) requires 3 folds along the lines m n and t that extend theedges FE GH and IEn respectively2 The knot K = 〈mn t〉 is the one in Fig 1(c)

When the knot is entirely unfolded we obtain the tape with the creases and the generatedpoints as shown in Fig 2 We note the following geometrical properties The vertices E H andI are lined up on the edge CD whereas vertices F and G are incident to the edge AB The foldalong m passes through F and superposes point H and line AB Point E is the intersectionof m and CD Similarly the fold line n passes through G and the fold along n superposespoint E and line AB Point H is the intersection of n and CD Note that fold lines m and nare mutually defined The fold is a 2-fold operation where m and n are defined simultaneouslyLine t can be determined by applying operation (O5) of Huzitarsquos fold operation set Namely

2Recall that En is the reflection point of E across line n as defined in Sect 2

53

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

Figure 2 Unknotted tape

line t passes through I and superposes G and CD Note that the parameters of (O5) points IG and line CD are considered with respect to the configuration before the fold Refer to Fig 2The origami after the the 2-fold (ie along m and n) is shown in Fig 1(b) The purposes ofthe fold along t is first to construct the vertex I and second to fasten and lock the knot

A purely geometrical proof that the knot fold creates a regular polygon is sketched in [14]In the following we present a formal and automated algebraic proof that uses properties of theoperation of folding such as preservation of some of distances parallelism etc

42 Geometrical Constraint Solving Approach

The question now becomes how to determine the fold lines m n and t such that the knot isa regular pentagon The proof that the knot fold gives rise to regular pentagons shows thateach of the fold line makes angles 2α = 2π

5 with the edges [14] where α = ∡GEH = ∡EHF In origami geometry construction of angles using Huzitarsquos fold operations is not trivial Theproblem of constructing angles is boiled down to a sequence of fold steps which makes theconstruction tedious where the number of intermediate points and lines is prone to increaseFurthermore not all angles are constructible by Huzitarsquos fold operations The construction ofa regular 11-gon whose interior angles are equal to 9π

11 is shown to be impossible by Huzitarsquosfold operations [15] Hence we carefully choose a specification of the knot fold that couldbe extended towards the construction of regular n-gons where n ge 7 We are led to avoidconstruction of angles in order to solve the knot fold construction problem We consider theknot fold construction as a geometrical constraint solving problem without use of angles

Example Regular pentagon

Our method of constructing a regular pentagon by the knot fold uses a multi-fold togetherwith Huzitarsquos fold operations We consider the example in Fig 1 where we make a knotK = 〈mn t〉 We try to define the geometrical properties of K in a systematic way so thatwe can generalize it to the knot fold of regular n-gons where n ge 7 We observe the followinggeometrical properties on m n t E F G H and I

bull Points E and F are incident to mbull Points G and H are incident to nbull Points E H and I are incident to CDbull Points F and G are incident to ABbull The fold line m superposes H and AB ie Hm isin ABbull The fold line n superposes E and AB ie En isin ABbull The fold line t passes through I and superposes G and CD ie I isin t and Gt isin CDbull The distances |EF | |FG| and |GH| are equal

54

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

The above properties are described by the following first order logical formula φK

φK equiv existmn t isin L existEFGH I isin Π

EF sub m and GH sub n and EH I sub CD and FG sub ABand

Hm isin AB and En isin AB and I isin t andGt isin CD and |EF | = |FG| = |GH|

(1)

We used Eos to construct the regular pentagon in Fig 1 It is possible to determine t indepen-dently from m and n We consider the formula (2) that defines the 2-fold operation to solvelines m and n first

φprimeK equiv existmn isin L existEFGH isin Π

EF sub m and GH sub n and EH sub CD and FG sub ABand

Hm isin AB and En isin AB and |EF | = |FG| = |GH|

(2)

The fold line t is obtained by applying operation (O5) Namely line t passes through pointI and superposes point H and line AB

We can prove automatically that the generated shape is a regular pentagon based on Grobnerbases theory We will omit the proof of the correctness of the pentagon knot construction Inthe next sections we will discuss the construction and the proof of a regular heptagon by theknot fold in details

5 Regular Heptagon by the Knot Fold

Brunton studied the construction of regular n-gons where n ge 3 [12] He showed that the

number of necessary knots is Φ(n)2 minus 1 in order to construct a regular n-gon where Φ(n) is

Eulerrsquos totient function Hence to construct a regular heptagon we perform 2 knots K1 andK2 We explained in Sect 4 that a knot can be decomposed into 3-fold operations along threefold lines In the case of regular heptagon we need 5 fold lines m n t u and v whereK1 = 〈mn t〉 and K2 = 〈v um〉 Let EKJIHGF be the constructed regular heptagonFigure 3 exhibits the vertices of the regular heptagon after unfolding K1 and K2 The foldlines are extensions of edges of EKJIHGF as follows Lines m n and t are the extension ofsegment EF IJ and GFn respectively Lines v and u are extensions of segments KEu andHIm respectively Figure 4 shows a sketch of a regular heptagon with the lines m n t u andv

51 Geometrical Constraints

Figure 3 Unfolded regular heptagon EKJIHGF

Lines m and n of the knot K1 = 〈mn t〉 are defined by the following properties on m n tE F I J G and H

55

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

tn

mu

vE

F

G

H

I

J

K

Figure 4 Sketch of a regular heptagon EKJIHGF and lines m n t u and v

bull Points E and F are incident to mbull Points I and J are incident to nbull Points E and J are incident to CDbull Points F I G and H are incident to ABbull The fold line m superposes I and CD ie Im isin CDbull The fold line n superposes F and CD ie Fn isin CDbull The distances |EF | |IJ | |FGn| |IHm| and |GnHm| are equal3

We write formula φK1in a similar fashion to the formula (1)

φK1equiv existmn t isin L existEF I JGH isin Π

EF sub m and I J sub n and F IGH sub AB and E J sub CDand

Im isin CD and Fn isin CD andG isin t and J t isin ABand

|EF | = |IJ | = |FGn| = |IHm| = |GnHm|

(3)

Similarly to our discussion in Sect 42 line t can be constructed independently from lines mand n We therefore can separate the construction t and use φprime

K1in (4) to solve for m and n

first

φprimeK1

equiv existmn existEF I JGH isin Π

EF sub m and I J sub n and F IGH sub AB and E J sub CDand

Im isin CD and Fn isin CDand

|EF | = |IJ | = |FGn| = |IHm| = |GnHm|

(4)

Knot K2 = 〈v um〉 is defined by the following properties on v u m K X H Y Z and F bull Points K and X are on vbull Points H and Y are on ubull Points K and Y are on CDbull Points Z H F and X are on ABbull The fold line v superposes H and CD ie Hv isin CD

3Refering to Fig 3 distances |GFn| and |FGn| are equal due to the fact that reflection across line n preservesthe distances Similarly distances |HIm| and |IHm| are equal

56

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

bull The fold line u superposes X and CD ie Xu isin CDbull The fold line m passes through F and superposes Y and AB ie Y m isin ABbull The distances |KX| |HY | |XFu| |HZv| and |FuZv| are equal

φK2equiv existv um isin L existKXH Y Z F isin Π

KX sub v and HY sub u and KY sub CD and XHZ F sub ABand

Hv isin CD andXu isin CD and F isin m and Y m isin ABand

|KX| = |HY | = |XFu| = |HZv| = |FuZv|

(5)

However referring to Fig 3 points X Y and Z are equal to points Eu Im and ((((Gn)m)u)v)From formula φprime

K1 E I and G are obtained It is possible to determine the fold lines that

make K2 in an easier way than solving constraints in formula (5) as we explain in the nextsub-section

52 Construction by Eos

We first assume that the initial origami is a rectangle ABCD We work with the Cartesiancoordinate system and the coordinates of points A B C and D are (0 0) (wd 0) (wd ht)and (0 ht) respectively The width wd and the height ht can be taken arbitrary Of coursewd is sufficiently larger than ht so that the knot construction is feasible For concreteness ofour presentation using Eos we set wd = 900 and ht = 60 Furthermore let E be an arbitrarybut fixed point on segment CD Let the coordinates of E be (400 ht) for simplicity and clarityof the construction Our objective is to construct a regular heptagon EKJIHGF by the knotfold Recall that the construction requires a 2-fold operation prior to Huzitarsquos fold operations(see Sect 41) The first folding step is the crucial one ie the 2-fold operation

In Eos Huzitarsquos fold operations can be performed using function HO The extension to themulti-fold is natural as HO is implemented with the generality that allows the specification oflogical formulas describing the multi-fold Multi-fold is realized by the call of the followingMathematica function

HO [ H Constraint rarr φ ]

H is a list of points on the origami which determine the faces to be moved φ is a formula in thefirst-order predicate logic The formula φ specifies the constraints that the geometrical objectsconcerned have to satisfy In our example the geometrical constraints that specify the 2-foldoperation are expressed by formula φprime

K1in (4) We write φprime

K1in the language of Eos and call

HO as follows

HO[C A Constraint rarr existmmLineexistnnLineexistff PointexistiiPointexistjjPointexistggPointexisthhPoint

(E f sub m and i j sub n and f i g h sub AB and j isin CDand

im isin CD and fn isin CDand

SqDistance[E f ] == SqDistance[i j] == SqDistance[f gn] ==

SqDistance[i hm] == SqDistance[gn hm])]

(6)

The term SqDistance[XY ] is the square of the distance between X and Y (ie |XY |2)Notations like ldquoexistmmLinerdquo ldquoE f sub mrdquo ldquoimrdquo ldquoim isin CDrdquo are Eos extension of Mathematicasyntax

The evaluation of (6) generates 24 distinct cases of possible configurations of points F GH I and J and lines m and n We deduce that the algebraic interpretation of the constraintsas defined by φprime

K1 is a well constrained system of equations since we obtained finite number of

solutions However not all of the 24 cases are relevant to our construction problem They may

57

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

(a) Case 1 (b) Case 2

(c) Case 3 (d) Case 4

(e) Case 5 (f) Case 6

Figure 5 6 possible cases for lines m and n

correspond to degenerate cases that lead to failure of the proof by Grobner bases In order toeliminate the degenerate cases and also to get a reasonable number of cases we further narrowthe search space of the configuration of points and lines For that we add the following extraconstraints

E isin nandj isin mandSqDistance[E i] == SqDistance[j f ] == SqDistance[E h] == SqDistance[j g]

The sub-formula E isin n and j isin m eliminates the degenerate cases where E and j are equalSub-formula SqDistance[E i] == SqDistance[j f ] == SqDistance[E h] == SqDistance[j g]specifies further conditions on points E F G H I and J We evaluate the following HO call

HO[C A Constraint rarr existmmLineexistnnLineexistff PointexistiiPointexistjjPointexistggPointexisthhPoint

(E f sub m and i j sub n and f i g h sub AB and j isin CDand

im isin CD and fn isin CD and

SqDistance[E f ] == SqDistance[i j] == SqDistance[f gn] ==

SqDistance[i hm] == SqDistance[gn hm]and

E isin n and j isin m and SqDistance[E i] == SqDistance[j f ] == SqDistance[E h] == SqDistance[j g])

MarkPointAt rarr F I J G H]

(7)

Consequently we obtain 6 cases as shown in Fig 5 Two of them namely those in Fig 5(a) andin Fig 5(f) lead to the construction of a regular heptagon Eos allows the user to interactivelychoose the suitable case to proceed with the construction Keyword MarkPointAt tells the Eoshow to label the existentially quantified points f i j g and h The outcome of folding in thecase 6 is shown in Fig 6

Next we apply two operations (O1) to fold along the line FGn and IHm in Fig 6 by callingHO with suitable arguments The lines FGn and IHm are the fold lines t and u respectivelyThe results are shown in Fig 7(a) and 7(b) Finally given the origami of Fig 7(b) we constructthe remaining vertex K We apply operation (O6) to obtain v which brings H and G onto ICand HB respectively Point K is the intersection of IC and line v We obtain the heptagonEKJIHGF in Fig 7(c)

58

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

Figure 6 Step 1 Folds along lines m and n

53 Algebraic Interpretation

This algebraic interpretation is used to ldquoevaluaterdquo the function calls of HO as well as the auto-mated proof of the correctness of the construction We take HO in (7) as an example To obtaingeometrical objects m n F G H I and J the formula in (7) is transformed into a set ofalgebraic equalities Further details of the algebraic interpretation are explained in [8] and [5]

Let the coordinates of A B D and E be (0 0) (900 0) (0 60) and (400 60) respectivelyFor an atomic formula φ let [[φ]] denote the set of polynomial relations that are the algebraicmeaning of φ An atomic formula is interpreted as a set of polynomial relations (equalities orinequalities) and a term is given as a rational function The set of (non-simplified) polynomialequalities (8) ndash (14) is the algebraic interpretation of formula in (7)

400a5+ 60b6+ c7 == 0 c7+ a5x11+ b6y12 == 0 c10+ a8x13+ b9y14 == 0

c10+ a8x15+ b9y16 == 0minus900y12 == 0minus900y14 == 0

minus900y20 == 0minus900y18 == 0minus54000 + 900y16 == 0 (8)

minus54000 +900

(

minus2b6(c7+ a5x13) + a52y14minus b62y14)

a52 + b62== 0 (9)

minus54000 +900

(

minus2b9(c10+ a8x11) + a82y12minus b92y12)

a82 + b92== 0 (10)

(400minus x11)2 + (60minus y12)2 == (x13minus x15)2 + (y14minus y16)2 ==(

y12minusminus2b9(c10+ a8x17) + a82y18minus b92y18

a82 + b92

)2

+

(

x11minusminusa82x17+ b92x17minus 2a8(c10+ b9y18)

a82 + b92

)2

==

(

y14minusminus2b6(c7+ a5x19) + a52y20minus b62y20

a52 + b62

)2

+

(

x13minusminusa52x19+ b62x19minus 2a5(c7+ b6y20)

a52 + b62

)2

==

(

minus2b9(c10+ a8x17) + a82y18minus b92y18

a82 + b92minus

minus2b6(c7+ a5x19) + a52y20minus b62y20

a52 + b62

)2

+

(

minusa82x17+ b92x17minus 2a8(c10+ b9y18)

a82 + b92minus

minusa52x19+ b62x19minus 2a5(c7+ b6y20)

a52 + b62

)2

(11)

59

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

400a8+ 60b9+ c10 6= 0 c7+ a5x15+ b6y16 6= 0 (12)

(minus400 + x13)2 + (minus60 + y14)2 ==

(x11minus x15)2 + (y12minus y16)2 == (minus400 + x19)2 + (minus60 + y20)2 ==

(x15minus x17)2 + (y16minus y18)2 (13)

(minus1 + b9)b9 == 0 (minus1 + a8)(minus1 + b9) == 0 1 + a82 6= 0 (minus1 + b6)b6 == 0

(minus1 + a5)(minus1 + b6) == 0 1 + a52 6= 0 (14)

A line a x + b y + c = 0 is represented by (a b c) together with the constraint (minus1 + b)b =0 and (minus1 + a)(minus1 + b) = 0 and a2 + 1 6= 0 Lines m and n are represented by (a5 b6 c7) and(a8 b9 c10) respectively Hence we have the equalities and disequalities in (14)

The equalities in (8) are the algebraic interpretation of the sub-formula E f sub mandi j subnand f i g h sub AB and j isin CD The first equation 400a5+ 60b6+ c7 == 0 means that point Eat (400 60) is incident to m defined by the equation a5x+ b6y + c7 = 0 Similarly the rest ofthe equations in (8) are interpretations of f at (x11 y12) is on m i at (x13 y14) is on n j at(x15 y16) is on n f is on AB i is on AB h at (x19 y20) is on AB g at (x17 y18) is on ABand j is on CD respectively

The reflection of point i at (x13 y14) across line m is the point im whose coordinates are

(minusa52x13 + b62x13minus 2a5(c7 + b6y14)

a52 + b62minus2b6(c7 + a5x13) + a52y14minus b62y14

a52 + b62)

Equation (9) states that im is incident to CD represented by (0 1 -60) Similarly equation(10) is the algebraic interpretation of fn isin CD Eos transforms rational form p

q== 0 to

p == 0 Note that in (9)ndash(11) q comes from coefficient of lines and q 6= 0 is deduced from (14)The disequalities of (12) states that the coordinates of point E and j do not satisfy the

equation of lines n and m respectively Eos changes the disequalities into equalities by addingslack variables introduced by Rabinowitch trick

Now we examine the equalities (11) and (13) [[SqDistance[E f ]==SqDistance[i j]]] givesrise to the first equality in (11) namely (400minusx11)2+(60minusy12)2 == (x13minusx15)2+(y14minusy16)2where E at (400 60) f at (x11 y12) i at (x13 y14) and j at (x15 y16) The rest of theequalities in (11) and equalities in (13) are obtained in the same way

By solving the above set of polynomial equalities for the coefficients of m and n and coor-dinates of f i j g and h we obtain the 6 cases in Fig 5

6 Proof

61 Theorem to Prove

We prove the following theorem

Theorem 61 Given the origami in Fig 7(c) we have(a) |EF | = |FG| = |GH| = |HI| = |IJ | = |JK| = |KE| and(b) ∡EOF = ∡FOG = ∡GOH = ∡HOI = ∡IOJ = ∡JOK = ∡KOE = 2π

7 where O is thecenter of EKJIHGF

Let θ = ∡EOF and α = eiθ VectorminusminusrarrFG is the rotation of

minusminusrarrEF through θ around center O

To prove the theorem 61 we show that the rotations ofminusminusrarrEF through angles 2θ 3θ 4θ 5θ and

60

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

(a) (b) (c)

Figure 7 Construction of (a) the edge GF (step 2) (b) the edge IH (step 3) and (c) vertex Kand final heptagon EKJIHG (step 4)

6θ givesminusminusrarrGH

minusrarrHI

minusrarrIJ

minusminusrarrJK and

minusminusrarrKE respectively and furthermore that θ = 2π

7 We show thatafter the construction the following holds

forallα isin C (αminusminusrarrEF minus

minusminusrarrFG = 0 rArr

α2minusminusrarrEF minusminusminusrarrGH = 0 and α3minusminusrarrEF minus

minusrarrHI = 0 and α4minusminusrarrEF minus

minusrarrIJ = 0and

α5minusminusrarrEF minusminusminusrarrJK = 0 and α6minusminusrarrEF minus

minusminusrarrKE = 0 and α7 minus 1 = 0)

(15)

Let P be the geometrical constraints accumulated during the construction Let C equiv forallα isinC (C1 rArr C2 and C3 and C4 and C5 and C6 and C7) be the formula (15) P and C form the premise andconclusion of the proposition (16) that we want to prove

P rArr forallα isin C (C1 rArr C2 and C3 and C4 and C5 and C6 and C7) (16)

Formula (16) is semantically equivalent to the conjunctions of the formulas (17)ndash(22)

P rArr forallα isin C (C1 rArr C2) (17)

P rArr forallα isin C (C1 rArr C3) (18)

P rArr forallα isin C (C1 rArr C4) (19)

P rArr forallα isin C (C1 rArr C5) (20)

P rArr forallα isin C (C1 rArr C6) (21)

P rArr forallα isin C (C1 rArr C7) (22)

62 Proof by Eos

We show how the validity of (17) is proved and the rest is achieved in a similar way We addthe conclusion forallα isin C C1 rArr C2 by calling Eos function Goal as follows

Goal[forallααisinComplexes(VectorToComplex[αminusminusrarrEF minus

minusminusrarrFG]==0 rArr

(VectorToComplex[α2minusminusrarrEF minusminusminusrarrGH]==0))]

(23)

Expressions C1 equiv αminusminusrarrEF minus

minusminusrarrFG = 0 and C2 equiv α2minusminusrarrEF minus

minusminusrarrGH = 0 written in the language of

Eos are VectorToComplex[αminusminusrarrEF minus

minusminusrarrFG] and VectorToComplex[α2minusminusrarrEF minus

minusminusrarrGH]==0 respectively

61

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

Function Goal adds the negation of the conclusion to the premise By calling Goal we obtainP and not(forallα isin C (C1 rArr C2)) In order to translate P and not(forallα isin C (C1 rArr C2)) into algebraic formwe fix the coordinate system to be Cartesian with points A B C D and E as follows

map = DefMapping[A Point[0-wd]B Point[wd0]

C Point[wd ht] D Point[0 ht] E Point[0 ht] ]amp(24)

Without loss of generality we set the size of the initial origami to be 2wdtimesht where the widthwd is taken to be arbitrary and the height ht is equal to 1 The point E is fixed at location(0 ht) Finally we check whether the reduced Grobner basis of the algebraic interpretation ofP and not(forallα isin C (C1 rArr C2)) is 1 by calling function Prove

Prove[ldquoKnot Heptagonrdquo Mapping rarr map GroebnerBasis rarr

CoefficientDomain rarr RationalFunctions

MonomialOrder rarr DegreeReverseLexicographic]

(25)

The above call of function Prove tells Eos to compute Grobner basis of the polynomial set[[P and not(forallα isin C (C1 rArr C2))]] Let V be the set of variables in [[P and not(forallα isin C (C1 rArr C2))]] TheGrobner basis computation is carried out in the domain of polynomials whose variables are inV wd and whose coefficients are in functions of Q(wd) Eos computes Grobner basis andgenerates a proof document (whose title is given by the first argument of the call of Prove) [16]

63 Proof Results

The proofs of (17)ndash(22) are successful The CPU time used for Grobner basis computation onMac OS X (Intel Core i7 8G 24GHz) machine varies from 69236984 seconds (for proving (17))to 1994889588 seconds (for proving (20))

7 Conclusion

We presented the construction of a regular heptagon using the knot fold Our method consistsin applying 2-fold operation coupled with Huzitarsquos fold operations The fold lines that makethe knot fold are determined by solving geometrical constraints We further showed the proofof the correctness of the construction of a regular heptagon based on Grobner bases

Note that using Huzitarsquos fold operations (O1) sim (O7) a regular heptagon is constructibleWith Eos we need 9 Huzitarsquos fold operations and more than 10 auxiliary operations such asunfolding and marking supporting points Further investigation of the geometrical constraintsby the knot fold is required to construct regular 11-gon which is impossible by Huzitarsquos foldoperations

Another issue that should be investigated in the future research is the rigidity of the knotfold We need to define the notion of rigidity in mathematical terms in this knot fold as wellas in more general origami that may involve 3D constructions

71 Acknowledgments

We thank Stephen Watt of Western Ontario University for drawing our attention to the knotfold This work is supported by JSPS KAKENHI Grant No 25330007 The first author of thispaper is supported by a postdoctoral fellowship at Kwansei Gakuin University

62

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

References

[1] D S Kasir The Algebra of Omar Khayyam (English translation of Khayyamrsquos original workAl-Jabr Wrsquoal Muqabalah) Teachers College Press 1931

[2] P L Wantzel Recherches sur les moyens de connaıtre si un probleme de geometrie peut se resoudreavec la regle et le compas Journal de Mathematiques Pures et Appliquees pages 366ndash372 1837

[3] H Huzita Axiomatic Development of Origami Geometry In Proceedings of the First InternationalMeeting of Origami Science and Technology pages 143ndash158 1989

[4] R C Alperin A Mathematical Theory of Origami Constructions and Numbers New York Journalof Mathematics 6119ndash133 2000

[5] T Ida A Kasem F Ghourabi and H Takahashi Morleyrsquos Theorem Revisited Origami Con-struction and Automated Proof Journal of Symbolic Computation 46(5)571 ndash 583 2011

[6] J Justin Resolution par le pliage de lrsquoequation du troisieme degre et applications geometriques InProceedings of the First International Meeting of Origami Science and Technology pages 251ndash2611989

[7] F Ghourabi A Kasem and C Kaliszyk Algebraic Analysis of Huzitarsquos Origami Operations andtheir Extensions In Automated Deduction in Geometry LNAILNCS Springer 2013 (to appear)

[8] F Ghourabi T Ida H Takahashi M Marin and A Kasem Logical and Algebraic View ofHuzitarsquos Origami Axioms with Applications to Computational Origami In Proceedings of the22nd ACM Symposium on Applied Computing (SACrsquo07) pages 767ndash772 Seoul Korea 2007

[9] R C Alperin and R J Lang One- Two and Multi-fold Origami Axioms In Origami4 Pro-ceedings of the Fourth International Meeting of Origami Science Mathematics and Education(4OSME) pages 371ndash393 2009

[10] F Ghourabi T Ida and H Takahashi Computational Origami of Angle Quintisection InProceedings of the Workshop in Symbolic Computation in Software Science (SCSS2008) RISCTechnical Report Series 08-08 pages 57ndash68 2008

[11] H M Cundy and A P Rollett Mathematical Models Oxford University Press 1961

[12] J K Brunton Polygonal Knots The Mathematical Gazette 45(354)299ndash301 1961

[13] K Sakaguchi On Polygons Made by Knotting Slips of Paper Technical Report of ResearchInstitute of Education Nara University of Education 1855ndash58 1982

[14] J Maekawa Introduction of the study of knot tape In Origami5 Proceedings of the FourthInternational Meeting of Origami Science Mathematics and Education (5OSME) pages 395ndash403 2011

[15] D A Cox Galois Theory Wiley-Interscience 2004

[16] F Ghourabi T Ida and A Kasem Proof Documents for Automated Origami Theorem ProvingIn Automated Deduction in Geometry volume 6877 of LNCS pages 78ndash97 Springer 2011

63

Automated Verification of Equivalence on

Quantum Cryptographic Protocols

Takahiro Kubota1 Yoshihiko Kakutani1 Go Kato2

Yasuhito Kawano2 and Hideki Sakurada2

1 The University of Tokyo Tokyo Japantakahirok11 30kakutaniissu-tokyoacjp

2 NTT Communication Science Laboratories Kanagawa Japankatogokawanoyasuhitosakuradahidekilabnttcojp

Abstract

It is recognized that security verification of cryptographic protocols tends to be difficultand in fact some flaws on protocol designs or security proofs were found after they had beenpresented The use of formal methods is a way to deal with such complexity Especiallyprocess calculi are suitable to describe parallel systems Bisimilarity which denotes thattwo processes behave indistinguishably from the outside is a key notion in process calculiHowever by-hand verification of bisimilarity is often tedious when the processes have manylong branches in their transitions We developed a software tool to automatically verifybisimulation relation in a quantum process calculus qCCS and applied it to Shor andPreskillrsquos security proof of BB84 The tool succeeds to verify the equivalence of BB84 andan EDP-based protocol which are discussed in their proof

1 Introduction

Security proofs of cryptographic protocols tend to be complex and difficult to verify Thisfact has been recognized in the classical cryptography and there is a line of researches to dealwith the complexity of verification [1 2] Since by-hand proofs are prone to human error andtime consumption efforts have been put into automating security proofs and verification in theclassical cryptography Security proofs are also complex in the quantum cryptography where wemust also consider attacks using entanglements The first security proof of BB84 quantum keydistribution (QKD) protocol by Mayers [3] is about 50 pages long After that paper researchershave been seeking simpler proofs [4 5] Since QKD is one of the closest application to practicein the quantum information field it is important to examine QKD systemsrsquo security formallyand make it machine-checkable

There are several formal frameworks for quantum protocols Feng et al developed a processcalculus qCCS [6] In this calculus a protocol is formalized as a configuration A configurationis a pair of a process and a quantum state corresponding to quantum variables Weak openbisimulation relation on qCCS configurations is defined Weakly open bisimilar configurationshave the same transitions up to internal ones and reveal the identical quantum states to theoutsider (adversary) in each step The relation is proven to be closed by parallel composition ofprocesses A use case of a process calculus for formal verification is to prove weak bisimilarityof implementation and specification described as configurations qCCS has been applied toquantum teleportation superdense coding and BB84 protocols

To extend application of formal methods to security proofs we applied qCCS to Shor andPreskillrsquos security proof of BB84 [4] in the previous paper [7] In Shor and Preskillrsquos securityproof security of BB84 is proven to be equivalent to that of another protocol based on anentanglement distillation protocol (EDP) and then the latter is proven to be secure We

64

Automated Verification of Equivalence on Quantum Cryptographic Protocols Kubota et al

formalized BB84 and the EDP-based protocol as configurations and proved their bisimilarityby hand However by-hand verification of bisimilarity is often tedious when configurationshave many long branches in their transitions In this paper we present a software tool to verifybisimilarity of given two qCCS configurations There are two main contributions of our work

First we implemented a software tool that formally verifies bisimilarity of qCCS configu-rations without recursive structures A protocol possibly takes security parameters for variouspurposes As for BB84 it takes two parameters one determines the length of qubits whichAlice sends to Bob in the first quantum communication and the other is for tolerated error-ratein the eavesdropping detection step Such parameters are passed to the verifier as symbols andare interpreted appropriately In our verifierrsquos framework quantum states and operations aredescribed as symbols Since attacks from the adversary are also treated as symbols our verifiercan deal with unspecified attacks To examine the behavioural equivalence adversaryrsquos viewsdenoted by partial traces must be checked to be equal in each step of a protocol The verifierautomatically checks the equality using user-defined equations

Second we applied our verifier to Shor and Preskillrsquos security proof of BB84 [4] The verifiertakes as input two configurations denoting BB84 and the EDP-based protocol and equationsabout the properties of error-correcting codes and measurement of the halves of EPR pairsThe verifier succeeds to verify the bisimilarity of the configurations of the two protocols

The package of the verifier is available from httphagiissu-tokyoacjp~tkqccs

verifiertargz It includes a user manual and and example scripts in the folders doc andscriptsRelated Work The authors of qCCS presented the notion of symbolic bisimulation for quan-tum processes [8] A purpose is to verify bisimilarity algorithmically They proved the strong(internal actions should be simulated) symbolic bisimilarity is equivalent to the strong openbisimilarity and actually presented an algorithm to verify symbolic ground (outsiders do notperform quantum operations adaptively) bisimilarity Since our purpose is to apply a pro-cess calculus to security proofs where adversarial interference must be taken into account weimplemented a tool that verifies weak open bisimilarity on the basis of the original qCCS [6]

2 The Verifier

Formal Framework The verifier employs a sublanguage of qCCS where the syntax of recur-sion and the use of classical data are restricted The framework is still expressive because ourtarget protocols do not need recursion and classical probability distributions can be representedas quantum states denoted by diagonal operators The syntax of the processes in the verifier isas follows

P = discard(q) | cqP | cqP | meas b then P saem | op[q]P | P ||P | PL

Intuitively discard(q)means termination of a process keeping a sequence of quantum variablesq secret cqP sends a quantum variable q to a channel c and then executes P cqP receivesquantum data to a variable q from a channel c and then executes P meas b then P saem

measures a quantum bit b and executes P if the outcome is 0 or terminates if the outcome is1 op[q]P performs a superoperator op to quantum variables q and then executes P P ||P prime

executes P and P prime in parallel PL where L is a set of channels executes P keeping channelsin L private Let qv(P ) be the set of quantum variables that occur in a process P cqP meas b then P saem op[q]P and P ||P prime are defined only if q isin qv(P ) b isin qv(P ) q sub qv(P )and qv(P ) cap qv(P prime) = empty respectively In our verifier each quantum variable is defined with its

65

Automated Verification of Equivalence on Quantum Cryptographic Protocols Kubota et al

qubit-length that is indicated by a natural number symbol declared beforehand The adoptionof natural number symbols is important to treat security parameters in the verifier Quantumstates are represented as character strings called environments The syntax of the environmentsis given as follows

ρ = X[q] | op[q](ρ) | ρ ρ | proji[b](ρ) | Tr[q](ρ)

Let qv(ρ) be the set of quantum variables that occur in an environment ρ X[q] meansthat quantum variables q are in a quantum state X op[q](ρ) is a quantum state after theapplication of operation op to quantum variables q in an environment ρ ρ ρprime represents thetensor product of ρ and ρprime but ρ ρprime and ρprime ρ are identified in the verifier ρ ρprime is definedonly if qv(ρ) cap qv(ρprime) = empty proji[b](ρ) means the reduced density operator |i〉〈i|bρ|i〉〈i|b withi isin 0 1 Tr[q](ρ) means the partial trace of ρ by q We call a pair 〈P ρ〉 of a process Pand an environment ρ a configuration only if qv(P ) sub qv(ρ) because quantum states of qubitsoccurring in P must be defined in ρ For example an agent that sends the halves of n EPR pairsto the outside is formalized as a configuration 〈cqdiscard(r) EPR[qr]ANY[s]〉 where thequantum variables q r are of the qubit length n and the quantum variable s is defined with anarbitrary qubit-length EPR[qr] is interpreted to (|00〉〈00|+ |00〉〈11|+ |11〉〈00|+ |11〉〈11|)otimesn

qr

and ANY[s] is arbitrarily for adversaryrsquos density operatorsA labelled transition system based on the original one [6] is implemented in the verifier

Transitions are interpreted as interactions between configurations and the adversary For exam-

ple the configuration above performs a transition 〈cqdiscard(r) EPR[qr]ANY[s]〉cqminusminusrarr

〈discard(r) EPR[qr]ANY[s]〉 where the adversary can recognize that the quantum vari-able q is sent through the channel c Transitions caused by internal actions such as quantumoperations internal communications and conditional branches are labelled τ The label τ intu-itively means that the action is invisible from the outside The transition rules of conditionalbranch are 〈meas b then P saem ρ〉

τminusrarr 〈P proj0[b](ρ)〉 and 〈meas b then P saem ρ〉

τminusrarr

〈discard(qv(P )) proj1[b](ρ)〉 These may decrease the trace of the density operator de-noting a quantum state Since the trace indicates the probability to reach to a configurationwe can restore the probability from configurations to conditional branches We identify thebranches that are evoked by an identical quantum variable Eventually probability is absorbedin quantum states and excluded from the transition system

The transition system of the original qCCS is probabilistic which is caused by the mea-surement construction M [qx] in the syntax [6] It measures an observable M of a quantumvariable q and stores the result in a classical variable x There are two ways to formalize quan-tum measurement since one can be also formalized as a superoperator Because only M [qx]evokes a probabilistic branch processes with different formalization of measurement are notbisimilar in general We proposed a criteria how to select the way in our previous work [7] weshould use M [qx] if a process behaves differently according to the measurement For examplethe case where a process performs different labeled transitions is typical Otherwise we shouldformalize measurement by a superoperator In our verifierrsquos framework M [qx] cannot be writ-ten independently Instead the syntax meas b then P saem is the composition of M [qx] andthe conditional branch in the original qCCS This restriction and the conditions on quantumvariables prevent the situation where two configurations with the different ways of formalizationof measurement are not bisimilarProcedure to Check Bisimulation Weak bisimulation relation [6] is defined on qCCS con-figurations Roughly speaking weakly bisimilar configurations (1) perform identical labelledtransitions up to τ transitions and (2) reveal identical density operators whatever operations theadversary performs to her quantum variables The adversaryrsquos view is denoted by the partial

66

Automated Verification of Equivalence on Quantum Cryptographic Protocols Kubota et al

trace Tr[q](ρ) when the global quantum state is ρ and q are the quantum variables that arenot revealed to the adversary The verifier takes as input two configurations and user-definedequations on environments and returns true or false It is designed to be sound with respectto the original qCCS that is two configurations are bisimilar if the verifier returns true withthem and some valid equations This is because

Reqs = (CD) |The verifier returns true given CD and eqs

is a bisimulation relation for all valid equations eqs Precisely Reqs is converted accordinglybecause meas b then P saem is decomposed to M [bx] and a conditional branch which performsa two-step transition in the branch with x = 0 The recursive procedure to verify bisimilarityis as follows Since the transitions of the processes written in our sublanguage are finite theprocedure always terminates

1 The procedure takes as input two configurations 〈P0 ρ0〉 〈Q0 σ0〉 and user-defined equa-tions on environments

2 If P0 and Q0 can perform any τ -transitions of superoperator applications they are allperformed at this point Let 〈P ρ〉 and 〈Q σ〉 be the obtained configurations

3 Whether qv(P ) = qv(Q) is checked If it does not hold the procedure returns false

4 Whether Tr[qv(P )](ρ) = Tr[qv(Q)](σ) is checked with user-defined equations Theprocedure to check the equality of quantum states are described in the next subsectionIf it does not hold the procedure returns false

5 A new superoperator symbol E[qv(ρ)minus qv(P )] that stands for an adversarial operationis generated

6 For each 〈P prime ρprime〉 such that 〈P E[qv(ρ) minus qv(P )](ρ)〉αminusrarr 〈P prime ρprime〉 the procedure checks

whether there exists 〈Qprime σprime〉 such that 〈Q E[qv(σ) minus qv(Q)](σ)〉τlowastminusrarr

αminusrarr

τlowastminusrarr 〈Qprime σprime〉 and

the procedure returns true with the input 〈P prime ρprime〉 and 〈Qprime σprime〉 If there exists it goes tothe next step 7 Otherwise it returns false

7 For each 〈Qprime σprime〉 such that 〈Q E[qv(σ) minus qv(Q)](σ)〉αminusrarr 〈Qprime σprime〉 the procedure checks

whether there exists 〈P prime ρprime〉 such that 〈P E[qv(ρ) minus qv(P )](ρ)〉τlowastminusrarr

αminusrarr

τlowastminusrarr 〈P prime ρprime〉 and

the procedure returns true with the input 〈Qprime σprime〉 and 〈P prime ρprime〉 If there exists it returnstrue Otherwise it returns false

The step 2 prominently reduces the search space Indeed 〈op1[q]P ||op

2[r]Q ρ〉 and

〈P ||QF rop2

(E qop1

(ρ))〉 are bisimilar and F rop2

(E qop1

(ρ)) = E qop1

(F rop2

(ρ)) holds because q cap r = emptyholds Therefore superoperators that can originally cause τ transitions are disposedEquality Test of Quantum States To test the equality of given two environments the verifierchecks whether they are transformed to the same form There are two kinds of transformationstrace out and application of user-defined rules

Partial trace is significant to test the equality of quantum states For example two differentquantum states op1[q](X[q]Y[r]Z[s]) and op2[r](U[q]V[r]Z[s]) have the same par-tial trace Z[s] under Tr[qr] for arbitrary interpretation of the superoperators op1 op2 andthe quantum states X Y Z U V The verifier eliminates symbols of superoperators and quantumstates according to the partial trace rules below

Tr[q](E[r](ρ)) = Tr[q](ρ) if r sub q (1) Tr[q](ρ) = Tr[r](Tr[s](ρ)) if q = r cup s (2)

Tr[q](E[r](ρ)) = E[r](Tr[q](ρ)) if q cap r = empty (3) Tr[q](ρ lowast ρq lowast σ) = ρ lowast σ (4)

67

Automated Verification of Equivalence on Quantum Cryptographic Protocols Kubota et al

If r sub q holds Tr[q](E[r](ρ)) is rewritten to Tr[q](ρ) eliminating E[r] by the rule (1)otherwise by the rules (2) and (3) the trace-out symbol with quantum variables that are disjointto targets of superoperator goes inside of itrsquos application After eliminating superoperatorsquantum states are traced out by the rule (4)

If an objective quantum state has a part that matches to the left-hand side of a user-defined equation the part is rewritten to the right-hand side To apply a user-definedequation the verifier automatically solves commutativity of superoperators or partial tracesthat are applied to disjoint sets of quantum variables For example if the objectivequantum state is Tr[q](hadamard[s] (EPR[qr]X[s])) and a user defines an equationTr[q](EPR[qr])=Tr[q](PROB [qr]) (E1) the application goes as follows

Tr[q](hadamard[s](EPR[qr]X[s])) = hadamards[s](Tr[q](EPR[qr]X[s])) (by 5)

= hadamard[s](Tr[q](PROB[qr]X[s])) (by E1)

Since the trace-out rules may have become applicable after applications of user-defined rulesthe trace-out procedure is applied again In each opportunity to test the equality of quantumstates each user-defined equation is applied only once This guarantees whatever rules a userdefines the equality test terminates

3 Application to Shor and Preskillrsquos Security Proof

The two protocols BB84 and the EDP-based protocol [4] are formalized as qCCS configurationson the basis of our previous work [7] Readers can find the script scriptsshor-preskillscrin the package The interpretations of the symbols of the quantum states and the superoperatorsthat are used in the formalization are also included as docshor-preskill symbolspdfOn Channels As in general QKD protocols three kinds of channels are used public quantumchannels private classical channels and public no-interpolate classical channels Since thesyntax has channel restriction PL formalization of private channels is straightforward Publicno-interpolate classical channels are realized by copying the data If a quantum variable q wherea classical value is assigned is sent through a public no-interpolate channel c this is formalizedas copy[qQ]cqdQ c where Q is a new quantum variable a superoperatorcopy copies the value of q to Q and d is a new non-restricted channel q will securely sentthrough the restricted channel c and an adversary obtains the same value accessing Q througha public channel d Note that the value of q can be copied because it is classicalEquations for the Proof We defined 10 equations in the verifier Equations are interpretedto those on density operators and proven correct For example the equation below tells theverifier that the halves of EPR pairs are indistinguishable from the uniform distribution Thisis used to check that the adversaryrsquos views are identical in the EDP-based protocol and BB84before Alice in the EDP-based protocol measures her halves of the check qubits

equation E7

Tr[q1_A](EPR[q1_Aq2_A]) = Tr[q1_A](PROB[q1_Aq2_A])

end

The user-defined rule above is interpreted to an equation trq1 A(|00〉〈00|+ |00〉〈11|+ |11〉〈00|+

|11〉〈11|)otimesnq1 Aq2 A = trq1 A(|00〉〈00|+ |11〉〈11|)otimesn

q1 Aq2 A The other rules are related to CSS codespartial traces and measurement of quantum states We obtained them by formalizing theequality of quantum states that are discussed in the original proof [4]

It is actually natural to express quantum states as symbols with some equations in inputs Incryptographic protocols the dimension of quantum states and superoperators cannot be fixed

68

Automated Verification of Equivalence on Quantum Cryptographic Protocols Kubota et al

as a certain number as they depend on security parameters In addition qubits going throughpublic channels are potentially interpolated by the adversary Since arbitrary computationby the adversary must be considered it should be described as an unspecified superoperatorTherefore quantum states are difficult to be expressed as concrete matrices which can benumerically analyzed Although quantum states are treated symbolically automatic calculationof partial traces is still possible focusing on occurrence of quantum variables in environmentsExperiment Result We ran the verifier with the input of shor-preskillscr We used anote PC with Intel Core i5 CPU M 460 253GHz and 1GB memory The transition tree ofthe EDP-based protocol has 621 nodes and 165 paths and that of BB84 has 588 nodes and 165paths The verifier checked the bisimilarity of the two protocols in 1598 seconds The recursiveprocedure was called 951 times

4 Conclusions

We presented a software tool to check bisimulation of qCCS configurations and applied it to asecurity proof of BB84 [4] In security proofs equivalence on protocols is often discussed Itcan be described as bisimulation relation but it is nearly impossible to check by hand if statetransitions of processes have many long branches In addition the equality of an adversaryrsquosview between two protocols has to be checked in each step An adversaryrsquos view is calculatedfrom a global quantum states which is possibly denoted by a huge matrix The verifier doesexhausting parts of proofs of behavioral equivalence namely it checks the correspondence ofall state transitions up to invisible ones and an adversaryrsquos view up to equations On the otherhand a user only have to examine the correctness of formalization of protocols and validityof equations that he defines It could be difficult to find all appropriate equations for a proofimmediately The verifier is also able to show environments andor processes when the checkprocedure returns false With the information a user can modify equations to inputFuture WorkWe plan to define probabilistic bisimilarity which denotes that configurations be-have indistinguishably up to some probability This will be helpful to prove ldquoindistinguishabilityup to negligible probabilityrdquo of protocols It is quite common argument in the cryptography

References

[1] S Halevi A plausible approach to computer-aided cryptographic proofs Cryptology ePrint ArchiveReport 2005181 2005

[2] B Blanchet A D Jaggard A Scedrov and J-K Tsay Computationally sound mechanized proofsfor basic and public-key kerberos In Proceedings of the 2008 ACM symposium on Informationcomputer and communications security pages 87ndash99 2008

[3] D Mayers Unconditional security in quantum cryptography J ACM 48351ndash406 May 2001

[4] P W Shor and J Preskill Simple proof of security of the bb84 quantum key distribution protocolPhys Rev Lett 85(2)441ndash444 Jul 2000

[5] H-K Lo and H F Chau Unconditional security of quantum key distribution over arbitrarily longdistances Phys Rev Lett 283(5410)2050ndash2056 Mar 1999

[6] Y Deng and Y Feng Open bisimulation for quantum processes In Theoretical Computer Sciencevolume 7604 of LNCS pages 119ndash133 2012

[7] T Kubota Y Kakutani G Kato Y Kawano and H Sakurada Application of a process calculusto security proofs of quantum protocols In Proceedings of WORLDCOMPFCS2012 Jul 2012

[8] Y Feng Y Deng and M Ying Symbolic bisimulation for quantum processes arXiv preprintarXiv12023484 2012

69

A Modified Parallel F4 Algorithm for Shared

and Distributed Memory Architectures

Severin Neumann

Fakultat fur Mathematik und InformatikUniversitat Passau D-94030 Passau Germany

neumansfimuni-passaude

Abstract

In applications of symbolic computation an often required but complex procedure is findingGrobner bases for polynomial ideals Hence it is obvious to realize parallel algorithms tocompute them There are already flavours of the F4 algorithm like [4] and [13] using thespecial structure of the occurring matrices to speed up the reductions on parallel architec-tures with shared memory In this paper we start from these and present modificationsallowing efficient computations of Grobner bases on systems with distributed memory Toachieve this we concentrate on the following objectives decreasing the memory consump-tion and avoiding communication overhead We remove not required steps of the reductionsplit the columns of the matrix in blocks for distribution and review the effectiveness of theSIMPLIFY function Finally we evaluate benchmarks with up to 256 distributed threads ofan implementation being available at httpsgithubcomsvrnmparallelGBC

1 Introduction

Parallelization is one of the most used methods to improve the performance of existing softwareBut it should be introduced systematically One chooses the most time-consuming segments ofa program and tries to improve these first In applications of symbolic computation an oftenrequired but complex procedure is finding Grobner bases for polynomial ideals Therefore itis obvious to realize parallel versions of algorithms to compute them Although it is possibleto use Buchbergerrsquos algorithm [14] we favour Faugerersquos algorithm F4 [3] since the reduction isdone due to matrix transformation which is known for being well parallelizable

There are already parallel flavours of F4 like [4] and [13] using the special structure ofthe occurring matrices to speed up the reduction Both approaches have been developed formulticore and multiprocessor systems with shared memory For these systems the number ofparallel processing units is limited and currently there are not many platforms serving morethan 64 processors Compared with that clusters of several suchlike computers can have antheoretical unlimited number of processors This advantage comes with the downside of dis-tributed memory realizing algorithms requires to consider that data has to be transfered Bythat memory duplication and communication overhead are introduced

In the following we start from the mentioned developments for shared memory systemsand present modifications which will finally allow efficient computation of Grobner bases alsofor systems with distributed memory To achieve this we have concentrated on the followingobjectives reducing the memory consumption and avoiding communication overhead Weremove needless steps of the reduction split the columns of the matrix in blocks for distributionand review the effectiveness of the SIMPLIFY function

At the end we will evaluate benchmarks of an implementation using eight distributed nodeshaving 32 processor cores each The source code is available at httpsgithubcomsvrnmparallelGBC

70

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

2 Notations

In the following we will use the notation of [11] Hence K denotes a field and K[x1 xn] thepolynomial ring over K in n indeterminantes Tn is defined as the set of all terms xα1

1 middot middotxαnn

σ is a term ordering on this set For a polynomial f isin K[x1 xn] with f =summ

i=1 ci middot tiwhere ci isin K and ti isin T

n for all i we call the set Supp(f) = t1 tm support of f Thenthe leading term of f is defined as LTσ(f) = tk = maxσ(Supp(f)) and the leading coefficientis LCσ(f) = ck

Let F = f1 fs isin K[x1 xn] 0 be a set of polynomials Then I = 〈F〉 is theideal generated by F The elements of the set B = (i j) | 1 le i lt j lt s are called criticalpairs For each critical pair exists an S-polynomial Sij = 1

LCσ(fi)middot tij middot fi minus

1LCσ(fj)

middot tji middot fj

with tij =lcm(LTσ(fi)LTσ(fj))

LTσ(fi)and tji =

lcm(LTσ(fj)LTσ(fi))LTσ(fj)

The set F is a σ-Grobner basis of I if for all critical pairs the S-polynomials can be reducedto zero by the elements of F with respect to σ

If not stated otherwise we will use the degree reverse lexicographic termordering (DegRevLex)and the finite field with 32003 elements (F32003) for examples and benchmarks

3 Preliminaries

The F4 algorithm was introduced by Faugere in 1999 [3] By using the special structure ofthe matrix and column-based parallelism Faugere and Lachartre introduced a parallelizationimproving the performance remarkable [4] We have presented another modification [13] for F4speeding up the computation by row-based parallelization

In the following we give a quick summary about Grobner bases computation and the men-tioned developments For a given set of polynomials F = f1 fs isin K[x1 xn] 0generating an ideal I = 〈F〉 a σ-Grobner basis G = g1 gt isin K[x1 xn] can be com-puted using the F4 algorithm by the following four steps

1 Create and update the set of critical pairs B using Gebauerrsquos and Mollerrsquos UPDATE func-tion [6] This function guarantees that the leading terms tij middot fi = tji middot fj of the minuendand subtrahend of the S-polynomial is unique among the critical pairs

2 Select a subset of all critical pairs for reduction using the normal or the sugar cubestrategy [7] At this point the details are not relevant For our benchmarks we chose thesugar cube strategy Although we have to mention that our implementation supports thenormal strategy and for some of the polynomial systems we used as example this strategymight perform better

3 Symbolic preprocess the selected pairs to obtain a coefficient matrix representing theS-polynomials The matrix is additionally filled with rows representing reduction polyno-mials for each term which can be reduced using elements of the partial computed Grobnerbasis G The SIMPLIFY method can be applied to reuse results of previous reductions

4 Reduce the generated matrix until row-echelon form This is equivalent to top-reducingthe S-polynomials All non-zero rows of this matrix having leading terms which are notdivisible by any element of G are inserted into G As long as new elements are found thealgorithm continues with step 1

The most time-consuming step is the reduction of the coefficient matrix The mentioned par-allelizations of Lachartre and Faugere as well as our own approach concentrate on speeding

71

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

up this step We want to show how to use these improvements also for distributed parallelarchitectures therefore we have to review them

Starting after symbolic preprocessing we obtain a coefficient matrix M which has to bereduced to a row-echelon form M has n rows and m columns with m ge n and can bedecomposed in submatrices

1 Submatrices S1 and S2 arise from the subtrahends and minuends of the S-polynomialsSince the UPDATE function guarantees that all polynomials have distinct leading terms therepresenting rows have unique pivot columns Therefore S1 and S2 are upper-triangular

2 Submatrix R represents the reduction polynomials They were computed during symbolicpreprocessing For each reducible term there is only one reduction polynomial Becauseof that R is upper-triangular

3 Finally these submatrices can be split up in pivot and non-pivot columns The pivots of Rand S1 are forming the submatrix A and the non-pivots the submatrix B The submatrixS2 is split into C containing its pivots and D containing the non-pivot columns Thisnotation was introduced in [4]

The following example demonstrates the construction of a matrix occurring during Grobnerbases computations

Example 1 Let K = K32003 P = K[x1 x2 x3] and let the polynomials g1 = x21 + x2

2g2 = x1 middot x2 + x2

2 + x2 middot x3 and g3 = x22 + x2

3 + x3 form the ideal I = 〈g1 g2 g3〉 for which aGrobner basis with respect to DegRevLex should be computed Using UPDATE we get the criticalpairs (2 3) and (1 2) They have the same sugar degree sugar(g2 g3) = 3 = sugar(g1 g2) Sowe reduce the following polynomials

f12 =(x21 + x2

2) middot x2 = x21 middot x2 + x3

2

f21 =(x1 middot x2 + x22 + x2 middot x3) middot x1 = x2

1 middot x2 + x1 middot x22 + x1 middot x2 middot x3

f23 =(x1 middot x2 + x22 + x2 middot x3) middot x2 = x1 middot x

22 + x3

2 + x22 middot x3

f32 =(x22 + x2

3 + x3) middot x1 = x1 middot x22 + x1 middot x

23 + x1 middot x3

and as set of reduction polynomials we obtain

r1 =g3 middot x2 = x32 + x2 middot x

23 + x2 middot x3

r2 =g2 middot x3 = x1 middot x2 middot x3 + x22 middot x3 + x2 middot x

23

r3 =g3 middot x3 = x22 middot x3 + x3

3 + x23

At the end we get the following matrix M

f12f23r1r2r3f21f32

1 0 1 0 0 0 0 0 0 0 00 1 1 0 1 0 0 0 0 0 00 0 1 0 0 0 1 0 0 1 00 0 0 1 1 0 1 0 0 0 00 0 0 0 1 0 0 1 0 0 11 1 0 1 0 0 0 0 0 0 00 1 0 0 0 1 0 0 1 0 0

One can easily see the mentioned structure of the matrix The upper left submatrix is A andits pivots are highlighted Below is C and the non-pivot columns are forming B and D

72

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

Using this decomposition the (full) reduction of the matrix can be computed using thefollowing algorithm

1 Primary reduction Reduce B to Aminus1 middotB

2 Secondary reduction Reduce D to D minus C middotAminus1 middotB

3 Final reduction Reduce D to its reduced row-echelon form using Gaussian elimination

4 Optional reduction Reduce B using the pivots of D

Especially the primary reduction can be efficiently parallelized since the matrix is in uppertriangular form and so all pivots are known The primary and secondary reduction can becomputed in parallel because a reduced row of B can be applied independently on rows of D

After the final reduction all non-zero rows of D are elements of the Grobner basis andcan be used to compute further critical pairs Matrix (AB) does not contain any requiredelements because by construction the pivots of A are equivalent to leading terms which arealready contained in the Grobner basis Hence the fourth step is optional and only required ifSIMPLIFY is used

There are two different approaches to achieve parallelization Column-based as suggestedby Faugere and Lachatre and row-based as suggested by us Actually these two are not mu-tually exclusive and we will use this property to advance the parallelism on architectures withdistributed memory In the following we will use the row-based approach for shared memoryparallelism but one can easily see that all modifications are also applicable to the column-basedapproach of Faugere and Lachatre

4 Matrix Distribution

In the case of the matrix reduction during Grobner basis computation we have to considerhow to distribute the coefficient matrices with least duplication and communication Like anyother parallel and distributed algorithm for transforming matrices into row echelon form wecan choose between row- and column-based distribution or a combination of both

If row-based or combined distribution is chosen the algorithm scatters rows or blocks amongthe computation nodes and these need to send rows from one to each other if they are requiredfor further reductions To reduce the communication overhead this needs to use a strategywhich decides how the matrix is distributed Since we use rows-based parallelization for theshared memory level and since the column-based distribution does play well with the specialproperties of Grobner basis computations we didnrsquot analyse the effectiveness of the row-basedor combined approach

If column-based distribution is chosen the pivot matricesA and C have to be send to all nodesand the non-pivot matrices B and D can be distributed without duplication Since all pivotsare preset for primary and secondary reduction this approach does only require communicationbefore and after all reductions are done

Furthermore the matrices are sparse and by using appropriate matrix formats the commu-nication overhead can be reduced even more We chose to store the off-diagonal elements of Aand C in a coordinate list ie there is one list storing tuples of row column and value Thisformat allows reordering in parallel executable sets to improve the row-based parallelization aspresented in [13] For B and D a modified list of lists format is used storing pairs of row indexand value for each column This allows to distribute columns independently As suggested in[8 Chapter 6] the columns are distributed round-robin to optimize load balancing Afterwards

73

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

each node can use row-based parallelism on the local shared memory The following shows thedistribution of the matrix constructed in example 1

Example 2 Using two parallel nodes the matrix M of the previous example is decomposedinto one coordinate list and two lists of lists Afterwards the pivots are sent to both nodes andthe two sets of non pivot columns are distributed among the nodes Finally the two nodes areholding the following data

Node 1 Node 2

(A C)(411) (431) (201)(211) (351)(051)(151)(161)

(B D)5 (61)7 (41)9 (43)

(A C)(411) (431) (201)(211) (351)(051)(151)(161)

(B D)6 (21) (31)8 (61) -10 (41) -

Table 1 shows that the final reduction can be computed on a single node because thesubmatrix D consumes only a tiny fraction of the whole matrix One can easily check thatthis is true in general the submatrices S1 and S2 have s rows each and the submatrix R hasr rows There are p pivot columns and n non-pivot columns Hence the coefficient matrix has2 middots+r rows and p+n columns After primary and secondary reduction the final reduction onlyrequires the submatrix D which has s remaining rows and n columns Therefore all reducedcolumns can be gathered on one node which executes the Gaussian elimination on D

Polynomial System Sugar degree primary matrix final matrix ratio ()Gametwo 7 [10] 17 7731 x 5818 2671x2182 13Cyclic 8 [1] 14 3819 x 4244 612x1283 48Cyclic 9 16 70251 x 75040 4014x10605 08

Katsura 12 [9] 9 12141 x 11490 2064x2155 32Katsura 13 9 26063 x 23531 4962x4346 35Eco 12 [12] 9 12547 x 10937 2394x1269 22Eco 13 10 25707 x 24686 2883x2310 10F966 [5] 9 60274 x 63503 4823x9058 11

Table 1 Ratio of primary matrix and final matrix during reduction for selected problems

The optional reduction is an obstacle for the effectiveness of the algorithm since it requiresthat the reduced matrix D has to be distributed again to be applied on B Because of that weexamine if the optional reduction is useful at all Even more we put to test if the SIMPLIFY

method and distributed computation play well together

5 Simplifying the F4 Algorithm

Removing the optional reduction may scale down the required communication overhead andthe reduction time Even more if SIMPLIFY isnrsquot used during symbolic preprocessing the

74

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

distributed matrix has not to be gathered completely since the columns of the reduced matrixB are not required after primary and secondary reduction

Algorithm 1 SIMPLIFY

Input t isin Tn a term f isin K[x1 xn] a polynomial F isin (Fk)k=1dminus1) where Fk is

finite subset of K[x1 xn]Output a non evaluated product ie an element of Tn timesK[x1 xn]foreach u isin list of divisors of t do1

if existj(1 le j lt d) such that (u middot f) isin Fj then2

Fj is the row echelon form of Fj wrt σ 3

there exists a (unique) p isin Fj

+such that LTσ(p) = LTσ(u middot f) 4

if u 6= t then return SIMPLIFY( tu pF) else return (1 p)5

end6

end7

The SIMPLIFY method does not guarantee that a reduction is improved by reusing previousresults Actually SIMPLIFY proves it effectiveness mostly by application Hence we requirea best possible implementation of the method Algorithm 1 is a repetition of the originalSIMPLIFY [3] It leaves some details open and there are some possibilities for optimization

bull Searching through all divisors of t is time consuming regarding the fact that only somedivisors of u will satisfy the condition (u f) isin Fj for j isin (1 le j lt d)

bull To check if there exists a j with (u f) in Fj it is important how Fj is stored A naiveimplementation will require to loop over all rows of Fj until the condition is satisfied

bull This algorithm does not check if there is another jprime 6= j satisfying the condition andprovides a better replacement

To address these issues we propose the following modifications

bull All rows of F1 Fdminus1 are stored in a two-dimensional map The first key is a polynomialf and the second is a term u This allows to update (u f) if a better replacement is foundBy that only one value per pair is stored This will decrease the required memory

bull The first map should provide a fast random access to the value of key f and the secondmap should have an ordering to allow a decreasing iteration of the possible terms In thisway the search space for possible replacements is reduced to the multiples of f only

bull The value of a map element is the reduced form of f middot u

We call this data structure SimplifyDB We can provide an improved version of SIMPLIFY asshown by algorithm 2 Additionally we have to introduce a function to update the SimplifyDB

Therefore after reduction we execute algorithm 3 for each row of Fj

+ The insertion step allows

us to compare candidates for the SimplifyDB In our implementation for two candidates thebetter is the one which has less elements in its support This is equivalent to the first weightedlength function wlen(p) = Supp(p) in [2] At this point we didnrsquot try any other suggestedweighted length function

SIMPLIFY can be improved even more During symbolic preprocessing it is called twiceonce for the selected critical pair (m f) with m isin T

n and f isin G and once to create reduction

75

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

Algorithm 2 SIMPLIFY with SimplifyDB

Input t isin Tn a term f isin K[x1 xn] a polynomial SimplifyDB

Output a non evaluated product ie an element of Tn timesK[x1 xn]foreach u le t isin SimplifyDB[f ] do1

if u divides t then2

p = SimplifyDB[f ][u] 3

if u 6= t then return SIMPLIFY( tu p SimplifyDB) else return (1p) 4

end5

end6

Algorithm 3 Insertion into SimplifyDB

Input t isin Tn a term f p isin K[x1 xn] polynomials SimplifyDB

Output SimplifyDBif existu isin SimplifyDB[f ] t = u then1

Replace SimplifyDB[f ][u] with p if it is better 2

else3

SimplifyDB[f ][t] = p 4

end5

polynomials mprime middot f with mprime isin Tn and f prime isin G As one can easily see the second input parameter

is always an element of G So it stands to reason to restrict SIMPLIFY

SIMPLIFY(t i) where i is the index of gi isin G

Still there is the recursive call of SIMPLIFY taking a polynomial p as parameter which mightnot be an element of G Recall that p was found in the SimplifyDB using f and a term u = t

z

with z isin Tn With the knowledge that f = gi isin G we can write p = f middotuminus r = gi middotuminus r where

r isin K[x1 xn] is the sum of all reductions applied on f during a previous reduction stepThe recursive call is looking for another polynomial pprime which simplifies z middot p = z middot (gi middot u minus r)If such a polynomial pprime exists we can write pprime = z middot (gi middot u minus r) minus rprime = z middot u middot gi minus (z middot r minus rprime)Hence if the SimplifyDB stores pprime at index (gi z middot u) instead of (p z) the recursion is obsoleteand SIMPLIFY can be replaced with algorithm 4 being recursion free

Algorithm 4 New SIMPLIFY algorithm

Input t isin Tn a term i is the index of gi isin G SimplifyDB

Output a non evaluated product ie an element of Tn timesK[x1 xn]foreach u le t isin SimplifyDB[f ] do1

if u divides t then return ( tu SimplifyDB[f ][u]) 2

end3

Before benchmarking different variants of the distributed versions of the algorithm a firstlook at timings using only shared memory will thin out the number of combinations Forthe following computations we used a system with 48 AMD Opteron

TM

6172 cores having64 gigabyte of main memory The implementation of the parallelization for the shared memoryis presented in [13] and in its latest version it is realized using Intel Rcopy Threading Building Blocks(TBB) and Open Multi-Processing (OpenMP) for parallelization

76

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

Table 2 shows that the optional reduction is mostly useless and can be left out duringGrobner basis computation Table 3 shows that our new recursion-free SIMPLIFY is also inpractice faster and even more memory efficient

Finally SIMPLIFY is improving performance by increasing memory usage and so for solvinglarger polynomial systems it might be possible to find a solution within the bounds of availablememory by disabling SIMPLIFY Consequently we will compare computations with and withoutthe improved SIMPLIFY for the distributed parallel implementation in the following section

Polynomial systems without optional reduction with optional reductionmax matrix size runtime max matrix size runtime

Gametwo 7 7808 x 5895 2846 7731 x 5818 2985Cyclic 8 3841 x 4295 1118 3819 x 4244 1215Cyclic 9 70292 x 75080 6067 70251 x 75040 6283

Katsura 12 12142 x 11491 3449 12141 x 11490 3666Katsura 13 26063 x 23531 1522 26063 x 23531 1692Eco 12 12575 x 11349 2522 12547 x 10937 2836Eco 13 25707 x 24686 9176 25707 x 24686 1037F966 60898 x 63942 9832 60274 x 63503 1185

Table 2 Comparison of computations with and without optional reduction The new SIMPLIFY

algorithm was used in both cases

Polynomial with new SIMPLIFY with original SIMPLIFY without SIMPLIFYsystems runtime (s) memory runtime memory runtime memory

Gametwo 7 2846 459MB 2882 721MB 2997 262MBCyclic 8 1118 262MB 1443 393MB 1228 131MBCyclic 9 6067 156GB 6492 240GB 5429 210GB

Katsura 12 3449 655MB 3928 157GB 4374 328MBKatsura 13 1522 256GB 1872 727GB 2071 917MBEco 12 2522 328MB 3875 138GB 5087 262MBEco 13 9176 114GB 1364 577GB 2182 852MBF966 9832 256GB 2182 113GB 2125 125GB

Table 3 Comparison of original and new SIMPLIFY

6 Benchmarks

For the following benchmarks of our distributed implementation we used a cluster of up toeight systems having 16 Intel Rcopy Xeon Rcopy E5-2670 cores with hyperthreading and 64GB of RAMallowing us using up to 256 parallel threads For data distribution we use the Message PassingInterface (MPI) and the BoostMPI wrapper

Table 4 compares once again runtimes for computations with and without SIMPLIFY usingone two or four nodes For all polynomial input systems the computation time goes up andthe distribution has no positive effect However we accomplished to speed-up the reductiontime This is not an inconsistency The overall runtime goes up due to the communication

77

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

overhead and the possibility to improve the performance is limited to decreasing the reductiontime Hence the problem is the small size of the given polynomial systems Figure 1 illustratesthis issue for Cyclic 9

Table 5 adds further and more difficult examples Especially for Katsura 15 and Cyclic 10the distributed parallelization takes effect providing a speed-up of 23 and 27 for the overallcomputation time and 57 and 50 for the reduction using four respectively eight nodes Exclud-ing the Eco 14 system the computation is most effective without SIMPLIFY and in particularfor Cyclic 10 computations were not even possible with it due to memory overflows

Eco 14 is an counterexample because it is not possible to decrease the computation timeusing a distributed system This is caused by the effectiveness of SIMPLIFY for the probleminstance

The crashed computations for Katsura 15 and for Cyclic 10 without SIMPLIFY with twonodes are caused by a not yet solved overflow in the MPI implementation if more than 512 MBhave to be transfered in one operation This does not happen with four or eight nodes becausethe matrix size for each node decreases by factor two respectively four

At the end no distributed computation with SIMPLIFY is faster and hence it should beremoved in further developments of distributed parallel algorithms for Grobner bases compu-tations

Polynomial systems with SIMPLIFY without SIMPLIFY nodes 1 2 4 1 2 4

Gametwo 7 2985 3455 5603 2848 3853 2888(5549) (6709) (6010) (6630) (4607) (3427)

Cyclic 8 7798 1112 9520 7497 1406 2078(1327) (1707) (1953) (1332) (1473) (1168)

Cyclic 9 5060 5182 4947 3306 3617 4276(2222) (1952) (1388) (1499) (1224) (7373)

Katsura 12 4200 4636 5523 2859 3997 6685(6083) (8220) (7762) (6699) (4535) (3362)

Katsura 13 1874 1900 1864 1396 1588 1760(4046) (4661) (3682) (5003) (3107) (1815)

Eco 12 2135 2940 4149 2498 4108 8802(2564) (3760) (3953) (6458) (3664) (3097)

Eco 13 9178 1065 1209 1114 1575 2126(1210) (1632) (1462) (3865) (2310) (1467)

F966 9188 1062 1321 9360 1392 1851(2086) (2629) (2391) (3859) (2632) (1870)

Table 4 Distributed computation (and reduction) times for 12 or 4 nodes

78

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

1woS 2woS 4woS 1wS 2wS 4wS

0

100

200

300

400

500

600

Overhead

Reduction

Prepare

Update

Figure 1 Computation time in detail for Cyclic 9 with and without SIMPLIFY

Poly sys with SIMPLIFY without SIMPLIFY nodes 1 2 4 8 1 2 4 8

Katsura 14 9575 8310 7489 7448 7756 6599 6754 991(3139) (2634) (2012) 1691 (3984) (2244) (1351) (86)

Katsura 15 5719 crashed 3440 3252 5615 3857 3252 3372(2571) (-) 1272 1008 (3781) (1960) (1094) (666)

Cyclic 10 crashed crashed crashed crashed 30400 crashed 13270 11280(-) (-) (-) (-) (25240) (-) (7862) (5010)

Eco 14 5098 5194 5526 626 8005 7870 9967 1660(1106) (1177) (9802) (8938) (4113) (2240) (1277) (7824)

Table 5 Distributed computation (and reduction) times for larger input systems

7 Conclusion

We have shown that the parallelization of the F4 algorithm can be expanded form a sharedmemory system to a cluster of distributed nodes providing a multiple of the computation powerof a single system This was primarily achieved by using column-based parallelism removingthe optional reduction and the SIMPLIFY function It allowed us to solve larger input systemslike Katsura 15 or Cyclic 10 almost three times faster using four or respectively eight distributednodes Some work is still required to optimize the speed-up and the communication of the nodeshas to be improved to make solving of even larger problem instances possible

79

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

References

[1] Goran Bjorck and Uffe Haagerup All cyclic p-roots of index 3 found by symmetry-preservingcalculations 2008

[2] Michael Brickenstein Slimgb Grobner bases with slim polynomials Revista Matematica Com-

plutense 23(2)453ndash466 2010

[3] Jean-Charles Faugere A new efficient algorithm for computing Grobner bases (F4) Journal of

Pure and Applied Algebra 139(1ndash3)61ndash88 June 1999

[4] Jean-Charles Faugere and Sylvain Lachartre Parallel Gaussian Elimination for Grobner basescomputations in finite fields In Proceedings of the 4th International Workshop on Parallel and

Symbolic Computation PASCO rsquo10 pages 89ndash97 New York USA July 2010 ACM

[5] Jean-Charles Faugere Moreau Francois De Saint Martin and Fabrice Rouillier Design of regularnonseparable bidimensional wavelets using Groebner basis techniques IEEE Transactions on

Signal Processing 46(4)845ndash856 1998

[6] Rudiger Gebauer and H Michael Moller On an installation of buchbergerrsquos algorithm Journal

of Symbolic Computation 6275ndash286 December 1988

[7] Alessandro Giovini Teo Mora Gianfranco Niesi Lorenzo Robbiano and Carlo Traverso rdquoOnesugar cube pleaserdquo or selection strategies in the buchberger algorithm In Proceedings of the 1991

international symposium on Symbolic and algebraic computation ISSAC rsquo91 pages 49ndash54 NewYork USA 1991 ACM

[8] Gene H Golub and Charles F Van Loan Matrix Computations Johns Hopkins Studies in theMathematical Sciences Johns Hopkins University Press 1996

[9] Shigetoshi Katsura Wataru Fukuda Sakari Inawashiro Nahomi Fujiki and Rudiger GebauerDistribution of effective field in the ising spin glass of the plusmnj model at t = 0 Cell Biochemistry

and Biophysics 11309ndash319 1987

[10] David M Kreps and Robert Wilson Sequential equilibria Econometrica 50(4)863ndash94 July 1982

[11] Martin Kreuzer and Lorenzo Robbiano Computational Commutative Algebra 1 ComputationalCommutative Algebra Springer 2000

[12] Alexander Morgan Solving polynomial systems using continuation for engineering and scientific

problems Classics in applied mathematics SIAM 2009

[13] Severin Neumann Parallel reduction of matrices in Grobner bases computations In Vladimir PGerdt Wolfram Koepf Ernst W Mayr and Evgenii V Vorozhtsov editors Computer Algebra in

Scientific Computing volume 7442 of Lecture Notes in Computer Science pages 260ndash270 SpringerBerlin Heidelberg 2012

[14] Kurt Siegl A parallel factorization tree grobner basis algorithm In Parallel Symbolic Computation

PASCO 1994 Proceedings of the First International Symposium River Edge USA 1994 WorldScientific Publishing Co Inc

80

Generating Asymptotically Non-Terminant

Initial Variable Values for Linear Diagonalizable

Programs

Rachid Rebiha1lowast Nadir Matringe23 and Arnaldo Vieira Moura1

1 Institute of Computing UNICAMP University of Campinas SP Brasilrachidicunicampbr

2 Universit de Poitiers Laboratoire Mathmatiques et Applications France3 Institue de Mathematiques de Jussieu Universite Paris 7-Denis Diderot France

Abstract

We present the key notion of asymptotically non-terminant initial variable values fornon-terminant loop programs We show that those specific values are directly associated toinital variable values for which the corresponding loop program does not terminate Con-sidering linear diagonalizable programs we describe powerful computational methods thatgenerate automatically and symbolically a semi-linear space represented by a linear systemof equalities and inequalities Each element of this space provides us with asymptoticallynon-terminant initial variable values Our approach is based on linear algebraic methodsWe obtain specific conditions using certain basis and matrix encodings related to the loopconditions and instructions

1 Introduction

Research on formal methods for program verification [12 15 8 17] aims at discovering math-ematical techniques and developing their associated algorithms to establish the correctness ofsoftware hardware concurrent systems embedded systems or hybrid systems Static programanalysis [12 15] is used to check that a software is free of defects such as buffer overflows orsegmentation faults which are safety properties or termination and non-termination which areliveness properties Proving termination of while loop programs is necessary for the verificationof liveness properties that any well behaved and engineered system or any safety critical em-bedded system must guarantee We could list here many verification approaches that are onlypractical depending on the facility with which termination can be automatically determinedVerification of temporal properties of infinite state systems [20] is another example

Recent work on automated termination analysis of imperative loop programs has focusedon a partial decision procedure based on the discovery and synthesis of ranking functions Suchfunctions map the loop variable to a well-defined domain where their value decreases furtherat each iteration of the loop [9 10] Several interesting approaches based on the generationof linear ranking functions have been proposed [3 4] for loop programs where the guards andthe instructions can be expressed in a logic supporting linear arithmetic For the generation ofsuch functions there are effective heuristics [14 10] and in some cases there are also completemethods for the synthesis of linear ranking functions [16] On the other hand it is easy togenerate a simple linear terminant loop program that does not have a linear ranking functionAnd in this case such complete synthesis methods [16] fail to provide a conclusion about thetermination or the non termination of such a program

lowastSupported by FAPESP grant 201108947-1 and FAPESP grant BEPE 201304734-9

81

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

In this work we address the non-termination problem for linear while loop programs Inother words we consider the class of loop programs where the loop condition is a conjunc-tion of linear inequalities and the assignments to each of the variables in the loop instructionblock are affine or linear forms In matrix notation linear loop programs will be representedin a general form as while (Bx gt b) x = Ax + c (ie A and B are matrices b and c arevectors of real numbers and that x is a vector of variables) Without loss of generality theterminationnon-termination analysis for such a class of linear programs could be reduced tothe problem of terminationnon-termination for homogeneous linear programs [6 21] Thosebeing programs where linear assignments consist of homogeneous expressions and where thelinear loop condition consists of at most one inequality Concerning effective program trans-formations and simplification techniques non-termination analysis for programs presented in amore complex form can often be reduced to an analysis of a program expressed in this basicaffine form Despite tremendous progress over the years [6 5 7 13 11 2 1] the problem offinding a practical sound and complete methods for determining or analyzing non termina-tion remains very challenging for this class of programs and for all initial variable values Westarted our investigation from our preliminary technical reports [19 18] where we introduced atermination analysis in which algorithms ran in polynomial time complexity Here consideringa non terminating loop we introduce new static analysis methods that compute automaticallyand in polynomial time complexity the set of initial input variable values for which the programdoes not terminate and also a set of initial inputs values for which the program does terminateThis justifies the innovation of our contributions ie none of the other mentioned related workis capable of generating such critical information over non-terminating loops We summarizeour contributions as follows

bull To the best of our knowledge we introduce a new key notion for non-termination and ter-mination analysis for loop programs we identify the important concept of asymptoticallynon-terminant initial variable values ANT for short Any asymptotically non-terminantinitial variable values can be directly related to an initial variable value for which theconsidered program does not terminate

bull Our theoretical contributions provide us with efficient computational methods running inpolynomial time complexity and allowing the exact computation of the set of all asymp-totically non-terminant initial variable values for a given loop program

bull We generate automatically a set of linear equalities and inequalities describing a semi-linear space that represents symbolically the set of all asymptotically non-terminant initialvariable values The set of ANT values contains the set of non-terminant initial variablevalues On the other hand the complementary set of ANT values is a precise under-approximation of the set of terminant inputs for the same program

Example 11 (Motivating Example) Consider the following program depicted below on theleft We show a part of the output of our algorithm below on the right

(i) Pseudo code

while(2x+3y-zgt0)

x= y + z

y= -(12)x+(32)y -(12)z

z=(32)x -(32)y+(12)z

(ii) Output of our prototype

Locus of ANT

[[4u[1]+u[2]+u[3]gt0]

AND[u[1]+4u[2]+4u[3]gt0]

AND[-u[1]+u[2]-u[3]=0]]

OR[[-u[1]+u[2]-u[3]gt0]]

82

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

The semi-linear ANT = u = (u1 u2 u3)⊤ isin E | 4u1 + u2 + u3 gt 0 and u1 + 4u2 + 4u3 gt

0 andminusu1 + u2 minus u3 = 0 cup u = (u1 u2 u3)⊤ isin E | minus u1 + u2 minus u3 gt 0 represents symbolically

all asymptotically initial variable values that are directly associated to initial variable valuesfor which the program does not terminate On the other hand the complementary of this setco-ANT = u = (u1 u2 u3)

⊤ isin E | 4u1 + u2 + u3 le 0 or u1 + 4u2 + 4u3 le 0 orminusu1 + u2 minus u3 6=0 cap u = (u1 u2 u3)

⊤ isin E | minus u1 + u2 minus u3 le 0 is a precise under-approximation of the setof all initial variable values on which the program terminates

The rest of this article is organized as follows Section 2 can be seen as a preliminarysection where we introduce some key notions and results from linear algebra which will be usedto build our computational methods In this section we also present our computational modelfor programs and some further notations Section 3 introduces the new notion of asymptoticallynon-terminant initial variable values Section 4 provides the main theoretical contributionsof this work This section also presents our computational methods that generate a symbolicrepresentation of the asymptotically non-terminant variable values for linear programs Weprovide a complete dicussion in Section 5 Finally Section 6 states our conclusions

2 Linear Algebra and Linear Loop Programs

Here we present key linear algebraic notions and results which are central in the theoretical andalgorithmic development of our methods We denote by M(mnK) the set of mtimes n matriceswith entries in K and simply M(nK) when m = n The Kernel of A also called its nullspacedenoted by Ker(A) is Ker(A) = v isin K

n | A middot v = 0Km In fact when we deal with squarematrices these Kernels are Eigenspaces Let A be a ntimes n square matrix with entries in K Anonzero vector x isin K is an eigenvector for A associated with the eigenvalue λ isin K if A middotx = λxie (A minus λIn) middot x = 0 where In is the n times n identity matrix The nullspace of (A minus λIn) iscalled the eigenspace of A associated with eigenvalue λ Let n be a positive integer we willdenote R

n by E and its canonical basis by Bc = (e1 en) Let A be a square matrix inM(nR) Let us introduce the notation Spec(A) for the set of eigenvalues of A in R and wewill write Spec(A)lowast for the set Spec(A)minus 0 For λ isin Spec(A) we will denote by Eλ(A) thecorresponding eigenspace Throughout the paper we write dλ for the dimension of Eλ(A) Wewill say that A is diagonalizable if E = oplusλisinSpec(A)Eλ(A) Let A be a diagonalizable matrixFor each eigenspace Eλ(A) we will take a basis Bλ = (eλ1 eλdλ

) and we define

B = cupλisinSpec(A)Bλ

as a basis for E

Definition 21 Let x belong to E We denote by xλ its component in Eλ(A) If x admits the

decompositionsum

λisinSpec(A)(sumdλ

i=1 xλieλi) in B we have xλ =sumdλ

i=1 xλieλi

We denote by P the transformation matrix corresponding to B whose columns are the vectorsof B decomposed in Bc Letting di denote the integer dλi

for the ease of notation we recallthe following lemma

Lemma 21 We have Pminus1AP = diag(λ1Id1 λtIdt) We denote by D the matrix Pminus1AP

As we will obtain our results using the decomposition of x in B we recall how one obtains itfrom the decomposition of x in Bc

83

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

Lemma 22 Let x isin E If x =sumn

i=1 xiei = (x1 xn)⊤ isin Bc and x decomposes as

sumtj=1(

sumdj

i=1 xλj ieλj i) in B the coefficients xλj i are those of the column vector Pminus1x in Bc

Throughout the paper we write lt gt for the canonical scalar product on E which is given by lt

x y gt=sumn

i=1 xiyi and recall as it is standard in static program analysis that a primed symbolxprime refers to the next state value of x after a transition is taken Next we present transitionsystems as representations of imperative programs and automata as their computational models

Definition 22 A transition system is given by 〈x L T l0Θ〉 where x = (x1 xn) is a setof variables L is a set of locations and l0 isin L is the initial location A state is given by aninterpretation of the variables in x A transition τ isin T is given by a tuple 〈lpre lpost qτ ρτ 〉where lpre and lpost designate the pre- and post- locations of τ respectively and the transitionrelation ρτ is a first-order assertion over x cup xprime The transition guard qτ is a conjunction ofinequalities over x Θ is the initial condition given as a first-order assertion over x Thetransition system is said to be linear when ρτ is an affine form

We will use the following matrix notations to represent loop programs and their associatedtransitions systems

Definition 23 Let P be a loop program represented by the transition system 〈x =(x1 xn) l0 T = 〈l l qτ ρτ 〉 l0Θ〉 We say that P is a linear loop program if the followingconditions hold

bull Transition guards are conjunctions of linear inequalities We represent the loop conditionin matrix form as V x gt b where V isin M(mnR) and b isin R

m By V x gt b we mean thateach coordinate of vector V x is greater than the corresponding coordinate of vector b

bull Transition relations are affine or linear forms We represent the linear assignments inmatrix form as x = Ax+ c where A isin M(nR) and c isin R

n

The linear loop program P = P (A V b c) will be represented in its most general form aswhile (V x gt b) x = Ax+ c

In this work we use the following linear loop program classifications

Definition 24 We identify the following three types of linear loop programs from the morespecific to the more general form

bull Homogeneous We denote by PH the set of programs where all linear assignments consistof homogeneous expressions and where the linear loop condition consists of at most oneinequality If P is in PH then P will be written in matrix form as while (lt v x gtgt

0) x = Ax where v is a (ntimes 1)-vector corresponding to the loop condition and whereA isin M(nR) is related to the list of assignments in the loop We say that P has ahomogeneous form and it will also be denoted as P (A v)

bull Generalized Condition We denote by PG the set of linear loop programs where the loopcondition is generalized to a conjunction of multiple linear homogeneous inequalities

bull Affine Form We denote by P A the set of loop programs where the inequalities and theassignments are generalized to affine expressions If P is in P A it will be written aswhile (V x gt b) x = Ax+ c for A and V in M(nR) b isin R

m and c isin Rn

84

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

Without lost of generality the static analysis for the class of linear programs P A could bereduced to the problem of terminationnon-termination for homogeneous linear programs inPH In this work we consider programs in PH The generalization to programs in P A canalready be done and it will be reported elsewhere

3 Asymptotically Non-terminant Variable Values

In this section we present the new notion of asymptotically non-terminant variable values Itwill prove to be central in analysis of termination in general Let A be a matrix in M(nR)and v be a vector in E Consider the program P (A v) while (lt v x gtgt 0) x = Ax whichtakes values in E We first give the definition of the termination of such a program

Definition 31 The program P (A v) is said to be terminating on x isin E if and only iflt vAk(x) gt is not positive for some k ge 0

In other words Definition 31 states that if the program P (A v) performs k ge 0 loopiterations from initial variables xin E we obtain x = Ak(x) Thus if lt vAk(x) gtle 0the loop condition is violated and so P (a v) terminates Next we introduce the followingimportant notion

Definition 32 We say that x isin E is an asymptotically non terminating value for P (A v) ifthere exists kx ge 0 such that P (A v) is non terminating on Akx(v) We will write that x isANT for P (A v) or simply x is ANT We will also write that P (A v) is ANT on x

Note that if P (A v) is non terminating on Akx(x) then lt vAk(x) gt is gt 0 for k ge kxThe following result follows directly from the previous definition

Corollary 31 An element x isin E is ANT if and only if lt vAk(x) gt is positive for k largeenough

If the set of ANT points is not empty we say that the program P (A v) is ANT We willalso write NT for non terminant For the programs we study here the following lemma alreadyshows the importance of such a set

Lemma 31 The program P (A v) is NT if and only if it is ANT

Proof It is clear that NT implies ANT (ie NT sube ANT ) as a NT point of P (A v) is ofcourse ANT (with kx = 0) Conversely if P (A v) is ANT call x an ANT point then Akx(x)is a NT point of P (A v) and so P (A v) is NT

As one can easily see the set of NT points is included in the set of ANT points But themost important property of the ANT set remains in the fact that each of its point provides uswith an associated element in NT for the corresponding program In other words each elementx in the ANT set even if it does not necessarily belong to the NT set refers directly to initialvariable values yx = Ak[x](x) for which the program does not terminate ie yx is an NT pointWe can say that there exists a number of loop iterations k[x] departing from the initial variable

values x such that Ak[x](x) correspond to initial variable values for which P (A v) does notterminate But it does not necessarily implies that x is also an NT point for P (A v) In factprogram P (A v) could terminate on the initial variable values x by performing a number of

85

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

loop iterations strictly smaller than k[x] On the other hand the complementary set co-ANT

provides us with a quite precise under approximation of the set of all initial variable values forwhich the program terminates

The set of ANT points of a program is also important to the understanding of the terminationof a program with more than one conditional linear inequality as well as for termination overthe rationals for example This will be reported elsewhere

4 Automated generation of ANT loci

In this section we show how we generate automatically and exactly the ANT Locus ie the setof all ANT points for linear diagonalizable programs over the reals We represent symbolicallythe computed ANT Locus by a semi-linear space defined by linear equalities and inequalitiesConsider the program P (A v) while (lt v x gtgt 0) x = Ax The study of ANT setsdepends on the spectrum of A Recall the introductory discussion and Definition 21 at Section2

Proposition 41 For x in E and k ge 1 the scalar product lt vAk(x) gt is equal to

sum

λisinSpec(A)

λk lt v xλ gt=sum

λisinSpec(A)lowast

λk lt v xλ gt

Proof It is a direct consequence of the equality Ak(xλ) = λkxλ

41 The regular case

We first analyze the situation where A is what we call regular

Definition 41 We say that A is regular if Spec(A) cap[

minus Spec(A)]

is an empty set ie ifλ belongs to Spec(A) then minusλ does not belong to Spec(A)

In this case we make the following observation

Proposition 42 Let micro be the nonzero eigenvalue of largest absolute value if it exists such thatlt v xmicro gt is nonzero For k large the quantity lt vAk(x) gt is equivalent to microk lt v xmicro gt

Proof Indeed we can write lt vAk(x) gt as

microk lt v xmicro gt +sum

λ|λ|lt|micro|

λk lt v xλ gt= microk(lt v xmicro gt +sum

λ|λ|lt|micro|

λk

microklt v xλ gt)

and λk

microk approaches zero when k goes to infinity

We then define the following sets

Definition 42 For micro a positive eigenvalue of A we define Smicro as follows

Smicro = x isin Elt v xmicro gtgt 0 lt v xλ gt= 0 for |λ| gt |micro|

86

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

In order to obtain Smicro for all positive eigenvalues micro of A one needs to calculate lt v xmicro gtand lt v xλ gt for all eigenvalues λ such that |λ| gt |micro| For all eigenvalues λ involved inthe computation of Smicro one also needs to evaluate the coefficients cλi =lt v eλi gt for all

eigenvectors eλi isin B and 1 le i le dλ Thus we have lt v xλ gt=sumdλ

i=1 cλixλi Now we onlyneed to compute the coefficient xλi which are those of the column vector Pminus1x in Bc whereP is the transformation matrix corresponding to B See Lemma 22

We ca now state the following theorem allowing the exact computation of the ANT Locusfor the regular case

Theorem 41 The program P (A v) is ANT on x if and only if x belongs to

microgt0isinSpec(A)

Smicro

Proof Let x belong to E If all lt v xλ gt are zero for λ isin Spec(A) then lt vAk(x) gt= 0and x is not ANT Otherwise let micro be the eigenvalue of largest absolute value such thatlt v xmicro gt is nonzero Then according to Proposition 42 the sign of lt vAk(x) gt is the signof microk lt v xmicro gt for k large If micro is negative this sign will be alternatively positive and negativedepending on the parity of k and x is not ANT If micro is positive this sign will be the sign oflt v xmicro gt hence x will be ANT if and only if lt v xmicro gt is positive This proves the result

Example 41 (Running example) Consider the program P (A v) depicted as follows

(i) Pseudo code

while(x+y-2zgt0)

x= x-4y-4z

y= 8x-11y-8z

z= -8x+8y+5z

(ii) Associated matrices

A =

1 minus4 minus48 minus11 minus8minus8 8 5

and v =

11minus2

Step 1 Diagonalization of the matrix A

P =

1 1 12 1 0minus2 0 1

D =

1 0 00 minus3 00 0 minus3

and Pminus1 =

1 minus1 minus1minus2 3 22 minus2 minus1

Using our notations the obtained eigenvectors (ie the column vectors of P ) are denoted asfollows e11 = (1 2minus2)⊤ eminus31 = (1 1 0)⊤ eminus32 = (1 0 1)⊤

Step 2 We compute Smicro for all positive micro isin Spec(A)lowast

bull We compute first the coefficients cλic11 =lt v e11 gt=lt (1 1minus2)⊤ (1 2minus2)⊤ gt= 7

cminus31 =lt v eminus31 gt=lt (1 1minus2)⊤ (1 1 0)⊤ gt= 2

cminus32 =lt v eminus31 gt=lt (1 1minus2)⊤ (1 0 1)⊤ gt= minus1

bull We compute the coefficient xλi which are those of the column vector Pminus1 middotu in Bc whereu = (u1 u2 u3) is the vector encoding the initial variable values

Pminus1

u1

u2

u3

=

u1 minus u2 minus u3)minus2u1 + 3u2 + 2u3)2u1 minus 2u2 minus u3)

=

x11

xminus31

xminus32

We can now proceed to the generation of the linear constraints defining a semi-linear space

87

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

describing symbolically and exactly Smicrolt v x1 gt= c11x11 = 7(u1 minus u2 minus u3)lt v xminus3 gt= cminus31xminus31 + cminus32xminus32 = minus6u1 + 8u2 + 5u3)Hence we have S1 = u = (u1 u2 u3)

⊤ isin E | (u1minusu2minusu3 gt 0)and(minus6u1+8u2+5u3 = 0)

Step 3 We apply Theorem 41 to generate the ANT Locus It reduces to the semi-linear spaceS1 = u = (u1 u2 u3)

⊤ isin E | (u1 minus u2 minus u3 gt 0) and (minus6u1 + 8u2 + 5u3 = 0)

42 The general case handling linear diagonalizable programs

For the general case in the asymptotic expansion of lt vAk(x) gt one can have compensationsbetween λk lt v xλ gt and (minusλ)k lt v xλ gt as these terms can be zero when k is even forinstance and of a well determined sign when k is odd We thus need to take care of this issueTo this end we introduce the following notation

Definition 43 If λ does not belong to Spec(A) for any x isin E we write xλ = 0

We have the following propositions which give the asymptotic behavior of lt vAk(x) gt

Proposition 43 Let micro be the nonzero eigenvalue of largest absolute value if it exists suchthat lt v x|micro| + xminus|micro| gt is nonzero For k large the quantity lt vA2k(x) gt is equivalent to

|micro|2k(lt v x|micro| + xminus|micro| gt)

Proof Indeed we can write lt vA2k(x) gt as

micro2k(lt v x|micro| gt + lt v xminus|micro| gt) +sum

|λ||λ|lt|micro|

λ2k(lt v x|λ| gt + lt v xminus|λ| gt)

= micro2k(lt v x|micro| gt + lt v xminus|micro| gt) +sum

|λ||λ|lt|micro|

λ2k

micro2k(lt v x|λ| gt + lt v xminus|λ| gt))

and λk

microk approaches to zero when k goes to infinity

Proposition 44 Let micro be the nonzero eigenvalue of largest absolute value if it exists suchthat lt v x|micro| minus xminus|micro| gt is nonzero For k large the quantity lt vA2k+1(x) gt is equivalent to

|micro|2k+1(lt v x|micro| minus xminus|micro| gt)

Proof The proof is similar to the proof of Proposition 43

As in the previous Section we introduce the following relevant sets

Definition 44 For |micro| in |Spec(A)lowast| we define the sets S0|micro| and S1

|micro| as follows

S0|micro| = x isin Elt v x|micro| + xminus|micro| gtgt 0 lt v x|λ| + xminus|λ| gt= 0 for |λ| gt |micro| and

S1|micro| = x isin Elt v x|micro| minus xminus|micro| gtgt 0 lt v x|λ| minus xminus|λ| gt= 0 for |λ| gt |micro|

In order to compute the sets S0|micro| and S1

|micro| we obtain the coefficients cλi =lt v eλi gt for alleigenvalues λ If the λ appearing as index in the coefficient cλi is not an eigenvalue then we fix

cλi = 0 and dλ = 0 (see Definition 43) Thus we have lt v x|λ| + xminus|λ| gt=sumd|λ|

i=1 c|λ|ix|λ|i +sumdminus|λ|

i=1 cminus|λ|ixminus|λ|i and lt v x|λ| minus xminus|λ| gt=sumd|λ|

i=1 c|λ|ix|λ|i minussumdminus|λ|

i=1 cminus|λ|ixminus|λ|iWe finally obtain the following main theorem

88

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

Theorem 42 The program P (A v) is ANT on x if and only if x belongs to the set

(|micro||microprime|)isin|Spec(A)lowast|times|Spec(A)lowast|

S0|micro| cap S1

|microprime|

Proof It is obvious that x is ANT if and only if lt vA2k(x) gt and lt vA2k+1(x) gt are bothpositive for k large Now reasoning as in the proof of Theorem 41 but using Propositions 43and 44 instead of Proposition 42 we obtain that lt vA2k(x) gt is positive for k large if andonly if x belongs to S0

|micro| for some micro isin |Spec(A)lowast| and that lt vA2k+1(x) gt is positive for k

large if and only if x belongs to S1|microprime| for some microprime isin |Spec(A)lowast| The result follows

The following two examples illustrate how Theorem 42 applies to different cases

Example 42 (Running example) Consider the program P (A v) depicted as follows

(i) Pseudo code

while(2x+3y-zgt0)

x=15x+18y-8z+6s-5t

y=5x+3y+z-t-3s

z=-4y+5z-4s-2t

s=-43x-46y+17z-14s+15t

t=26x+30y-12z+8s-10t

(ii) Associated matrices

A =

15 18 minus8 6 minus55 3 1 minus1 minus30 minus4 5 minus4 minus2

minus43 minus46 17 minus14 1526 30 minus12 8 minus10

v =

11231

Step 1 Diagonalization of the matrix A

P =

2 1 minus1 1 1minus1 0 2 0 minus1minus2 0 2 minus1 minus2minus4 minus1 0 minus2 minus12 2 1 2 1

D =

minus3 0 0 0 00 minus1 0 0 00 0 0 0 00 0 0 1 00 0 0 0 2

and Pminus1 =

minus3 minus3 1 minus1 1minus1 minus2 1 0 1minus5 minus4 1 minus1 210 10 minus3 2 minus4minus7 minus6 1 minus1 3

We obtain the following eigenvectors written using our notation e01 = (minus1 2 2 0 1)⊤e11 = (1 0minus1minus2 2)⊤ e21 = (1minus1minus2minus1 1)⊤ eminus11 = (1 0 0minus1 2)⊤ and eminus31 =(2minus1minus2minus4 2)⊤

Step 2 Computing Smicro for all positive micro isin Spec(A)lowast

bull Our algorithm first computes the coefficients cλi We obtain c01 = 6 c11 = minus5c21 = minus6 cminus11 = 0 and cminus31 = minus13

bull Then our algorithm computes the coefficients of the decomposition of the initial vari-able values in B They are those of the column vector Pminus1 middot u in Bc where u =(u1 u2 u3 u4 u5)

⊤ is the vector encoding the initial variable values

Pminus1

u1

u2

u3

u4

u5

=

minus3u1 minus 3u2 + u3 minus u4 + u5

minusu1 minus 2u2 + u3 + u5

minus5u1 minus 4u2 + u3 minus u4 + 2u5

10u1 + 10u2 minus 3u3 + 2u4 minus 4u5

minus7u1 minus 6u2 + u3 minus u4 + 3u5

=

xminus31

xminus11

x01

x11

x21

Now the algorithm obtains all the non-zero terms appearing in the definition of S0|λ| and S1

|λ|

lt v x|1| + xminus|1| gt= c11x11 = minus5(10u1 + 10u2 minus 3u3 + 2u4 minus 4u5)lt v x|2| + xminus|2| gt= c21x21 = minus6(minus7u1 minus 6u2 + u3 minus u4 + 3u5)

89

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

lt v x|minus3| + xminus|minus3| gt= cminus31xminus31 = minus13(minus3u1 minus 3u2 + u3 minus u4 + u5)lt v x|minus3| minus xminus|minus3| gt= minuscminus31xminus31 = 13(minus3u1 minus 3u2 + u3 minus u4 + u5)

All the sets S0|λ| and S1

|λ| can now be computed exactly

S0

|1| = u isin E | 5(10u1 + 10u2 minus 3u3 + 2u4 minus 4u5) gt 0 and minus6(minus7u1 minus 6u2 + u3 minus u4 + 3u5) = 0 and

minus 13(minus3u1 minus 3u2 + u3 minus u4 + u5) = 0

S1

|1| = u isin E|5(10u1 + 10u2 minus 3u3 + 2u4 minus 4u5) gt 0 and minus6(minus7u1 minus 6u2 + u3 minus u4 + 3u5) = 0 and

13(minus3u1 minus 3u2 + u3 minus u4 + u5) = 0

S0

|2| = u isin E| minus 6(minus7u1 minus 6u2 + u3 minus u4 + 3u5) gt 0 and minus13(minus3u1 minus 3u2 + u3 minus u4 + u5) = 0

S0

|2| = u isin E| minus 6(minus7u1 minus 6u2 + u3 minus u4 + 3u5) gt 0 and minus13(minus3u1 minus 3u2 + u3 minus u4 + u5) = 0

S1

|2| = u isin E| minus 6(minus7u1 minus 6u2 + u3 minus u4 + 3u5) gt 0 and 13(minus3u1 minus 3u2 + u3 minus u4 + u5) = 0

S0

|minus3| = u isin E| minus 13(minus3u1 minus 3u2 + u3 minus u4 + u5) gt 0

S1

|minus3| = u isin E| 13(minus3u1 minus 3u2 + u3 minus u4 + u5) gt 0

Step 3 We apply Theorem 42 to generate the ANT LocusThe algorithm computes the following intersections S0

1 capS11 S

01 capS1

2 S01 capS1

3 S02 capS1

1 S02 capS1

2 S02 cap S1

3 S03 cap S1

1 S03 cap S1

2 and S03 cap S1

1 In fact the previous computational step already allows our algorithm to perform implicit sim-plifications For instance it appears that S0

|1| = S1|1| S

0|1| = S1

|1| = S0|minus1| = S1

|minus1| S0|2| = S1

|2|

and that S0|minus3| cap S1

|minus3| is the empty set According to Theorem 42 the ANT locus reduces tothe following semi-linear space

u = (u1 u2 u3 u4 u5)⊤ isin E | minus 10u1 minus 10u2 + 3u3 minus 2u4 + 4u5 gt 0 and

minus 7u1 minus 6u2 + u3 minus u4 + 3u5 = 0 and

minus 3u1 minus 3u2 + u3 minus u4 + u5 = 0⋃

u = (u1 u2 u3 u4 u5)⊤ isin E | minus 10u1 minus 10u2 + 3u3 minus 2u4 + 4u5 gt 0 and

minus 3u1 minus 3u2 + u3 minus u4 + u5) gt 0 and

minus 7u1 minus 6u2 + u3 minus u4 + 3u5 = 0⋃

u = (u1 u2 u3 u4 u5)⊤ isin E | 7u1 + 6u2 minus u3 + u4 minus 3u5 gt 0 and

minus 3u1 minus 3u2 + u3 minus u4 + u5 = 0

5 Discussions

This work is complementary to our previous work [19] which dealt with termination analysisIn [19] we first prove a sufficient condition for the termination of homogeneous linear programsThis statement was conjectured in the important work of [21] where the first attempt toprove this result contains non trivial mistakes As we shown in [19] the actual proof of thissufficient condition requires expertise in several independent mathematical fields Also thenecessary condition proposed in [21] does not apply as expected in practice We then wentto generalize the previous result and to the best of our knowledge we presented the firstnecessary and sufficient condition (NSC for short) for the termination of linear programsIn fact this NSC exhibits a complete decidability result for the class of linear programs on all

90

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

initial values Moreover departing from this NSC we showed the scalability of these approachesby demonstrating that one can directly extract a sound and complete computational methodrunning in polynomial time complexity to determine termination or nontermination for linearprograms On the other hand all other related and previous works mentioned in this paper donot provide any techniques capable of generating automatically the set of initial input variablevalues for which a loop does not terminate The main contributions of this paper remain ona sound and complete computational method to compute the set of input variable values forwhich the programs do not terminate The overall time complexity of our algorithm is also oforder O(n3) As can be seen the main results ie Theorems 41 and 42 provide us with adirect symbolic representation of the ANT set Even if those theorems are rigorously stated andproofs are quite technical they are really easy to apply we only need to compute the explicitterms S0

|micro| and S1|microprime| in order to directly obtain a formula representing exactly and symbolically

the ANT set In a same manner we extended this techniques to linear program not necessarilydiagonalizable and we obtained similar theoretical and practical results As their associatedproofs are more technical they would required more space to be fully expressed and we left themfor an ensuing report In other more recent work on termination static analysis for programsover the rationals or the integers with several conditional linear inequalities we also show thatthe notion ANT remains central

6 Conclusion

We presented the new notion of asymptotically non-terminant initial variable values for linearprograms Considering a linear diagonalizable program our theoretical results provided us withsound complete and fast computational methods allowing the automated generation of the setsof all asymptotically non-terminant initial variable values represented symbolically and exactlyby a semi-linear space eg conjunctions and disjunctions of linear equalities and inequalitiesAlso by taking the complementary set of the semi-linear set of ANT initial variable values weobtain a precise under-approximation of the set of terminant initial variable values for the (non-terminant) program Actually this type of method can be vastly generalized to tackle the ter-mination and non-termination problem of linear programs not necessarily diagonalizable withmore than one conditional linear inequality on rational or integer initial values for instanceWe leave this investigation for an ensuing report

References

[1] Amir M Ben-Amram and Samir Genaim On the linear ranking problem for integer linear-constraint loops In Proceedings of the 40th annual ACM SIGPLAN-SIGACT symposium onPrinciples of programming languages POPL rsquo13 pages 51ndash62 New York NY USA 2013 ACM

[2] Amir M Ben-Amram Samir Genaim and Abu Naser Masud On the termination of integer loopsIn VMCAI pages 72ndash87 2012

[3] Aaron R Bradley Zohar Manna and Henny B Sipma Linear ranking with reachability In InCAV pages 491ndash504 Springer 2005

[4] Aaron R Bradley Zohar Manna and Henny B Sipma Termination analysis of integer linearloops In In CONCUR pages 488ndash502 Springer-Verlag 2005

[5] Aaron R Bradley Zohar Manna and Henny B Sipma Termination of polynomial programsIn In VMCAIrsquo2005 Verification Model Checking and Abstract Interpretation volume 3385 ofLNCS pages 113ndash129 Springer 2005

91

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

[6] Mark Braverman Termination of integer linear programs In In Proc CAV06 LNCS 4144 pages372ndash385 Springer 2006

[7] Hong Yi Chen Shaked Flur and Supratik Mukhopadhyay Termination proofs for linear simpleloops In Proceedings of the 19th international conference on Static Analysis SASrsquo12 pages 422ndash438 Berlin Heidelberg 2012 Springer-Verlag

[8] Edmund M Clarke Orna Grumberg and Doron Peled Model Checking MIT Press CambridgeMA 2000

[9] Michael Colon and Henny Sipma Synthesis of linear ranking functions In Proceedings of the 7thInternational Conference on Tools and Algorithms for the Construction and Analysis of SystemsTACAS 2001 pages 67ndash81 London UK 2001 Springer-Verlag

[10] Michael A Colon and Henny B Sipma Practical methods for proving program termination InIn CAV2002 Computer Aided Verification volume 2404 of LNCS pages 442ndash454 Springer 2002

[11] Byron Cook Andreas Podelski and Andrey Rybalchenko Termination proofs for systems codeSIGPLAN Not 41(6)415ndash426 June 2006

[12] P Cousot and R Cousot Abstract interpretation and application to logic programs Journal ofLogic Programming 13(2ndash3)103ndash179 1992

[13] Patrick Cousot and Radhia Cousot An abstract interpretation framework for termination SIG-PLAN Not 47(1)245ndash258 January 2012

[14] Dennis Dams Rob Gerth and Orna Grumberg A heuristic for the automatic generation of rankingfunctions In Workshop on Advances in Verification pages 1ndash8 2000

[15] Zohar Manna Mathematical Theory of Computation McGraw-Hill 1974

[16] Andreas Podelski and Andrey Rybalchenko A complete method for the synthesis of linear rankingfunctions In VMCAI pages 239ndash251 2004

[17] Jean-Pierre Queille and Joseph Sifakis Specification and verification of concurrent systems incesar In Proceedings of the 5th International Symposium in Programming pages 337ndash351 LondonUK 1982 Springer-Verlag

[18] Rachid Rebiha Nadir Matringe and Arnaldo V Moura A complete approach for terminationanalysis of linear programs Technical Report IC-13-08 Institute of Computing University ofCampinas February 2013

[19] Rachid Rebiha Nadir Matringe and Arnaldo V Moura Necessary and sufficient condition fortermination of linear programs Technical Report IC-13-07 Institute of Computing University ofCampinas February 2013

[20] Henny B Sipma Tomas E Uribe and Zohar Manna Deductive model checking Form MethodsSyst Des 15(1)49ndash74 July 1999

[21] Ashish Tiwari Termination of linear programs In Rajeev Alur and Doron Peled editors ComputerAided Verification 16th International Conference CAV 2004 Boston MA USA volume 3114 ofLecture Notes in Computer Science pages 70ndash82 Springer 2004

92

Data Conversion Method between a Natural

Number and a Binary Tree for an Inductive

Proof and Its Application

Kazuko Takahashi1 Shizuo Yoshimaru1lowast

and Mizuki Goto1

1 School of Science and Technology Kwansei Gakuin Universityktakakwanseiacjp

2 School of Science and Technology Kwansei Gakuin Universityshizuoyoshimarugmailcom

3 School of Science and Technology Kwansei Gakuin Universitybub85144kwanseiacjp

Abstract

This paper presents modeling of a binary tree that represents a natural number andgives an inductive proof for its properties using theorem provers We define a function forconverting data from a natural number into a binary tree and give an inductive proof forits well-definedness We formalize this method develop a computational model based onit and apply it to an electronic cash protocol We also define the payment function onthe binary tree and go on to prove the divisibility of electronic cash using the theoremprovers IsabelleHOL and Coq respectively Furthermore we discuss the effectiveness ofthis method

1 Introduction

Theorem proving is an important technique to provide a certified system or to ensure bug-free programming Several theorem provers which may be called proof assistants have beendeveloped including ACL2 [11] PVS [19] IsabelleHOL [16] Coq [4] Agda [17] and so onThese tools help users to develop formal proofs either interactively or semi-automaticallytypically using induction as the proof strategy There are numerous applications for suchprovers There are relatively few practical applications of these tools in most fields comparedto their use in pure mathematics although there are some outstanding results in microprocessordesign [10] C compilers [14] operating system kernels [12] security protocols [1] and securecard systems [3 13] To use these provers successfully it is necessary to construct a suitablemodel and then select an appropriate proof strategy In practical applications it may be difficultto form a natural inductive model and so it may be necessary to build a data structure whichcan be difficult for these provers to handle

We have previously attempted to prove the divisibility of an electronic cash protocol [21] Inthis experience we have encountered difficulties in proving the properties regarding the functionthat converts a natural number to a binary tree The binary tree is a complete binary treewhere a Boolean value is attached to each node and the value of which is defined as a sum ofthe value of the left and right subtrees The problem can be reduced to the fact that there existsa function that cannot be defined in a primitive recursive form on an inductively defined datastructure Because a natural number has a linear structure with only one successor whereas a

lowastCurrently Nochu Information System CoLTD

93

Data Conversion Revisited Takahashi Yoshimaru and Goto

binary tree has a branching structure with two successors at each branching point the inductionschemes are different which complicates the proof

To solve this problem we introduced a bit sequence as an intermediate data structure anddefined the function from a natural number to a binary tree as a composition of two recursivefunctions via a bit sequence Specifically the first function describes the mapping from anatural number to an intermediate bit sequence and the second function is the mapping fromthe bit sequence to the binary tree We formalized this model and associated proof method andapplied it to the divisibility of an electronic cash protocol using IsabelleHOL However thisprevious work had several drawbacks First the model was complicated because of an intricatelabeling for the nodes of a tree a simpler and more natural model for this specific binary treehas subsequently been identified Second the proof was incomplete as one of the lemmas thatrelates the bit sequence to the binary tree was left as an axiom Third the effectiveness of themethod was not discussed we did not know whether this method could be applied similarlywith theorem provers other than IsabelleHOL or whether a large number of modificationswould be required In this paper we provide a simplified model give complete proofs of thedivisibility using the theorem provers IsabelleHOL and Coq and discuss the effectiveness ofthe method

The rest of this paper is organized as follows In Section 2 we describe in detail the problemsof data conversion and our solution In Sections 3 and 4 we present a formalization and aninductive proof of the divisibility of an electronic cash protocol In Section 5 we provide adiscussion and in Section 6 we present our conclusions

2 Data Conversion Formalization

21 Problem

First we illustrate the problem of converting between a natural number and a binary treewhich are data structures with different induction schemes

Let NAT and BTREE be a natural number and a binary tree respectively NAT is induc-tively defined with one successor BTREE is inductively defined in such a form that there aretwo successors ie

nat_p(0)

nat_p(n) =gt nat_p(Suc(n))

tree_p(Tip)

tree_p(lt) amp tree_p(rt) =gt tree_p(Node(_ltrt))

where Suc denotes the successor function Node is a constructor for a tree rsquo rsquo denotes ananonymous variable that corresponds to a parent node lt and rt are the left and right subtreesrespectively and T ip is a leaf node The symbols amp and =gt denote conjunction and implicationrespectively

Consider data conversion between NAT and BTREE Let f be a function that maps fromNAT to BTREE and g be a function that maps from BTREE to NAT We assume that thesefunctions are defined inductively in the following form

f NAT --gt BTREE

f(Suc(n)) = c1(f(n))

f(0) = Tip

94

Data Conversion Revisited Takahashi Yoshimaru and Goto

g BTREE --gt NAT

g(Node(_ltrt)) = c2(g(lt) g(rt))

g(Tip) = 0

where c1 is a function from BTREE to BTREE and c2 is a function from NATtimes NAT to NATConsider proving the following relationship between f and g

g(f(n)) = n

We use the following induction scheme IS on NAT to prove it

foralln( (forallnprimenprime lt n =rArr g(f(nprime)) = nprime) =rArr g(f(n)) = n ) [IS]

The proof proceeds by rewriting g(f(n)) in succession as follows

g(f(n)) = g(f(c2(n1 n2)))= g(Node( f(n1) f(n2)))= c2(g(f(n1)) g(f(n2)))= c2(n1 n2)

where c2(n1 n2) = n for a certain n1 n2 lt nThe induction scheme IS is used to proceed from the third line to the fourth line To succeed

in this proof there are two problems to be solved The first is the progression from the first lineto the second line we have to prove the equality f(c2(n1 n2)) = Node( f(n1) f(n2)) Thisproblem is how to divide a natural number into two parts suitably The second and arguablymore challenging problem is that we cannot find c1 that defines f in a recursive form naturallyConsider the function f which maps a natural number to a binary tree The forms of the datastructures f(n) and f(Suc(n)) are considerably different and the differences depend on thevalues of n For example compare the operation of adding a leaf node labeled ldquoTruerdquo to thebinary tree shown in Figure 1 In this figure (a) shows the operation of adding a node to thebinary tree that has two leaf nodes labeled ldquoTruerdquo and (b) shows the operation of adding anode to the binary tree that has three leaf nodes labeled ldquoTruerdquo These operations cannot berepresented uniformly therefore f(n) cannot be uniformly defined for all n Furthermore evenif f is defined the proof over the properties on f is not straightforward

(a)

T F F F

T T

(b)

T T T TT T T F

T

T T T

T T

T T

T

T

Figure 1 Operation on adding a ldquoTruerdquo node to a binary tree

On the other hand the definition of g is simpler because it is a conversion from a data typethat is not totally-ordered to one that is totally-ordered

22 Solution

To solve the problem shown above we introduce the bit sequence BS as an intermediate datastructure between NAT and BTREE

95

Data Conversion Revisited Takahashi Yoshimaru and Goto

221 Conversion from BS to BTREE

First we describe the conversion from BS to BTREE We choose a specific binary tree used inan electronic cash protocol This tree is a complete binary tree and a Boolean value is attachedto each node the value of which is defined as a sum of the values of its left and right subtrees

Let b0b1 bn be a sequence of Boolean values that corresponds to a natural number kThen k = bprime0 middot 2

n + bprime1 middot 2nminus1 + + bprimen middot 20 where bprimei = 10 for bi = TrueFalse (1 le i le n)

respectively We encode bprime0 middot2n as the left tree and the remainder as the right tree The function

from BS to BTREE is defined as follows

bs_to_btree() = (Tipfalse)

bs_to_btree(bbs) = (if b

then Node(true create_btree(truelength(bs)) bs_to_btree(bs) )

else Node(true bs_to_btree(bs) create_btree(falselength(bs)) )

)

where is an operator combining the head and tail of the list T ip indicates a leaf node thefunction create btree(bool nat) creates a binary tree of height nat in which all nodes are labeledwith bool and length(list) denotes the length of list 1 Intuitively when scanning the datafrom the head of BS descending by one bit corresponds to descending one subtree in BTREEThe induction scheme for the bit sequence is that if some property holds on a bit sequence bsit also holds on bbs If b = True (ie k ge 2n) then all nodes in the left subtree are labeledTrue this is referred to as a full tree However if b = False (ie k lt 2n) then none of thenodes in the right tree are labeled True this is referred to as an empty tree Thus the datatypes BS and BTREE are matched in their induction schemes

Let a bit sequence be represented as a list the elements of which are either True or FalseFigure 2 shows the conversion of the bit sequence [True False T rue] into a binary tree Inthis figure the black trees are full trees the white trees are empty trees and the dotted treesare the others

T

T T T

FTFTT

[TrueFalseTrue] [FalseTrue] [True]

Figure 2 The mapping between a bit sequence and a binary tree

Because the binary tree corresponding to [True False T rue] is not an empty tree the rootnode is labeled True Because the first bit in the sequence is True the left tree is a full treeThe tree to the right of it is the tree corresponding to the remaining bit sequence [False T rue]after the first bit has been extracted Now consider the coding of [False T rue] because the

1We can define a mirror tree in which left and right subtrees are exchanged

96

Data Conversion Revisited Takahashi Yoshimaru and Goto

first bit of the sequence is False the right tree must be an empty tree and the left tree isthe tree corresponding to the remaining bit sequence Then we consider the coding of [True]because the first bit of the bit sequence is True the left tree is a full tree and the right tree isthe binary tree corresponding to the remaining bit sequence Finally we obtain a T ip for [ ]

T

T

T

T F

T

T

T T T T T F F F

Figure 3 The binary tree for [True False T rue]

The binary tree obtained from [True False T rue] is thus as follows (Figure 3)

( True

( True ( TrueTrueTrue ) ( TrueTrueTrue ) )

( True ( TrueTrueFalse ) ( FalseFalseFalse ) )

)

The function bs to btree can give an inductive definition that provides for the division of ninto n1 and n2 corresponding to the left and right subtrees respectively in the proof processfor IS in the previous subsection

222 Conversion from NAT to BS

Next we give a definition for the conversion from NAT to BS We show two different modelsone using a general function and one using a primitive recursive function

First we define the general function naive nat to bs This is defined in an iterative formand determines the value of a a bit sequence from the least-significant bit as follows

naive_nat_to_bs(0) = [False]

naive_nat_to_bs(1) = [True]

naive_nat_to_bs(n) = (naive_nat_to_bs(div(n2))) ([mod(n2) = 1])

where is the concatenation operator for lists div(n 2) and mod(n 2) return the result ofdivision of n by 2 and its remainder respectively

Second we define the primitive recursive function nat to bs This is defined in a tail-recursive form and determines the value of a bit sequence from the most-significant bit Thedefinition is more complex than that of the iterative form

nat_to_bs(0) = [false]

nat_to_bs(Suc(n)) = calc(lg(Suc(n))Suc(n))

calc(0m) = [true]

calc(Suc(n)m) = (if 2^n lt= m) then True(calc(nm-2^(Suc(n))))

else False(calc(nm))

lg(n) = (if nlt=1 then 0

else Suc(lg (div(n2))))

97

Data Conversion Revisited Takahashi Yoshimaru and Goto

where lg is a key function that returns the place number of the bit sequence corresponding toa given argument ie the natural number m that satisfies m le log n lt m+ 1 The followingtable shows the relationship of a natural number nat a bit sequence bs and the value of lgNote that when n increases by 1 the location in the bit sequence which is equal to the heightof the tree increases logarithmically

nat bs lg

1 1 02 10 13 11 14 100 25 101 26 110 27 111 28 1000 39 1001 3

223 Conversion from NAT to BTREE

Finally nat to btree is defined as the composition of the two functions naive nat to bs andbs to btree or the composition of nat to bs and bs to btree nat to bs and bs to btree are prim-itive recursive functions whereas naive nat to bs is a recursive function

The definition of nat to bs is more suitable to an induction scheme than that ofnaive nat to bs because induction is typically applied from the head to the tail

In the next two sections we apply this formalization to the electronic cash protocol definedin [18] and prove its divisibility

3 Modeling of an Electronic Cash Protocol

31 Ideal Electronic Cash

An electronic cash (e-cash) protocol is in general a combination of cryptography techniquessuch as zero-knowledge proof and public key encryption We consider the ideal e-cash protocolproposed by Okamoto [18] In this protocol a coin of some monetary value is encoded asa binary tree and a payment function is defined over it This binary tree approach makese-cash efficient and unlinkable and is used in many divisible e-cash schemes [7 8 15 18]We formalize this protocol and prove its divisibility on a data level ie a user can spend acoin in several separate transactions by dividing its value without overspending if and only ifa payment function satisfies the payment rules This is one of the properties that an ideale-cash protocol should satisfy We define the data structure of money and define two primitiverecursive functions of money amount and pay on money The definitions are shown using Coqcode in this section

32 Definition of money

A coin is represented as a binary tree called money Each node of the tree represents a certaindenomination The root node is assigned the monetary value of the money and the values of

98

Data Conversion Revisited Takahashi Yoshimaru and Goto

all other nodes are defined as half the value of their parent nodesMoney is defined as an inductive function It is a binary tree where nodes are labeled with

Boolean values The label True means that a node is usable while False means that it is notFor a given Boolean value b and a natural number n we can create money in which all of thenodes have the label b

Inductive money Type =

| Tip bool -gt money

| Node bool -gt money -gt money -gt money

Fixpoint create_money(b bool)(n nat) money =

match n with

| 0 =gt Tip b

| S nrsquo =gt Node b (create_money b nrsquo) (create_money b nrsquo)

end

33 Creation of money from a natural number

cash is a function that createsmoney corresponding to a given natural number that is defined asa composition of bs to money and naive nat to bs (or nat to bs) bs to money can be definedin a manner similar to that of bs to btree

Definition cash(n nat) money = bs_to_money (naive_nat_to_bs n)

Note that cash is the money that satisfies a specific condition whereas type money al-lows any complete binary tree whose nodes are labeled as Boolean values For exampleNode(false T ip(true) T ip(true)) is an element of money but not a result of a function cash

34 Calculation of the amount of money

The function money amount computes the amount of money that can be used If the rootnode is labeled True the amount of the tree is the sum of that of the left tree and the righttree otherwise the amount is 0

Fixpoint money_amount(m money) nat =

match m with

| Tip true =gt 1

| Tip false =gt 0

| Node true l r =gt money_amount l + money_amount r

| Node false _ _ =gt 0

end

35 Payment

Payment rules are set in [18] as follows when we spend some amount from the coin we searchfor a node (or combination of nodes) whose value is equal to the payment value and then cancelthese nodes at the same time all of the ancestors and all of the descendants are also canceledOverspending is prevented if and only if these rules are satisfied

The function pay corresponds to payment according to the payment rules When we pay nfrom money where n is less than or equal to the amount of money then we pay all of n fromthe left tree and the right tree remains as it is if the amount of the left tree is more than n

99

Data Conversion Revisited Takahashi Yoshimaru and Goto

Otherwise we exhaust the left tree in the payment and pay the remainder from the right treeFor example money amount(pay(cash(13) 4) = 9

In the following code eq nat dec and lt dec are functions on NAT that denote rsquo=rsquo and rsquoltrsquorespectively change false is a function that changes the label of a node to False

Fixpoint pay(m money)(n nat) money =

match m with

| Tip true =gt Tip (if eq_nat_dec n 0 then true else false)

| Node true l r =gt

if lt_dec (money_amount l) n

then Node true (change_false l) (pay r (n - money_amount l))

else Node true (pay l n) r

| _ =gt m

end

4 Proof of Properties

We prove three properties on the divisibility of the e-cash protocol On proving these propertiesinductively we apply the method proposed in Section 2

In this section we only show the outline of the proof focusing on how induction is appliedThe complete Coq proof is shown in the Appendix

First the distribution property over money amount holds

money amount(Node( left right)) =money amount(left) +money amount(right) middot middot middot (1)

This can readily be proved We rewrite the left side of the given equation

41 Well-definedness of cash

The monetary value of money created by cash from a natural number is equal to that valueThis property is represented as follows

forall n (money amount (cash(n)) = n)

and is proved using the properties of the bit sequence Below we show a case in which the firstbit b of the sequence is True When it is False the proof proceeds in the same manner

money amount(cash(n))= money amount(bs to money(bbs)) middot middot middot (2)= money amount( Node(true

bs to money(bs) create money(true length(bs) ) middot middot middot (3)= money amount(bs to money(bs))+

money amount(create money(true (length(bs)))) middot middot middot (4)

Formula (2) is obtained by unfolding cash where nat to bs(n) = bbs formula (3) isobtained by unfolding bs to money and formula (4) is obtained by the distribution propertyof money amount (1)

The first term of formula (4) is transformed as follows

100

Data Conversion Revisited Takahashi Yoshimaru and Goto

money amount(bs to money(bs))= money amount(bs to money(nat to bs(nminus 2lg n))) middot middot middot (5)= money amount(cash(nminus 2lgn)) middot middot middot (6)

Formula (5) is obtained using case split tactics on n property of lg and several other tacticsFormula (6) is obtained by unfolding cash

The second term of formula (4) is transformed as follows

money-amount(create money(true length(bs)))= money amount(cash(2lgn)) (7)

Here we use the following induction scheme of NAT

if forall k k lt n money amount(cash(k)) = kthen money mount(cash(n)) = n holds

We can prove 2lg n le n and nminus 2lg n lt n If 2lg n lt n we apply this type of induction toboth formulas (6) and (7) and so formula (4) is finally transformed into the following form

money amount(cash(2lg n)) +money amount(cash(nminus 2lg n))= 2lg n + (nminus 2lg n)= n

In case 2lg n = n the proof is simpler without using induction

42 Well-definedness of pay

The amount remaining after payment is the difference between the original value and thepayment value This property is represented as follows 2

forall nforall m (money amount(pay(cash(n)m)) = nminusm)

This is derived from the following lemma

forall cforall n (money-amount(pay(c n)) = money-amount(c)minus n

which is proved as follows When we pay n from c if n does not exceed the amount of c wepay m1 from the left subtree as far as possible and pay the remainder m2 from the right treem1 and m2 are determined as follows if n lt money amount(left) then m1 = n and m2 = 0otherwise m1 = money amount(left) and m2 = n minus money amount(left) This is provedusing induction Below we show an inductive case because the proof is simple for the basecase

money amount(pay(cm1 +m2))= money amount(pay(Node( left right)m1 +m2)) middot middot middot (8)= money amount(pay(leftm1)) +money amount(pay(rightm2)) middot middot middot (9)= money amount(left)minusm1 +money amount(right) minus m2 middot middot middot (10)= (money amount(left) + money amount(right)) minus (m1 + m2)= money amount(Node( left right)) minus (m1 +m2) middot middot middot (11)= money amount(c) minus (m1 +m2)

2Note that nminusm = 0 when m gt n

101

Data Conversion Revisited Takahashi Yoshimaru and Goto

Formula (8) is obtained by expanding c Formula (9) is obtained by the distribution propertyofmoney amount and the property of payment onmoney Formula (10) is obtained by applyinginduction tomoney Formula (11) is obtained from the distribution property ofmoney amount

43 Divisibility

Given that ms is a list of values each of which corresponds to a transaction if a user paysfrom the head of this list in succession then the remainder is the correct value This propertyis represented as follows

forallnforallms( n ge listsum(ms)

=rArr money amount (foldl(pay(cash(n)ms))) = n minus listsum(ms) )

Here foldl and listsum are the functions handling a list Let ms be a list [m1 mk]foldl(pay(cms)) is rewritten in the following form

(pay( (pay(cm1) mk)

and listsum(ms) is rewritten in the following form

m1 + + mk

This theorem can be proved using the result of the proofs for the above two properties ofwell-definedness

5 Discussion

Modeling the e-cash protocol and proving the properties described in the previous sections wereperformed using the theorem provers IsabelleHOL and Coq respectively First we comparethese two provers

Both of them are interactive theorem-proving environments based on inductive theoremproving The data types and functions are defined in recursive form and the proof proceeds byconnecting suitable tactics

IsabelleHOL has a more powerful engine for automatic proof than Coq A proof may suc-ceed simply by using the lsquoautorsquo command without connecting multiple lemmas in IsabelleHOLwhereas a user must specify tactics manually in Coq However the proof procedure in Coq iseasier to understand

Both provers are based on typed logics and adopt higher-order functions In Coq type-checking is richer and proof-checking is reduced to type checking It requires the user to provethe termination of a recursive function IsabelleHOL also requires the user to prove thetermination of a recursive function but has a stronger automatic mechanism and user doesnot need to supply much input

We developed a model for an e-cash protocol and set out to prove three properties of themodel using IsabelleHOL and subsequently translated the model into Coq The translationwas basically straightforward The definition of a primitive recursive function using primrec inIsabelleHOL was translated to Fixpoint in Coq the definition of a recursive function usingfun was translated to Function the definition of a non-recursive function using definitionwas translated to Definition In addition we must prove the termination of the functionintroduced via Function

102

Data Conversion Revisited Takahashi Yoshimaru and Goto

The tactics used in the proofs of two provers were quite different Generally more tactics arerequired in Coq however the proof in Coq provides a useful basis from which to make a proofin IsabelleHOL Actually we completed the proof of the unproved lemma in IsabelleHOL byreferring to the proof in Coq From this experience it is expected that similar modeling withother provers is possible and that the existing proofs will be useful as a basis for forming proofsin those other provers All definitions and proofs in IsabelleHOL and Coq are shown in [22]

In the field of protocol verification there are a number of works on the verification ofsecurity protocols using IsabelleHOL (eg[2]) However they mainly proved security or safetyof protocols To the best of our knowledge there exists no research on a proof that focuses onthe divisibility of electronic cash protocols using a theorem-proving approach

Bijection between the set of natural numbers and rooted trees has been discussed in severalworks [5 6 9] In these works prime decomposition of the natural numbers was used toconstruct the corresponding rooted tree They used an incomplete tree in which each primenumber forms an individual branch It appears to be impossible to define this bijection in aninductive manner Attempts to provide the mechanical proof were not made and the correctnessof the methods has not been proved using theorem provers On the other hand we propose amethod for automated theorem proving using a complete binary tree

The data conversion method described here is applicable to conversion from an inductivelydefined data structure with one successor to one with n successors by introducing a list inwhich each element takes n values as an intermediate data structure instead of a bit sequenceFollowing this transformation the proof can proceed in a similar manner to the one shown inthis paper although the number of lemmas would increase Moreover it can be extended todata conversion from data structures with m successors to data structures with n successors bycomposing two data-conversion functions ie one from an inductively defined data structurewith m successors to that with one successor and then a second function from an inductivelydefined data structure with one successor to one with n successors

6 Conclusion

We have described a function for converting data from a natural number to a binary treeand have given an inductive proof for its well-definedness We have described a method ofintroducing a bit sequence as an intermediate data structure to provide a model for inductivelydefined data structures with different induction schemes We formalized this method developeda computational model based on it and applied it to an electronic cash protocol We succeededin proving the properties of divisibility of the protocol using the theorem provers IsabelleHOLand Coq and discussed the effectiveness of the method

In future we would like to investigate other functions andor properties on such a binarytree that is handled here and develop methods of their inductive proof

References

[1] Arsac W Bella G Chantry X and Compagna L Multi-Attacker Protocol Validation J ofAutomated Reasoning 46(3-4)353-388 (2011)

[2] Bella G Massacci B and Paulson L Verifying the SET Purchase Protocols J of AutomatedReasoning 365 37 (2006)

[3] Bella G Inductive Verification of Smart Card Protocols J of Computer Security 11(1)87-132(2003)

103

Data Conversion Revisited Takahashi Yoshimaru and Goto

[4] Bertot Y and Castran P Interactive Theorem Proving and Program Development - CoqrsquoArtThe Calculus of Inductive Constructions Springer Verlag (1998)

[5] Beyer T and Hedetniemi S M Constant Time Generation of Rooted Trees SIAM J Comput9(4)706-712 (1980)

[6] Cappello P A New Bijection between Natural Numbers and Rooted Trees 4th SIAM Conferenceon Discrete Mathematics (1988)

[7] Chan A Frankel Y and Tsiounins Y Easy Come - Easy Go Divisible Cash EUROCRYPT98pp 561-575 (1998)

[8] Canard S and Gouget A Divisible E-Cash Systems Can Be Truly Anonymous EURO-CRYPT2007 pp482-497 (2007)

[9] Gobel F On a 1-1-Correspondence between Rooted Trees and Natural Numbers J of Combina-torial Theory Series B(29)141-143 (1980)

[10] Hardin D S (ed) Design and Verification of Microprocessor Systems for High-Assurance Appli-cations Springer Verlag (2010)

[11] KaufmannM Monolios P and Moore J S Computer-Aided Reasoning An Approach KluwerAcademic Publishers (2000)

[12] Klein G et al seL4 Formal Verification of an Operating-System Kernel Commun ACM 53(6)107-115 (2010)

[13] Kurita T and Nakatsugawa Y The Application of VDM to the Industrial Development ofFirmware for a Smart Card IC Chip Int J of Software and Informatics 3(2-3)343-355 (2009)

[14] Leroy X Formal Verification of a Realistic Compiler Communications of the ACM 52(7)107-115(2009)

[15] Nakanishi T and Sugiyama Y An Efficiently Improvement on an Unlinkable Divisible ElectronicCash System IEICE Trans on Fundamentals E85-A(19)2326-2335 (2002)

[16] Nipkow T Paulson L and Wenzel M IsabelleHOL A Proof Assistant for Higher-Order LogicSpringer Verlag (2002)

[17] Norell U Dependently Typed Programming in Agda Advanced Functional Programming 2008pp230-266 (2008)

[18] Okamoto T An Efficient Divisible Electronic Cash Scheme The proceedings of Cryptorsquo95pp438-451 (1995)

[19] OwreS RushbyJM and ShankarN PVS A Prototype Verification System The proceedingsof CADE-11 pp748-752 (1992)

[20] Sprenger C Zurich E T H Basin D et al Cryptographically Sound Theorem Proving 19thIEEE Computer Security Foundations Workshop (2006)

[21] Takahashi K and Yoshimaru S Formalization of Data Conversion for Inductive Proof Tunisia-Japan Workshop on Symbolic Computation in Software Science (SCSS 2009) pp135-150 (2009)

[22] httpistksckwanseiacjp~ktakaEMONEY

104

Data Conversion Revisited Takahashi Yoshimaru and Goto

Appendix Proof for E-cash protocol in Coq (tail-recursiveversion)

Require Import Omega List Arith Div2 Bool Recdef Wf_nat

Theorem well_definedness_of_pay

forall(m money)(n nat)

n lt= money_amount m

-gt money_amount(pay m n) = money_amount m - n

Proof

intros m

induction m intros n LNM destruct b simpl in try reflexivity

destruct (eq_nat_dec n 0)

rewrite e reflexivity

assert(n = 1) by omega

rewrite H reflexivity

destruct (lt_dec (money_amount m1) n) simpl

rewrite IHm2 try omega

replace (money_amount (change_false m1)) with 0 try omega

destruct m1 simpl reflexivity

rewrite IHm1 omega

Qed

Lemma bit_sequence_distribution

forall(bs list bool)(b bool)

money_amount(bs_to_money(bs ++ (bnil))) =

2 money_amount(bs_to_money bs) + (if b then 1 else 0)

Proof

intros bs b

induction bs simpl in

destruct b reflexivity

assert(forall(bl bool)money_amount (create_money bl (length

(bs ++ b nil))) =

money_amount (create_money bl (length bs)) + money_amount

(create_money bl (length bs)))

intros clear IHbs destruct bl induction bs simpl try omega

destruct a simpl in rewrite IHbs repeat rewrite plus_0_r

repeat rewrite plus_assoc rewrite H omega

Qed

Lemma one_reminder_div2

forall(n nat)

(2 div2 n) + (if one_reminder n then 1 else 0) = n

Proof

intros n

case_eq (one_reminder n) intros induction n using lt_wf_ind

destruct n try discriminate

destruct n try reflexivity

simpl in H

simpl

replace (S (div2 n + S (div2 n + 0) + 1))

with (S (S (2 div2 n + 1)))

105

Data Conversion Revisited Takahashi Yoshimaru and Goto

repeat f_equal

rewrite H0 try reflexivity try omega

apply H

simpl

omega

destruct n try reflexivity

destruct n try discriminate

simpl in H

simpl

replace (S (div2 n + S (div2 n + 0) + 0))

with (S (S (2 div2 n + 0)))

repeat f_equal

rewrite H0 try reflexivity try omega

apply H

simpl

omega

Qed

Theorem well_definedness_of_cash

forall(n nat)

money_amount (cash n) = n

Proof

intros n

induction n using lt_wf_ind

destruct n try (simpl reflexivity)

destruct n try (simpl reflexivity)

unfold cash rewrite bit_sequence_equation

case_eq (one_reminder (S (S n))) intros

rewrite bit_sequence_distribution unfold cash in H rewrite H

try (apply lt_div2 apply lt_0_Sn)

pose (one_reminder_div2 (S (S n)))

rewrite H0 in e apply e

Qed

Definition listsum(ns list nat) nat = fold_right plus 0 ns

Definition payment_amount(m money)(ns list nat) nat =

money_amount (fold_left pay ns m)

Theorem Divisibility

forall(n nat)(ns list nat)

listsum ns lt= n -gt

payment_amount (cash n) ns = n - listsum ns

Proof

intros n ns LSM

induction ns using rev_ind simpl in

rewrite lt- minus_n_O

apply well_definedness_of_cash

unfold payment_amount in

unfold listsum in

rewrite fold_left_app

rewrite fold_right_app in simpl in

rewrite plus_0_r in

106

Data Conversion Revisited Takahashi Yoshimaru and Goto

assert(fold_right plus 0 ns + x lt= n)

generalize n LSM

clear IHns LSM n

induction ns intros simpl in

omega

assert(fold_right plus x ns lt= n - a) by omega

apply IHns in H omega

rewrite well_definedness_of_pay rewrite IHns simpl in try omega

replace (fold_right plus x ns) with ((fold_right plus 0 ns) + x)

omega

clear IHns H LSM

induction ns simpl

reflexivity

rewrite lt- IHns info omega

Qed

107

Computer Algebra Investigation of Known

Primitive Triangle-Free Strongly Regular

Graphs

Mikhail Klin and Matan Ziv-Av

Ben-Gurion University of the Negevklincsbguacil

matansvgaliborg

Abstract

With the aid of computer algebra systems COCO and GAP with its packages we areinvestigating all seven known primitive triangle-free strongly regular graphs on 5 10 1650 56 77 and 100 vertices These graphs are rank 3 graphs having a rich automorphismgroup The embeddings of each graph from this family to other ones are described the au-tomorphic equitable partitions are classified all equitable partitions in the graphs on up to50 vertices are enumerated Basing on the reported computer aided results and using tech-niques of coherent configurations a few new models of these graphs are suggested whichare relying on knowledge of just a small part of symmetries of a graph in consideration

1 Introduction

This paper appears on the edge between computer algebra systems and algebraic graph theory(briefly AGT) and is mainly devoted to the computer aided investigation of the known primitivetriangle free strongly regular graphs

In fact there are 7 such graphs those on 5 10 16 50 56 77 and 100 vertices The largestone denoted by NL2(10) is the universal graph for this family in the sense that all seven graphsare induced subgraphs of NL2(10) We denote by F the family of those 7 graphs

The history of the discovery of the graphs from F and in particular of NL2(10) is quitestriking Indeed the graph NL2(10) was discovered twice once in 1956 by Dale Mesner andsecond time independently in 1968 by D G Higman and C C Sims The details of thishistory are considered in [15] see also a very brief summary in Section 4

The graphs on 5 10 and 50 vertices form a very significant subfamily consisting of theknown Moore graphs One more possible member of this series (see eg [16]) would have 3250vertices its existence is an open problem of a great significance Moore graphs and their naturalgeneralizations are objects of much interest in extremal graph theory they serve as the bestexamples of optimal network topologies Discovery of a new primitive triangle free stronglyregular graph would be a high level sensation in modern mathematics

This text is oriented towards an interdisciplinary audience though its kernel is strictlyrelated to a concrete kind of application of computer algebra in AGT

Section 2 provides in compact form the necessary background about strongly regular graphssee [11] [5] for more details while in section 3 we briefly introduce the tools of computer algebraused in AGT The seven graphs from the family F are presented in section 4

Our first main result is introduced in Section 5 full description of embeddings of (primitiveand imprimitive) triangle free strongly regular graphs into the graphs in F

108

Triangle-free strongly regular graphs Klin Ziv-Av

The next topic of our investigation is related to equitable partitions with a special emphasison automorphic equitable partitions see definitions in Section 6 The search strategy is de-scribed in Section 7 though much more details may be found in [28] We report the completeenumeration of automorphic equitable partitions and partial results for the general case

Sections 8ndash10 reflect our efforts to understand a few of the computer aided results and topresent them in a computer free form (completely or at least relatively)

In Section 8 we deal with the graph NL2(10) and describe it in a sense locally that isvia so-called metric equitable partitions obtained from the embeddings of a quadrangle anda graph K33 without one edge (Atkinson configuration) with 4 and 8 cells respectively Thespectrum of the second partition contains all of the eigenvalues of NL2(10) (the case of fullspectrum) Some modifications of the famous Robertson model (see [21]) appear in Section 9while in Section 10 we present a handful of models for some other graphs in F

It is worthy to mention that for generations of mathematicians the graphs in F appear asa source of ongoing aesthetic admiration see especially the home page of Andries Brouwer [6]We believe that some of our models shed a new light on those graphs

Last but not least is that as a rule the models we suggest rely on a relatively small subgroupof the group Aut(Γ) for Γ isin F In this way we provide promising patterns for those researcherswho wish in future to face a challenge to try to construct new primitive triangle free stronglyregular graphs cf Section 11

2 Strongly regular graphs a brief survey

An undirected graph Γ is called a strongly regular graph (SRG) with parameters (v k λ micro) ifit is a regular graph of order v and valency k and every pair of adjacent vertices has exactly λcommon neighbors while every pair of non-adjacent vertices has exactly micro common neighborsSometimes we use an extended set of parameters (v k l λ micro) where l is the number of non-neighbors of a vertex that is l = v minus k minus 1

If A = A(Γ) is the adjacency matrix of an undirected graph Γ then Γ is strongly regular ifand only if A2 = kI + λA+ micro(J minus I minus A) This implies that (I A J minus I minus A) is the standardbasis of a rank 3 homogeneous coherent algebra In other words (∆ΓΓ) are the basic graphsof a rank 3 symmetric association scheme (here Γ is the complement of Γ while ∆ contains allthe loops) The adjacency matrix of a strongly regular graph has exactly 3 distinct eigenvaluesFor a strongly regular graph we denote by

bull r gt s the two eigenvalues of A(Γ) different from k r is always positive while s is alwaysnegative

bull f g the multiplicity of the eigenvalues r s respectively

A formula for f and g is given by g f = 12

[(v minus 1)plusmn 2k+(vminus1)(λminusmicro)radic

(λminusmicro)2+4(kminusmicro)

]

A quadruple of parameters (v k λ micro) for which f and g as given by the preceding formulasare positive integers is called a feasible set of parameters See [6] for a list of feasible parametersets with some information about known graphs for some of the sets

A strongly regular graph Γ is called primitive if both Γ and its complement Γ are connectedThis is equivalent to primitivity of the related association scheme (∆ΓΓ)

109

Triangle-free strongly regular graphs Klin Ziv-Av

3 Computer algebra tools in AGT

During the last two decades the significance of the use of computer algebra systems in AGTincreased drastically Such systems are exploited in the search for new combinatorial objectsthe enumeration of objects with prescribed parameters and the understanding of algebraic andstructural properties of a given combinatorial object Γ (such as the automorphism group Aut(Γ)its action and orbits on the ingredients of Γ enumeration of substructures of Γ embeddings ofΓ into larger structures etc)

An ideal case is when the computer aided understanding of an object Γ is followed by furthertheoretical generalizations The foremost goal of this paper is to share with the reader manynew interesting properties of the graphs in the family F in order to promote the search for newprimitive tfSRGs

Below are the main tools we use

bull COCO is a set of programs for dealing with coherent configurations including construc-tion enumeration of subschemes and calculation of automorphism groups

Developed in 1990-2 Moscow USSR mainly by Faradzev and Klin [8] [9]

bull WL-stabilization ndash Weisfeiler-Leman stabilization is an efficient algorithm for calcu-lating coherent closure of a given matrix (see [25] [3]) Two implementations of theWL-stabilization are available (see [2])

bull GAP an acronym for ldquoGroups Algorithms and Programmingrdquo is a system for com-putation in discrete abstract algebra [10] [22] It supports easy addition of extensions(packages in gap nomenclature) that are written in the GAP programming languagewhich can add new features to the GAP system

One such package GRAPE [23] is designed for construction and analysis of finite graphsGRAPE itself is dependent on an external program nauty [18] in order to calculate theautomorphism group of a graph Another package is DESIGN used for construction andexamination of block designs

bull COCO v2 ndash The COCO v2 initiative aims to re-implement the algorithms in COCOWL-stabilization and DISCRETA as a GAP package In addition the new package shouldessentially extend abilities of current version basing on new theoretical results obtainedsince the original COCO package was written

We refer to [14] for a more detailed discussion of the ways in which computer algebra systemsare used in AGT for the purpose of experimentation and further theoretical generalizations

4 The seven known primitive triangle-free strongly regu-

lar graphs

A graph Γ is called triangle free if it admits no triangles that is cliques of size 3 If Γ is also astrongly regular graph then it is called a triangle free strongly regular graph (tfSRG for short)A graph is triangle free if any two neighbors have no common neighbors therefore a tfSRG isan SRG with λ = 0

The 7 known primitive tfSRGs with orders from 5 to 100 vertices are

1 Pentagon with parameters (5 2 0 1) Its automorphism group is D5 of order 10

110

Triangle-free strongly regular graphs Klin Ziv-Av

0

1

2 3

4

25

26

27 28

29

10

11

12 13

14

Figure 1 Hoffman-Singleton graph Robertson model

2 Petersen graph with parameters (10 3 0 1) Its automorphism group is isomorphic to S5

of order 120 A simple model has as vertices 2-subsets of a set of size 5 with two verticesadjacent if the subsets are disjoint

3 Clebsch graph with parameters (16 5 0 2) Usually denoted by 5 Its automorphismgroup is isomorphic to (S5 ≀S2)

pos of order 1920 A simple model is 4-dimensional cube Q4

together with long diagonals or Cayley graph CAY (E24 0001 0010 0100 1000 1111)

4 Hoffman-Singleton graph (HoSi) with parameters (50 7 0 1) Its automorphism group isisomorphic to PΣU(3 52) of order 252000 ([4]) The simplest model is Robertson model([21]) 5 pentagons marked P0 P4 and 5 pentagrams marked Q0 Q4 with vertexi of Pj joined to vertex i+ jk (mod 5) of Qk

5 Gewirtz (or Sims-Gewirtz) graph with parameters (56 10 0 2) Its automorphism groupof order 80640 is a non split extension of PSL3(4) by E22 A simple model is as theinduced subgraph of NL2(10) on the common non-neighbors of two adjacent vertices

6 Mesner graph with parameters (77 16 0 4) The automorphism group is of order 887040and is isomorphic to the stabilizer of a point in the automorphism group of NL2(10) Onesimple model is induced subgraph of NL2(10) on non-neighbors of a vertex

7 NL2(10) with parameters (100 22 0 6) also known as the Higman-Sims graph Its auto-morphism group contains Higman-Sims sporadic simple group as a subgroup of index 2We refer to [15] for a detailed presentation of the original construction of this graph byDale Mesner as it appeared on [19] [20]

Recall that the graph NL2(10) on 100 vertices was constructed twice by Dale Mesner inhis Thesis in 1956 [19] and later on by Higman and Sims in 1968 when they discovered anew sporadic simple group Moreover in 1964 Mesner proved its uniqueness We denote thisgraph by NL2(10) following the parametrization for a family of putative graphs introduced byMesner in [20] In [15] the history of this discovery as well as of related events is discussed withmany details A new wave of interest in tfSRGs stimulated by [15] was especially productivefor us It became clear that this is the time to arrange a serious comprehensive investigation ofdiverse structural properties of the graphs in the family F The goal is to attract the attentionof researchers to such an information in order to provide new ideas how efforts for the searchof new tfSRGs should be arranged We also wish to share with the reader some surprising newfeatures of the graphs in the family F observed with the aid of a computer

111

Triangle-free strongly regular graphs Klin Ziv-Av

5 Embeddings of tfSRGs into known primitive tfSRGs

Usually in graph theory a graph ∆ = (V prime Eprime) is called a subgraph of a graph Γ = (VE) if

V prime sube V and Eprime sube E Of special interest are induced subgraphs in this case Eprime = E capV prime

2

whereX2

is the set of all 2-subsets of X

Proposition 1 A subgraph ∆ of diameter 2 of a graph Γ with no triangles is an inducedsubgraph

Proof Assume that ∆ is not induced then there exists an edge uw isin E uw 6isin Eprime withuw isin V prime Since the diameter of ∆ is 2 there exist a v which is adjacent in ∆ (and thereforein Γ) to u w thus u v w is a triangle in Γ which is a contradiction

The enumeration of all tfSRGs inside of known tfSRGs was the first serious computationalchallenge in this project The results of its complete solution are discussed below

A non-empty imprimitive tfSRG is either a complete bipartite graph (Kllsim= 2 Kl) or

a graph s K2 consisting of s edges with no common vertices Note that K22 is simply aquadrangle

Lemma 2 Graph NL2(10) does not contain subgraph K33

Proof Originally we obtained this result with the aid of a computer In fact easy proof followsfrom the non-edge decomposition of Γ = NL2(10) (see eg [15]) without any assumptions aboutits uniqueness Indeed let ∆ be a subgraph of Γ which is isomorphic to K33 Assume thattwo bipartite parts of ∆ consist of subsets a b c d e f of vertices Consider now non-edgedecomposition of Γ with respect to a b then c belongs to the cell of size 60 while d e fbelong to the cell of size 6 thus c has just g = 2 neighbors in the latter cell a contradictionwith the valency of c equal to 3 in ∆

As a corollary we obtain that every known primitive tfSRG does not contain K33 andmoreover does not contain Kll when l ge 3

Another simple theoretical result (see eg [28]) claims that the number of quadrangles in an

SRG with parameters (v k l λ micro) is equal tovk2 (

λ

2)+vl2 (

micro

2)2 When λ = 0 this reduces to vlmicro(microminus1)

8 Similar formula may be obtained for the number of 2K2 The numbers of imprimitive tfSRGsinside of graphs in F are given in Table 1 in the supplement while the number of orbits of suchembeddings (with respect to Aut(Γ) for Γ isin F) are given in Table 2

Note that there is no induced subgraph of NL2(10) isomorphic to 12 K2 so both tablesin Supplement A end with s = 11 for s K2

Similar computer results are presented in Tables 3 and 4 (Supplement A) for the embeddingsof a graph from the family F into a larger graph in F

Here the final picture is less sophisticated There are just two cases where for pair of graphsXY isin F there exist more than one orbit of embeddings (up to action of Aut(Y )) of X intoY Namely in these terms there are 9 embeddings of Petersen graph into Mesner graph and 5embeddings into NL2(10) Computer free understanding of these embeddings remains a quiteinteresting task for future investigations of the links between the graphs in the family F

In all other cases there exists (up to isomorphism) at most one embedding for consideredpair (XY ) For most pairs there is a reasonably clear explanation in literature such as twoHoSi inside NL2(10) see eg [12] as well as Robertson model of HoSi [21] which explainspositions in it for both pentagon and Petersen graph

Beside this there are two more embeddings which are not immediately evident

112

Triangle-free strongly regular graphs Klin Ziv-Av

The first pair is the embedding of the Petersen graph into Gewirtz graph In fact inthis embedding the Petersen graph appears as a subgraph of the second constituent of theGewirtz graph which in turn is a graph ∆ of valency 8 on 45 vertices It turns out thatAut(∆) sim= Aut(S6) This graph ∆ generates a non-Schurian association scheme with threeclasses see eg [24] [13] example W38 The graph ∆ may be also described as the distance2 graph of the distance transitive graph of diameter 4 and valency 4 on 45 vertices akageneralized octagon GO(2 1) aka line graph of Tuttersquos 8-cage (see [5] for more details) Inthis context the task of explanation of the embedding of Petersen graph into ∆ seems to be anice exercise in AGT though out of the framework of this presentation

The second exceptional pair is the embedding of the Clebsch graph 5 into NL2(10) Thispair is of a definite independent interest and thus is considered separately in Section 10

Finally we mention that the classification of cocliques in graphs from F may be regardedas a degenerate case of subject in this section Indeed empty graph is a particular case of animprimitive tfSRG We however disregard this problem referring to information presented onthe home page of Andries Brouwer [6]

6 Equitable partitions

Let Γ = (VE) be a graph A partition τ of the vertex set V τ = V1 Vs is calledequitable partition (briefly EP) if for i j isin 1 s the numbers |Γ(v) cap Vj | are equal for allv isin Vi Here Γ(v) = u isin V |u v isin E Usually an EP τ is accompanied by intersectiondiagram which represents a kind of quotient graph Γτ on which all intersection numbers aredepicted Many such diagrams appear in [5] The quotient graph Γτ is in fact a multigraphIts (collapsed) adjacency matrix B consists of all intersection numbers

Obviously entries of B are non-negative integers and for a regular graph Γ of valency k thesum of each row in B is k

If H is a subgroup of Aut(Γ) then the set of orbits of H is an EP of Γ Such an EP is calledautomorphic (briefly AEP)

Proposition 3 ([11]) Let Γ be a graph A = A(Γ) the adjacency matrix of Γ If a partitionτ is EP of Γ with matrix B then the characteristic polynomial of B divides the characteristicpolynomial of A

In fact there are more necessary conditions for a prescribed matrix B to be the adjacencymatrix of a suitable EP of Γ which are formulated in terms of spectral graph theory see eg[7] They create a solid background for a clever search of potential EPs in a given graph Γ

7 Search for equitable partitions

In this project we distinguished two alternative problems for the complete search of EPs ingraphs of F

First problem is to enumerate all automorphic EPs Here we strongly rely on the level ofgroup theoretical ldquointellectrdquo of GAP Indeed for groups of relatively small order (say up to afew thousands) GAP allows to establish efficiently the structure of a considered group as wellas the lattice of its subgroups

However for four graphs in F the group G = Aut(Γ) has larger order thus with the growingof |G| extra theoretical input is required For example in case of G = Aut(NL2(10)) we wereusing information from the website of the Atlas of Finite Group Representations ([26]) about

113

Triangle-free strongly regular graphs Klin Ziv-Av

the maximal subgroups of G (this information goes back to [17]) This knowledge together withad hoc tricks inside of GAP made it possible to describe all subgroups of G up to equivalencyclasses with respect to EPs The fact that all groups G = Aut(Γ) Γ isin F are subgroups ofAut(NL2(10)) was also quite beneficial

Finally we successfully enumerated all automorphic EPs for all Γ isin FThe second problem is much more sophisticated to enumerate all EPs for all graphs in FFor the smallest three graphs in F the results were achieved via simple brute force see

corresponding tables in Supplement BFor HoSi we used a few complementary strategies in the search for all EPs First we attacked

partitions with ldquolargerdquo number of cells say s gt 5 Here we introduced extra parameter thesize of the smallest cell which varies from 1 to 9 Each such case was considered separately

On the second stage we step by step enumerated cases 2 le s le 5 by enumerating possiblecollapsed adjacency matrices for each case and for any such matrix enumerating all EPs

The description of our computer activities together with detailed discussion of the resultsis presented in [28] An extra advantage of the enumeration in HoSi is that it serves as a kindof a pleasant interaction of a human and a computer Indeed in spite of the fact that the mainpart of computation was fulfilled by GAP a human can follow search explain its logic and stepby step to comprehend all ongoing results

We admit however that the extra advantage of HoSi is that here parameter micro takes itssmallest possible value of 1 (for a primitive SRG) As soon as micro gt 1 and v is growing theproblem is becoming essentially more difficult

This is why already for the Gewirtz graph with v = 56 we only succeeded in enumeration ofall EPs for which the stabilizer has order at least 2 There are 688 such EPs The enumerationof the rigid EPs cannot be completed by a computer in a reasonable time

The full enumeration of all EPs for the largest two graphs in F (on 77 and 100 vertices) atthis stage looks intractable Only modest particular cases may be proceeded efficiently

We refer to Supplement B for Tables 5 6 and 7 which summarize our activities for bothconsidered problems see [28] for more information

As was mentioned in the introduction one of the main goals of this project is to detect anumber of ldquonicerdquo EPs which may serve as a training model for future search of new primitivetfSRGs At this stage this kind of job only partially relies on the support from computer finallya humanrsquos insight still turns out to be very significant Below we report about interestinginterpretations created by us for a handful of detected EPs

8 Quadrangle and Atkinson EPs of NL2(10)

Recall that Γ = NL2(10) has100middot77middot6middot5

8 = 28875 quadrangles This is a simple result obtainedon a combinatorial level without any knowledge of structure of Γ

Provided that Γ and G = Aut(Γ) are known we easily obtain (with the use of a computer)that all quadrangles in Γ form one orbit under G and stabilizer H of a quadrangle in G hasorder 3072 is isomorphic as abstract group to (Z4 times Z2)(Z4 times Z2)) Z2) Z2) Z3) Z2) Z2

and has in action on V (Γ) four orbits of lengths 4 8 24 and 64Thus we may consider an automorphic EP of size s = 4 There is sense to try again

combinatorial arguments in order to determine all invariants of this EP without any priorknowledge of Γ and its group Fortunately this turns out to be possible

Proposition 4 Let τ be a metric decomposition with respect to a prescribed quadrangle Qinside of Γ Then τ is EP s = 4 sizes of cells are 4 8 24 64 and (with respect to this

114

Triangle-free strongly regular graphs Klin Ziv-Av

ordering of cells) B =

2 4 0 162 0 12 80 4 2 161 1 6 14

See proof in [28]In principle next stage should be to describe a model of NL2(10) in terms of the group

H of order 3072 or one of its subgroups which is transitive on all cells of the quadrangle EPNevertheless in this text we are avoiding this task Instead of we prefer to split the quadrangleEP to one with larger number of cells and to proceed with that new one

A note [1] was published before the announcement of CFSG The author considered 13parameter sets for tfSRGs which may be also rank 3 graphs with the number v of verticeswhere 100 lt v le 1000 and proved that such graphs can not be constructed with the aid ofknown 2-transitive permutation groups Part of exposed details is related to consideration of aconfiguration A (graph K33 minus one edge) in putative graph

We got impression that [1] is overseen through a generation of mathematicians and it mightbe helpful to analyze existence of A (we call it Atkinson configuration) in known tfSRGs

It turns out that A appears only in graphs on 77 and 100 vertices Here we analyze itsposition in Γ = NL2(10)

Let us fix at A a quadrangle for example with the vertices a b c f Then two extra ver-tices have two neighbors in the selected quadrangle namely ends of two non-edges respectively

Now we embed A into the considered above quadrangle decomposition splitting in it cell ofsize 8 into two cells of size 2 (exactly our d e) and the remainder This immediately impliessplit of the cell of size 64 into two cells of sizes 16 and 48 The cell of size 24 is forced to besplit into subcells of sizes 12 6 6 depending on the number of neighbors in d e being 1 2and 0 respectively

A more careful analysis (see [28]) shows that we are still getting an EP

Proposition 5 A metrical decomposition τ(A) of a tfSRG with the parameters of NL2(10)with respect to configuration A is EP with s = 8 and cells of sizes 4 2 16 48 6 12 6 6 Ithas collapsed matrix B as follows with Spec(B) = 22 25 (minus8)2

B =

2 1 4 12 3 0 0 02 0 8 0 0 6 6 01 1 2 12 0 3 0 31 0 4 10 1 3 2 12 0 0 8 0 6 2 40 1 4 12 3 2 0 00 2 0 16 2 0 0 20 0 8 8 4 0 2 0

Originally the proof was obtained with the aid of com-puter analysis of Γ = NL2(10) Later on an outline of asimilar proof as for quadrangle configuration was againobtained without prior knowledge of Γ

Further consideration of τ(A) was fulfilled inside ofknown graph Γ and its group Aut(Γ) It turns out thatH = Aut(τ(A)) sim= D4timesS4 is a group of order 192 H hasexactly 8 orbits on the set V (Γ) thus A is an automorphicEP

Describing further stabilizers of H on each of the 8orbits we elaborated the following ad hoc model of Γ

We start from the auxiliary graph ∆ depicted in Figure 2We identify elements of each orbit in τ(A) with suitable sets of structures described with

the aid of ∆ In fact each set of structures appears as orbit of action of the group H Thus itis enough to describe a representative of each orbit

For example the elements in the cell of size 16 are the vertices of ∆ while the elements ofthe cell of size 4 are the four columns of ∆ The most tricky to find was a representation of the7th cell of size 6

115

Triangle-free strongly regular graphs Klin Ziv-Av

12 13 14 15

8 9 10 11

4 5 6 7

0 1 2 3

Figure 2 Auxiliary graph ∆

We think that this piecewise model of Γ appearing from areasonably small solvable group of order 192 may serve as anoptimistic message for those researchers who are hunting for newtfSRGs see also comments in Section 11

9 Some modifications of Robertson

model

The Robertson model of the Hoffman-Singleton graph (see Figure1) partitions the vertices into five pentagons and five pentagramsand describes a simple arithmetic rule for the edges connectingpentagons and pentagrams (see Section 4) Let pij (qij) be vertexj of pentagon (pentagram) i

Since NL2(10) has an EP to two cells of size 50 where theinduced graph on each cell is isomorphic to HoSi this model can be extended to a model ofNL2(10)

In both cases we get an EP with a collapsed adjacency matrix that has a transitive au-tomorphism group (a permutation g isin Sn is an automorphism of a matrix M isin F

ntimesn if thepermutation matrix Mg commutes with M) We are therefore interested in equitable partitionswith this property

In the list of equitable partitions of HoSi we find another such partition with 10 cells of sizefive The collapsed adjacency matrix of this partition isM The spectrum ofM is 7 24 (minus3)5so it has the full spectrum of HoSi

M =

0 2 2 0 0 0 0 1 1 12 0 1 0 1 2 0 0 1 02 1 0 2 0 0 1 0 0 10 0 2 0 1 1 2 0 0 10 1 0 1 0 2 0 1 0 20 2 0 1 2 0 1 0 1 00 0 1 2 0 1 0 1 2 01 0 0 0 1 0 1 0 2 21 1 0 0 0 1 2 2 0 01 0 1 1 2 0 0 2 0 0

The cells of this partition can be de-scribed in the Robertson model of HoSi foreach i isin [1 5] we construct two cellsp11+i p21+i p32+i p44+i p52+iq11+i q21+i q35+i q43+i q55+i

If we consider this matrix M as the adjacencymatrix of a color graph then the basic graph for thecolor 1 is the Petersen graph while the basic graphfor the color 2 is a cycle of length 10 For compar-ison acting similarly with the Robertson partitionwe get a graph K55

The stabilizer of the (ordered) partition inAut(HoSi) is isomorphic to the dihedral group D5

of order 10 as is the automorphism group of M

The coherent closure of the partition (more specifically of the graph with its vertices coloredaccording to the partition) is a Schurian coherent configuration of rank 300 with the stabilizerof the partition as its automorphism group

This EP of HoSi can be extended to an EP of NL2(10) of 20 independent sets of size 5 Inthis case the matrix has spectrum 22 213 (minus8)6 so this EP has full spectrum as well

The automorphism group of this matrix has order 240 and is isomorphic to Z2 times S5 whilethe stabilizer of the ordered partition is again D5 of order 10

The coherent closure of the partition is a Schurian coherent configuration of rank 1200 withthe stabilizer of the partition as its automorphism group

116

Triangle-free strongly regular graphs Klin Ziv-Av

7 7 7

7 7 7

7 74 4

2 2 2

2 2 2

Figure 3 AEP of Gewirtz graph by a semiregular subgroup of order 7

10 A few more models

The calculated data both about embeddings of tfSRGs inside tfSRGs and about EPs can beused to present new models and constructions for tfSRGs Here we offer a few examples withoutgoing into a lot of details

Example 1 (Two Wagner graphs in Clebsch graph) Wagner graph also known as Mobiusladder of order 8 denoted by M8 is a cubic graph on 8 vertices A simple model for it is aCay(Z8 1minus1 4) The spectrum is 3 12minus1 and Aut(M8) = D8

In one of the three EPs of 5 into two cells of size 8 the induced subgraph on each cell isthe Wagner graph The stabilizer of ordered partition inside Aut(5) is D8

Example 2 (Non-automorphic EP of HoSi) We can construct an EP of HoSi into two cellsby taking one of the cells to be the 20 vertices of two Petersen graphs (any two pentagons andtwo pentagrams in Robertson model) The stabilizer of this partition is D10 of order 20 so itis not automorphic

Example 3 (Inside Gewirtz graph six 7-cycles) There is one automorphic partition of Gewirtzgraph into 8 cells of size 7 The induced graph on 6 of the cells is a cycle of length 7 while theinduced graph on the other two cells has no edges

From the intersection diagram (Figure 3) we see that this partition can be merged to an

equitable partition with 2 cells of sizes 42 and 14 with adjacency matrix

(8 26 4

)

The induced graph on the cell of size 42 of valency 8 is a coherent graph Its coherent closureis a rank 6 imprimitive non-Schurian association scheme This graph is not a rational graphwith spectrum 8 222 (minus1)7 (1 +

radic2)6 (1minus

radic2)6

The induced graph on the cell of size 14 is a bipartite graph with two parts of size 7 It isthe co-Heawood graph that is the bipartite complement to the Heawood graph the Levi graph ofFano plane This is by necessity true since a regular bipartite graph of valency 4 and order 14in which every vertex belongs to exactly one quadrangle is the co-Heawood graph

A Brouwer ([6]) notes that this co-Heawood graph is a subgraph of the Gewirtz graph

Example 4 (Gewirtz graph inside of Mesner graph through the group Z7) We start witha semiregular subgroup Z7 of order 7 this time inside of the automorphism group of Mesnergraph We get an AEP with 11 cells of size 7 the collapsed matrix N of order 11 is presentedin [28] It turns out that Aut(N) sim= S2 ≀ S3 (the wreath product) is a group of order 72 withorbits of sizes 6 2 13 There are three non-equivalent possibilities to merge from this AEP a

117

Triangle-free strongly regular graphs Klin Ziv-Av

non-automorphic EP with 3 cells of sizes 14 21 42 and a collapsed matrix

4 6 6

4 0 12

2 6 8

which

has full spectrumEach of the cases provides also an EP for the Gewirtz graph with two cells of sizes 14 and

42 Thus as a by product we obtain other (cf Example 3) embeddings of the co-Heawoodgraph into the Gewirtz graph This example demonstrates ldquoirregularitiesrdquo which may causeinteresting EPs unpredictable from the first sight

Example 5 (Clebsch graph inside NL2(10)) Recall that up to the automorphism group ofΓ = NL2(10) there is one embedding of 5 into Γ The equitable partition resulting from thisembedding allows us to describe another model for NL2(10)

We start from a group H2 = Z4 times S4 of order 96 with orbits of lengths 16 16 48 128 The collapsed adjacency matrix of the corresponding automorphic equitable partition is Bprimeprime(shown below) Clearly the induced graph on the first cell of the partition is isomorphic to 5

In principle one may try as in previous sections to reconstruct the corresponding matrix Bfrom scratch not relying on knowledge of the graph Γ and its group A promising starting pointwould be justification of existence of a coclique of size 8 and its adjacency with the induced 5

We however prefer to exploit at this stage another possibility Namely it turns out thatthe stabilizers of A and 5 inside of Γ have maximal possible intersection K = Z4timesS3 of order24 K defines an AEP with 11 cells of sizes 2 4 4 6 6 6 12 12 12 12 24 and matrix Bprime

Bprime =

0 2 2 0 0 6 0 6 0 6 01 2 1 3 0 0 3 3 3 0 61 1 2 0 3 0 3 0 3 3 60 2 0 0 4 2 2 0 2 6 40 0 2 4 0 2 2 6 2 0 42 0 0 2 2 0 4 0 4 0 80 1 1 1 1 2 4 3 2 3 41 1 0 0 3 0 3 2 3 3 60 1 1 1 1 2 2 3 4 3 41 0 1 3 0 0 3 3 3 2 60 1 1 1 1 2 2 3 2 3 6

Bprimeprime =

5 4 9 3 14 2 12 0 43 4 11 3 14 0 12 2 42 8 6 6 0

It is easy to recognize how Bprime is split from the matrix B of the metric EP of the configurationA Then we merge the Bprime into Bprimeprime

The cell of size 48 is a merging of the last 3 cells the cell of size 8 is merging of cell of sizes2 and 6 (5th cell) while the cell of size 12 is a merging of two remaining cells of size 6 Eachcell of size 16 is a merging of cells of sizes 4 and 12

Example 6 (Reconstruction of NL2(10) from a subgroup of order 2) Using information inthe atlas [26] (or direct calculation using GAP) we see that G = Aut(NL2(10)) containsone conjugacy class of involutions with no fixed points From such an involution i we getan AEP into 50 cells of size 2 We investigated the quotient graph Γ of this AEP and itscollapsed adjacency matrix denoted by B The structure of Γ may be recovered by consideringthe centralizer CG(i) However we prefer to rely on information of combinatorial nature The

graph Γ has a natural EP into cells of sizes 20 and 30 (representing edges and non-edges inNL2(10))

The induced (color) graph on 20 vertices is the graph K1010 from which a 1-factor is removedThe induced graph on 30 vertices is the incidence graph of generalized quadrangle of order

2 GQ(2)

118

Triangle-free strongly regular graphs Klin Ziv-Av

This equitable partition corresponds to an equitable partition of Γ = NL2(10) into two cellsof sizes 40 and 60

11 Concluding comments

The presentation in this extended abstract is a tip of iceberg Much more concrete informationmay be found in [28] while [27] subject of ongoing polishing and development will reflect alldetected computer data about the graphs from family F We see also more potential to returnagain to construction of further models for graphs in F in particular relying on non-automorphicEPs The new attempts to achieve at least in part enumeration of all EPs of restricted size ofcells for graphs on 77 and 100 vertices are also on agenda The paper [16] as well as a numberof private communications of M Macaj to author MK create a background to attack in nearestfuture the problem of existence of new tfSRGs with relatively small parameters The parameterset on 162 vertices seems to be first interesting and realistic target

It should be mentioned that the results in [16] as well as in numerous private communica-tions of M Macaj to the author MK show that a putative new primitive triangle free stronglyregular graph Γ with prescribed parameters will have a relatively small automorphism groupAut(Γ) very concrete restrictions on the cycle structure of elements in Aut(Γ) are typicallyavailable Transformation of those restrictions to the language of equitable partitions may beregarded as a reasonable starting platform for attempts to construct a new tfSRG

Note however that many experts in AGT do not believe at all that a new tfSRG existsNeedless to say that this question creates a great challenge for the modern scientific community

Acknowledgments

We thank Andy Woldar for ongoing collaboration in this project We acknowledge Sven Re-ichard and Christian Pech for sharing with us their draft versions of COCO II Ongoing com-munication with Martin Macaj is very helpful and stimulative We also are pleased to thankPeter Cameron and Jozef Siran for interest expressed to the topic of our research

References

[1] M D Atkinson On rank 3 groups having λ = 0 Canad J Math 29(4)845ndash847 1977

[2] L Babel S Baumann and M Luedecke Stabcol An efficient implementation of the weisfeiler-leman algorithm Technical Report TUM-M9611 Technical University Munich 1996

[3] L Babel I V Chuvaeva M Klin and D V Pasechnik Algebraic combinatorics in mathematicalchemistry methods and algorithms ii program implementation of the weisfeiler-leman algorithmTechnical Report TUM-M9701 Fakultat fur Mathematik TU Munc 1997 httpwww-litmatumdeveroeffhtml96068019html

[4] C T Benson and N E Losey On a graph of Hoffman and Singleton J Combinatorial TheorySer B 1167ndash79 1971

[5] A E Brouwer A M Cohen and A Neumaier Distance-regular graphs volume 18 of Ergeb-nisse der Mathematik und ihrer Grenzgebiete (3) [Results in Mathematics and Related Areas (3)]Springer-Verlag Berlin 1989

[6] AE Brouwer httpwwwwintuenl~aebgraphs

119

Triangle-free strongly regular graphs Klin Ziv-Av

[7] Dragos Cvetkovic Peter Rowlinson and Slobodan Simic An introduction to the theory of graphspectra volume 75 of London Mathematical Society Student Texts Cambridge University PressCambridge 2010

[8] I A Faradzev and M H Klin Computer package for computations with coherent configurationsIn Proc ISSAC pages 219ndash223 Bonn 1991 ACM Press

[9] I A Faradzev M H Klin and M E Muzichuk Cellular rings and groups of automorphisms ofgraphs In Investigations in algebraic theory of combinatorial objects volume 84 of Math Appl(Soviet Ser) pages 1ndash152 Kluwer Acad Publ Dordrecht 1994

[10] The GAP Group GAP ndash Groups Algorithms and Programming Version 4412 2008

[11] Chris Godsil and Gordon Royle Algebraic graph theory volume 207 of Graduate Texts in Mathe-matics Springer-Verlag New York 2001

[12] Paul R Hafner On the graphs of Hoffman-Singleton and Higman-Sims Electron J Combin11(1)Research Paper 77 33 pp (electronic) 2004

[13] M Klin C Pech and P-H Zieschang Flag algebras of block designs i initial notions steiner2-designs and generalized quadrangles November 1998

[14] Mikhail Klin Christian Pech Sven Reichard Andrew Woldar and Matan Ziv-Av Examples ofcomputer experimentation in algebraic combinatorics Ars Math Contemp 3(2)237ndash258 2010

[15] Mikhail H Klin and Andrew J Woldar Dale Mesner Higman amp Sims and the strongly regulargraph with parameters (100 22 0 6) Bull Inst Combin Appl 6313ndash35 2011

[16] Martin Macaj and Jozef Siran Search for properties of the missing Moore graph Linear AlgebraAppl 432(9)2381ndash2398 2010

[17] Spyros S Magliveras The subgroup structure of the Higman-Sims simple group Bull AmerMath Soc 77535ndash539 1971

[18] B D McKay nauty userrsquos guide (version 15) 1990

[19] Dale Marsh Mesner An investigation of certain combinatorial properties of partially balancedincomplete block experimental designs and association schemes with a detailed study of designs oflatin square and related types ProQuest LLC Ann Arbor MI 1956 Thesis (PhD)ndashMichiganState University

[20] Dale Marsh Mesner Negative latin square designs Mimeo notes 410 Institute of Statistics UNCNC 1964

[21] George Neil Robertson Graphs minimal under girth valency and connectivity constraints Pro-Quest LLC Ann Arbor MI 1969 Thesis (PhD)ndashUniversity of Waterloo (Canada)

[22] Martin Schonert et al GAP ndash Groups Algorithms and Programming ndash version 3 release 4 patch-level 4 Lehrstuhl D fur Mathematik Rheinisch Westfalische Technische Hochschule AachenGermany 1997

[23] Leonard H Soicher GRAPE a system for computing with graphs and groups In Groups andcomputation (New Brunswick NJ 1991) volume 11 of DIMACS Ser Discrete Math TheoretComput Sci pages 287ndash291 Amer Math Soc Providence RI 1993

[24] Edwin R van Dam Three-class association schemes J Algebraic Combin 10(1)69ndash107 1999

[25] B Weisfeiler On construction and identification of graphs Number 558 in Lecture Notes in MathSpringer Berlin 1976

[26] Robert Wilson Peter Walsh Jonathan Tripp Ibrahim Suleiman Richard Parker Simon NortonSimon Nickerson Steve Linton John Bray and Rachel Abbott Atlas of finite group representa-tions - version 3 httpbrauermathsqmulacukAtlasv3

[27] M Ziv-Av Protocols with computer data related to the investigation of known primitive trangle-free strongly regular graphs httpwwwmathbguacil~zivavmath

[28] M Ziv-Av Results of computer algebra calculations for triangle free strongly regular graphshttpwwwmathbguacil~zivavmatheqpartpdf

120

Triangle-free strongly regular graphs Klin Ziv-Av

A Data about embeddings of tfSRGs inside tfSRGs

Quadrangle edge 2 edges 3 4 5 6Pentagon 0 5 0 0 0 0 0Petersen 0 15 15 5 0 0 0Clebsch 40 40 60 40 10 0 0HoSi 0 175 7875 128625 845250 2170350 1817550

Gewirtz 630 280 15120 245280 1370880 2603664 1643040Mesner 6930 616 55440 1330560 10589040 28961856 24641232NL2(10) 28875 1100 154000 5544000 67452000 301593600 477338400

7 edges 8 9 10 11HoSi 40150 15750 3500 350 0

Gewirtz 104160 7560 1400 112 0Mesner 3664320 166320 30800 2464 0NL2(10) 258192000 14322000 924000 154000 11200

Table 1 Number of imprimitive tfSRGs inside tfSRGs

Quadrangle edge 2 edges 3 4 5 6Pentagon 0 1 0 0 0 0 0Petersen 0 1 1 1 0 0 0Clebsch 1 1 1 1 1 0 0HoSi 0 1 1 4 10 21 15

Gewirtz 1 1 2 9 30 48 36Mesner 1 1 1 7 26 56 50NL2(10) 1 1 1 2 7 14 17

7 edges 8 9 10 11HoSi 8 1 1 1 0

Gewirtz 5 2 2 1 0Mesner 14 2 2 1 0NL2(10) 14 3 2 2 1

Table 2 Number of orbits of imprimitive tfSRGs inside tfSRGs

Pentagon Petersen Clebsch HoSi Gewirtz Mesner NL2(10)Pentagon 1 12 192 1260 8064 88704 443520Petersen 1 16 525 13440 1921920 35481600Clebsch 1 0 0 0 924000HoSi 1 0 0 704

Gewirtz 1 22 1030Mesner 1 100NL2(10) 1

Table 3 Number of primitive tfSRGs inside tfSRGs

121

Triangle-free strongly regular graphs Klin Ziv-Av

Pentagon Petersen Clebsch HoSi Gewirtz Mesner NL2(10)Pentagon 1 1 1 1 1 1 1Petersen 1 1 1 1 9 5Clebsch 1 0 0 0 1HoSi 1 0 0 1

Gewirtz 1 1 1Mesner 1 1NL2(10) 1

Table 4 Number of orbits of primitive tfSRGs inside tfSRGs

B Data about equitable partitions of primitive tfSRGs

Pentagon Petersen Clebsch HoSi Gewirtz Mesner NL2(10)EP 3 11 46 163Aut 3 11 38 89 154 236 607

Table 5 Number of orbits of equitable partitions and of automorphic equitable partitions forknown tfSRGs

Size 1 3 5 TotalEP 1 1 1 3Aut 1 1 1 3

Size 1 2 3 4 5 6 7 10 TotalEP 1 2 2 2 1 1 1 1 11Aut 1 2 2 2 1 1 1 1 11

Size 1 2 3 4 5 6 7 8 9 10 12 16 TotalEP 1 4 6 12 5 7 3 4 1 1 1 1 46Aut 1 4 5 10 3 5 2 4 1 1 1 1 38

Size 1 2 3 4 5 6 7 8 9 10 11EP 1 6 8 16 18 20 19 18 11 11 8Aut 1 4 5 7 6 9 9 11 4 9 4Size 12 13 14 15 16 18 20 28 30 50 TotalEP 7 7 2 2 1 2 3 1 1 1 163Aut 4 4 2 1 1 2 3 1 1 1 89

Table 6 Numbers of EPs and automorphic EPs by size of partition for four small graphs

122

Triangle-free strongly regular graphs Klin Ziv-Av

Size 1 2 3 4 5 6 7 8 9 10 11 12 13Aut 1 5 9 12 12 14 15 16 14 11 7 7 6Size 14 16 17 18 19 20 23 28 31 32 35 56 TotalAut 5 3 3 2 2 4 1 1 1 1 1 1 154

Size 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15Aut 1 3 5 8 11 10 20 14 19 12 18 12 16 9 14Size 16 17 18 19 20 21 23 25 29 33 41 45 49 77 TotalAut 5 12 5 9 1 8 4 8 6 2 1 1 1 1 236

Size 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15Aut 1 6 15 21 28 29 31 42 34 35 37 49 30 31 27Size 16 17 18 19 20 21 22 23 24 25 26 27 28 29Aut 26 18 18 13 26 14 11 7 9 6 6 5 2 1Size 30 31 32 33 34 35 39 40 45 50 53 60 65 100 TotalAut 7 1 3 2 2 3 1 4 1 1 1 1 1 1 607

Table 7 Numbers of automorphic EPs by size of partition for larger graphs

123

Usage of Invariants for Symbolic Verification of

Requirements

Short Paper

Alexander Letichevsky1 Alexander Godlevsky1 Anton Guba1 Alexander

Kolchin1 Oleksandr Letychevskyi1 Vladimir Peschanenko2

1 VM Glushkov Institute of Cybernetics Kiev Ukraineletcyfranet godlissorgua antongubaukrnet kolchin avyahoocom litissorgua

2 Kherson State University Kherson Ukrainevladimiriusgmailcom

The main goal of the paper is finding of pre- and post-invariants for transitions betweensymbolic states in the system that must be verified and use them for verification purposesSystems are specified by basic protocols [1] This specification defines a transition system withtransitions s rarr s

prime where s and sprime are symbolic states b is a basic protocol The main problem

of verification is a reachability problem for given properties expressed in specification logiclanguage

We present double approximation method of verification based on computing invariants Themethod is implemented as an iterative algorithm which solves in parallel reachability problemand computes lower and upper approximations of invariants for basic protocols

Currently there are a lot of significant works devoted to computing invariants which areconsidered for loops in programs Loops are marked explicitly - syntactic constructions likewhile and others When we deal with requirement specifications we do not deal with explicitmarked loops moreover basic protocols provide non-deterministic order Existing methodsusually ignore the conditions of the loops Invariants formulae which is obtained as a resultinclude unreachable states and therefore could be used in verification only in the following wayif a property does not intersect with the invariant formula then it is unreachable if intersectsthen conclusion cannot be done Therefore the problem of modification of existing methodsor to develop a new algorithm that could be applied in practice of requirements verification isactual

Research of problems of automatic program invariants generation for a variety of data al-gebras was performed starting from 70-th years in Institute of Cybernetics of NAS of UkraineTheir main results are presented in [2] Double approximation method is the dynamic iterativemethod of invariants generation and it is based on these results and adapted for requirementsverification The method also can be applied to program verification if a program is consideredas a special case of basic protocol specification The method has been implemented in VRS(Verification of Requirement Specifications) system [3] and IMS (Insertion Modeling System)system [4]

References

[1] A Letichevsky J Kapitonova V Volkov A Letichevsky Jr S Baranov V Kotlyarov T WeigertSystem Specification with Basic Protocols Cybernetics and System Analyses vol 4 2005 p 3-21

[2] Godlevsky AB Kapitonova YV Krivoy SL Letichevsky AA Iterative methods of programanalysis Cybernetics vol 2 1989 9-19

[3] Verification for Requirement Specification (VRS) httpissorguaISSVRStoolhtm lastviewed May 2013

[4] APS and IMS Systems httpapsystemorgua last viewed May 2013

124

Lebesgue Constants and Optimal Node Systems

via Symbolic Computations

Short Paper

Robert Vajda

University of Szeged Szeged Hungaryvajdarmathu-szegedhu

Abstract

Polynomial interpolation is a classical method to approximate continuous functionsby polynomials To measure the correctness of the approximation Lebesgue constantsare introduced For a given node system X(n+1) = x1 lt lt xn+1 (xj isin [a b])the Lebesgue function λn(x) is the sum of the modulus of the Lagrange basis polynomialsbuilt on X(n+1) The Lebesgue constant Λn assigned to the function λn(x) is its maximumover [a b] The Lebesgue constant bounds the interpolation error ie the interpolationpolynomial is at most (1 + Λn) times worse then the best approximation The minimumof the Λnrsquos for fixed n and interval [a b] is called the optimal Lebesgue constant Λlowast

n Forspecific interpolation node systems such as the equidistant system numerical results forthe Lebesgue constants Λn and their asymptotic behavior are known [3 7] However togive explicit symbolic expression for the minimal Lebesgue constant Λlowast

n is computationallydifficult In this work motivated by Rack [5 6] we are interested for expressing the minimalLebesgue constants symbolically on [minus1 1] and we are also looking for the characterizationof the those node systems which realize the minimal Lebesgue constants We exploited theequioscillation property of the Lebesgue function [4] and used quantifier elimination andGroebner Basis as tools [1 2] Most of the computation is done in Mathematica [8]

Acknowledgement The research of the author was partially supported by the HSRF(OTKA) grant number K83219

References

[1] D S Arnon - G E Collins - S McCallum Cylindrical Algebraic Decomposition I The BasicAlgorithm In Caviness-Johnson (eds) Quantifier Elimination and Cylindrical Algebraic Decom-position 136-151 Springer 1998

[2] B Buchberger Ein Algorithmus zum Auffinden der Basiselemente des Restklassenringes nach einemnulldimensionalen Polynomideal (An algorithm for finding the basis elements in the residue classring modulo a zero dimensional polynomial ideal) PhD Thesis Innsbruck 1965

[3] J S Hesthaven From electrostatics to almost optimal nodal sets for polynomial interpolation in asimplex SIAM J Numer Anal Vol 35 No 2 655-676 1998

[4] T A Kilgore A characterization of the Lagrange interpolating projection with minimal Tchebycheffnorm J Approx Theory 24 (1978) no 4 273-288

[5] H-J Rack An example of optimal nodes for interpolation International Journal of MathematicalEducation in Science and Technology 15 (3) 355-357 1984

[6] H-J Rack An example of optimal nodes for interpolation revisited Advances in Applied Mathe-matics and Approximation Theory Springer Proceedings in Mathematics amp Statistics Volume 41117-120 2013

[7] S J Simon Lebesgue constants in polynomial interpolation Annales Mathematicae et Informaticae33 109-123 2006

[8] Wolfram Research Inc Mathematica Version 90 Champaign Illinois 2012

125

Author Index

Alpuente Marıa 4

Ballis Demis 4

Buchberger Bruno 1

Comini Marco 19 31

Frechina Francisco 4

Ghourabi Fadoua 50

Godlevsky Alexander 124

Goto Mizuki 93

Guba Anton 124

Ida Tetsuo 50

Kakutani Yoshihiko 64

Kato Go 64

Kawano Yasuhito 64

Klin Mikhail 108

Kolchin Alexander 124

Kubota Takahiro 64

Letichevsky Alexander 124

Letychevskyi Oleksandr 124

Li Wei 2

Matringe Nadir 81

Moura Arnaldo 81

Neumann Severin 70

Ouaknine Joel 3

Peschanenko Vladimir 124

Rebiha Rachid 81

Sakurada Hideki 64

Sapina Julia 4

Takahashi Kazuko 50 93

Torella Luca 19 31

Vajda Robert 125

Yoshimaru Shizuo 93

Ziv-Av Matan 108

Keyword Index

algebraic number 125

automated verification 64

BB84 64

bottom-up semantics 31

computational model 93

computational origami 50

computer algebra 108

debugging 4

Distributed 70

elecronic cash protocol 93

equitable partitions 108

F4 70

formal methods 64

geometrical constraint solving 50

Groebner basis 125

Grobner Basis 70

induction scheme 93

invariants 124

knot fold 50

Lebesgue constant 125

Linear Algebra 81

maude 4

MPI 70

Parallel 70

polynomial interpolation 125

process calculi 64

program animation 4

property-oriented specifications 19

quantifier elimination 125

quantum cryptography 64

requirements specification 124

resultant 125

rewriting logic 4

semantics-based inference methods 19

slicing 4

Static Analysis 81

stepping 4

strongly regular graphs 108

symbolic verification 124

term rewriting 31

Term Rewriting Systems 19 31

Termination Analysis 81

theorem proving 50

theorem proving methods 93

  • Introduction
  • Preliminaries
  • Rewriting Modulo Equational Theories
  • Exploring the Computation Tree
    • Expanding a Program State
    • Computing a Fragment of the Computation Tree
      • Particularizing the Exploration
        • Interactive Stepper
        • Forward Trace Slicer
          • Implementation
          • Conclusions
          • Introduction
            • Notations
              • Many notions of equivalence
              • Deriving specifications from TRSs
                • An effective instance of the presented method
                  • Conclusions and future work
                  • Introduction
                  • Preliminaries
                  • Modeling the small-step rewriting behavior
                    • The semantic domain
                      • Linearizing Narrowing
                        • Operational denotations of TRSs
                          • Evaluation Function
                          • Properties of the TRS operational denotation
                            • Fixpoint denotations of TRSs
                              • Properties of the TRS fixpoint denotation
                                  • Conclusions
                                  • Technical Proofs
                                  • Introduction
                                  • Notations
                                  • Origami Geometrical Construction
                                    • Huzitas Fold Operations
                                    • Extensions
                                      • Knot Fold
                                        • Geometrical Properties
                                        • Geometrical Constraint Solving Approach
                                          • Regular Heptagon by the Knot Fold
                                            • Geometrical Constraints
                                            • Construction by Eos
                                            • Algebraic Interpretation
                                              • Proof
                                                • Theorem to Prove
                                                • Proof by Eos
                                                • Proof Results
                                                  • Conclusion
                                                    • Acknowledgments
                                                      • Introduction
                                                      • The Verifier
                                                      • Application to Shor and Preskills Security Proof
                                                      • Conclusions
                                                      • Introduction
                                                      • Notations
                                                      • Preliminaries
                                                      • Matrix Distribution
                                                      • Simplifying the F4 Algorithm
                                                      • Benchmarks
                                                      • Conclusion
                                                      • Introduction
                                                      • Linear Algebra and Linear Loop Programs
                                                      • Asymptotically Non-terminant Variable Values
                                                      • Automated generation of ANT loci
                                                        • The regular case
                                                        • The general case handling linear diagonalizable programs
                                                          • Discussions
                                                          • Conclusion
                                                          • Introduction
                                                          • Data Conversion Formalization
                                                            • Problem
                                                            • Solution
                                                              • Conversion from BS to BTREE
                                                              • Conversion from NAT to BS
                                                              • Conversion from NAT to BTREE
                                                                  • Modeling of an Electronic Cash Protocol
                                                                    • Ideal Electronic Cash
                                                                    • Definition of money
                                                                    • Creation of money from a natural number
                                                                    • Calculation of the amount of money
                                                                    • Payment
                                                                      • Proof of Properties
                                                                        • Well-definedness of cash
                                                                        • Well-definedness of pay
                                                                        • Divisibility
                                                                          • Discussion
                                                                          • Conclusion
                                                                          • Introduction
                                                                          • Strongly regular graphs a brief survey
                                                                          • Computer algebra tools in AGT
                                                                          • The seven known primitive triangle-free strongly regular graphs
                                                                          • Embeddings of tfSRGs into known primitive tfSRGs
                                                                          • Equitable partitions
                                                                          • Search for equitable partitions
                                                                          • Quadrangle and Atkinson EPs of NL2(10)
                                                                          • Some modifications of Robertson model
                                                                          • A few more models
                                                                          • Concluding comments
                                                                          • Data about embeddings of tfSRGs inside tfSRGs
                                                                          • Data about equitable partitions of primitive tfSRGs
Page 2: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,

Fifth International Symposium on

Symbolic Computation in

Software Science

SCSS 2013

Symposium Proceedings

July 5-6 2013

Research Institute for Symbolic Computation

Johannes-Kepler University Linz Austria

Preface

Symbolic Computation is the science of computing with symbolic objects (terms formulaeprograms representations of algebraic objects etc) Powerful symbolic algorithms have beendeveloped during the past decades like theorem proving automated reasoning software veri-fication model checking rewriting formalization of mathematics network security Grobnerbases characteristic sets telescoping for recurrence relations etc

The purpose of the International Symposium on Symbolic Computation in Software Science- SCSS is to promote research on theoretical and practical aspects of symbolic computationin software sciences The symposium provides a forum for active dialog between researchersfrom several fields of computer algebra algebraic geometry algorithmic combinatorics compu-tational logic and software analysis and verification

This yearrsquos SCSS edition is the fifth in the SCSS workshop series and is organized at theResearch Institute for Symbolic Computation (RISC) of the Johannes Kepler University Linzduring July 5-6 2013 With the focus of promoting the exchange of ideas and experiences fromapplications of symbolic computation in software science SCSS 2013 has attracted researchersfrom across a number of fields including computer algebra algebraic geometry term rewritingprocess algebras and program verification

We are very excited to have three excellent keynote speakers Bruno Buchberger (RISC-Linz) Wei Li (Beihang University) and Joel Ouaknine (Oxford University) Our invited speak-ers have significant research expertise and insights into the challenges and opportunities for thegrowing SCSS community

We would like to thank the program committee members and reviewers for all their effortsThanks also go to the steering committee members for their valuable advice and guidanceWe would also like to thank Andrei Voronkov for his help on EasyChair Finally we alsoacknowledge partial funding from the strategical program Innovative Upper Austria 2010 Plusand the Doctoral Program ldquoComputational Mathematicsrdquo (W1214) - DK1 project

Laura Kovacs Programme ChairTemur Kutsia Symposium Chair

Symposium Organization

Symposium Chair

Temur Kutsia Research Institute for Symbolic Computa-

tion - RISC Austria

Program Chair

Laura Kovacs Chalmers University of Technology Sweden

Program Committee

Marıa Alpuente Technical University of Valencia Spain

Serge Autexier DFKI Germany

Nikolaj Bjorner Microsoft Research USA

Adel Bouhoula Ecole superieure des communications de Tu-

nis Tunisia

Iliano Cervesato Carnegie Mellon University - Qatar Cam-

pus Qatar

Horatiu Cirstea Loria France

Jurgen Giesl RWTH Aachen Germany

Tetsuo Ida Tsukuba University Japan

Paul Jackson School of Informatics University of Edin-

burgh UK

Tudor Jebelean Research Institute for Symbolic Computa-

tion - RISC Austria

Cezary Kaliszyk University of Innsbruck Austria

Fairouz Kamareddine Heriot-Watt University UK

Laura Kovacs Chalmers University of Technology Sweden

Temur Kutsia Research Institute for Symbolic Computa-

tion - RISC Austria

Stephan Merz INRIA-LORIA Nancy France

Ali Mili New Jersey Institute of Technology USA

Yasuhiko Minamide University of Tsukuba Japan

Pierre-Etienne Moreau INRIA-LORIA Nancy France

Andre Platzer Carnegie Mellon University USA

Stefan Ratschan Czech Academy of Sciences The Czech Re-

public

Rachid Rebiha University of Lugano Switzerland and IC

Unicamp Brazil

Enric Rodrıguez Car-

bonell

Technical University of Catalonia Spain

Sorin Stratulat Universite Paul Verlaine France

Thomas Sturm Max Planck Institute for Informatics Ger-

many

Additional Reviewers

Cabarcas Daniel

Eder Christian

Gay Simon

Ghorbal Khalil

Ghourabi Fadoua

Kredel Heinz

Martins Joao G

Vigneron Laurent

Table of Contents

Invited Papers

Mathematics of 21st Century A Personal View 1

Bruno Buchberger

A Semantic Framework for Program Debugging 2

Wei Li

Decision Problems for Linear Recurrence Sequences 3

Joel Ouaknine

Regular Papers

Parametric Exploration of Rewriting Logic Computations 4

Marıa Alpuente Demis Ballis Francisco Frechina and Julia

Sapina

Automatic Inference of Term Equivalence in Term Rewriting

Systems 19

Marco Comini and Luca Torella

A Condensed Goal-Independent Fixpoint Semantics Modeling

the Small-Step Behavior of Rewriting 31

Marco Comini and Luca Torella

Logical and Algebraic Views of a Knot Fold of a Regular

Heptagon 50

Fadoua Ghourabi Tetsuo Ida and Kazuko Takahashi

Automated Verification of Equivalence on Quantum

Cryptographic Protocols 64

Takahiro Kubota Yoshihiko Kakutani Go Kato Yasuhito

Kawano and Hideki Sakurada

A modified parallel F4 algorithm for shared and distributed

memory architectures 70

Severin Neumann

Generating Asymptotically Non-terminant Initial Variable

Values for Linear Diagonalizable Programs 81

Rachid Rebiha Nadir Matringe and Arnaldo Moura

Data Conversion Method between a Natural Number and a

Binay Tree for an Inductive Proof and Its Application 93

Kazuko Takahashi Shizuo Yoshimaru and Mizuki Goto

Computer algebra investigation of known primitive

triangle-free strongly regular graphs 108

Matan Ziv-Av and Mikhail Klin

Short Papers

Usage of Invariants for Symbolic Verification of Requirements 124

Alexander Letichevsky Alexander Godlevsky Anton Guba

Alexander Kolchin Oleksandr Letychevskyi and Vladimir

Peschanenko

Lebesgue Constants and Optimal Node Systems via Symbolic

Computations 125

Robert Vajda

Mathematics of 21st Century

A Personal View

Bruno Buchberger

Research Institute for Symbolic Computation - RISC

Johannes Kepler University Linz Austria

BrunoBuchbergerriscuni-linzacat

Extended Abstract

Mathematics of 19th century and before was rich in content intuition strong ideas motivationfrom natural sciences and had a coherent view of all fields of mathematics (geometry algebraanalysis number theory )

Mathematics of 20th century added three important aspects mathematical logic as themathematical meta-theory of mathematics formalism and abstractness and reduction to firstprinciples (ldquoBourbakismrdquo) and the notion of computing (both as an exact mathematicalnotion and as the foundation of the revolutionary device rdquoprogrammable computerrdquo) In factthe three aspects have a lot to do with each other and are fundamentally interrelated Howeverin practice the three aspects were (and still are) pursued by three different communities Thedeep insights of logicians on the nature of mathematics are hardly used in ever-day practiceof ldquoworking mathematiciansrdquo ldquopure mathematiciansrdquo are often proud that they do not touchthe computer except for writing e-mails typing in LaTeX and using web search and computerscientists often think that what they are doing does not need mathematics or even is oppositeto mathematics

In my view as indicated by trends in late 20th century in 21st century mathematics willevolve as - or return to be - a unified body of mathematical logic abstract structural math-ematics and computer mathematics with no boundaries between the three aspects ldquoWorkingmathematiciansrdquo will have to master the three aspects equally well and integrate them in theirdaily work More specifically working in mathematics will proceed on the ldquoobject levelrdquo ofdeveloping new mathematical content (abstract knowledge and computational methods) andat the same time on the ldquometa-levelrdquo of developing automated reasoning methods for support-ing research on the object level This ldquomassage of the mathematical brainrdquo by jumping backand forth between the object and the meta-level will guide mathematics onto a new level ofsophistication

Symbolic computation is just a way of expressing this general view of mathematics of the21st century and it also should be clear that software science is just another way of expressingthe algorithmic aspect of this view

In the talk we will exemplify the spirit of this new type of mathematics by a report onthe Theorema system being developed in the speakerrsquos research group Theorema is both alogic and a software frame for doing mathematics in the way sketched above On the objectlevel Theorema allows to prove and program within the same logical frame and on the meta-level it allows to formulate reasoning techniques that help proving and programming on theobject level In particular we will show how this type of doing mathematics allows to mimicthe invention process behind the speakerrsquos theory of Grobner bases which provides a generalmethod for dealing with multivariate nonlinear polynomial systems

1

A Semantic Framework for Program Debugging

Wei Li

State Key Laboratory of Software Development Environment

School of Computer Science and Engineering

Beihang University China

liweinlsdebuaaeducn

Abstract

This work aims to build a semantic framework for automated debugging A debugging pro-

cess consists of tracing locating and fixing processes consecutively The first two processes

are accomplished by a tracing procedure and a locating procedure respectively The tracing

procedure reproduces the execution of a failed test case with well-designed data structures and

saves necessary information for locating bugs The locating procedure will use the informa-

tion obtained from the tracing procedure to locate ill-designed statements and to generate a

fix-equation the solution of which is a function that will be used to fix the bugs A structural

operational semantics is given to define the functions of the tracing and locating procedure

Both procedures are proved to terminate and produces one fix-equation The main task of

fixing process is to solve the fix-equation It turns out that for a given failed test case there

exist three different types of solutions 1 the bug is solvable there exists a solution of the

fix-equation and the program can be repaired 2 There exists a non-linear error in the pro-

gram the fix-equation generated at each round of the locating procedure is solvable but a new

bug will arise when the old bug is being fixed 3 There exists a logical design error and the

fix-equation is not solvable

2

Decision Problems for Linear Recurrence

Sequences

Joel Ouaknine

Department of Computer Science

Oxford University United Kingdom

JoelOuakninecsoxacuk

Abstract

Linear recurrence sequences (LRS) such as the Fibonacci numbers permeate vast areas ofmathematics and computer science In this talk we consider three natural decision problemsfor LRS namely the Skolem Problem (does a given LRS have a zero) the Positivity Problem

(are all terms of a given LRS positive) and the Ultimate Positivity Problem (are all but finitelymany terms of a given LRS positive) Such problems (and assorted variants) have applicationsin a wide array of scientific areas such as theoretical biology (analysis of L-systems pop-ulation dynamics) economics (stability of supply-and-demand equilibria in cyclical marketsmultiplier-accelerator models) software verification (termination of linear programs) proba-bilistic model checking (reachability and approximation in Markov chains stochastic logics)quantum computing (threshold problems for quantum automata) discrete linear dynamicalsystems (reachability and invariance problems) as well as combinatorics statistical physicsterm rewriting formal languages cellular automata generating functions etc

We shall see that these problems have deep and fascinating connections to rich mathematicalconcepts and conjectures particularly in the fields of analytic and algebraic number theorydiophantine geometry and approximation real algebraic geometry mathematical logic andcomplexity theory

3

Parametric Exploration of

Rewriting Logic Computations lowast

M Alpuente1 D Ballis2 F Frechina1 and J Sapina1

1 DSIC-ELP Universitat Politecnica de ValenciaCamino de Vera sn Apdo 22012 46071 Valencia Spain

alpuenteffrechinajsapinadsicupves2 DIMI Universita degli Studi di Udine

Via delle Scienze 206 33100 Udine Italy demisballisuniudit

Abstract

This paper presents a parameterized technique for the inspection of Rewriting Logiccomputations that allows the non-deterministic execution of a given rewrite theory to befollowed up in different ways Starting from a selected state in the computation tree theexploration is driven by a user-defined inspection criterion that specifies the explorationmode By selecting different inspection criteria one can automatically derive useful debug-ging facilities such as program steppers and more sophisticated dynamic trace slicers thatfacilitate the detection of control and data dependencies across the computation tree Ourmethodology which is implemented in the Anima graphical tool allows users to capture theimpact of a given criterion validate input data and detect improper program behaviors

1 Introduction

Program animation or stepping refers to the very common debugging technique of executingcode one step at a time allowing the user to inspect the program state and related databefore and after the execution step This allows the user to evaluate the effects of a givenstatement or instruction in isolation and thereby gain insight into the program behavior (ormisbehavior) Nearly all modern IDEs debuggers and testing tools currently support this modeof execution optionally where animation is achieved either by forcing execution breakpointscode instrumentation or instruction simulation

Rewriting Logic (RWL) is a very general logical and semantic framework which is particu-larly suitable for formalizing highly concurrent complex systems (eg biological systems [7] andWeb systems [2 6]) RWL is efficiently implemented in the high-performance system Maude [9]Roughly speaking a rewriting logic theory seamlessly combines a term rewriting system (TRS)together with an equational theory that may include equations and axioms (ie algebraic lawssuch as commutativity associativity and unity) so that rewrite steps are performed modulo theequations and axioms

In recent years debugging and optimization techniques based on RWL have received growingattention [1 13 16 17] but to the best of our knowledge no practical animation tool forRWLMaude has been formally developed To debug Maude programs Maude has a basictracing facility that allows the user to advance through the program execution letting himherselect the statements to be traced except for the application of algebraic axioms that are not

lowastThis work has been partially supported by the EU (FEDER) and the Spanish MEC project ref TIN2010-21062-C02-02 and by Generalitat Valenciana ref PROMETEO2011052 This work was carried out during thetenure of D Ballisrsquo ERCIM lsquoAlain Bensoussanrdquo Postdoctoral Fellowship The research leading to these resultshas received funding from the European Union Seventh Framework Programme (FP72007-2013) under grantagreement n 246016 F Frechina was supported by FPU-ME grant AP2010-5681

4

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

under user control and are never recorded as execution steps in the trace All rewrite steps thatare obtained by applying the equations or rules for the selected function symbols are shown inthe output trace so that the only way to simplify the displayed view of the trace is by manuallyfixing the traceable equations or rules Thus the trace is typically huge and incomplete andwhen the user detects an erroneous intermediate result it is difficult to determine where theincorrect inference started Moreover this trace is either directly displayed or written to afile (in both cases in plain text format) thus only being amenable for manual inspection bythe user This is in contrast with the enriched traces described below which are complete (allexecution steps are recorded by default) and can be sliced automatically so that they can bedramatically simplified in order to facilitate a specific analysis Also the trace can be directlydisplayed or delivered in its meta-level representation which is very useful for further automatedmanipulation

Contributions This paper presents the first parametric (forward) exploration technique forRWL computations Our technique is based on a generic animation algorithm that can be tunedto work with different modalities including incremental stepping and automated forward slicingThe algorithm is fully general and can be applied for debugging as well as for optimizing anyRWL-based tool that manipulates RWL computations Our formulation takes into account theprecise way in which Maude mechanizes the rewriting process and revisits all those rewrite stepsin an instrumented fine-grained way where each small step corresponds to the application ofan equation equational axiom or rule This allows us to explain the input execution trace withregard to the set of symbols of interest (input symbols) by tracing them along the executiontrace so that in the case of the forward slicing modality all data that are not descendants ofthe observed symbols are simply discarded

Related Work Program animators have existed since the early years of programmingAlthough several steppers have been implemented in the functional programming community(see [10] for references) none of these systems applies to the animation and forward slicing ofMaude computations An algebraic stepper for Scheme is defined and formally proved in [10]which is included in the DrScheme programming environment The stepper reduces Schemeprograms to values (according to the reduction semantics of Scheme) and is useful for explainingthe semantics of linguistic facilities and for studying the behavior of small programs It explainsa programrsquos execution as a sequence of reduction steps based on the ordinary laws of algebra forthe functional core of the language and more general algebraic laws for the rest of the languageIn order to discover all of the steps that occur during the program evaluation the stepperrewrites (or rdquoinstrumentsrdquo) the code The inserted code uses a mechanism called ldquocontinuationmarksrdquo to store information about the programrsquos execution as it is running and makes calls tothe stepper before after and during the evaluation of each program expression Continuationmarks allow the stepper to reuse the underlying Scheme implementation without having to re-implement the evaluator The stepperrsquos implementation technique also applies to both ML andHaskell since it supports states continuations multiple threads of control and lazy evaluation[10]

In [4 5] an incremental backward trace slicer was presented that generates a trace slice ofan execution trace T by tracing back a set of symbols of interest along (an instrumented versionof) T while data that are not required to produce the target symbols are simply discarded Thiscan be very helpful in debugging since any information that is not strictly needed to delivera critical part of the result is discarded which helps answer the question of what programcomponents might affect a lsquoselected computationrdquo However for the dual problem of ldquowhatprogram components might be affected by a selected computationrdquo a kind of forward expansionis needed which has been overlooked to date

5

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

Plan of the paper Section 2 recalls some fundamental notions of RWL and Section 3summarizes the rewriting modulo equational theories defined in Maude Section 4 formulatesthe exploration as a parameterized procedure that is completely controlled by the user whileSection 5 formalizes three different inspection techniques that are obtained as an instance ofthe generic scheme Finally Section 6 reports on a prototypical implementation of the proposedtechniques and Section 7 concludes

2 Preliminaries

Let us recall some important notions that are relevant to this work We assume some basicknowledge of term rewriting [18] and Rewriting Logic [14] Some familiarity with the Maudelanguage [9] is also required

We consider an order-sorted signature Σ with a finite poset of sorts (Slt) that models theusual subsort relation [9] We assume an S-sorted family V = VssisinS of disjoint variable setsτ(ΣV)s and τ(Σ)s are the sets of terms and ground terms of sort s respectively We writeτ(ΣV) and τ(Σ) for the corresponding term algebras The set of variables that occur in a termt is denoted by Var(t) In order to simplify the presentation we often disregard sorts when noconfusion can arise

A position w in a term t is represented by a sequence of natural numbers that addressesa subterm of t (Λ denotes the empty sequence ie the root position) By notation w1w2we denote the concatenation of positions (sequences) w1 and w2 Positions are ordered by theprefix ordering that is given the positions w1 and w2 w1 le w2 if there exists a position u suchthat w1u = w2

Given a term t we let Pos(t) denote the set of positions of t By t|w we denote the subtermof t at position w and t[s]w specifies the result of replacing the subterm t|w by the term s

A substitution σ equiv x1t1 x2t2 is a mapping from the set of variables V to the set ofterms τ(ΣV) which is equal to the identity almost everywhere except over a set of variablesx1 xn The domain of σ is the set Dom(σ) = x isin V | xσ 6= x By id we denote theidentity substitution The application of a substitution σ to a term t denoted tσ is defined byinduction on the structure of terms

tσ =

xσ if t = x x isin V

f(t1σ tnσ) if t = f(t1 tn) n ge 0

For any substitution σ and set of variables V σ |V denotes the substitution obtained from σby restricting its domain to V (ie σ |V (x) = xσ if x isin V otherwise σ |V (x) = x) Given twoterms s and t a substitution σ is a matcher of t in s if sσ = t The term t is an instance ofthe term s iff there exists a matcher σ of t in s By matchs(t) we denote the function thatreturns a matcher of t in s if such a matcher exists

A (labelled) equation is an expression of the form [l] λ = ρ where λ ρ isin τ(ΣV) V ar(ρ) subeV ar(λ) and l is a label ie a name that identifies the equation A (labelled) rewrite rule isan expression of the form [l] λ rarr ρ where λ ρ isin τ(ΣV) V ar(ρ) sube V ar(λ) and l is a labelWhen no confusion can arise rule and equation labels are often omitted The term λ (resp ρ)is called left-hand side (resp right-hand side) of the rule λrarr ρ (resp equation λ = ρ)

6

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

3 Rewriting Modulo Equational Theories

An order-sorted equational theory is a pair E = (Σ∆cupB) where Σ is an order-sorted signature∆ is a collection of (oriented) equations and B is a collection of equational axioms (ie algebraiclaws such as associativity commutativity and unity) that can be associated with any binaryoperator of Σ The equational theory E induces a congruence relation on the term algebraτ(ΣV) which is denoted by =E A rewrite theory is a triple R = (Σ∆ cup BR) where(Σ∆ cupB) is an order-sorted equational theory and R is a set of rewrite rules

Example 31The following rewrite theory encoded in Maude specifies a close variant of the fault-tolerantclient-server communication protocol of [15]

mod CLIENT-SERVER-TRANSF is inc INT + QID sorts Content State Msg Cli Serv Addressee

Sender Data CliName ServName Question Answer subsort Msg Cli Serv lt State subsort Addressee Sender CliName ServName lt Qid subsort Question Answer Data lt Nat

ops Srv Srv-A Srv-B Cli Cli-A Cli-B -gt Qid op null -gt State op _amp_ State State -gt State [assoc comm id null] op _lt-_ Addressee Content -gt Msg op __ Sender Data -gt Content op [____] CliName ServName Question Answer -gt Cli op na -gt Answer op [_] ServName -gt Serv [ctor] op f ServName CliName Data -gt Data

vars C S Addr Qid vars Q D A Nat var CNT [Content]

eq [succ] f(S C Q) = s(Q)

rl [req] [C S Q na] =gt[C S Q na] amp S lt- C Q

rl [reply] S lt- C Q amp [S] =gt[S] amp C lt- S f(S C Q)

rl [rec] C lt- S D amp [C S Q A] =gt[C S Q A]

rl [dupl] (Addr lt- CNT) =gt(Addr lt- CNT) amp (Addr lt- CNT)

rl [loss] (Addr lt- CNT) =gt null endm

The specification models an environment where several clients and servers coexist Eachserver can serve many clients while for the sake of simplicity we assume that each clientcommunicates with a single server

The names of clients and servers belong to the sort Qid Clients are represented as 4-tuplesof the form [C S Q D] where C is the clientrsquos name S is the name of the server it wants tocommunicate with Q is a natural number that identifies a client request and D is either a naturalnumber that represents the server response or the constant value na (not available) when theresponse has not been yet received Servers are stateless and are represented as structures [S]with S being the serverrsquos name All messages are represented as pairs of the form Addr lt- CNTwhere Addr is the addresseersquos name and CNT stands for the message contents Such contentsare pairs AddrN with Addr being the senderrsquos name and N being a number that representseither a request or a response

The server S uses a function f (only known to the server itself) that given a question Q

from client C the call f(S C Q) computes the answer s(Q) where s(Q) is the successor of Q Thisfunction is specified by means of the equation succ

Program states are formalized as a soup (multiset) of clients servers and messages whereasthe system behavior is formalized through five rewrite rules that model a faulty communicationenvironment in which messages can arrive out of order can be duplicated and can be lostSpecifically the rule req allows a client C to send a message with request Q to the server SThe rule reply lets the server S consume the client request Q and send a response messagethat is computed by means of the function f The rule rec specifies the client reception of aserver response D that should be stored in the client data structure Indeed the right-handside [C S Q A] of the rule includes an intentional barely perceptible bug that does not let theclient structure be correctly updated with the incoming response D The correct right-hand sideshould be [C S Q D] Finally the rules dupl and loss model the faulty environment and have

7

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

the obvious meaning messages can either be duplicated or lost

Given a rewrite theory (Σ ER) with E = ∆ cup B the rewriting modulo E relation (insymbols rarrRE) can be defined by lifting the usual rewrite relation on terms [12] to the E-congruence classes [t]E on the term algebra τ(ΣV) that are induced by =E [8] that is [t]Eis the class of all terms that are equal to t modulo E Unfortunately rarrRE is in generalundecidable since a rewrite step t rarrRE tprime involves searching through the possibly infiniteequivalence classes [t]E and [tprime]E

The exploration technique formalized in this work is formulated by considering the preciseway in which Maude proves the rewrite steps (see Section 52 in [9]) Actually the Maudeinterpreter implements rewriting modulo E by means of two much simpler relations namelyrarr∆B and rarrRB These allow rewrite rules and equations to be intermixed in the rewritingprocess by simply using an algorithm of matching modulo B We define rarrRcup∆B as rarrRB

cup rarr∆B Roughly speaking the relation rarr∆B uses the equations of ∆ (oriented from leftto right) as simplification rules thus for any term t by repeatedly applying the equations assimplification rules we eventually reach a normalized term tdarr∆ to which no further equationscan be applied The term t darr∆ is called a canonical form of t wrt ∆ On the other handthe relation rarrRB implements rewriting with the rules of R which might be non-terminatingand non-confluent whereas ∆ is required to be terminating and Church-Rosser modulo B inorder to guarantee the existence and unicity (modulo B) of a canonical form wrt ∆ for anyterm [9]

Formally rarrRB and rarr∆B are defined as follows given a rewrite rule r = (λ rarr ρ) isin R(resp an equation e = (λ = ρ) isin ∆) a substitution σ a term t and a position w of t

trσwrarrRB tprime (resp t

eσwrarr∆B tprime) iff λσ =B t|w and tprime = t[ρσ]w When no confusion can arise we

simply write trarrRB tprime (resp trarr∆Btprime) instead of t

rσwrarrRB tprime (resp t

eσwrarr∆B tprime)

Under appropriate conditions on the rewrite theory a rewrite step modulo E on a term t canbe implemented without loss of completeness by applying the following rewrite strategy [11](i) reduce t wrt rarr∆B until the canonical form t darr∆ is reached (ii) rewrite t darr∆ wrt rarrRB

A computation C in the rewrite theory (Σ∆ cupBR) is a rewrite sequence

s0 rarrlowast∆B s0darr∆ rarrRB s1 rarrlowast

∆B s1darr∆

that interleaves rarr∆B rewrite steps and rarrRB rewrite steps following the strategy mentionedabove Terms that appear in computations are also called (program) states

A computation tree TR(s) for a term s and a rewrite theory R is a tree-like representationof all the possible computations in R that originate from the initial state s More preciselyTR(s) is a labelled tree whose root node label identifies the initial state s and whose edges arelabelled with rewrite steps of the form t rarrRcup∆B tprime so that any node in TR(s) represents aprogram state of a computation stemming from s

Example 32

Consider the rewrite theory of Example 31 together with the initial state [Srv-A] amp [Cli-A

Srv-A7na] amp [Cli-BSrv-A17na] In this case the computation tree consists of severalinfinite computations that start from the considered initial state and model interactions betweenclients Cli-A and Cli-B and server Srv-A The computed tree is depicted in the following picturewhere for the sake of simplicity we only display the equations and rules that have been appliedat each rewrite step while other information such as the computed substitution and the rewrite

8

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

position are omitted in the depicted tree

Query Go

Go

Go

Go

Go

Go

GoGoBack

Back

Back

Back

Back

Back

BackBack Anima

[Srv-A] amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]s0

req[Srv-A] amp (Srv-A lt- Cli-A7) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s1 req[Srv-A] amp (Srv-A lt- Cli-B17) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s2

reply[Srv-A] amp (Cli-A lt- Srv-Af(Serv-ACli-A7)) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s3 reqdupl[Srv-A] amp (Srv-A lt- Cli-A7) amp (Srv-A lt- Cli-A7) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s4 req[Srv-A] amp (Srv-A lt- Cli-A7) amp (Srv-A lt- Cli-B17) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s5 loss[Srv-A] amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s6

succ[Srv-A] amp (Cli-A lt- Srv-A8) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s7

Options

Given a computation C it is always possible to expand C in an instrumented computationCinst in which each application of the matching modulo B algorithm is mimicked by the explicitapplication of a suitable equational axiom which is also oriented as a rewrite rule [3]

Also typically hidden inside the B-matching algorithms some flatunflat transformationsallow terms that contain operators that obey associative-commutative axioms to be rewrittenThese transformations allow terms to be reordered and correctly parenthesized in order toenable subsequent rewrite steps Basically this is achieved by producing a single auxiliaryrepresentative of their AC congruence class [3] For example consider a binary AC operatorf together with the standard lexicographic ordering over symbols Given the B-equivalencef(b f(f(b a) c)) =B f(f(b c) f(a b)) we can represent it by using the ldquointernal sequencerdquo

of transformations f(b f(f(b a) c))flatminusrarr lowast

Bf(a b b c)unflatminusrarr lowast

Bf(f(b c) f(a b)) where the firstsubsequence corresponds to a flattening transformation sequence that obtains the AC canonicalform while the second one corresponds to the inverse unflattening transformation This wayany given instrumented computation consists of a sequence of (standard) rewrites using theequations (rarr∆) rewrite rules (rarrR) equational axioms and flatunflat transformations (rarrB)By abuse of notation since equations and axioms are both interpreted as rewrite rules in ourformulation we often abuse the notation λrarr ρ to denote rules as well as (oriented) equationsand axioms Given an instrumented computation Cinst by |Cinst| we denote its length mdashthat isthe number of rewrite steps that occur in Cinst We use the functions head(Cinst) and tail(Cinst)to respectively select the first rewrite step in Cinst and the instrumented computation yieldedby removing the first rewrite step from Cinst In the sequel we also assume the existence of afunction instrument(C) which takes a computation C and delivers its instrumented counterpart

Example 33Consider the rewrite theory of Example 31 together with the following computation

C = [Cli Srv 7 na] amp [Srv] amp Cli lt- Srv f(Srv Cli 7) rarr∆B

[Cli Srv 7 na]amp [Srv] amp Cli lt- Srv 8 rarrRB

[Cli Srv 7 7] amp [Srv]

The corresponding instrumented computation Cinst which is produced by instrument(C) isgiven by 1) suitably parenthesizing states by means of flatteningunflattening transformations

9

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

when needed and 2) making commutative ldquostepsrdquo explicit by using the (oriented) equationalaxiom (X amp Y rarr Y amp X) in B that models the commutativity property of the (juxtaposition)operator amp Note these transformations are needed to enable the application of the rule rec

(of R) to the seventh state

Cinst = [Cli Srv 7 na] amp [Srv] amp Cli lt- Srv f(Srv Cli 7)succminusrarr∆

[Cli Srv 7 na] amp [Srv] amp Cli lt- Srv 8unflatminusrarrB

[Cli Srv 7 na] amp ([Srv] amp Cli lt- Srv 8)commminusrarrB

[Cli Srv 7 na] amp (Cli lt- Srv 8 amp [Srv])flatminusrarrB

[Cli Srv 7 na] amp Cli lt- Srv 8 amp [Srv]unflatminusrarrB

([Cli Srv 7 na] amp Cli lt- Srv 8) amp [Srv]commminusrarrB

(Cli lt- Srv 8 amp [Cli Srv 7 na]) amp [Srv]recminusrarrR

[Cli Srv 7 7] amp [Srv]

4 Exploring the Computation Tree

Computation trees are typically large and complex objects to deal with because of the highly-concurrent nondeterministic nature of rewrite theories Also their complete generation andinspection are generally not feasible since some of their branches may be infinite as they encodenonterminating computations

However one may still be interested in analysing a fragment of a given computation tree fordebugging or program comprehension purposes This section presents an exploration techniquethat allows the user to incrementally generate and inspect a portion T bull

R(sbull) of a computationtree TR(s) by expanding (fragments of) its program states into their descendants starting fromthe root node The exploration is an interactive procedure that is completely controlled by theuser who is free to choose the program state fragments to be expanded

41 Expanding a Program State

A state fragment of a state s is a term sbull that hides part of the information in s that is theirrelevant data in s are simply replaced by special bull-variables of appropriate sort denoted bybulli with i = 0 1 2 Given a state fragment sbull a meaningful position p of sbull is a positionp isin Pos(sbull) such that sbull|p 6= bulli for all i = 0 1 By MPos(sbull) we denote the set thatcontains all the meaningful positions of sbull Symbols that occur at meaningful positions of astate fragment are called meaningful symbols By Varbull(exp) we define the set of all bull-variablesthat occur in the expression exp

Basically a state fragment records just the information the user wants to observe of a givenprogram state

The next auxiliary definition formalizes the function fragment(t P ) that allows a statefragment of t to be constructed wrt a set of positions P of t The function fragment relies onthe function freshbull whose invocation returns a (fresh) variable bulli of appropriate sort which isdistinct from any previously generated variable bullj

Definition 41 Let t isin τ(ΣV) be a state and let P be a set of positions st P sube Pos(t)Then the function fragment(t P ) is defined as follows

fragment(t P ) = recfrag(t PΛ) where

10

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

function inspect(sbull Cinstr I)1 if |Cinstr | = 1 then2 return I(sbull Cinstr )3 elseif |Cinstr | gt 14 if I(sbull head(Cinstr ))= nil then5 return inspect(I(sbull head(Cinstr ))

tail(Cinstr ) I)6 else7 return nil8 end9 endendf

function expand(sbull sR I)1 Ebull

R = empty

2 for each srσwrarrRcup∆B t

with w isin MPos(sbull)

3 Cinst = instrument(srσwrarrRcup∆B t)

4 tbull = inspect(sbull Cinst I)

5 if tbull 6= nil then EbullR = Ebull

R cup sbullrrarr tbull

6 end7 return Ebull

R

endf

Figure 1 The inspect function Figure 2 The expand function

recfrag(t P p) =

f(recfrag(t1 P p1) recfrag(tn P pn))

if t=f(t1 tn) and p isin P

t if t isin V and p isin P

freshbull otherwise

and P = u | u le p and p isin P is the prefix closure of P

Roughly speaking fragment(t P ) yields a state fragment of t wrt a set of positions P thatincludes all symbols of t that occur within the paths from the root to any position in P whileeach maximal subterm t|p with p 6isin P is replaced by means of a freshly generated bull-variable

Example 42Let t = d(f(g(a h(b)) c) a) be a state and let P = 11 12 be a set of positions of t Byapplying Definition 41 we get the state fragment tbull = fragment(t P ) = d(f(g(bull1 bull2) c) bull3)and the set of meaningful positions MPos(tbull) = Λ 1 11 12

An inspection criterion is a function I(sbull srσwrarrK t) that given a rewrite step s

rσwrarrK t with

K isin ∆ RB and a state fragment sbull of s computes a state fragment tbull of the state t Roughlyspeaking an inspection criterion controls the information content conveyed by term fragmentsresulting from the execution of standard rewrite steps Hence distinct implementations of the

inspection criteria I(sbull srσwrarrK t) may produce distinct fragments sbull

rrarr tbull of the considered

rewrite step We assume that the special value nil is returned by the inspection criterionwhenever no fragment tbull can be delivered Several examples of inspection criteria are shown inSection 5

The function inspect of Figure 1 allows an inspection criterion I to be sequentially appliedalong an instrumented computation Cinstr in order to generate the fragment of the last stateof the computation Specifically given an instrumented computation s0 rarrK s1 rarrK rarr snn gt 0 the computation is traversed and the inspection criterion I is recursively applied oneach rewrite step si rarrK si+1 wrt the input fragment sbulli to generate the next fragment sbulli+1

The expansion of a single program state is specified by the function expand(sbull sR I) ofFigure 2 which takes as input a state s and its fragment sbull to be expanded wrt a rewritetheory R and an inspection criterion I Basically expand unfolds the state fragment sbull wrt

all the possible rewrite steps srσwrarrRcup∆B t that occur at the meaningful positions of sbull and

stores the corresponding fragments of sbullrrarr tbull in the set Ebull Note that to compute the state

11

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

fragment tbull for a rewrite step srσwrarrRcup∆B t and a state fragment sbull expand first generates the

instrumented computation Cinst of the considered step and then applies the inspection criterionI over C by using the inspect function

42 Computing a Fragment of the Computation Tree

The construction of a fragment T bullR(sbull0) of a computation tree TR(s0) is specified by the function

explore given in Figure 3 Essentially explore formalizes an interactive procedure that startsfrom a tree fragment (built using the auxiliary function createTree) which only consists of theroot node sbull0 and repeatedly uses the function expand to compute rewrite step fragments thatcorrespond to the visited tree edges wrt a given inspection criterion The tree T bull

R(sbull0) is builtby choosing at each loop iteration of the algorithm the tree node that represents the statefragment to be expanded by means of the auxiliary function pickLeaf (T bull

R(sbull0)) which allowsthe user to freely select a node sbull from the frontier of the current tree T bull

R(sbull0) Then T bullR(sbull0)

is augmented by calling addChildren(T bullR(sbull0) s

bull expand(sbull sR I)) This function call adds allthe edges sbull rarr tbull which are obtained by expanding sbull to the tree T bull

R(sbull0)The special value EoE (End of Exploration) is used to terminate the inspection process

when the function pickLeaf (T bullR(sbull0)) is equal to EoE no state to be expanded is selected and

the exploration terminates delivering the computed fragment T bullR(sbull0)

function explore(sbull0 s0R I)1 T bull

R(sbull0) = createTree(sbull0)2 while(sbull = pickLeaf (T bull

R(sbull0)) 6= EoE) do3 T bull

R(sbull0) = addChildren(T bullR(sbull0) s

bull expand(sbull sR I))4 od5 return T bull

R(sbull0)endf

Figure 3 The explore function

5 Particularizing the Exploration

The methodology given in Section 4 provides a generic scheme for the exploration of com-putation trees wrt a given inspection criterion I that must be provided by the user Inthis section we show three implementations of the criterion I that produce three distinct ex-ploration strategies In the first case the considered criterion allows an interactive programstepper to be derived in which rewriting logic computations of interest can be animated Inthe second case we implement a partial stepper that allows computations with partial inputsto be animated Finally in the last example the chosen inspection criterion implements anautomated forward slicing technique that allows relevant control and data information to beextracted from computation trees

51 Interactive Stepper

Given a computation tree TR(s0) for an initial state s0 and a rewrite theory R the stepwiseinspection of the computation tree can be directly implemented by instantiating the explorationscheme of Section 4 with the inspection criterion

Istep(sbull s

rσwrarr K t) = t

12

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

that always returns the reduced state t of the rewrite step srσwrarr K t with K isin ∆ RB

This way by starting the exploration from a state fragment that corresponds to the wholeinitial state s0 (ie sbull0 = s0) the call explore(s0R Istep) generates a fragment T bull

R(sbull0) of thecomputation tree TR(s0) whose topology depends on the program states that the user decidesto expand during the exploration process

Example 51Consider the rewrite theoryR in Example 31 and the computation tree in Example 32 Assumethe user starts the exploration by calling explore(s0R Istep) which allows the first level of thecomputation tree to be unfolded by expanding the initial state s0 wrt the inspection criterion

Istep This generates the tree TbullR(s0) containing the edges s0

reqrarr s1 s0

reqrarr s2 Now if the user

carries on with the exploration of program state s1 and then quits s1 will be expanded and thetree T bull

R(s0) will be augmented accordingly Specifically the resulting T bullR(s0) will include the

following edges s0reqrarr s1 s0

reqrarr s2 s1

succrarr s3 s1

reqrarr s4 s1

duplrarr s4 s1

reqrarr s5 s1

lossrarr s6

It is worth noting that all the program state fragments produced by the program stepperdefined above are ldquoconcreterdquo (ie state fragments that do not include bull-variables) Howeversometimes it may be useful to work with partial information and hence with state fragmentsthat abstract ldquoconcreterdquo program states by using bull-variables This approach may help to focususerrsquos attention on the parts of the program states that the user wants to observe disregardingunwanted information and useless rewrite steps

Example 52Consider the following two rewrite rules [r1] f(x b) rarr g(x) and [r2] f(a y) rarr h(y) togetherwith the initial state f(a b) Then the computation tree in this case is finite and only contains

the tree edges f(a b)r1xaΛ

rarr g(a) and f(a b)r2ybΛ

rarr h(b) Now consider the state fragmentf(bull1 b) where only the second input argument is relevant If we decided to expand the initialstate fragment f(bull1 b) we would get the tree fragment represented by the single rewrite step

f(bull1 b)r1rarr g(bull1) since the partial input encoded into f(bull1 b) cannot be rewritten via r2

In light of Example 52 and our previous considerations we define the following inspectioncriterion

Ipstep(sbull s

rσwrarr K t) = if sbull

rσbullwrarr K tbull then return tbull else return nil

Roughly speaking given a rewrite step micro srσwrarr K t with K isin ∆ RB the criterion

Ipstep returns a state fragment tbull of the reduced state t whenever sbull can be rewritten to tbull

using the very same rule r and position w that occur in microThe particularization of the exploration scheme with the criterion Ipstep allows an interac-

tive partial stepper to be derived in which the user can work with state information of interestthereby producing more compact and focused representations of the visited fragments of thecomputation trees

52 Forward Trace Slicer

Forward trace slicing is a program analysis technique that allows computations to be simplifiedwrt a selected fragment of their initial state More precisely given a computation C withinitial state s0 and a state fragment sbull0 of s0 forward slicing yields a simplified view Cbull of Cin which each state s of the original computation is replaced by a state fragment sbull that only

13

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

function Islice(sbull s

λrarrρσwrarr t)

1 if w isin MPos(sbull) then2 θ = xfreshbull | x isin V ar(λ)3 λbull = fragment(λMPos(Varbull(sbull|w)) cap Pos(λ))

4 ψλ = 〈|θmatchλbull(sbull|w)|〉

5 tbull = sbull[ρψλ]w6 else7 tbull = nil8 fi9 return tbull

endf

Figure 4 Inspection criterion that models forward slicing of a rewrite step

records the information that depends on the meaningful symbols of sbull0 while unrelated dataare simply pruned away

In the following we define an inspection criterion Islice that implements the forward slicingof a single rewrite step The considered criterion takes two parameters as input namely a

rewrite step micro = (srσwrarr K t) (with r = λ rarr ρ and K isin ∆ RB) and a state fragment

sbull of a state s It delivers the state fragment tbull which includes only those data that arerelated to the meaningful symbols of sbull Intuitively the state fragment tbull is obtained fromsbull by ldquorewritingrdquo sbull at position w with the rule r and a suitable substitution that abstractsunwanted information of the computed substitution with bull-variables A rigorous formalizationof the inspection criterion Islice is provided by the algorithm in Figure 4

Note that by adopting the inspection criterion Islice the exploration scheme of Section 4automatically turns into an interactive forward trace slicer that expands program states usingthe slicing methodology encoded into the inspection criterion Islice In other words given acomputation tree TR(s0) and a user-defined state fragment sbull0 of the initial state s0 any branchsbull0 rarr sbull1 rarr sbulln in the tree T bull

R(sbull0) which is computed by the explore function is the slicedcounterpart of a computation s0 rarrRcup∆B s1 rarrRcup∆B sn (wrt the state fragment sbull0) thatappears in the computation tree TR(s0)

Roughly speaking the inspection criterion Islice works as follows When the rewrite stepmicro occurs at a position w that is not a meaningful position of sbull (in symbols w 6isin MPos(sbull))trivially micro does not contribute to producing the meaningful symbols of tbull This amounts tosaying that no relevant information descends from the state fragment sbull and hence the functionreturns the nil value

On the other hand when w isin MPos(sbull) the computation of tbull involves a more in-depthanalysis of the rewrite step which is based on a refinement process that allows the descendantsof sbull in tbull to be computed The following definition is auxiliary

Definition 53 (substitution update) Let σ1 and σ2 be two substitutions The update ofσ1 wrt σ2 is defined by the operator 〈| |〉 as follows

〈|σ1 σ2|〉 = σ|Dom(σ1) where

xσ =

xσ2 if x isin Dom(σ1) capDom(σ2)xσ1 otherwise

The operator 〈|σ1 σ2|〉 updates (overrides) a substitution σ1 with a substitution σ2 where bothσ1 and σ2 may contain bull-variables The main idea behind 〈| |〉 is that for the slicing of the

14

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

rewrite step micro all variables in the applied rewrite rule r are naıvely assumed to be initiallybound to irrelevant data bull and the bindings are incrementally updated as we apply the rule r

More specifically we initially define the substitution θ = xfreshbull | x isin V ar(ρ) thatbinds each variable in λ rarr ρ to a fresh bull-variable This corresponds to assuming that all theinformation in micro which is introduced by the substitution σ can be marked as irrelevant Thenθ is refined as follows

We first compute the state fragment λbull = fragment(λMPos(Varbull(sbull|w))capPos(λ)) that onlyrecords the meaningful symbols of the left-hand side λ of the rule r wrt the set of meaningfulpositions of sbull|w Then by matching λbull with sbull|w we generate a matcher matchλbull(sbull|w) thatextracts the meaningful symbols from sbull|w Such a matcher is then used to compute ψλ which

is an update of θ wrt matchλbull(sbull|w) containing the meaningful information to be trackedFinally the state fragment tbull is computed from sbull by replacing its subterm at position w withthe instance ρψλ of the right-hand side of the applied rule r This way we can transfer all therelevant information marked in sbull into the fragment of the resulting state tbull

Example 54Consider the computation tree of Example 32 whose initial state is

s0 = [Srv-A] amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

Let sbull0 = bull amp [Cli-Abull7 bull ] amp bull be a state fragment1 of s0 where only request 7 of ClientCli-A is considered of interest By sequentially expanding the nodes sbull0 s

bull1 s

bull3 and s

bull5 wrt

the inspection criterion Islice we get the following fragment of the given computation tree

Query Go

Go

Go

Go

Go

Go

GoGoBack

Back

Back

Back

Back

Back

BackBack AnimaOptions

bull amp [Cli-Abull7bull] amp bullsbull0

reqbull amp (bull lt- Cli-A7) amp [Cli-Abull7na] amp bullsbull1

reqduplbull amp (bull lt- Cli-A7) amp (bull lt- Cli-A7) amp [Cli-Abull7na] amp bull

sbull2 reply[bull] amp (Cli-A lt- bullf(bullCli-A7)) amp [Cli-Abull7na] amp bull

sbull3 lossbull amp [Cli-Abull7na] amp bullsbull4

succ[bull] amp (Cli-A lt- bull8) amp [Cli-Abull7na] amp bullsbull5

req[bull] amp (bull lt- Cli-A7) amp(Cli-A lt- bull8) amp [Cli-Abull7na] amp bull

sbull6 dupl[bull] amp (Cli-A lt- bull8) amp(Cli-A lt- bull8) amp [Cli-Abull7na] amp bull

sbull7 loss[bull] amp [Cli-Abull7na] amp bullsbull8 rec

[bull] amp [Cli-Abull77] amp bullsbull9

Note that the slicing process automatically computes a tree fragment that represents apartial view of the protocol interactions from client Cli-Arsquos perspective Actually irrelevantinformation is hidden and rules applied on irrelevant positions are directly ignored whichallows a simplified fragment to be obtained favoring its inspection for debugging and analysispurposes In fact if we observe the highlighted computation in the tree we can easily detectthe wrong behaviour of the rule rec Specifically by inspecting the state fragment sbull9 = ([bull]amp [Climinus A bull 7 7] amp bull) which is generated by an application of the rule rec we immediatelyrealize that the response 8 produced in the parent state sbull5 has not been stored in sbull9 whichclearly indicates a buggy implementation of the considered rule

1Throughout the example we omit indices from the considered bull-variables to keep notation lighter andimprove readability So any variable bulli i = 0 1 is simply denoted by bull

15

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

Finally it is worth noting that the forward trace slicer implemented via the criterion Islicediffers from the partial stepper given at the end of Section 51 Given a state fragment sbull and

a rewrite steprσwrarrK t Islice always yields a fragment tbull when the rewrite occurs at a meaningful

position By contrast the inspection criterion Ipstep encoded in the partial stepper may fail toprovide a computed fragment tbull when sbull does not rewrite to tbull

Example 55

Consider the same rewrite rules and initial state f(bull1 b) of Example 52 By expanding f(bull1 b)wrt the inspection criterion Islice we get the computation tree fragment with tree edgesf(bull1 b)

r1rarr g(bull1) and f(bull1 b)r2rarr h(b) whereas the partial stepper only computes the tree edge

f(bull1 b)r1rarr g(bull1) as shown in Example 52

6 Implementation

The exploration methodology developed in this paper has been implemented in the Anima

tool which is publicly available at httpsafe-toolsdsicupvesanima The underlyingrewriting machinery of Anima is written in Maude and consists of about 150 Maude functiondefinitions (approximately 1600 lines of source code)

Anima also comes with an intuitive Web user inter-

Database

Anima Client

JAX-RS API

Initial State Rewriting LogicSpecification Animation

Anima Web Service

Anima Core

Figure 5 Anima architecture

face based on AJAX technology which allows usersto graphically display and animate computation treefragments The core exploration engine is specified asa RESTful Web service by means of the Jersey JAX-RS API

The architecture of Anima is depicted in Figure 5and consists of five main components Anima ClientJAX-RS API AnimaWeb Service Database and An-ima Core The Anima Client is purely implementedin HTML5 and JSP It represents the front-end layerof our tool and provides an intuitive versatile Webuser interface which interacts with the Anima Web Service to invoke the capabilities of theAnima Core and save partial results in the Database component

A screenshot that shows the Anima tool at work on the case study that is described inExample 54 is given in Figure 6

These are the main features provided by Anima

1 Inspection strategies The tool implements the three inspection strategies described inSection 5 As shown in Figure 6 the user can select a strategy by using the selectorprovided in the option pane

2 ExpandingFolding program states The user can expand or fold states by right-clicking onthem with the mouse and by selecting the ExpandFold Node options from the contextualmenu For instance in Figure 6 a state fragment on the frontier of the computed treehas been selected and is ready to be expanded through the Expand Node option

3 Selecting meaningful symbols State fragments can be specified by highlighting the statesymbols of interest either directly on the tree or in the detailed information window

16

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

GoGoGoGoGoBackBackBackBackBack Anima

Options

View

Rule Labels

State Labels

Zoom 100

- +

Interactive StepperInteractive StepperInteractive StepperInteractive StepperInteractive Stepper

Simple Advanced

ON OFF

ON Transition information from state to sbull1 sbull2

Rule

rl [reply] S lt- C Q amp [S] =gt [S] amp C lt- S f(S C Q)

amp [Cli-Abull7na]

bull amp [Cli-Abull7bull] amp bull

sbull0

req

bull amp (bull lt- Cli-A7) amp [Cli-Abull7na] amp bull

sbull1

reqdupl

bull amp (bull lt- Cli-A7) amp (bull

lt- Cli-A7) amp [Cli-Abull

7na] amp bull

sbull2 reply

[bull] amp (Cli-A lt- bullf(bullCl

i-A7))

amp bull

sbull3 loss

bull amp [Cli-Abull7na] amp bull

sbull4

Expand node

Fold node

Show full information

Show transition information

Expand view

Collapse view

Figure 6 Anima at work

4 Search mechanism The search facility implements a pattern language that allows stateinformation of interest to be searched on huge states and complex computation trees Theuser only has to provide a filtering pattern (the query) that specifies the set of symbols thatheshe wants to search for and then all the states matching the query are automaticallyhighlighted in the computation tree

5 Transition information Anima facilitates the inspection of a selected rewrite step s rarr tthat occurs in the computation tree by underlining its redex in s and the reduced subtermin t Some additional transition information is also displayed in the transition informa-tion window (eg the ruleequation applied the rewrite position and the computedsubstitution of the considered rewrite step) by right-clicking on the corresponding option

7 Conclusions

The analysis of execution traces plays a fundamental role in many program analysis approachessuch as runtime verification monitoring testing and specification mining We have presenteda parametrized exploration technique that can be applied to the inspection of rewriting logiccomputations and that can work in different ways Three instances of the parameterized ex-ploration scheme (an incremental stepper an incremental partial stepper and a forward traceslicer) have been formalized and implemented in the Anima tool which is a novel program an-imator for RWL The tool is useful for Maude programmers in two ways First it concretelydemonstrates the semantics of the language allowing the evaluation rules to be observed inaction Secondly it can be used as a debugging tool allowing the users to step forward andbackward while slicing the trace in order to validate input data or locate programming mis-takes

17

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

References

[1] M Alpuente D Ballis M Baggi and M Falaschi A FoldUnfold Transformation Frameworkfor Rewrite Theories extended to CCT In Proc 2010 ACM SIGPLAN Workshop on PartialEvaluation and Program Manipulation PEPM 2010 pages 43ndash52 ACM 2010

[2] M Alpuente D Ballis J Espert and D Romero Model-checking Web Applications with Web-TLR In Proc of 8th Intrsquol Symposium on Automated Technology for Verification and Analysis(ATVA 2010) volume 6252 of LNCS pages 341ndash346 Springer-Verlag 2010

[3] M Alpuente D Ballis J Espert and D Romero Backward Trace Slicing for Rewriting LogicTheories In Proc CADE 2011 volume 6803 of LNCSLNAI pages 34ndash48 Springer-Verlag 2011

[4] M Alpuente D Ballis F Frechina and D Romero Backward Trace Slicing for ConditionalRewrite Theories In Proc LPAR-18 volume 7180 of LNCS pages 62ndash76 Springer-Verlag 2012

[5] M Alpuente D Ballis F Frechina and J Sapina Slicing-Based Trace Analysis of RewritingLogic Specifications with iJulienne In Matthias Felleisen and Philippa Gardner editors Procof 22nd European Symposium on Programming ESOP 2013 volume 7792 of Lecture Notes inComputer Science pages 121ndash124 Springer 2013

[6] M Alpuente D Ballis and D Romero Specification and Verification of Web Applications inRewriting Logic In Formal Methods Second World Congress FM 2009 volume 5850 of LNCSpages 790ndash805 Springer-Verlag 2009

[7] M Baggi D Ballis and M Falaschi Quantitative Pathway Logic for Computational Biology InProc of 7th Intrsquol Conference on Computational Methods in Systems Biology (CMSB rsquo09) volume5688 of LNCS pages 68ndash82 Springer-Verlag 2009

[8] R Bruni and J Meseguer Semantic Foundations for Generalized Rewrite Theories TheoreticalComputer Science 360(1ndash3)386ndash414 2006

[9] M Clavel F Duran S Eker P Lincoln N Martı-Oliet J Meseguer and C Talcott MaudeManual (Version 26) Technical report SRI Intrsquol Computer Science Laboratory 2011 Availableat httpmaudecsuiucedumaude2-manual

[10] J Clements M Flatt and M Felleisen Modeling an Algebraic Stepper In Proc 10th EuropeanSymposium on Programming volume 2028 of LNCS pages 320ndash334 Springer-Verlag 2001

[11] F Duran and J Meseguer A Maude Coherence Checker Tool for Conditional Order-SortedRewrite Theories In Proc of 8th International Workshop on Rewriting Logic and Its Applications(WRLArsquo10) number 6381 in LNCS pages 86ndash103 Springer-Verlag 2010

[12] JW Klop Term Rewriting Systems In S Abramsky D Gabbay and T Maibaum editorsHandbook of Logic in Computer Science volume I pages 1ndash112 Oxford University Press 1992

[13] N Martı-Oliet and J Meseguer Rewriting Logic Roadmap and Bibliography Theoretical Com-puter Science 285(2)121ndash154 2002

[14] J Meseguer Conditional Rewriting Logic as a Unified Model of Concurrency Theoretical Com-puter Science 96(1)73ndash155 1992

[15] J Meseguer The Temporal Logic of Rewriting A Gentle Introduction In Concurrency Graphsand Models Essays Dedicated to Ugo Montanari on the Occasion of his 65th Birthday volume5065 pages 354ndash382 Berlin Heidelberg 2008 Springer-Verlag

[16] A Riesco A Verdejo R Caballero and N Martı-Oliet Declarative Debugging of RewritingLogic Specifications In Recent Trends in Algebraic Development Techniques 19th Intrsquol WorkshopWADT 2008 volume 5486 of LNCS pages 308ndash325 Springer-Verlag 2009

[17] A Riesco A Verdejo and N Martı-Oliet Declarative Debugging of Missing Answers for MaudeIn 21st Intrsquol Conference on Rewriting Techniques and Applications RTA 2010 volume 6 of LIPIcspages 277ndash294 Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik 2010

[18] TeReSe editor Term Rewriting Systems Cambridge University Press Cambridge UK 2003

18

Automatic Inference of Term Equivalence in

Term Rewriting Systems

Marco Comini1 and Luca Torella2

1 DIMI University of Udine Italymarcocominiuniudit

2 DIISM University of Siena Italylucatorellaunisiit

Abstract

In this paper we propose a method to automatically infer algebraic property-orientedspecifications from Term Rewriting Systems Namely having three semantics with suitableproperties given the source code of a TRS we infer a specification which consists of a setof most general equations relating terms that rewrite for all possible instantiations to thesame set of constructor terms

The semantic-based inference method that we propose can cope with non-constructor-based TRSs and considers non-ground terms Particular emphasis is put on avoiding thegeneration of ldquoredundantrdquo equations that can be a logical consequence of other ones

1 Introduction

In the last years there has been a growing interest in the research on automatic inference ofhigh-level specifications from an executable or the source code of a system This is probablydue to the fact that the size of software systems is growing over time and certainly one cangreatly benefit from the use of automatic tools There are several proposals like [1 7 6] whichhave proven to be very helpful

Specifications have been classified by their characteristics [8] It is common to distin-guish between property-oriented specifications and model-oriented or functional specificationsProperty-oriented specifications are of higher description level than other kinds of specificationsthey consist of an indirect definition of the systemrsquos behavior by stating a set of propertiesusually in the form of axioms that the system must satisfy [11 10] In other words a specifi-cation does not represent the functionality of the program (the output of the system) but itsproperties in terms of relations among the operations that can be invoked in the program (ieidentifies different calls that have the same behavior when executed) This kind of specifica-tions is particularly well suited for program understanding the user can realize non-evidentinformation about the behavior of a given function by observing its relation to other functionsMoreover the inferred properties can manifest potential symptoms of program errors which canbe used as input for (formal) validation and verification purposes

We can identify two mainstream approaches to perform the inference of specifications glass-box and black-box The glass-box approach [1] assumes that the source code of the programis available In this context the goal of inferring a specification is mainly applied to documentthe code or to understand it Therefore the specification must be more succinct and compre-hensible than the source code itself The inferred specification can also be used to automatethe testing process of the program or to verify that a given property holds [1] The black-boxapproach [7 6] works only by running the executable This means that the only informationused during the inference process is the input-output behavior of the program In this setting

19

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

the inferred specification is often used to discover the functionality of the system (or services ina network) [6] Although black-box approaches work without any restriction on the consideredlanguage ndash which is rarely the case in a glass-box approach ndash in general they cannot guaranteethe correctness of the results (whereas indeed semantics-based glass-box approaches can)

For this work we developed a (glass-box) semantic-based algebraic specification synthesismethod for the Term Rewriting Systems formalism that is completely automatic ie needsonly the source TRS to run Moreover the outcomes are very intuitive since specifications aresets of equations of the form e1 = e2 where e1 e2 are generic TRS expressions so the userdoes not need any kind of extra knowledge to interpret the results The underpinnings of ourproposal are radically different from other works for functional programming since the presenceof non-confluence or non-constructor-based TRSs poses several additional problems

11 Notations

We assume that the reader is familiar with the basic notions of term rewriting For a thoroughdiscussion of these topics see [9] In the paper we use the following notations V denotes a(fixed) countably infinite set of variables and T (ΣV) denotes the terms built over signatureΣ and variables V T (Σempty) are ground terms Substitutions over T (Σempty) are called groundsubstitutions Σ is partitioned in D the defined symbols and C the constructor symbols

T (CV) are constructor terms Substitutions over T (CV) are said constructor substitutionsC[t1 tn] denotes the replacement of t1 tn in context C A TRS R is a set of rules l rarr r

where l = f(t1 tn) l r isin T (ΣV) var(r) sube var(l) and f isin D t1 tn are the argumentpatterns of l rarr r and need not necessarily be in T (CV) unlike in functional programmingwhere only constructor-based TRSs are considered (with ti isin T (CV))

2 Many notions of equivalence

In the functional programming paradigm an equation e1 = e2 is typically interpreted as aproperty that holds for any well-typed constructor ground instance of the variables occurringin the equation Namely for all bindings of variables with well-typed (constructor ground)terms ϑ the constructor term computed for the calls e1ϑ and e2ϑ is the same In functionalprogramming we can consider only constructor instances because by having constructor-basedconfluent TRSs the set of values for non-constructor instances is the same as for constructorones

Differently from the functional programming case the TRS formalism admits variables ininitial terms and defined symbols in the patterns of the rules moreover rules are evaluatednon-deterministically and can rewrite to many constructor terms Thus an equation can beinterpreted in many different ways We will discuss the key points of the problem by means ofa (very simple) illustrative example

Example 21 Consider the following (non constructor based) TRS R where we provide a prettystandard definition of the arithmetic operations + - and (modulo)

0 + x -gt x x - 0 -gt x x s(y) -gt (x - s(y)) s(y)

s(x) + y -gt s(x+y) s(x) - s(y) -gt x - y (0 - s(x)) s(y) -gt y - x

Note that since the TRS formalism is untyped a term like 0 + a is admissible and is evaluatedto constructor term a

20

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

For this TRS one could expect to have in its property-oriented specification equations like

(x + y) + z = x + (y + z) (21)

x - (y + z) = (x - y) - z (22)

(x - y) - z = (x - z) - y (23)

0 + x = x (24)

x + 0 = x (25)

x + y = y + x (26)

These equations of the form e1 = e2 can be read as the (observable) outcomes of e1 are thesame of e2 The first essential thing is to formalize the meaning of ldquoobservable outcomesrdquo ofthe evaluation of an expression e (which contains variables) In the TRS formalism we haveseveral possible combinations First it is technically possible to literally interpret variables ine and decide to observe either the set of normal forms of e or the set of constructor terms ofe However as can be quickly verified only (24) is valid in either of these forms Indeedconsider for example terms x - (y + z) and (x - y) - z For both terms no rule can beapplied hence they are both (non constructor) normal forms and thus (22) is not literally validClearly this is quite a radical choice An interesting alternative would be to request that forany possible interpretation of variables with any term the expressions rewrite to the same setof constructor terms Formally by defining the rewriting behavior of a term t as

BJtRK ∶= ϑ sdot s∣ tϑETHrarrR

lowast s s isin T (CV) ϑ∶V rarr T (ΣV) dom(ϑ) sube var(t) (27)

we can interpret e1 = e2 as e1 =RB e2 ∶lArrrArr BJe1RK = BJe2RK In the following we call thisequivalence rewriting behavior equivalence Actually eqs (21) to (24) are valid wrt =RB

Note that if we would have chosen to use normal forms instead of constructor terms in (27)(ie s rarr instead of s isin T (CV)) then we would still have the same situation described beforewhere only (24) holds

The other equations (eqs (25) and (26)) are not valid in this sense For instance BJx + 0K =xt sdot si(0)∣tETHrarrlowast si(0) 1 while BJxK = xt sdot v∣tETHrarr

R

lowast v v isin T (CV) (and then ε sdot x isin BJxK ∖

BJx + 0K) These equations are not valid essentially because we have variables which cannotbe instantiated but if we consider ground constructor instancies which ldquotriggerrdquo in either terman evaluation to constructor terms then we actually obtain the same constructor terms Forexample for t1 = x and t2 = x + 0 for all ϑi = xsi(0) we have BJt1ϑiK = BJt2ϑiK = ε sdot si(0)∣Thus (25) holds in this sense

Decidedly also this notion of equivalence is interesting for the user We can formalize it ast1 =G t2 ∶lArrrArr forallϑ ground constructor BJt1ϑK cupBJt2ϑK sube ε sdot t∣t isin T (CV)rArr BJt1ϑK = BJt2ϑK Wewill call it ground constructor equivalence Note that =G is the only possible notion in the purefunctional paradigm where we can just have evaluations of ground terms and where we haveonly confluent constructor-based TRSs In this case the latter definition boils down to twoexpressions are equivalent if all its ground constructor instances rewrite to the same constructorterm This fact allows one to have an intuition of the reason why the problem of specificationsynthesis is definitively more complex in the full TRS paradigm

Since we do not consider only constructor-based TRSs there is another very relevant differ-ence wrt the pure functional case For instance let us consider the TRS Q obtained by addingthe rule g((x - y) - z) -gt x - (y + z) to TRS R of Example 21 Let t1 = x - (y + z)

1Here by si(0) we mean i repeated applications of s to 0 including the degenerate case for i = 0

21

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

and t2 = (x-y)-z We have BJt1QK = BJt2QK = x0 y0 z0 sdot 0xs(0) y0 z0 sdot s(0)xs(0) ys(0) z0 sdot 0xs(0) y0 zs(0) sdot 0 ∣ While the term g(t2) has this same be-havior BJg(t1)QK = empty

In general in the case of the TRS formalism terms embedded within a context do notnecessarily manifest the same behavior Thus it is also interesting to additionally ask to theequivalence notion =RB that the behaviors must be the same also when the two terms areembedded within any context Namely e1 =C e2 ∶lArrrArr forall contextC BJC[e1]RK = BJC[e2]RKWe call this equivalence contextual equivalence We can see that =C is (obviously) strongerthan =RB which is in turn stronger than =G Actually they are strictly stronger Indeed onlyeqs (21) and (24) are valid wrt =C (while eqs (22) and (23) are not)

We believe that all these notions are interesting for the user thus we formalize our notionof (algebraic) specification as follows

Definition 22 A specification S is a set of (sequences of) equations of the form t1 =K t2 =K =K tn with K isin CRB G and t1 t2 tn isin T (ΣV)

Thus for TRS Q we would get the following (partial) specification

(x + y) + z =C x + (y + z) 0 + x =C x

x - (y + z) =RB (x - y) - z (x - y) - z =RB (x - z) - y

x + y =G y + x x + 0 =G x

(x + y) z =G ((x z) + (y z)) z (x + y) y =G x y

(x - y) z =G (((x + z) z) - (y z)) z

In the following we present a first proposal of a semantics-based method that infers such spec-ifications for TRSs and tackles the presented issues (and discuss about its limitations) It isan adaptation for the TRS paradigm of ideas from [2] for the Functional Logic paradigm Thisadaptation is not straightforward since the Functional Logic paradigm is quite similar to theFunctional paradigm but considerably different from the TRS paradigm Moreover this worksignificantly extends the inference process by tackling equations like f(x y) = f(y x) which arereally important

3 Deriving specifications from TRSs

The methodology we are about to present is parametric wrt three semantics evaluation func-tions which need to enjoy some properties Namely

ERBJt RK gives the rewriting behavior (RB) semantics of term t with (definitions from) TRSR This semantics has to be fully abstract wrt rewriting behavior equivalence Namelywe require that ERBJt1 RK = ERBJt2 RK lArrrArr t1 =RB t2

EC Jt RK gives the contextual (C) semantics of the term t with the TRS R This semantics hasto be fully abstract wrt contextual equivalence Namely EC Jt1 RK = EC Jt2 RK lArrrArrt1 =C t2

EGJt RK gives the ground (G) semantics of the term t with the TRS R This semanticshas to be fully abstract wrt ground constructor equivalence Namely EGJt1 RK =EGJt2 RK lArrrArr t1 =G t2

22

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

The idea underlying the process of inferring specifications is that of computing the semanticsof various terms and then identify all terms which have the same semantics However not allequivalences are as important as others given the fact that many equivalences are simplelogical consequences of others For example if ti =C si then for all constructor contexts CC[t1 tn] =C C[s1 sn] thus the latter derived equivalences are uninteresting and shouldbe omitted Indeed it would be desirable to synthesize the minimal set of equations from whichby deduction all valid equalities can be derived This is certainly a complex issue in testingapproaches With a semantics-based approach it is fairly natural to produce just the relevantequations The (high level) idea is to proceed bottom-up by starting from the evaluation ofsimpler terms and then newer terms are constructed (and evaluated) by using only semanticallydifferent arguments Thus by construction only non-redundant equations are produced

There is also another source of redundancy due to the inclusion of relations =K For examplesince =C is the finer relation t =C s implies t =RB s and t =G s To avoid the generation of coarserredundant equations a simple solution is that of starting with =C equivalences and once theseare all settled to proceed only with the evaluation of the =RB equivalences of non =C equivalentterms Thereafter we can evaluate the =G equivalences of non =RB equivalent terms

Clearly the full computation of a programsrsquo semantics is not feasible in general For themoment for the sake of comprehension we prefer to present the conceptual framework leavingout of the picture the issues related to decidability We will show a possible decidable instanceof the method in Section 31

Let us describe in more detail the specification inference process The input of the processconsists of a TRS to be analyzed and two additional parameters a relevant API Σr and amaximum term size max size The relevant API allows the user to choose the operations inthe program that will be present in the inferred specification whereas the maximum term sizelimits the size of the terms in the specification As a consequence these two parameters tunethe granularity of the specification both making the process terminating and allowing the userto keep the specification concise and easy to understand

The output consists of a set of equations represented by equivalence classes of terms (withdistinct variables) Note that inferred equations may differ for the same program dependingon the considered API and on the maximum term size Similarly to other property-orientedapproaches the computed specification is complete up to terms of size max size ie it includesall the properties (relations) that hold between the operations in the relevant API and that areexpressible by terms of size less or equal than max size

Terms are classified by their semantics into a data structure which we call classificationconsisting (conceptually) of a set of equivalence classes (ec) formed by

bull sem(ec) the semantics of (all) the terms in that classbull rep(ec) the representative term of the class (rep(ec) isin terms(ec))bull terms(ec) the set of terms belonging to that equivalence classbull epoch(ec) an integer to record the moment of introduction of that equivalence class

The representative term is the term which is used in the construction of nested expressionswhen the equivalence class is considered To output smaller equations it is better to choose thesmallest term in the class (wrt the function size) but any element of terms(ec) can be used

The inference process consists of successive phases one for each kind of equality (in orderof discriminating power ie C RB G) as depicted in Figure 1

Computation of the initial classification (epochs 0 and 1) The first phase of the algo-rithm is the computation of the initial classification that is needed to compute the classificationwrt =C We initially create a classification which contains

23

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

Inference Process

Computation of the initial classification

Generation of =C -classification

Generation of =RB -classification

Generation of =G -classification

Generation of =C -equations

Generation of =RB -equations

Generation of =G -equations

Specification

TRS

Program

API

max size

Figure 1 A general view of the inference process

bull one class for a free (logical) variable ⟨EC JxK x x 0⟩bull the classes for any constructor symbol ie for all cn

2 isin C and x1 xn distinct variables

⟨EC JtK t t 0⟩ where t = c(x1 xn)

Then for all symbols fn of the relevant API Σr and distinct variables x1 xn we add

to classification the term t = f(x1 xn) with semantics s = EC Jt RK and epoch m = 1This operation denoted addEC (t sm) is the most delicate part of the method If we wouldnot consider the generation of ldquopermutedrdquo equations like f(x y) = f(y x) then the wholeactivity would just boil down to look for the presence of s in some equivalence class and thenupdating the classification accordingly (like in [2]) Handling of permutations cannot be done bynaıvely adding all (different) permutations of s In this way we would generate many redundantequations Consider for instance the TRS Q

f(abc) -gt 0

f(bac) -gt 0

f(acb) -gt 0

f(bca) -gt 0

f(cab) -gt 0

f(cba) -gt 0

From the minimal set f(x y z) =C f(y x z) =C f(x z y) we can generate all other valid per-mutations like f(x y z) =C f(y z x) =C f(z x y) Thus in this case we should only generatepermutated equations where we just swap two variables However for the TRS R

f(abc) -gt 0 f(bca) -gt 0 f(cab) -gt 0

f(x y z) neC f(y x z) neC f(x z y) but f(x y z) =C f(y z x) Moreover f(x y z) =C f(z x y)can be deduced by this Thus in this case we should only generate permutated equations witha rotation of three variables since all other rotations of three variables are just a consequence

Thus not all permutations have to be considered while adding a semantics to a classificationand it is not necessary to look for all permutations within the semantics already present in theclassification To generate only a minimal set of necessary permutated equations we need toconsider for each k variables a set Πn

k of generators of the permutations of n variables whichdo not move n minus k variables (note that Πn

1 = id ) Then for a term t = f(x1 xn) westart sequentially for i from 1 to n and look if for some π isin Πn

i we have an equivalence classec in the current classification whose semantics coincides with sπ (ie ec = ⟨sπ tprime T mprime⟩) Ifit is found then the term tπminus1 is added to the set of terms in ec (ie ec is transformed inecprime = ⟨sπ tprime T cup tπminus1 mprime⟩) and we stop Otherwise we iterate with next i If all fails a newequivalence class ⟨s t T m⟩ has to be created but we have to determine the right term set

2Following the standard notation fn denotes a function f of arity n

24

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

T (to possibly generate equations like f(x y) = f(y x)) We initially start with T = t andj = n and sequentially for i from 2 to j we check if for some π isin Πj

i we have s = sπ If wefind it we add tπ to T and decrement j by i minus 1 (i variables are now used in a valid equationand thus from this moment on i minus 1 variables have no longer to be considered) Otherwise wecontinue with next i The final T is used for the new equivalence class

For example for t = f(x y z) in TRS Q we start with variables x y z and T = t Nowconsider for instance π = (xy) isin Π3

2 Since EC JtK = EC JtπK then T = f(x y z) f(y x z)and then we drop x and remain with variables y z Now we have only πprime = (y z) isin Π2

2 andsince EC JtK = EC JtπprimeK then T = f(x y z) f(y x z) f(x z y) we drop y and (thus) finishInstead for t = f(x y z) in TRS R we start with variables x y z and T = t Now considerfor instance π1 = (xy) isin Π3

2 Since EC JtK ne EC Jtπ1K then we consider π2 = (y z) isin Π3

2 and sinceEC JtK ne EC Jtπ2K we increase i Now we have only π3 = (xy z) isin Π3

3 and since EC JtK = EC Jtπ3Kthen T = f(x y z) f(y z x) we drop x y and (thus) finish

Generation of =C classification (epochs 2 and above) The second phase of the algo-rithm is the (iterative) computation of the successive epochs until we complete the constructionof the classification of terms wrt =C At each iteration (with epoch k) for all symbols fnof the relevant API Σr we select from the current classification all possible combinations of nequivalence classes ec1 ecn such that at least one eci was newly produced in the previousiteration (ie whose epoch is k minus 1) We build the term t = f(rep(ec1) rep(ecn)) whichby construction has surely not been considered yet Then if size(t) le max size we computethe semantics s = EC Jt RK and update the current classification by adding to classification theterm t and its semantics s (addEC (t s k)) as described before

If we have produced new equivalence classes then we continue to iterate This phase eventu-ally terminates because at each iteration we consider by construction terms which are differentfrom those already existing in the classification and whose size is strictly greater than the sizeof its subterms (but the size is bounded by max size)

The following example illustrates how the iterative process works

Example 31 Let us use the program R of Example 21 and choose as relevant API the func-tions + - and In the first step the terms

t11 = x + y t12 = x - y t13 = x y

are built Since (all permutations of) the semantics of all these terms are different and differentfrom the other semantics already in the initial classification three new classes are added to theinitial classification

During the second iteration the following two terms (among others) are built

bull the term t21 = (xrsquo + yrsquo) + y is built as the instantiation of x in t11 with (a renamedapart variant of) t11 and

bull the term t22 = x + (xrsquo + yrsquo) as the instantiation of y in t11 with t11

The semantics of these two terms is the same s but it is different from the semantics of theexisting equivalence classes Thus during this iteration (at least) the new equivalence classecprime ∶= ⟨s t21 t21 t22 n⟩ is computed Hereafter only the representative of the class will beused for constructing new terms Since we have chosen t21 instead of t22 as the representativeterms like (x + (xrsquo + yrsquo)) z will never be built

Thanks to the closedness wrt context of the semantics this strategy for generating terms issafe In other words when we avoid to build a term it is because it is not able to produce a

25

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

behavior different from the behaviors already included by the existing terms thus we are notlosing completeness

Generation of the =C specification Since by construction we have avoided much redun-dancy thanks to the strategy used to generate the equivalence classes we now have only to takeeach equivalence class with more than one term and generate equations for these terms

Generation of =RB equations The third phase of the algorithm works on the former clas-sification by first transforming each equivalence class ec by replacing the C-semantics sem(ec)with ERBJrep(ec) RK and terms(ec) with the (singleton) set rep(ec) After the transforma-tion some of the previous equivalence classes which had different semantic constructor termsmay now have the same RB -semantics and then we merge them making the union of the termsets terms(ec)

Thanks to the fact that before merging all equivalence classes were made of just singletonterm sets we cannot generate (again) equations t1 =RB t2 when an equation t1 =C t2 had beenalready issued Let us clarify this phase by an example

Example 32 Assume we have a classification consisting of three equivalence classes with C-semantics s1 s2 and s3 and representative terms t11 t22 and t31

ec1 = ⟨s1 t11t11 t12 t13⟩ ec2 = ⟨s2 t22t21 t22⟩ ec3 = ⟨s3 t31t31⟩

We generate equations t11 =C t12 =C t13 and t21 =C t22Now assume that ERBJt11K = w0 and ERBJt22K = ERBJt31K = w1 Then (since t12 t13 and

t21 are removed) we obtain the new classification

ec4 = ⟨w0 t11 t11 n⟩ ec5 = ⟨w1 t22 t22 t31 n⟩

Hence the only new equation is t22 =RB t31 Indeed equation t11 =RB t12 is uninterestingsince we already know t11 =C t12 and equation t21 =RB t31 is redundant (because t21 =C t22 andt22 =RB t31)

The resulting (coarser) classification is then used to produce the =RB equations as donebefore by generating equations for all non-singletons term sets

Generation of the =G equations In the last phase we transform again the classificationby replacing the RB -semantics with the G-semantics (and terms(ec) with the set rep(ec))Then we merge eventual equivalence classes with the same semantics and finally we generate=G equations for non singleton term sets

Theorem 33 (Correctness) For all equations e1 = e2 generated in the second third andforth phase we have that e1 =C e2 e1 =RB e2 and e1 =G e2 respectively

Proof By construction of equivalence classes in the second phase an equation t1 = t2 isgenerated if and only if the semantics EC Jt1 RK = EC Jt2 RK Then since EC Jt1 RK =EC Jt2 RK lArrrArr t1 =C t2 the first part of thesis follows immediately Then by the succes-sive trasformation and reclassification in the third phase we issue an equation t1 = t2 if andonly if ERBJt1 RK = ERBJt2 RK Then since ERBJt1 RK = ERBJt2 RK lArrrArr t1 =RB t2 we havethe second part of thesis The proof of the third part of thesis since EGJt1 RK = EGJt2 RK lArrrArrt1 =G t2 is analogous

26

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

Example 34 Let us recall (again) the programR of Example 21 The terms x + y and y + xbefore the transformation belong to two different equivalence classes (since their rewritingbehavior is different) Anyway after the transformation the two classes are merged since theirG-semantics is the same namely x0 y0 sdot 0xs(0) y0 sdot s(0)x0 ys(0) sdot s(0) ∣

We now present some examples to show how our proposal deals with non-contructor basedor non-confluent TRS plus some to show that we can infer several non-trivial equations

Example 35 Consider the definition for the boolean data type with constructor terms trueand false and boolean operations and or not and imp

and(true x) -gt x

and(false x) -gt false

or(true x) -gt true

or(false x) -gt x

not(true) -gt false

not(false) -gt true

imp(false x) -gt true

imp(true x) -gt x

This is a pretty standard ldquoshort-cutrdquo definition of boolean connectives With our method weget the following equations

not(or(xy)) =C and(not(x)not(y)) imp(xy) =C or(not(x)y)

not(and(xy)) =C or(not(x)not(y)) not(not(x)) =G x

and(xand(yz)) =C and(and(xy)z) and(xy) =G and(yx)

Example 36 Let us consider the following non-constructor based TRS implementing someoperations over the naturals in Peano notation

x - 0 -gt x

s(x) - s(y) -gt x - y

g(x) -gt chk(x - s(x))

chk(0) -gt 0

chk(s(x)) -gt s(x)

chk(0 - s(x)) -gt err

The definition of - is a standard definition of the minus operation over naturals The chk

function simply returns the natural passed as argument or returns err if the argument is anot defined subtraction It is easy to see that the TRS is not constructor-based because ofthe presence of the - in the pattern of a rule The artificial function g which checks if thesubtraction of a number by its successor is a natural number is doomed to return err Withour classification we actually derive equation g(x) =C err

Example 37 Let us consider the following (artificial) non-orthogonal TRS

coin -gt 0

coin -gt 1

d(x) -gt g(xx)

g(01) -gt true

t(x) -gt k(xxx)

k(101) -gt true

The coin function can return both 0 and 1 The functions d and t call an auxiliary functionduplicating and triplicating (respectively) the variable received as argument Functions f andg require a specific combination of 0 and 1 to return the constructor term true Notice thatto reach the constructor term true from d and t respectively it is necessary to use a nondeterministic function able to rewrite to both 0 and 1 Some of the inferred equations for thisTRS are t(x) =C d(x) and t(coin) =C g(coincoin) =C k(coincoincoin) =C d(coin)

27

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

Example 38 Let us consider the following TRS that computes the double of numbers inPeano notation

double (0) -gt 0

double(s(x)) -gt s(s(double(x)))

dbl(x) -gt plus(xx)

plus(0y) -gt y

plus(s(x)y) -gt s(plus(xy))

Some of the inferred equations for the TRS are

dbl(dbl(double(x))) =G dbl(double(dbl(x))) (31)

double(x) =G dbl(x) (32)

dbl(dbl(x)) =G dbl(double(x))=Gdouble(dbl(x)) =G double(double(x)) (33)

plus(double(x)y) =G plus(dbl(x)y) (34)

We can observe that all equations hold with the =G relation and not with the =RB relationThis is due to the fact that the two functions dbl and dbl even if at a first sight could seemto evaluate the same constructor terms can behave differently For instance if we add to theTRS the two rules coin -gt 0 and coin -gt s(0) we can notice that the terms double(coin)and dbl(coin) return different constructor terms This is due to the non determinism ofthe coin function that exploits the right non-linearity of function dbl While double(coin)

evaluates to 0 and s(s(0)) the term dbl(coin) can be reduced even to s(0) (by dbl(coin)

rarr plus(coincoin) rarr2 plus(0s(0)) rarr s(0))This characteristic of the program is not easy to realize by just looking at the code

Example 39 Let us consider the following TRS defining two functions over an extension ofthe Peano notation able to handle negative integers

abs(-(x)) -gt abs(x)

abs(s(x)) -gt s(x)

abs(0) -gt 0

f(-(-(x))) -gt f(x)

f(0) -gt 0

f(s(x)) -gt s(x)

f(-(s(x))) -gt 0

Function abs is a standard definition of the absolute value function f returns its input if it isa positive number and 0 if it is not Some of the inferred equations are f(f(x)) =C abs(f(x))

and f(abs(x)) =C abs(abs(x))

Example 310 Let us consider the following program which implements a two-sided queue in a(non-trivial) efficient way The queue is implemented as two lists where the first list correspondsto the first part of the queue and the second list is the second part of the queue reversed Theinl function adds the new element to the head of the first list whereas the inr function addsthe new element to the head of the second list (the last element of the queue) The outl (outr)function drops one element from the left (right) list unless the list is empty in which case itreverses the other list and then swaps the two lists before removal

new -gt Q(Nil Nil)

inl(xQ(xs ys)) -gt Q((xxs)ys)

inr(xQ(xs ys)) -gt Q(xs (xys))

outl(Q(Nil ys)) -gt

Q(tail(rev(ys))Nil)

outl(Q((xxs)ys)) -gt Q(xsys)

outr(Q(xs Nil)) -gt

Q(Nil tail(rev(xs)))

outr(Q(xs (yys))) -gt Q(xsys)

null(Q((xxs)ys)) -gt False

null(Q(Nil (xxs))) -gt False

null(Q(Nil Nil)) -gt True

28

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

tail ((xxs)) -gt xs

rev(xs) -gt rv rsquo(xs Nil)

rv rsquo(Nil ys) -gt ys

rv rsquo((xxs)ys) -gt rv rsquo(xs (xys))

With our method (amongst others) we derive

null(new) =C True (35)

new =C outl(inl(xnew)) =C outr(inr(xnew)) (36)

outl(inl(xq)) =C outr(inr(xq)) (37)

inr(xinl(yq)) =C inl(yinr(xq)) (38)

inl(xoutl(inl(yq))) =C outr(inl(xinr(yq))) (39)

null(inl(xnew)) =C null(inr(xnew)) =C False (310)

We can see different kinds of non-trivial equations eqs (36) and (37) state that adding andremoving one element produces always the same result independently from the side in which weadd and remove it Equations (38) and (39) show a sort of restricted commutativity betweenfunctions

31 An effective instance of the presented method

In a semantics-based approach one of the main problems to be tackled is effectiveness Thesemantics of a program is in general infinite and thus some approximation has to be used inorder to have a terminating method To experiment on the validity of our proposal we startedby using a novel (condensed) fixpoint semantics which we have developed for left-linear TRSsthat is fully abstract wrt =C

3 Such semantics is defined as the fixpoint of an immediateconsequences operator P JRK We have opted for this semantics because it has some propertieswhich are very important from a pragmatical point of view

bull it is condensed meaning that denotations are the smallest possible (between all thosesemantics which induce the same program equivalence) This is a very relevant (if notessential) feature to develop a semantic-based tool which has to compute the semantics

bull The semantics ERB can be obtained directly by transforming the EC semantics concretelyjust by loosing internal structure Therefore no (costly) computation of ERB is needed

We have implemented the basic functionality of the proposed methodology in a prototype writ-ten in Haskell TRSynth available at httpsafe-toolsdsicupvestrsynth (for a detaileddescription see [4]) The implementation of =G equality is still ongoing work because we arelacking of a suitable implementation of the G-semantics

To achieve termination the prototype computes a fixed number k of steps of P JRK Thenit proceeds with the classification as described in Section 3 Clearly in presence of terms withinfinite solutions with such a rough approximation we may loose both correctness (by mis-takenly equating terms which become semantically different after k iterates) and completeness(by mistakenly not equating terms which will become semantically equivalent) Neverthelessthe results are encouraging For instance TRSynth detects all =C and =RB which we showed inexamples (except of Example 38 because of a bug in the computation of the semantics)

3The writing of articles related to the formal definition of this semantics is in progress [3]

29

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

4 Conclusions and future work

This paper discusses about the issues that arise for the automatic inference of high-levelproperty-oriented (algebraic) specifications because of non-confluent or non-constructor basedTRS Then a first proposal which overcomes these issues is presented

Our method computes a concise specification of program properties from the source code ofa TRS We hope to have convinced the reader (with all examples) that we reached our maingoal that is to get a concise and clear specification (that is useful for the programmer in orderto discover unseen properties or detect possible errors)

We have developed a prototype that implements the basic functionality of the approach Weare aware that many other attempts to guarantee termination could be used in other instanciesof the presented method Certainly given our know-how in the future we will experiment withabstractions obtained by abstract interpretation [5] (our novel semantics itself has been obtainedas an abstract interpretation) Actually we already have an ongoing work to implement thedepth(k) abstract version of our semantics In the depth(k) abstraction terms (occurring in thenodes of the semantic trees) are ldquocutrdquo at depth k by replacing them with cut variables distinctfrom program variables Hence for a given signature Σ the universe of abstract semantic treesis finite (although it increases exponentially wrt k) Therefore the finite convergence of thecomputation of the abstract semantics is guaranteed

References

[1] G Ammons R Bodık and J R Larus Mining specifications In 29th ACM SIGPLAN-SIGACTsymposium on Principles of programming languages (POPLrsquo02) pages 4ndash16 New York NY USA2002 Acm

[2] G Bacci M Comini M A Feliu and A Villanueva Automatic Synthesis of Specifications forFirst Order Curry Programs In Proceedings of the 14th symposium on Principles and practice ofdeclarative programming pages 25ndash34 New York NY USA 2012 ACM

[3] M Comini and L Torella A Condensed Goal-Independent Fixpoint Semantics Modeling theSmall-Step Behavior of Rewriting Technical Report DIMI-UD012013RR Dipartimento diMatematica e Informatica Universita di Udine 2013

[4] M Comini and L Torella TRSynth a Tool for Automatic Inference of Term Equivalence inLeft-linear Term Rewriting Systems In E Albert and S-C Mu editors PEPM rsquo13 Proceedingsof the ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation pages 67ndash70Acm 2013

[5] P Cousot and R Cousot Abstract Interpretation A Unified Lattice Model for Static Analysisof Programs by Construction or Approximation of Fixpoints In Proceedings of the 4th ACMSIGACT-SIGPLAN symposium on Principles of programming languages Los Angeles CaliforniaJanuary 17ndash19 pages 238ndash252 New York NY USA 1977 ACM Press

[6] C Ghezzi A Mocci and M Monga Synthesizing intensional behavior models by graph trans-formation In 31st International Conference on Software Engineering (ICSErsquo09) pages 430ndash4402009

[7] J Henkel C Reichenbach and A Diwan Discovering Documentation for Java Container ClassesIEEE Transactions on Software Engineering 33(8)526ndash542 2007

[8] A A Khwaja and J E Urban A property based specification formalism classification TheJournal of Systems and Software 832344ndash2362 2010

[9] TeReSe editor Term Rewriting Systems Cambridge University Press Cambridge UK 2003

[10] H van Vliet Software EngineeringndashPrinciples and Practice John Wiley 1993

[11] J M Wing A specifierrsquos introduction to formal methods Computer 23(9)10ndash24 1990

30

A Condensed Goal-Independent Fixpoint

Semantics Modeling the Small-Step Behavior of

Rewriting

Marco Comini1 and Luca Torella2

1 DIMI University of Udine Italy mdash marcocominiuniudit

2 DIISM University of Siena Italy mdash lucatorellaunisiit

Abstract

In this paper we present a novel condensed narrowing-like semantics that contains theminimal information which is needed to describe compositionally all possible rewritings ofa term rewriting system We provide its goal-dependent top-down definition and moreimportantly an equivalent goal-independent bottom-up fixpoint characterization

We prove soundness and completeness wrt the small-step behavior of rewriting forthe full class of term rewriting systems

1 Introduction

Nowadays the formalism of Term Rewriting Systems (TRSs) is used besides for functionalprogramming also for many other applications (like specification of communication protocolsto mention one) There has been a lot of research on the development of tools for the formalverification and (in general) automatic treatmentmanipulation of TRSs Within the proposalsthere are semantics-based approaches which can guarantee correctness by construction How-ever they cannot employ directly the construction of the semantics since in general it is infiniteThus some kind of approximation has to be used

Given the potentiality of application of the TRS formalism we have turned our attentiontoward the development of semantics-based TRS manipulation tools with the intention to useAbstract Interpretation theory as fundament to devise semantics approximations correct byconstruction However as also noted by [9] defining a suitable (concrete) semantics is usuallythe first crucial step in adapting the general methodology of Abstract Interpretation to thesemantic framework of the programming language at hand When a concrete semantics isused to define via abstract interpretation abstract (approximate) semantics to be employedto develop semantics-based manipulation tools it is particularly relevant if it is condensedand defined compositionally In the literature a semantics is said to be condensing when thesemantics of an instance of an expression (term goal call) can be obtained with a semanticoperation directly from the semantics of the (un-instantiated) expression In such a situationonly the semantics for most general expressions can be maintained in denotations We saythat a semantics is condensed when the denotations themselves do not contain redundancy iewhen it is not possible to semantically derive the components of a denotation from the othercomponents Indeed the abstract semantics operations which are obtained from a condensedconcrete semantics involve the use of the join operation (of the abstract domain) at each iterationin parallel onto all components of rules instead of using several subsequent applications for allcomponents This has a twofold benefit On one side it speeds up convergence of the abstractfixpoint computation On the other side it considerably improves precision

In [2] we developed an automatic debugging methodology for the TRS formalism based onabstract interpretation of the big-step rewriting semantics that is most commonly considered

31

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

in functional programming ie the set of constructor termsnormal forms However theresulting tool was inefficient The main reason for this inefficiency is because the chosen concretesemantics is not condensing and thus because of its accidental high redundancy it causes thealgorithms to use and produce much redundant information at each stage In contrast thesame methodology gave good results in [5] because it was applied to a condensed semantics

The constructor termsnormal forms semantics is not condensed because it contains allpossible rewritings but there are many possible rewritings which can be obtained by someother ones since rewriting is closed under substitution (stability) and replacement (t ETHrarr

R

lowast s

implies C[t]p ETHrarrR

lowast C[s]p) Thus in [1] we tried to directly devise a semantics fully abstract

wrt the big-step rewriting semantics with the specific objective to avoid all redundancy whilestill characterizing the rewritings of any term In particular we searched a semantics which

bull has a compositional goal-independent definitionbull is the fixpoint of a bottom-up constructionbull is as condensed as possible

Unfortunately (in [1]) we just partially achieved this goal since the semantics is defined only forsome classes of TRSs In the meantime for a (quite) different language in [4 3] we obtainedmdashfor the full languagemdasha semantics with the mentioned characteristics by following a differentapproach

1 Define a denotation fully abstract wrt the small-step behavior of evaluation of expres-sions which enjoys the mentioned properties

2 Obtain by abstraction of this small-step semantics a denotation (which enjoys the men-tioned properties) correct wrt the big-step behavior

This approach has the additional advantage that the small-step semantics can be reused alsoto develop other semantics more concrete than the big-step one (for instance semantics whichcan model functional dependencies that are suitable to develop pre-post verification methods)

Unfortunately in the case of the TRS formalism we do not have a suitable small-step se-mantics to start with For Curry we defined the small-step semantics by collecting just themost general traces of the small-step operational semantics which correspond (in our case) tothe rewriting derivations of the terms f(x1 xn) The problem is that we cannot obtainjust from the traces of all f(x1 xn) the rewriting derivations of all (nested) terms withoutusing again (directly or indirectly) the rewriting mechanism In fact usually f(x1 xn) isimmediately a normal form because we cannot instantiate variables however there are manyinstances which can trigger the rules Narrowing [7] can seem a possible solution to this prob-lem but we have an issue related to the interference of non-confluence (ie non-determinism)with non-linearity as shown by this example

Example 11Let us consider the following TRS R

coin rarr Tail Head ne Tail rarr True diff (x)rarr x ne xcoin rarrHead Tail ne Head rarr True

We have rewriting derivations diff (x) ETHrarr x ne x ↛ diff (Head) ETHrarr Head ne Head ↛ diff (Tail) ETHrarrTail ne Tail ↛ while diff (coin)ETHrarrlowast True Moreover we have the narrowing derivation diff (x) ε

x ne x 32

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

Narrowing can instantiate variables (according to rules) but a variable is instantiated with thesame term in all of its occurrences (it would make little sense to do differently for a top-downresolution mechanism) However Example 11 shows that it is not possible to retrieve thatdiff (coin) ETHrarrlowast True from all possible narrowing derivations of diff (x) since the only narrowingderivation (of diff (x)) does not reach True

In this paper we define a variation of narrowing (linearizing narrowing) which admits dif-ferent instances of variables with multiple occurrences With linearizing narrowing we definea denotation fully abstract wrt the small-step behavior of rewriting which enjoys the men-tioned properties for generic TRSs without restrictions The outline to achieve this is thefollowing

bull We gather all linearizing narrowing derivations into trees (Definition 310)bull We show that all possible rewritings can be reconstructed from linearizing narrowing trees(Theorem 314)

bull We define top-down condensed denotations OJRK by collecting just the linearizing nar-rowing trees of most general terms (f(ETHrarrxn)) and we prove that with a suitable semanticevaluation function E we can reconstruct any linearizing narrowing tree starting from

OJRK (Theorem 323)bull By using E we define a (bottom-up) immediate consequence operator whose least fixpointF JRK is equal to OJRK (Theorem 330) Thus from F JRK we can reconstruct all possiblerewritings of R and we have full abstraction wrt the rewriting behavior (Corollary 331)

Note that the proofs of all results are in the appendix

2 Preliminaries

We assume that the reader is familiar with the basic notions of term rewriting For a thoroughdiscussion of these topics see [10] In the paper we use the following notions and notations

We writeETHrarron for the list of syntactic objects o1 on Given a monotonic function F ∶ Lrarr Lover lattice L whose bottom is and lub is ⊔ by F uarrk we denote function λxF k(x) and byF uarrω function λx⊔F k(x)∣k isin N By lfp(F ) we denote the least fixed point of F (and recallthat for a continuos F lfp(F ) = F uarrω)Terms and Substitutions

Σ denotes a signature and V denotes a (fixed) countably infinite set of variables T (ΣV)denotes the terms built over signature Σ and variables V Σ is partitioned in D the definedsymbols (also called operations) and C the constructor symbols (also called data constructors)

T (CV) are called constructor terms The set of variables occurring in a term t is denoted byvar(t) while the sequence (in order) of variables occurring in a term t is denoted by ETHrarrvar(t) Aterm is linear if it does not contain multiple occurrences of any variable LT (ΣV) denotes theset of linear terms

t∣p denotes the subterm of t at position p and t[s]p denotes the result of replacing thesubterm t∣p by the term s

Given a substitution ϑ = x1t1 xntn we denote by dom(σ) and range(σ) the domainset x1 xn and the range set ⋃n

i=1 var(ti) respectively The identity substitution is denotedby ε By tσ we denote the application of σ to t σV denotes the restriction of substitution σto set V sube V σϑ denotes the composition of ϑ and σ ie the substitution st x(σϑ) = (xσ)ϑfor any x isin V Given two substitutions ϑ1 and ϑ2 and two terms t1 and t2 we say that ϑ1

33

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

(respectively t1) is more general than ϑ2 (respectively t2) denoted ϑ1 ⪯ ϑ2 (respectively t1 ⪯ t2)if and only if there exists a substitution σ st ϑ1σ = ϑ2 (respectively t1σ = t2) We denote by≃ the induced equivalence ie ϑ ≃ σ if and only if there exists a renaming ρ st ϑρ = σ (andσρminus1 = ϑ) With σ uarr σprime we indicate the lub (wrt ⪯) of σ and σprime

A substitution ϑ is an unifier for terms t and s if tϑ = sϑ t and s unifyare unifiable whenthere exists a unifier A unifier σ for t and s is a most general unifier denoted as σ =mgu(t s)when σ ⪯ ϑ for any unifier ϑ of t and s

Rewriting

A term rewriting system (TRS for short) R is a set of rules l rarr r where l r isin T (ΣV) var(r) subevar(l) l = f(t1 tn) and f isin D t1 tn are the argument patterns of l rarr r and neednot necessarily be in T (CV) unlike in functional programming where only constructor-basedTRSs are considered (ie with ti isin T (CV)) We denote by RΣ the set of all TRSs defined onsignature Σ

Given TRS R a rewrite step tpETHrarrR

tprime is defined if there are a position p in t l rarr r isin R and

a substitution η with dom(η) sube var(l) such that t∣p = lη and tprime = t[rη]p As usual we omit towrite position p when it is not relevant and omit R when is clear from the context Moreoverwe use ETHrarrlowast to denote the transitive and reflexive closure of the rewriting relation ETHrarr

A term t is called a normal form denoted by t↛ if there is no term s such that tETHrarrlowast sA substitution x1t1 xntn is R-normalized (wrt a TRS R) if all ti are normal forms

(which trivially includes the case when ti isin T (CV))Full Narrowing

In the paper with s≪X we denote a renamed apart variant s of an element belonging to a setof syntactic objects X ie a renaming of variable names of some x isin X that does not containvariables that appear in the context of the definition where s ≪ X is used (this is also calledldquousing fresh variables names in srdquo)

The combination of variable instantiation and rewriting is called narrowing [7] Formally a

(full) narrowing step tσp

Rtprime is defined if there is a position p in t l rarr r ≪R and σ =mgu(t∣p l)

such that t∣p notin V and tprime = (t[r]p)σ In such a case we have that tσpETHrarrR

tprime Again we omit to

write position p when it is not relevant and omit R when is clear from the contextt denotes that there is no term s such that t s

3 Modeling the small-step rewriting behavior

In this section we introduce the concrete semantics which is suitable to model the small-steprewriting behavior In order to formally state such relationship we first need to formally definethe concept of small-step rewriting behavior

Definition 31 (Rewriting behavior) Given t0 isin T (ΣV) and R isin RΣ the small-step rewrit-ing behavior of t0 in R is

BssJt0 in RK ∶= t0 ETHrarrR

t1 ETHrarrR⋯ETHrarrR

tnminus1 ETHrarrR

tn∣forallti isin T (ΣV) (31)

and the small-step rewriting behavior of R is BssJRK ∶= ⋃tisinT (ΣV)BssJt in RK

34

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

This notion of observable behavior induces the definition of TRS equivalence

forallR1 R2 isin RΣR1 asympss R2 ∶lArrrArr BssJR1 K = BssJR2 K (32)

Thanks to the following property we can restrain the check of Bss equivalence of two TRSs tolinear terms Moreover in the sequel we will also restrict our attention only to denotations forlinear terms

Proposition 32 Let R1 R2 isin RΣ Then R1 asympss R2 lArrrArr R1 is a variant of R2 lArrrArr forallt isinLT (ΣV) BssJt in R1 K = BssJt in R2 K

31 The semantic domain

We now define a notion of ldquohypothetical rewritingrdquo which resembles full narrowing [7] butit ldquodecouplesrdquo multiple occurrences of variables This way we maintain the potentiality tochoose different evolutions of the rewritings of redexes once variables are instantiated with nonconstructor terms

The semantic domain of our semantics will be made of trees with all possible derivations ofthis variation of narrowing

311 Linearizing Narrowing

Definition 33 (Term Linearization) Let t isin T (ΣV) r isin LT (ΣV) and σ∶ V rarr V We saythat (r σ) is a linearization of t denoted (r σ) = lin(t) if rσ = t and var(t) sube var(r) Thesubstitution σ will be called delinearizator

If a term is linear then lin(t) = (t ε) while for non-linear terms we can have different possibilities(for instance lin(f(xx)) = (f(x y)yx) = (f(z x)zx) = ) However the followingconstructions which involve linearization are actually independent upon the particular choiceof linearization in the sense that all possible different results are variants (analogously to whathappens for the choice of different mgursquos)

It may be useful to note that a delinearizer σ has one binding for each (further) multipleoccurrence of a variable

Definition 34 (Linearizing Narrowing Derivation) Let t s isin LT (ΣV) and R isin RΣ There

exists a linearizing narrowing step tθp

OcircrArrσR

s if there exist a position p of t l rarr r ≪ R

θprime =mgu(t∣p l) and σ∶ V rarr V such that

t∣p notin V (s σ) = lin(t[rθprime]p) θ = θprimevar(t)We omit to write position p when it is not relevant and omit R when is clear from the context

A sequence t0θ1

OcircrArrσ1

t1 θn

OcircrArrσn

tn is called linearizing narrowing derivation With t0θ

OcircrArrσ

lowast tn we

denote the existence of a linearizing narrowing derivation such that θ = θ1⋯θn and σ = σ1⋯σnNote that in linearizing narrowing derivations we do not apply mgu θ to all reduct (t[r]p)θ asnarrowing does This would not make any difference since terms are kept linear by constructionand thus θ cannot alter the context outside positions being reduced

Linearizing narrowing is correct wrt rewriting (as narrowing is) as proven by the followingtheorem which is the analogous of Theorem 38 of [8] (Theorem 1 of [7]) where we use linearizing

35

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

narrowing instead of narrowing Actually linearizing narrowing is more general than narrowingin the sense that when we have a narrowing derivation then we will surely have a linearizingnarrowing derivation which possibly compute more general instances (in case there are non-linear terms)

Theorem 35 Let R isin RΣ s0 isin LT (ΣV) t0 isin T (ΣV) η0 an R-normalized substitution suchthat t0 = s0η0 and V sub V such that var(s0) cup dom(η0) sube V If t0 ETHrarrlowast tn then there exist a termsn isin LT (ΣV) and substitutions ηn θ σ such that

s0θ

OcircrArrσ

lowast sn tn = snσηn (θηn)V = η0V ηn is R-normalized

where s0θ

OcircrArrσ

lowast sn and t0 ETHrarrlowast tn employ the same rewrite rules at the same positions

Note that while it is always possible to transform rewrite derivations into linearizing narrowingderivations (in the sense of Theorem 35) the opposite does not hold in general as we will showin Example 37 As anticipated we gather all linearizing narrowing derivations (of the sameterm t) into a tree

Definition 36 (Linearizing Narrowing Trees) Let t isin LT (ΣV) A linearizing narrowingtree T for t is a (not necessarily finite) labelled tree which is rooted in t and where

1 paths are linearizing narrowing derivations2 sibling subtrees have the same root terms if and only if their incoming arcs have different

substitutions

We denote with LNTΣ (or simply LNT when clear from the context) the set of all thelinearizing narrowing trees (over Σ) Moreover for any t isin LT (ΣV) we denote with LNTt theset of all linearizing narrowing trees for t

Point 2 ensures that all sibling steps in a linearizing tree are pairwise distinct and thus that wecannot have two different paths of the tree with the same terms and labels

Example 37Consider TRS R of Example 11 The linearizing narrowing tree starting from term diff (x) is

diff (x) x ne x1True

xHead x1Tailε

TruexTa

il x1Head

εε

x1x

This linearizing narrowing derivation diff (x) xHeadx1Tail

OcircOcircOcircOcircOcircOcircrArrx1x

lowast True can be read as if there is a

term t that can rewrite both to Head and Tail then diff (t) rewrites to True Indeed diff (coin)does rewrite to True (a possible rewriting derivation is diff (coin) ETHrarr coin ne coin ETHrarr Head necoin ETHrarr Head ne Tail ETHrarr True)

In this case is not possible to transform these linearizing narrowing derivations into rewritederivations (since diff (x)ETHrarr x ne x↛ as well as diff (t)ETHrarr t ne t↛ for all t isin T (CV))

This example also shows that linearizing narrowing can have longer derivations wrt (stan-dard) narrowing since diff (x) ε

x ne x

36

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

Definition 38 (Variance on LNT) Let t isin LT (ΣV) and T1 T2 isin LNTt We say that T1 andT2 are local variants if there exists a renaming ρ such that T1ρ = T2Two linearizing narrowing trees are local variants if and only if they have the same root t andtheir steps are equal up to renaming of variables which do not occur in t

Note Since the actual choices of local variable names is completely irrelevant from now onwith an abuse of notation by LNT we will actually indicate its quotient wrt localvariance Moreover all linearizing narrowing trees presented in the sequel will actuallybe an arbitrary representative of an equivalence class

Definition 39 (Order on LNT) Let denote with paths(T ) the set of all the paths of T start-ing from the root

Given T1 T2 isin LNT we define T1 ⊑ T2 if and only if paths(T1) sube paths(T2)Given a set T sube LNTt the least upper bound ⊔T is the tree whose paths are ⋃T isinT paths(T )

Dually for the greatest lower bound ⊓It is worth noticing that for any t isin LT (ΣV) LNTt is a complete lattice

By Point 2 of Definition 36 paths is injective thus it establishes an order preserving iso-

morphism (LNTt ⊑) minusminusminusminusminusminusminusminusminusrarrETHrarrlarrlarrETHminusminusminusminusminusminusminusminusminuspaths

prfxtree (paths(LNTt) sube) where the adjoint of paths prfxtree builds

a tree from a set of paths (by merging all common prefixes) So we have two isomorphic rep-resentations of linearizing narrowing trees and in the sequel we can simply write d isin T ford isin paths(T ) The set representation is very convenient for technical definitions while forexamples the tree representation is better suited

Definition 310 (Linearizing Narrowing Tree of a term) Let t isin LT (ΣV) and R isin RΣA linearizing narrowing tree NJt in RK for term t in TRS R is

NJt in RK ∶= d isin LNTt∣d uses rules from RIntuitively NJt in RK denotes the linearizing narrowing behavior of linear term t in TRS Rmodulo local variance (ie local variables are up to renaming)

Example 311Given the following TRS R

m(H (x))rarr d(xK(x)) d(C (x)K (E(y)))rarr f(xx y y)f (A x y F)rarr B(y y) f (E(x) y AA)rarrK(E(y))

The linearizing narrowing tree NJm(x) in RK is

m(x) d(x1K(x2)) f(x3 x4 y y1)B(y y2)

x3Ay1Fy2y

K(E(x4))x3E(x5)

yAy1A

ε

x1C(x3)x2E(y)

x4x3 y1y

xH(x1)

x2x1

Linearizing narrowing trees ldquocapturerdquo the behavioral TRS equivalence asympss since the TRSequivalence induced by N coincides with asympss

Theorem 312 Let R1 R2 isin RΣ Then R1 asympss R2 if and only if for every t isin LT (ΣV)NJt in R1 K =NJt in R2 K

37

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

Even more from linearizing narrowing trees we can completely reconstruct the small-steprewriting behavior To formally prove this we need to introduce the following operation to buildrewriting derivations from linearizing narrowing derivations

Definition 313 Let R isin RΣ and d = s0 θ1OcircrArrσ1

s1θ2OcircrArrσ2

θnOcircrArrσn

sn be a linearizing narrowing deriva-

tion The linear narrowing to rewriting operator is defined as

lfloordrfloor ∶= t0 ETHrarr t1 ETHrarr tk ∣ ξ is an R-normalized substitution 0 le k le nη = θ1 uarr σ1 uarr uarr θk uarr σk forall0 le i le k ti = siηξ (33)

We abuse notation and lift lfloorsdotrfloor also to sets as lfloorSrfloor ∶= ⋃disinSlfloordrfloorIntuitively this operation takes a prefix d of a linear narrowing derivation and if it can simulta-neously satisfy all its computed answers and delinearizators with substitution η then it buildsa rewriting sequence by applying ηξ to all terms of d for any R-normalized substitution ξ

Theorem 314 Let R isin RΣ and t isin LT (ΣV) Then BssJt in RK = lfloorNJt in RKrfloorHence NJt inRK is indeed a condensed representation of BssJt inRK Now the next step for theconstruction of a semantics with the desired characteristics is to achieve compositionality Todo so we should look for a denotation for most general terms f (ETHrarrxn) (of a TRS R) which couldbe used to retrieve with suitable semantic operations NJt in RK for any t isin LT (ΣV)32 Operational denotations of TRSs

The operational denotation of a TRS can be defined as an interpretation giving meaning to thedefined symbols over linearizing narrowing trees ldquomodulo variancerdquo Essentially we define thesemantics of each function in D over formal parameters (whose names are actually irrelevant)

Definition 315 (Interpretations) Let MGTD ∶= f (ETHrarrxn) ∣ fn isin D ETHrarrxn are distinct variablesTwo functions I J ∶MGTD rarr LNTΣ are (global) variants denoted by I cong J if for each

π isinMGTD there exists a renaming ρ such that (I(π))ρ = J(πρ)An interpretation is a function I ∶MGTD rarr LNTΣ modulo variance2 such that for every

π isinMGTD I(π) is a linearizing narrowing tree for πThe semantic domain IΣ (or simply I when clear from the context) is the set of all inter-

pretations ordered by the pointwise extension of ⊑The partial order on I formalizes the evolution of the computation process (I ⊑) is a completelattice and its least upper bound and greatest lower bound are the pointwise extension of ⊔and ⊓ respectively In the sequel we abuse the notations for LNT for I as well The bottomelement of I is I ∶= λππ (for each π isin MGTD) In the sequel we abuse the notations forLNT for I as well

It is important to note that MGTD (modulo variance) has the same cardinality of D (andis then finite) and thus each interpretation is a finite collection (of possibly infinite elements)Hence we will often explicitly write interpretations by cases like

I ∶=⎧⎪⎪⎪⎪⎨⎪⎪⎪⎪⎩

π1 ↦ T1

πn ↦ Tn

for

I(π1) ∶= T1⋮

I(πn) ∶= Tn2ie a family of elements of LNTΣ indexed by MGTD modulo variance

38

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

In the following any I isin I is implicitly considered as an arbitrary function MGT rarr LNT

obtained by choosing an arbitrary representative of the elements of I in the equivalence classgenerated by cong Actually in the sequel all the operators that we use on I are also independentof the choice of the representative Therefore we can define any operator on I in terms of itscounterpart defined on functions MGT rarr LNT

Moreover we also implicitly assume that the application of an interpretation I to a specificπ isin MGT denoted by I(π) is the application I(π) of any representative I of I which is

defined exactly on π For example if I = (λf (x y) f(x y) xc(z)

OcircOcircOcircrArrε

c(y z))congthen I(f(u v)) =

f(u v) uc(z)

OcircOcircOcircrArrε

c(v z)While defined symbols have to be interpreted according to TRS rules constructor symbols

are meant to be interpreted as themselves In order to treat them as a generic case of functionapplication we assume that any interpretation I is also implicitly extended on constructors asI(c(ETHrarrxn)) ∶= c(ETHrarrxn) In the sequel we will use ϕ when we refer to a generic (either constructoror defined) symbol whence f for defined symbols and c for constructor ones

Definition 316 (Operational denotation of TRSs) Let R isin RΣ Then the operationaldenotation of R is

OJRK ∶= (λf (ETHrarrxn) NJf(ETHrarrxn) in RK)cong

(34)

Intuitively O collects the linearizing narrowing tree of each f (ETHrarrxn) in R abstracting from theparticular choice of the variable names ETHrarrxn

Example 317The operational denotation of TRS R of Example 11 is

OJRK =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

coin ↦ coin

Tail

Head

εεεε

x ne y ↦ x ne yTrue

True

xTail yH

ead

εxHead yTailε

diff (x)↦ diff (x) x ne x1True

True

ε

x1x

xHead x1T

ail

εxTail x

1Headε

The (small-step) rewriting behavior of any term t can be ldquoreconstructedrdquo from OJRK bymeans of the following evaluation function E 321 Evaluation Function

When we have the interpretation with the linearizing narrowing tree of f (ETHrarrxn) we can easily

reconstruct the rewriting behavior of any f (ETHrarrtn) for (renamed apart)

ETHrarrtn isin LT (CV) by sim-

ply replacing the most general bindings along a derivation with constructor terms ti (clearly

39

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

pruning branches with inconsistent instances) However with non-constructor nested termsthings gets more involved In practice we have an interleaving of parts of all sub-derivationscorresponding to the evaluation of arguments leaded by the derivation of f (ETHrarrxn) Intuitively thebasic building block of our proposal is the definition of a semantics embedding operation thatmimics parameter passing Namely taken two linearizing narrowing trees T1 T2 and a variablex of (the root of) T1 the tree-embedding operation T1[xT2] transforms T1 by modifying itssteps accordingly to steps of T2 which provides specific actual parameter values to x in placeswhere x in T1 was originally ldquofreelyrdquo instantiated

In order to define T1[xT2] we need to introduce an auxiliary (technical) relation whichworks on single derivations Note that in the sequel to shorten definitions when we adornlinearizing narrowing derivations or trees with a term s like ds or Ts we mean that the headof ds or the root of Ts is term s

Definition 318 Let π isin LT (ΣV) dg be a linearizing narrowing derivation with head g andTb isin LNTb Then dgπTb ⊢ d is the least relation that satisfies the rules

dtπTs ⊢ tmicromicro = larrETHETHmgu(s π) (35a)

dtπTsprime ⊢ d

dtπTs ⊢ tmicroθq

OcircrArrσ

dmicro = larrETHETHmgu(s π) s

θp

OcircrArrσ

Tsprime isin Ts existq s∣p = tmicro∣q (35b)

dt0 π0Ts0 ⊢ dt1 dtn πnTsn ⊢ dtn+1

(t θp

OcircrArrσ

dt0)πTs0 ⊢ tmicro θprimep

OcircrArrσprimeprime

dtn+1

micro = larrETHETHmgu(s0 π)θprime = larrETHETHmgu(tmicro tθ)var(tmicro) x1y1 xnyn = proj (var(πθ) σ)Ts1 Tsn ≪ Ts0

π0 = πθ foralli isin 1 n πi = π0yixiforallj isin 0 n ETHrarrvj =ETHrarrvar(sj)

σprimeprime = (σ cup

n

⋃i=1

ETHrarrvi ETHrarrv0)var(tn+1)

(35c)

where

bull proj (Vσ) = xy isin σ ∣ y isin V bulllarrETHETHmgu(t s) is an mgu θ of t and s such that forallx isin var(t) xθ isin V

Broadly speaking the role of π in a statement dtπTs ⊢ d is that of the ldquoparameter patternrdquoresponsible to constrain ldquofreelyrdquo instantiated formal parameters in dt to the actual parametersvalues which are actually ldquocomingrdquo from Ts More specifically Rules 35 govern the inlaying ofthe steps of a linearizing narrowing tree Ts into a derivation dt In particular

bull The axiom 35a stops any further possible inlayingbull The rule 35b considers the case when we want to proceed with an inner linearizingnarrowing step employing a step coming from Ts In this case t plays the role of contextand the inner step is done accordingly to the one chosen from Ts Note that is it possibleto do the step only if exists q such that s∣p = tmicro∣q Namely the defined symbol over whichthe step is done needs to be ldquovisiblerdquo in tmicro

bull The rule 35c considers the case when we want to do an outermost step First the stephas to be compatible with the way we instantiated t so far namely exists mgu(tmicro tθ)Then we choose from σ only the delinearizers that depend on the variable from whichwe started the embedding Each of these delinearizer comes from the linearization of amultiple occurrence of a same variable z Thus for each rename zprime of z we sequentiallyembed into zprime a (possibly different) sub-derivation coming from a renamed apart variant of

40

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

Ts Note that if we would not have multiple occurrences of z (ie proj (var(πθ) σ) = empty)the rule would simply be

dt0 π0Ts0 ⊢ dt1(t θpOcircrArr

σ

dt0)πTs0 ⊢ tmicro θprimepOcircrArrσ

dt1

micro = larrETHETHmgu(s0 π) θprime = larrETHETHmgu(tmicro tθ)var(tmicro)

π0 = πθ

Note that in Rules 35 we use a selected form of mgu (ie larrETHETHmgu which does not rename variablesin the left argument) in order to avoid to change variable names along the way

Example 319Consider OJRK of Example 317 Let Tcoin ∶= OJRK(coin) and d0 ∶= diff (x) ε

OcircOcircrArrx1x

d1 isinOJRK(diff (x)) where d1 = x ne x1 xHeadx1Tail

OcircOcircOcircOcircOcircOcircOcircrArrε

True

Let us build a proof tree to find a derivation d such that d0xTcoin ⊢ d We have to startwith an application of rule (35c) which (in this case) has two premises since the delinearizatorx1x in the first step of d0 has one binding The first subtree which embeds the Head branchof Tcoin into x is

(35a)TrueHead Head ⊢ True

(35c)d1xHead ⊢ Head ne x1 x1Tail

OcircOcircOcircrArrε

True(35b)

d1xTcoin ⊢ coin ne x1 ε

OcircrArrε

Head ne x1 x1Tail

OcircOcircOcircrArrε

True

acutesup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1cedilsup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1parad3

(PT)

Now we can build the full proof tree (by building the second subtree which starting from d3can finish to embed the Tail branch of Tcoin into x1)

(PT)

(35a)TrueTail Tail ⊢ True

(35c)d2 x1Tail ⊢ Head ne Tail ε

OcircrArrε

True(35b)

d2 x1Tcoin ⊢ Head ne coin ε

OcircrArrε

Head ne Tail ε

OcircrArrε

True(35c)

d3 x1Tcoin ⊢ coin ne coin ε

OcircrArrε

Head ne coin ε

OcircrArrε

Head ne Tail ε

OcircrArrε

True(35c)

d xTcoin ⊢ diff (coin) ε

OcircrArrε

coin ne coin ε

OcircrArrε

Head ne coin ε

OcircrArrε

Head ne Tail ε

OcircrArrε

True

We have analogous proof tree for d xTcoin ⊢ diff (coin) ε

OcircrArrε

coin ne coin ε

OcircrArrε

Tail ne coin ε

OcircrArrε

Tail neHead

ε

OcircrArrε

True In total we have ten possible proof trees four of whom that have derivations

which reach True

Tree-embedding is simply defined by collecting all contributes of dxT ⊢ dprime

Definition 320 (Tree-embedding) Let Tg isin LNTg and Tb isin LNTg such that

1 Tg and Tb do not share any local variable2 x is a variable which does not occur in Tb

Then the tree-embedding operation Tg[xTb] is defined as Tg[xTb] ∶= d∣dg isin Tg dgxTb ⊢ d41

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

The evaluation function is obtained by repeated application of tree-embedding

Definition 321 (Evaluation Function) Let t isin LT (ΣV) and I isin I The evaluation of twrt I denoted E JtKI is defined by induction on the structure of t as follows

E JxKI ∶= x (36a)

E Jϕ(ETHrarrtn)KI ∶= I(ϕ(ETHrarrxn))[x1 E Jt1KI ] [xn E JtnKI ] ETHrarrxn renamed apart distinct (36b)

Example 322Consider OJRK of Example 317 The evaluation of E Jdiff (coin)KOJRK is

E Jdiff (coin)KOJRK = [ by Equation (36b) with n = 1 ]OJRK(diff (x))[x E JcoinKOJRK] = [ by Equation (36b) with n = 0 ]OJRK(diff (x))[xOJRK(coin)]

Then by completing what shown in Example 319 we have that E Jdiff (coin)KOJRK is

diff (coin)

diff (Head)Head ne Head

εεε

ε

coin ne coin

Head ne coinHead ne Head

εε

Head ne Tail Trueεεε

ε

εε

Tail ne coinTail ne Head True

εε

εε

Tail ne Tailεε

εε

coin ne HeadHead ne Head

εε

Tail ne Head Trueεεε

ε

εε

coin ne TailHead ne Tail True

εε

εε

Tail ne Tailεε

εε

εε

diff (Tail)Tail ne Tail

εε

εε

322 Properties of the TRS operational denotation

The following result states formally that from OJRK the evaluation function E can reconstructthe linearizing narrowing tree of any linear term

Theorem 323 For all R isin RΣ and t isin LT (ΣV) E JtKOJRK =NJt in RK

A straightforward consequence of Theorems 323 and 312 is

Corollary 324 For all R1 R2 isin RΣ OJR1 K = OJR2 K if and only if R1 asympss R2

Thus semantics O is fully abstract wrt asympss

33 Fixpoint denotations of TRSs

We will now define a bottom-up goal-independent denotation which is equivalent to O and thus(by Corollary 324) adequate to characterize the small-step behavior for TRSs It is definedas the fixpoint of an abstract immediate operator over interpretations P JRK This operatoris essentially given in terms of evaluation E of right hand sides of rules Namely given aninterpretation I it essentially consists in

42

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

bull building an initial linearizing narrowing step for a most general term according to rulesrsquoleft hand side

bull applying the evaluation operator E to the right hand side of the rule over I Definition 325 Let R isin RΣ P JRK∶ I rarr I is defined for all f isin D (of arity n) as

P JRKI (f(ETHrarrxn)) ∶=⊔f(ETHrarrxn) θ

OcircrArrσ

E JrprimeKI ∣ f(ETHrarrxn)θ rarr r ≪R

(rprime σ) = lin(r) (37)

Moreover we define our fixpoint semantics as F JRK ∶= lfp P JRK

F JRK is well defined since P JRK is continuous

Proposition 326 Let R isin RΣ Then P JRK is continuous

Example 327Let us consider the (artificial) TRS R ∶= g rarr f(h(a)) h(a) rarr h(b) f (h(b)) rarr a taken from[1] which is neither constructor-based nor confluent The evaluation of the right hand sidesof all rules is E Jf(h(a))KI = I(f(x))[x E Jh(a)KI ] = f(x)[xh(a)] = f(h(a)) E Jh(b)KI =h(x)[xb] = h(b) and E JaKI = a Hence

I1∶= P JRKuarr1 =

⎧⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎩

g ↦ g f(h(a))εε

h(x)↦ h(x) h(b)xa

ε

f(x)↦ f(x) axh(b)

ε

In the next iteration we have to evaluate E Jf(h(a))KI1= I

1(f(x))[x E Jh(a)KI

1] Since E Jh(a)KI

1=

I1(h(x))[x E JaKI

1] = h(a) ε

OcircrArrε

h(b) we have

P JRKuarr2 =⎧⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎩

g ↦ g f(h(a)) f(h(b)) aεε

εε

εε

h(x)↦ h(x) h(b)xa

ε

f(x)↦ f(x) axh(b)

ε

Now since P JRKuarr3 = P JRKuarr2 this is also the fixpoint F JRK

Example 328Consider TRS R of Example 11 The iterates of P JRK are

P JRKuarr1 =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

coin ↦ coin

Tail

Head

εεεε

x ne y ↦ x ne yTrue

True

xTail yH

ead

εxHead yTailε

diff (x)↦ diff (x) x ne x1ε

x1x

43

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

P JRKuarr2 =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

coin ↦ coin

Tail

Head

εεεε

x ne y ↦ x ne yTrue

True

xTail yH

ead

εxHead yTailε

diff (x)↦ diff (x) x ne x1True

True

ε

x1x

xHead x1T

ail

εxTail x

1Headε

Now since P JRKuarr3 = P JRKuarr2 this is also the fixpoint F JRK

Example 329Let us consider the TRS R ∶= zeros rarr ∶(0 zeros) take(0 x) rarr nil take(s(n) ∶(y z))) rarr∶(y take(n z)) f (n)rarr take(n zeros) The first two iterates of P JRK are

P JRKuarr1 =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

zeros ↦ zeros ∶(0 zeros)εε

take(x1 y1)↦ take(x1 y1 )

nil

x10

ε ∶(y0 take(x0 z))

x1s(x

0)y1 ∶(y

0 z)ε

f(x0)↦ f(x0) take(x0 zeros)εε

P JRKuarr2 =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

zeros ↦ zeros ∶(0 zeros) ∶(0 ∶(0 zeros))εε

εε

take(x2 y2)↦ take(x2 y2 )

nil

x20

ε ∶(y1 take(x1 z1))∶(y1nil)

εε ∶(y1 ∶(y0 take(x0 z0)))

x1s(x

0)z1 ∶(y

0 z0)

ε

x2s(x

1)y2 ∶(y

1 z1)ε

f(x1)↦ f(x1)

take(x1 zeros)

nil

x10

ε

take(x1 ∶(0 zeros))

nil

x10

ε

∶(0 take(x0 zeros))x

1s(x0)

ε

εε

εε

Note that to highlight the construction order of the various subtrees we used indices in variablesnames that respect the order of introduction and boxed the subtrees which correspond to the

44

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

previous iterate By continuing the computation of the iterates we obtain

F JRK =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

zeros ↦ zeros ∶(0 zeros) ∶(0 ∶(0 zeros))εε

εε

take(x y)↦ take(x y)

nil

x0

ε ∶(yprime take(xprime z))∶(yprimenil)

εε ∶(yprime ∶(yprimeprime take(xprimeprime zprime)))

x primes(x primeprime)z ∶(y primeprime z prime)ε

xs(x prime)y ∶(y prime z)ε

f(x)↦ f(x)

take(x zeros)

nil

x0

ε

take(x ∶(0 zeros))nil

x0

ε

take(x ∶(0 ∶(0 zeros)))εε ∶(0 take(xprime zeros))

∶(0nil)xprime 0

ε

∶(0 take(xprimeprime ∶(0 zeros)))

x primes(x primeprime)

ε

xs(x prime)ε

εε

εε

We can observe that since terms in R are linear the linearizing narrowing trees have justε as delinearizers and actually they are isomorphic to full narrowing trees

331 Properties of the TRS fixpoint denotation

The top-down goal-dependent denotation O and the bottom-up goal-independent denotationF are actually equivalent

Theorem 330 (Equivalence of denotations) Let R isin RΣ Then OJRK = F JRK

A straightforward consequence of Theorem 330 and Corollary 324 is

Corollary 331 (Correctness and full abstraction of F ) Let R1 R2 isin RΣ Then F JR1 K =F JR2 K if and only if R1 asympss R2

4 Conclusions

We have presented a condensed compositional bottom-up semantics for the full class of termrewriting systems which is fully abstract wrt the small-step behavior of rewriting

We are going to use this semantics to define by abstraction a condensed bottom-up se-mantics for the full class of term rewriting systems which is fully abstract wrt the big-stepbehavior of rewriting and thus suitable for semantic-based program manipulation tools Actu-ally we have developed a first proposal of such a semantics (by following this approach) but

45

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

restricted to the class of left-linear TRSs We already used it to develop a semantics-basedautomatic specification synthesis prototype [6] which is giving promising results

However we believe that our notion of linearized narrowing which differently from nar-rowing represents faithfully the small-step behavior of rewriting (in a compact way) could beinteresting for other applications as well

References

[1] M Alpuente M Comini S Escobar M Falaschi and J Iborra A Compact Fixpoint Semanticsfor Term Rewriting Systems Theoretical Computer Science 411(37)3348ndash3371 2010

[2] M Alpuente M Comini S Escobar M Falaschi and S Lucas Abstract Diagnosis of FunctionalPrograms In M Leuschel editor Logic Based Program Synthesis and Transformation ndash 12th

International Workshop LOPSTR 2002 Revised Selected Papers volume 2664 of Lecture Notes

in Computer Science pages 1ndash16 Berlin 2003 Springer-Verlag

[3] G Bacci An Abstract Interpretation Framework for Semantics and Diagnosis of Lazy Functional-

Logic Languages PhD thesis Dipartimento di matematica e Informatica Universita di Udine2011

[4] G Bacci and M Comini A Fully-Abstract Condensed Goal-Independent Bottom-Up FixpointModeling of the Behaviour of First Order Curry Submitted for Publication 2012

[5] M Comini G Levi M C Meo and G Vitiello Abstract Diagnosis Journal of Logic Program-

ming 39(1-3)43ndash93 1999

[6] M Comini and L Torella TRSynth a Tool for Automatic Inference of Term Equivalence inLeft-linear Term Rewriting Systems In E Albert and S-C Mu editors PEPM rsquo13 Proceedings

of the ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation pages 67ndash70Acm 2013

[7] J-M Hullot Canonical Forms and Unification In Proceedings of the 5th International Conference

on Automated Deduction volume 87 of Lecture Notes in Computer Science pages 318ndash334 Berlin1980 Springer-Verlag

[8] A Middeldorp and E Hamoen Completeness results for basic narrowing Applicable Algebra in

Engineering Communication and Computing 5213ndash253 1994 101007BF01190830

[9] H R Nielson and F Nielson Infinitary Control Flow Analysis a Collecting Semantics for ClosureAnalysis In Symposium on Principles of Programming Languages pages 332ndash345 1997

[10] TeReSe editor Term Rewriting Systems Cambridge University Press Cambridge UK 2003

A Technical Proofs

Proof of Proposition 32

Point 1 Implication lArrOcirc is straightforward We prove OcircrArr by reduction to absurd Supposethat R1 asympss R2 and R1 is not a variant of R2 Then there is at least one rule which isdifferent in R1 wrt R2 (or vice versa) Thus by Equation (31) we can have rewritingsteps which employ that rule in BssJR1 K which cannot be in BssJR2 K which is absurd

Point 2 Similarly to previous point but restricting to initial linear terms

In the sequel we use the following results

46

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

Proposition A1 ([8]) Suppose we have substitutions θ ρ ρprime and sets A B of variables suchthat (B minus dom(θ)) cup range(θ) sube A If ρA = ρprimeA then (θρ)A = (θρprime)AProposition A2 ([8]) Let R be a TRS and suppose we have substitutions θ ρ ρprime and setsA B of variables such that the following conditions are satisfied

ρA R-normalized θρprimeA = ρA B sube (A minus dom(θ)) cup range(θA)Then ρprimeB is also R-normalized

Proof of Theorem 35 We prove the thesis by induction on the length of the rewriting derivationfrom t0 to tn The case of length zero is straightforward

Suppose t0 ETHrarr t1 ETHrarr ETHrarr tn is a rewriting derivation of length n gt 0 We may assumewithout loss of generality that var(l) cap V = empty We have (s0η0)∣p = s0∣pη0 = τ l for somesubstitution τ with dom(τ) sube var(l) Let micro ∶= τ cup η0 We have s0∣pmicro = s0∣pη0 = lτ = lmicro so s0∣pand l are unifiable Let θprime

1∶= mgu(s0∣p l) and θ1 ∶= θprime1var(s0∣p) Clearly dom(θ1) cup range(θ1) sube

var(s0∣p) cup var(l) Moreover there exists a substitution ψ such that

θ1ψ = micro (1)

Now let (s1 σ1) ∶= lin(s0[rθprime1]p) By Definition 34

s0θ1p

OcircOcircrArrσ1 lrarrr

s1 (2)

Let V1 ∶= (V minus dom(θ1)) cup range(θ1) cup dom(σ1) andη1 ∶= (σ1ψ)V1

(3)

Clearly dom(η1) sube V1 We have var(s1) = dom(σ1)cup var(s0[rθ1]p) sube dom(σ1)cup var(s0[lθ1]p) =dom(σ1) cup var(s0θ1) sube V1 Therefore var(s1) cup dom(θ1) sube V1 By (1) and (3) we have s1σ1η1 =s1σ1ψ = s0[rθ1]pψ = s0[r]pθ1ψ = s0[r]pmicro = s0micro[rmicro]p Since V cap dom(τ) = empty we have

microV = η0V (4)

Likewise microvar(r) = η0var(r) Hence s0micro[rmicro]p = s0η0[rτ]p = t0[rτ]p = t1 Thust1 = s1σ1η1 (5)

Next we have to verify that (θ1η1)V = η0V By (3) and by Proposition A1 we have that(θ1η1)V = (θ1σ1ψ)V By (1) and (4) (θ1η1)V = (θ1σ1ψ)V Since dom(σ1) notin V we havethat (θ1σ1ψ)V = (θ1ψ)V = microV = η0V Thus

(θ1η1)V = η0V (6)

Now we show that η1 is R-normalized Since dom(η1) sube V1 it suffices to show that η1V1isR-normalized Let B ∶= (V minusdom(θ1))cuprange(θ1V ) Proposition A2 yields the normalization

of η1B Recall that range(θ1) sube var(s0∣p) cup var(l) Let x isin range(θ1) since θ1 is idempotentclearly x notin dom(θ1) If x isin var(s0∣p) sube V then x isin V minus dom(θ1) sube B If x isin var(l) thenx isin var(lθ1) = var(s0∣pθ1) thus x isin range(θ1V ) sube B Thus range(θ1) sube B and then V1 =B cup dom(σ1) By this and (3) since η1B is R-normalized η1V1

is R-normalized as well

47

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

By inductive hypothesis we have a term sn and substitutions θprime σprime and ηn such that

s1θprimeOcircrArrσprime

lowast sn (7)

tn = snσprimeηn (8)

(θprimeηn)V1= η1V1

(9)

ηn is R-normalized (10)

Moreover s1θprimeOcircOcircrArr

σprimeR

lowast sn and t1 ETHrarrR

lowast tn apply the same rewrite rules at the same positions

Let θ ∶= θ1θprime and σ = σ1σprime By (2) and (7) we obtain s0θ

OcircrArrσ

lowast sn By construction this

narrowing derivation makes use of the same rewriting rules at the same positions as the rewritingderivation t0 ETHrarr

R

lowast tn It remains to show that (θηn)V = η0V By (9) and Proposition A1

(θ1θprimeηn)V = (θ1η1)V Therefore by (6) (θηn)V = (θ1η1)V = η0V Proof of Theorem 312 We prove OcircrArr by reduction to absurd Suppose that R1 asympss R2 andexistt isin LT (ΣV) NJt in R1 K neNJt in R2 K This means that there is at least one derivation whichbelongs to NJt in R1 K and not to NJt in R2 K (or vice versa) Hence there is at least a rulewhich is not in common to the two programs Thus R1 asympss R2 which is absurd

We prove lArrOcirc by reduction to absurd Suppose that forallt isin LT (ΣV) NJt inR1 K =NJt inR2 Kand R1 asympss R2 Then there is at least one rule which is different in R1 wrt R2 Thus byEquation (31) and Theorem 35 NJt in R1 K neNJt in R2 K which is absurd

Proof of Theorem 314 We prove the two inclusions separately Inclusion supe is immediate byDefinition 313

Inclusion sube is proved by reduction to absurd Assume that there exists a derivation t0 ETHrarrR

lowast tn

such that it does not belong to lfloorNJt0 inRKrfloor Then by Theorem 35 taken η0 = ε there exists arelaxed narrowing derivation of the form s0

θ1

OcircrArrσ1

θn

OcircrArrσn

sn Note that for each i isin 1n θi andσi are just renaming ηi = ε and ti = siσi σ0 Let η ∶= η0 = ε It is easy to see that there existsηprime such that ηprime = θ1 uarr σ1 uarr uarr θn uarr σn By Definition 313 there exists a rewriting derivationtprime0ETHrarrR

lowast tprimen where tprimei = siηprime for each i isin 1n Moreover dom(σk) isin var(si) for each k isin i+ 1nand θi = (σj)dom(θi) or θi = (σj)dom(θi) for some j Hence siη

prime = siσi σ0 Thus tprimei = ti foreach i isin 1n which is absurd

Lemma A3 Let R a TRS x isin V and t s isin T (ΣV) such that they do not share variables andx isin t x isin s Then NJt in RK[xNJs in RK] =NJtxs in RK

Proof It is sufficient to prove that given dt isin NJt in RK and Ts = NJs in RK if dtxTs ⊢ dthen d isin NJtxs in RK To this aim we will prove a stronger result let π isin T (CV) letTs = NJs in RK and for any dt isin NJt in RK such that dtπTs ⊢ d then d isin NJtη in RK whereη =larrETHETHmgu(s π) We proceed by structural induction on the proof tree

rule 35a) straightforward

rule 35b) By inductive hypothesis dtπTsprime ⊢ dtmicro lArrrArr dtmicro isinNJtmicro inRK If it exists dtmicro then

tmicro∣p = s∣p Moreover existmicroprime such that microprime = larrETHETHmgu(sprime π) and tmicroprime∣p = sprime∣p Thus tmicroθp

OcircrArrσ

dtmicro isinNJtmicro in RK

48

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

rule 35c) By inductive hypothesis we have that dt0 π0Ts0 ⊢ dt1 lArrrArr dt1 isin NJtmicro0 inRK dtn πnTsn ⊢ dtn+1 lArrrArr dtn+1 isin NJtmicron in RK where micro0 = larrETHETHmgu(s0 π0) micron =larrETHETHmgu(sn πn) We know that exists a linearizing narrowing step t

θp

OcircrArrσ

t0 where θ2 =mgu(t∣p l) θ = θ2var(t) (s σ) = lin(rθ2) tmicro = t[s]p We need to prove that it exists the

linearizing narrowing step tmicroθprimep

OcircrArrσprimeprime

tn+1 Since it exists mgu(t∣p l) and mgu(tmicro tθ) thenit exists θ3 such that θ3 = mgu((tmicro)∣p l) Now let θprime ∶= θ3var(tmicro) and (sprime σprime) = lin(rθ3)then tmicro[sprime]p = t Let us observe that t1 = t0micro0 t2 = t0micro0micro1 tn+1 = t0micro0 micron wheremicro0 =larrETHETHmgu(s0 π0) micron =larrETHETHmgu(sn πn) Let microlowast = micro0 micron then tn+1 = t0microlowast = tmicrolowast[smicrolowast]p =tmicro[smicrolowast]p = t

Proof of Theorem 323 We proceed by structural induction on term t

t = x Immediate by Equation (36a)

t = ϕ(ETHrarrtn)

E Jϕ(ETHrarrtn)KOJRK =[ by Equation (36b) ]

= OJRK(ϕ(ETHrarrxn))[x1 E Jt1KOJRK] [xn E JtnKOJRK] =[ by inductive hypothesis ]

=NJϕ(ETHrarrxn) in RK[x1NJt1 in RK] [xnNJtn in RK] =[ by Lemma A3 ]

=NJϕ(ETHrarrtn) in RK

Proof of Proposition 326 It is straightforward to prove that P JP K is monotone and finitarythus it is continuous

Proof of Theorem 330 We prove the two inclusions separately

⊑) Let indicate with Ok all derivations of OJRK with length le k by induction we prove thatforallk Ok ⊑ P JRKuarrk

k = 0) immediate

k gt 0) foralld isin Ok we have that d = f(x) θΛ

OcircrArrσ

dprime such that (by Theorem 323) dprimet isin E JtKOkminus1

Thus by monotonicity of E we have that dprimet isin E JtKP JRKuarrkminus1 By the definition of P d isin P JP KP JRKuarrkminus1 = P JRKuarrk

Thus by Proposition 326 OJRK = ⊔kge0Ok ⊑ ⊔kge0P JRKuarrk = F JRK

⊒) We need to prove that f(ETHrarrxn) θΛ

OcircrArrσ

E JrprimeKOJRK ⊑NJf(ETHrarrxn) inRK By Theorem 323 E JrprimeKOJRK

is a linearizing narrowing tree Since θ = mgu(f(ETHrarrxn l))ETHrarrxnand (σ rprime) = lin(r) we can

conclude that f(ETHrarrxn) θΛ

OcircrArrσ

E JrprimeKOJRK ⊑NJf(ETHrarrxn) in RK

49

Logical and Algebraic Views of a Knot Fold of a

Regular Heptagon

Fadoua Ghourabi1 Tetsuo Ida2 and Kazuko Takahashi1

1 Kwansei Gakuin University Japanghourabikwanseiacjp ktkakwanseiacjp

2 University of Tsukuba Japanidai-eosorg

Abstract

Making a knot on a rectangular origami or more generally on a tape of a finite lengthgives rise to a regular polygon We present an automated algebraic proof that makingtwo knots leads to a regular heptagon Knot fold is regarded as a double fold operationcoupled with Huzitarsquos fold operations We specify the construction by describing thegeometrical constraints on the fold lines to be used for the construction of a knot Thealgebraic interpretation of the logical formulas allows us to solve the problem of howto find the fold operations ie to find concrete fold lines The logical and algebraicframework incorporated in a system called Eos (e-origami system) is used to simulate theknot construction as well as to prove the correctness of the construction based on algebraicproof methods

1 Introduction

From the early history of mathematics the correspondence between geometry and algebra hasbeen recognized and has been the subject of constant study In some sense ancient geometrywas a mother of algebra In particular solving algebraic equations has been related to therealm of Euclidean geometry Early mathematicians notably Khawarizmi and Khayyam gavegeometrical meanings to the solutions of equations Khayyamrsquos insight was that solutions ofcertain cubic equations are points of intersections of conic sections [1] Seven centuries laterafter freeing algebra from geometrical thinking Wantzel proved that solving cubic solutionsis impossible by Euclidean tools ie compass and straightedge [2] Further tools have beeninvented and used to perform constructions that are impossible by Euclidean tools

Paper folding ie origami allows solving cubic equations and hence geometrical construc-tions such as trisection of an arbitrary angle or a regular heptagon are realizable Given anorigami paper what we can do by hand is to construct creases and points The creases areconstructed by folding the paper along the lines which we call fold lines The points are con-structed by the intersection of lines Huzita presented a set of fold operations (known also asHuzitarsquos axioms in literature) with which he showed how to obtain fold lines [3] Huzitarsquos foldoperations are simple to perform by hand but powerful enough to solve cubic equations [4]

The geometrical construction of a regular heptagon has a unique history in that it belongsto the famous classical impossible problems by Euclidean tools Using paper folding the con-struction was shown to be possible In this paper we show another method of constructing aregular heptagon based on an extension of Huzitarsquos fold operations by introducing knottingThe constructions of regular n-gons (in particular of regular pentagon and heptagon) by makingknots have not been rigorously specified and the observation that their constructions purportto problems of solving geometrical constraints is missing

50

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

We investigate the geometrical constraints of the knot fold towards constructions of regu-lar polygons and proofs of the correctness of these constructions The knot fold operation isspecified by an existentially quantified formula of the first-order predicate logic The formulais then translated into a set of algebraic equalities and disequalities which then are solved byspecialized solvers based on Grobner basis theory andor CAD (Cylindrical Algebraic Decom-position) We have developed a computational origami system called Eos [5] using computeralgebra system Mathematica In brief it is an e-origami system which allows us to do virtualorigami It has capabilities of constructing and visualizing origami geometrical objects alge-braically analyzing origami folds and proving the correctness of origami constructions Eos

supports Huzitarsquos fold operations and has been extended to include multi-fold operations Weuse Eos to assist us with our mathematical study of the knot fold

The rest of the paper is organized as follows In Sect 2 we give the notations that we useIn Sect 3 we present Huzitarsquos fold operations and their extensions In Sect 4 we explain thegeometrical properties of the knot fold The construction of regular heptagon by Eos is shownin Sect 5 and its formal and algebraic proof is discussed in Sect 6 In Sect 7 we summarizeour results and point out a direction of further research

2 Notations

In this paper we restrict the use of geometrical objects to points segments and lines Pointsare denoted by a single capital letter of the Latin alphabet eg A B C D X Y etc Linesare denoted by m n t u and v Let X and Y be two points then XY denotes the line passingthrough points X and Y For brevity we often write XY to refer to the line passing through Xand Y We use the same notation to denote the segment between points X and Y Althoughthe meaning of the notation XY should be clear from the context we precede the notation XYwith either the word ldquosegmentrdquo or the word ldquolinerdquo to emphasize which objects we are working

with We also useminusminusrarrXY to denote a vector from point X to point Y The distance between two

points X and Y is denoted by |XY |Since we use Cartesian coordinate system in this paper a line is represented by a linear

equation ax+ by+ c = 0 in variables x and y The sets of all points and lines are denoted by Πand L respectively Abusing the set notation we use X isin m to mean that point X is incidentto line m and X1 Xp sub m to mean that all the points X1 Xp are incident to m

When an origami is folded along a line m some of the points are moved to superpose withtheir reflections across m We denote by Xm the reflection of point X across line m

A simple knot is denoted by K Ki denotes the ith knot The notation K = 〈mn t〉 meansthat the knot K is defined by 3 fold lines (to be explained in Sect 4)m n and t and furthermoreK is obtained by folding along the lines following the order of their appearance in 〈mn t〉

3 Origami Geometrical Construction

31 Huzitarsquos Fold Operations

By O we denote an origami An origami O is supposed to represent a square sheet of paperwith four points on the corners and four edges that is subject to folding1 We call A B Cand D the points on the corner Some intersections of lines may not fit on the square paper

1We could take O to be any convex polygon that can be constructed from a square sheet of paper Howeverthis could be an unnecessary generalization in our study

51

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

As we want to work with these points we consider O to be a sufficiently large (bounded) 2Dplane so that all the points and lines of interest are on O Huzita observed that the degreeof freedom of paper fold by fold lines can be made finite by specifying how certain points andlines are superposed Then he gave the following operations (O1) sim (O6) which serve as basicoperations in the geometrical construction of origamis Operation (O7) was added later byJustin [6] We call collectively (O1) sim (O7) Huzitarsquos fold operations

(O1) Given two distinct points P and Q fold O along the unique line that passes through Pand Q

(O2) Given two distinct points P and Q fold O along the unique line to superpose P and Q

(O3) Given two distinct lines m and n fold O along a line to superpose m and n

(O4) Given a line m and a point P fold O along the unique line passing through P to superposem onto itself

(O5) Given a line m a point P not on m and a point Q fold O along a line passing throughQ to superpose P and m

(O6) Given two lines m and n a point P not on m and a point Q not on n where m and n aredistinct or P and Q are distinct fold O along a line to superpose P and m and Q and n

(O7) Given two linesm and n and a point P not onm fold O along the unique line to superposeP and m and n onto itself

We note that the above statements are slightly different from the original ones To formalizethe above statements with the view to rigorous geometrical construction we restate Huzitarsquosoperations by carefully adding and removing side conditions of degeneracy and incidence [7]In essence treating origamis with a program requires rigorous specification of these operations

Huzitarsquos fold operations determine fold lines by specifying superpositions of constructedpoints and lines In Eos these specifications are formulas in a language of many-sorted first-order predicate logic By the algebraic interpretation of the formulas we derive polynomialequalities The problem of finding fold line(s) is therefore reduced to solving constraints ex-pressed in multi-variate polynomials of degree 3 over the field of origami constructible numbers[8 5]

32 Extensions

The contribution of Huzitarsquos fold operations is powerful enough to perform relevant geometri-cal constructions by way of solving algebraic equations of degree up to 3 Examples of suchconstructions are trisecting an arbitrary angle constructing a regular heptagon etc Somestudies have explored possible extensions of Huzitarsquos fold operations in an attempt to increasethe power of paper folding ie to solve higher degree equations

Alperin and Lang proposed multi-fold method where the origami is folded along more thanone fold line simultaneously [9] The idea is to find fold lines that are mutually dependentThe multi-fold construction allows solving higher degree equations We presented a construc-tion method of angle trisection using 2-fold operation [5] and angle quintisection using 4-foldoperation [10] Although the p-fold method generates an arbitrarily high degree polynomialaccurately folding an origami by p lines simultaneously would be difficult to do by hand evenfor p = 2

52

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

Folding polygonal knots has been traditionally used in Japan For example folding a broadsash for a kimono by a pentagon is a common practice of daily life However it is unknownwhen the knot fold was first mathematically studied The earliest contributions of which weare aware are those of Cundy and Rollett [11] Brunton [12] and Sakaguchi [13] Cundy andRollett showed models of knots that make some regular polygons Brunton elaborated themathematical study of the knot fold and showed that the number of necessary knots dependson the number of the edges of the polygon

4 Knot Fold

In order to determine the geometrical constraints of knot fold we first analyze key geometricalproperties of a knot

41 Geometrical Properties

(a) (b) (c)

Figure 1 Knot-fold of regular pentagon FEIHG

Let us examine the operation of knotting in Fig 1 We make one simple knot by tyingtogether the two ends of the origami tape in Fig 1(a) Note that we use a rectangular shapeof an origami When the height of the tape ie |AD| and |BC| is infinitesimal and both endsof the paper are connected the tape becomes a curve ie an object of study in knot theoryThe knot with 3 crossings is the most basic one in knot theory When we bring the height backto the original without distorting the tape except for folds we obtain the polygonal knot Awell fastened and well flattened knot becomes a polygonal shape as depicted in Fig 1(c) Theobtained polygonal shape exhibits a regular pentagonal form As it is inferred from the knottheory making the knot in Fig 1(c) requires 3 folds along the lines m n and t that extend theedges FE GH and IEn respectively2 The knot K = 〈mn t〉 is the one in Fig 1(c)

When the knot is entirely unfolded we obtain the tape with the creases and the generatedpoints as shown in Fig 2 We note the following geometrical properties The vertices E H andI are lined up on the edge CD whereas vertices F and G are incident to the edge AB The foldalong m passes through F and superposes point H and line AB Point E is the intersectionof m and CD Similarly the fold line n passes through G and the fold along n superposespoint E and line AB Point H is the intersection of n and CD Note that fold lines m and nare mutually defined The fold is a 2-fold operation where m and n are defined simultaneouslyLine t can be determined by applying operation (O5) of Huzitarsquos fold operation set Namely

2Recall that En is the reflection point of E across line n as defined in Sect 2

53

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

Figure 2 Unknotted tape

line t passes through I and superposes G and CD Note that the parameters of (O5) points IG and line CD are considered with respect to the configuration before the fold Refer to Fig 2The origami after the the 2-fold (ie along m and n) is shown in Fig 1(b) The purposes ofthe fold along t is first to construct the vertex I and second to fasten and lock the knot

A purely geometrical proof that the knot fold creates a regular polygon is sketched in [14]In the following we present a formal and automated algebraic proof that uses properties of theoperation of folding such as preservation of some of distances parallelism etc

42 Geometrical Constraint Solving Approach

The question now becomes how to determine the fold lines m n and t such that the knot isa regular pentagon The proof that the knot fold gives rise to regular pentagons shows thateach of the fold line makes angles 2α = 2π

5 with the edges [14] where α = ∡GEH = ∡EHF In origami geometry construction of angles using Huzitarsquos fold operations is not trivial Theproblem of constructing angles is boiled down to a sequence of fold steps which makes theconstruction tedious where the number of intermediate points and lines is prone to increaseFurthermore not all angles are constructible by Huzitarsquos fold operations The construction ofa regular 11-gon whose interior angles are equal to 9π

11 is shown to be impossible by Huzitarsquosfold operations [15] Hence we carefully choose a specification of the knot fold that couldbe extended towards the construction of regular n-gons where n ge 7 We are led to avoidconstruction of angles in order to solve the knot fold construction problem We consider theknot fold construction as a geometrical constraint solving problem without use of angles

Example Regular pentagon

Our method of constructing a regular pentagon by the knot fold uses a multi-fold togetherwith Huzitarsquos fold operations We consider the example in Fig 1 where we make a knotK = 〈mn t〉 We try to define the geometrical properties of K in a systematic way so thatwe can generalize it to the knot fold of regular n-gons where n ge 7 We observe the followinggeometrical properties on m n t E F G H and I

bull Points E and F are incident to mbull Points G and H are incident to nbull Points E H and I are incident to CDbull Points F and G are incident to ABbull The fold line m superposes H and AB ie Hm isin ABbull The fold line n superposes E and AB ie En isin ABbull The fold line t passes through I and superposes G and CD ie I isin t and Gt isin CDbull The distances |EF | |FG| and |GH| are equal

54

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

The above properties are described by the following first order logical formula φK

φK equiv existmn t isin L existEFGH I isin Π

EF sub m and GH sub n and EH I sub CD and FG sub ABand

Hm isin AB and En isin AB and I isin t andGt isin CD and |EF | = |FG| = |GH|

(1)

We used Eos to construct the regular pentagon in Fig 1 It is possible to determine t indepen-dently from m and n We consider the formula (2) that defines the 2-fold operation to solvelines m and n first

φprimeK equiv existmn isin L existEFGH isin Π

EF sub m and GH sub n and EH sub CD and FG sub ABand

Hm isin AB and En isin AB and |EF | = |FG| = |GH|

(2)

The fold line t is obtained by applying operation (O5) Namely line t passes through pointI and superposes point H and line AB

We can prove automatically that the generated shape is a regular pentagon based on Grobnerbases theory We will omit the proof of the correctness of the pentagon knot construction Inthe next sections we will discuss the construction and the proof of a regular heptagon by theknot fold in details

5 Regular Heptagon by the Knot Fold

Brunton studied the construction of regular n-gons where n ge 3 [12] He showed that the

number of necessary knots is Φ(n)2 minus 1 in order to construct a regular n-gon where Φ(n) is

Eulerrsquos totient function Hence to construct a regular heptagon we perform 2 knots K1 andK2 We explained in Sect 4 that a knot can be decomposed into 3-fold operations along threefold lines In the case of regular heptagon we need 5 fold lines m n t u and v whereK1 = 〈mn t〉 and K2 = 〈v um〉 Let EKJIHGF be the constructed regular heptagonFigure 3 exhibits the vertices of the regular heptagon after unfolding K1 and K2 The foldlines are extensions of edges of EKJIHGF as follows Lines m n and t are the extension ofsegment EF IJ and GFn respectively Lines v and u are extensions of segments KEu andHIm respectively Figure 4 shows a sketch of a regular heptagon with the lines m n t u andv

51 Geometrical Constraints

Figure 3 Unfolded regular heptagon EKJIHGF

Lines m and n of the knot K1 = 〈mn t〉 are defined by the following properties on m n tE F I J G and H

55

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

tn

mu

vE

F

G

H

I

J

K

Figure 4 Sketch of a regular heptagon EKJIHGF and lines m n t u and v

bull Points E and F are incident to mbull Points I and J are incident to nbull Points E and J are incident to CDbull Points F I G and H are incident to ABbull The fold line m superposes I and CD ie Im isin CDbull The fold line n superposes F and CD ie Fn isin CDbull The distances |EF | |IJ | |FGn| |IHm| and |GnHm| are equal3

We write formula φK1in a similar fashion to the formula (1)

φK1equiv existmn t isin L existEF I JGH isin Π

EF sub m and I J sub n and F IGH sub AB and E J sub CDand

Im isin CD and Fn isin CD andG isin t and J t isin ABand

|EF | = |IJ | = |FGn| = |IHm| = |GnHm|

(3)

Similarly to our discussion in Sect 42 line t can be constructed independently from lines mand n We therefore can separate the construction t and use φprime

K1in (4) to solve for m and n

first

φprimeK1

equiv existmn existEF I JGH isin Π

EF sub m and I J sub n and F IGH sub AB and E J sub CDand

Im isin CD and Fn isin CDand

|EF | = |IJ | = |FGn| = |IHm| = |GnHm|

(4)

Knot K2 = 〈v um〉 is defined by the following properties on v u m K X H Y Z and F bull Points K and X are on vbull Points H and Y are on ubull Points K and Y are on CDbull Points Z H F and X are on ABbull The fold line v superposes H and CD ie Hv isin CD

3Refering to Fig 3 distances |GFn| and |FGn| are equal due to the fact that reflection across line n preservesthe distances Similarly distances |HIm| and |IHm| are equal

56

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

bull The fold line u superposes X and CD ie Xu isin CDbull The fold line m passes through F and superposes Y and AB ie Y m isin ABbull The distances |KX| |HY | |XFu| |HZv| and |FuZv| are equal

φK2equiv existv um isin L existKXH Y Z F isin Π

KX sub v and HY sub u and KY sub CD and XHZ F sub ABand

Hv isin CD andXu isin CD and F isin m and Y m isin ABand

|KX| = |HY | = |XFu| = |HZv| = |FuZv|

(5)

However referring to Fig 3 points X Y and Z are equal to points Eu Im and ((((Gn)m)u)v)From formula φprime

K1 E I and G are obtained It is possible to determine the fold lines that

make K2 in an easier way than solving constraints in formula (5) as we explain in the nextsub-section

52 Construction by Eos

We first assume that the initial origami is a rectangle ABCD We work with the Cartesiancoordinate system and the coordinates of points A B C and D are (0 0) (wd 0) (wd ht)and (0 ht) respectively The width wd and the height ht can be taken arbitrary Of coursewd is sufficiently larger than ht so that the knot construction is feasible For concreteness ofour presentation using Eos we set wd = 900 and ht = 60 Furthermore let E be an arbitrarybut fixed point on segment CD Let the coordinates of E be (400 ht) for simplicity and clarityof the construction Our objective is to construct a regular heptagon EKJIHGF by the knotfold Recall that the construction requires a 2-fold operation prior to Huzitarsquos fold operations(see Sect 41) The first folding step is the crucial one ie the 2-fold operation

In Eos Huzitarsquos fold operations can be performed using function HO The extension to themulti-fold is natural as HO is implemented with the generality that allows the specification oflogical formulas describing the multi-fold Multi-fold is realized by the call of the followingMathematica function

HO [ H Constraint rarr φ ]

H is a list of points on the origami which determine the faces to be moved φ is a formula in thefirst-order predicate logic The formula φ specifies the constraints that the geometrical objectsconcerned have to satisfy In our example the geometrical constraints that specify the 2-foldoperation are expressed by formula φprime

K1in (4) We write φprime

K1in the language of Eos and call

HO as follows

HO[C A Constraint rarr existmmLineexistnnLineexistff PointexistiiPointexistjjPointexistggPointexisthhPoint

(E f sub m and i j sub n and f i g h sub AB and j isin CDand

im isin CD and fn isin CDand

SqDistance[E f ] == SqDistance[i j] == SqDistance[f gn] ==

SqDistance[i hm] == SqDistance[gn hm])]

(6)

The term SqDistance[XY ] is the square of the distance between X and Y (ie |XY |2)Notations like ldquoexistmmLinerdquo ldquoE f sub mrdquo ldquoimrdquo ldquoim isin CDrdquo are Eos extension of Mathematicasyntax

The evaluation of (6) generates 24 distinct cases of possible configurations of points F GH I and J and lines m and n We deduce that the algebraic interpretation of the constraintsas defined by φprime

K1 is a well constrained system of equations since we obtained finite number of

solutions However not all of the 24 cases are relevant to our construction problem They may

57

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

(a) Case 1 (b) Case 2

(c) Case 3 (d) Case 4

(e) Case 5 (f) Case 6

Figure 5 6 possible cases for lines m and n

correspond to degenerate cases that lead to failure of the proof by Grobner bases In order toeliminate the degenerate cases and also to get a reasonable number of cases we further narrowthe search space of the configuration of points and lines For that we add the following extraconstraints

E isin nandj isin mandSqDistance[E i] == SqDistance[j f ] == SqDistance[E h] == SqDistance[j g]

The sub-formula E isin n and j isin m eliminates the degenerate cases where E and j are equalSub-formula SqDistance[E i] == SqDistance[j f ] == SqDistance[E h] == SqDistance[j g]specifies further conditions on points E F G H I and J We evaluate the following HO call

HO[C A Constraint rarr existmmLineexistnnLineexistff PointexistiiPointexistjjPointexistggPointexisthhPoint

(E f sub m and i j sub n and f i g h sub AB and j isin CDand

im isin CD and fn isin CD and

SqDistance[E f ] == SqDistance[i j] == SqDistance[f gn] ==

SqDistance[i hm] == SqDistance[gn hm]and

E isin n and j isin m and SqDistance[E i] == SqDistance[j f ] == SqDistance[E h] == SqDistance[j g])

MarkPointAt rarr F I J G H]

(7)

Consequently we obtain 6 cases as shown in Fig 5 Two of them namely those in Fig 5(a) andin Fig 5(f) lead to the construction of a regular heptagon Eos allows the user to interactivelychoose the suitable case to proceed with the construction Keyword MarkPointAt tells the Eoshow to label the existentially quantified points f i j g and h The outcome of folding in thecase 6 is shown in Fig 6

Next we apply two operations (O1) to fold along the line FGn and IHm in Fig 6 by callingHO with suitable arguments The lines FGn and IHm are the fold lines t and u respectivelyThe results are shown in Fig 7(a) and 7(b) Finally given the origami of Fig 7(b) we constructthe remaining vertex K We apply operation (O6) to obtain v which brings H and G onto ICand HB respectively Point K is the intersection of IC and line v We obtain the heptagonEKJIHGF in Fig 7(c)

58

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

Figure 6 Step 1 Folds along lines m and n

53 Algebraic Interpretation

This algebraic interpretation is used to ldquoevaluaterdquo the function calls of HO as well as the auto-mated proof of the correctness of the construction We take HO in (7) as an example To obtaingeometrical objects m n F G H I and J the formula in (7) is transformed into a set ofalgebraic equalities Further details of the algebraic interpretation are explained in [8] and [5]

Let the coordinates of A B D and E be (0 0) (900 0) (0 60) and (400 60) respectivelyFor an atomic formula φ let [[φ]] denote the set of polynomial relations that are the algebraicmeaning of φ An atomic formula is interpreted as a set of polynomial relations (equalities orinequalities) and a term is given as a rational function The set of (non-simplified) polynomialequalities (8) ndash (14) is the algebraic interpretation of formula in (7)

400a5+ 60b6+ c7 == 0 c7+ a5x11+ b6y12 == 0 c10+ a8x13+ b9y14 == 0

c10+ a8x15+ b9y16 == 0minus900y12 == 0minus900y14 == 0

minus900y20 == 0minus900y18 == 0minus54000 + 900y16 == 0 (8)

minus54000 +900

(

minus2b6(c7+ a5x13) + a52y14minus b62y14)

a52 + b62== 0 (9)

minus54000 +900

(

minus2b9(c10+ a8x11) + a82y12minus b92y12)

a82 + b92== 0 (10)

(400minus x11)2 + (60minus y12)2 == (x13minus x15)2 + (y14minus y16)2 ==(

y12minusminus2b9(c10+ a8x17) + a82y18minus b92y18

a82 + b92

)2

+

(

x11minusminusa82x17+ b92x17minus 2a8(c10+ b9y18)

a82 + b92

)2

==

(

y14minusminus2b6(c7+ a5x19) + a52y20minus b62y20

a52 + b62

)2

+

(

x13minusminusa52x19+ b62x19minus 2a5(c7+ b6y20)

a52 + b62

)2

==

(

minus2b9(c10+ a8x17) + a82y18minus b92y18

a82 + b92minus

minus2b6(c7+ a5x19) + a52y20minus b62y20

a52 + b62

)2

+

(

minusa82x17+ b92x17minus 2a8(c10+ b9y18)

a82 + b92minus

minusa52x19+ b62x19minus 2a5(c7+ b6y20)

a52 + b62

)2

(11)

59

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

400a8+ 60b9+ c10 6= 0 c7+ a5x15+ b6y16 6= 0 (12)

(minus400 + x13)2 + (minus60 + y14)2 ==

(x11minus x15)2 + (y12minus y16)2 == (minus400 + x19)2 + (minus60 + y20)2 ==

(x15minus x17)2 + (y16minus y18)2 (13)

(minus1 + b9)b9 == 0 (minus1 + a8)(minus1 + b9) == 0 1 + a82 6= 0 (minus1 + b6)b6 == 0

(minus1 + a5)(minus1 + b6) == 0 1 + a52 6= 0 (14)

A line a x + b y + c = 0 is represented by (a b c) together with the constraint (minus1 + b)b =0 and (minus1 + a)(minus1 + b) = 0 and a2 + 1 6= 0 Lines m and n are represented by (a5 b6 c7) and(a8 b9 c10) respectively Hence we have the equalities and disequalities in (14)

The equalities in (8) are the algebraic interpretation of the sub-formula E f sub mandi j subnand f i g h sub AB and j isin CD The first equation 400a5+ 60b6+ c7 == 0 means that point Eat (400 60) is incident to m defined by the equation a5x+ b6y + c7 = 0 Similarly the rest ofthe equations in (8) are interpretations of f at (x11 y12) is on m i at (x13 y14) is on n j at(x15 y16) is on n f is on AB i is on AB h at (x19 y20) is on AB g at (x17 y18) is on ABand j is on CD respectively

The reflection of point i at (x13 y14) across line m is the point im whose coordinates are

(minusa52x13 + b62x13minus 2a5(c7 + b6y14)

a52 + b62minus2b6(c7 + a5x13) + a52y14minus b62y14

a52 + b62)

Equation (9) states that im is incident to CD represented by (0 1 -60) Similarly equation(10) is the algebraic interpretation of fn isin CD Eos transforms rational form p

q== 0 to

p == 0 Note that in (9)ndash(11) q comes from coefficient of lines and q 6= 0 is deduced from (14)The disequalities of (12) states that the coordinates of point E and j do not satisfy the

equation of lines n and m respectively Eos changes the disequalities into equalities by addingslack variables introduced by Rabinowitch trick

Now we examine the equalities (11) and (13) [[SqDistance[E f ]==SqDistance[i j]]] givesrise to the first equality in (11) namely (400minusx11)2+(60minusy12)2 == (x13minusx15)2+(y14minusy16)2where E at (400 60) f at (x11 y12) i at (x13 y14) and j at (x15 y16) The rest of theequalities in (11) and equalities in (13) are obtained in the same way

By solving the above set of polynomial equalities for the coefficients of m and n and coor-dinates of f i j g and h we obtain the 6 cases in Fig 5

6 Proof

61 Theorem to Prove

We prove the following theorem

Theorem 61 Given the origami in Fig 7(c) we have(a) |EF | = |FG| = |GH| = |HI| = |IJ | = |JK| = |KE| and(b) ∡EOF = ∡FOG = ∡GOH = ∡HOI = ∡IOJ = ∡JOK = ∡KOE = 2π

7 where O is thecenter of EKJIHGF

Let θ = ∡EOF and α = eiθ VectorminusminusrarrFG is the rotation of

minusminusrarrEF through θ around center O

To prove the theorem 61 we show that the rotations ofminusminusrarrEF through angles 2θ 3θ 4θ 5θ and

60

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

(a) (b) (c)

Figure 7 Construction of (a) the edge GF (step 2) (b) the edge IH (step 3) and (c) vertex Kand final heptagon EKJIHG (step 4)

6θ givesminusminusrarrGH

minusrarrHI

minusrarrIJ

minusminusrarrJK and

minusminusrarrKE respectively and furthermore that θ = 2π

7 We show thatafter the construction the following holds

forallα isin C (αminusminusrarrEF minus

minusminusrarrFG = 0 rArr

α2minusminusrarrEF minusminusminusrarrGH = 0 and α3minusminusrarrEF minus

minusrarrHI = 0 and α4minusminusrarrEF minus

minusrarrIJ = 0and

α5minusminusrarrEF minusminusminusrarrJK = 0 and α6minusminusrarrEF minus

minusminusrarrKE = 0 and α7 minus 1 = 0)

(15)

Let P be the geometrical constraints accumulated during the construction Let C equiv forallα isinC (C1 rArr C2 and C3 and C4 and C5 and C6 and C7) be the formula (15) P and C form the premise andconclusion of the proposition (16) that we want to prove

P rArr forallα isin C (C1 rArr C2 and C3 and C4 and C5 and C6 and C7) (16)

Formula (16) is semantically equivalent to the conjunctions of the formulas (17)ndash(22)

P rArr forallα isin C (C1 rArr C2) (17)

P rArr forallα isin C (C1 rArr C3) (18)

P rArr forallα isin C (C1 rArr C4) (19)

P rArr forallα isin C (C1 rArr C5) (20)

P rArr forallα isin C (C1 rArr C6) (21)

P rArr forallα isin C (C1 rArr C7) (22)

62 Proof by Eos

We show how the validity of (17) is proved and the rest is achieved in a similar way We addthe conclusion forallα isin C C1 rArr C2 by calling Eos function Goal as follows

Goal[forallααisinComplexes(VectorToComplex[αminusminusrarrEF minus

minusminusrarrFG]==0 rArr

(VectorToComplex[α2minusminusrarrEF minusminusminusrarrGH]==0))]

(23)

Expressions C1 equiv αminusminusrarrEF minus

minusminusrarrFG = 0 and C2 equiv α2minusminusrarrEF minus

minusminusrarrGH = 0 written in the language of

Eos are VectorToComplex[αminusminusrarrEF minus

minusminusrarrFG] and VectorToComplex[α2minusminusrarrEF minus

minusminusrarrGH]==0 respectively

61

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

Function Goal adds the negation of the conclusion to the premise By calling Goal we obtainP and not(forallα isin C (C1 rArr C2)) In order to translate P and not(forallα isin C (C1 rArr C2)) into algebraic formwe fix the coordinate system to be Cartesian with points A B C D and E as follows

map = DefMapping[A Point[0-wd]B Point[wd0]

C Point[wd ht] D Point[0 ht] E Point[0 ht] ]amp(24)

Without loss of generality we set the size of the initial origami to be 2wdtimesht where the widthwd is taken to be arbitrary and the height ht is equal to 1 The point E is fixed at location(0 ht) Finally we check whether the reduced Grobner basis of the algebraic interpretation ofP and not(forallα isin C (C1 rArr C2)) is 1 by calling function Prove

Prove[ldquoKnot Heptagonrdquo Mapping rarr map GroebnerBasis rarr

CoefficientDomain rarr RationalFunctions

MonomialOrder rarr DegreeReverseLexicographic]

(25)

The above call of function Prove tells Eos to compute Grobner basis of the polynomial set[[P and not(forallα isin C (C1 rArr C2))]] Let V be the set of variables in [[P and not(forallα isin C (C1 rArr C2))]] TheGrobner basis computation is carried out in the domain of polynomials whose variables are inV wd and whose coefficients are in functions of Q(wd) Eos computes Grobner basis andgenerates a proof document (whose title is given by the first argument of the call of Prove) [16]

63 Proof Results

The proofs of (17)ndash(22) are successful The CPU time used for Grobner basis computation onMac OS X (Intel Core i7 8G 24GHz) machine varies from 69236984 seconds (for proving (17))to 1994889588 seconds (for proving (20))

7 Conclusion

We presented the construction of a regular heptagon using the knot fold Our method consistsin applying 2-fold operation coupled with Huzitarsquos fold operations The fold lines that makethe knot fold are determined by solving geometrical constraints We further showed the proofof the correctness of the construction of a regular heptagon based on Grobner bases

Note that using Huzitarsquos fold operations (O1) sim (O7) a regular heptagon is constructibleWith Eos we need 9 Huzitarsquos fold operations and more than 10 auxiliary operations such asunfolding and marking supporting points Further investigation of the geometrical constraintsby the knot fold is required to construct regular 11-gon which is impossible by Huzitarsquos foldoperations

Another issue that should be investigated in the future research is the rigidity of the knotfold We need to define the notion of rigidity in mathematical terms in this knot fold as wellas in more general origami that may involve 3D constructions

71 Acknowledgments

We thank Stephen Watt of Western Ontario University for drawing our attention to the knotfold This work is supported by JSPS KAKENHI Grant No 25330007 The first author of thispaper is supported by a postdoctoral fellowship at Kwansei Gakuin University

62

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

References

[1] D S Kasir The Algebra of Omar Khayyam (English translation of Khayyamrsquos original workAl-Jabr Wrsquoal Muqabalah) Teachers College Press 1931

[2] P L Wantzel Recherches sur les moyens de connaıtre si un probleme de geometrie peut se resoudreavec la regle et le compas Journal de Mathematiques Pures et Appliquees pages 366ndash372 1837

[3] H Huzita Axiomatic Development of Origami Geometry In Proceedings of the First InternationalMeeting of Origami Science and Technology pages 143ndash158 1989

[4] R C Alperin A Mathematical Theory of Origami Constructions and Numbers New York Journalof Mathematics 6119ndash133 2000

[5] T Ida A Kasem F Ghourabi and H Takahashi Morleyrsquos Theorem Revisited Origami Con-struction and Automated Proof Journal of Symbolic Computation 46(5)571 ndash 583 2011

[6] J Justin Resolution par le pliage de lrsquoequation du troisieme degre et applications geometriques InProceedings of the First International Meeting of Origami Science and Technology pages 251ndash2611989

[7] F Ghourabi A Kasem and C Kaliszyk Algebraic Analysis of Huzitarsquos Origami Operations andtheir Extensions In Automated Deduction in Geometry LNAILNCS Springer 2013 (to appear)

[8] F Ghourabi T Ida H Takahashi M Marin and A Kasem Logical and Algebraic View ofHuzitarsquos Origami Axioms with Applications to Computational Origami In Proceedings of the22nd ACM Symposium on Applied Computing (SACrsquo07) pages 767ndash772 Seoul Korea 2007

[9] R C Alperin and R J Lang One- Two and Multi-fold Origami Axioms In Origami4 Pro-ceedings of the Fourth International Meeting of Origami Science Mathematics and Education(4OSME) pages 371ndash393 2009

[10] F Ghourabi T Ida and H Takahashi Computational Origami of Angle Quintisection InProceedings of the Workshop in Symbolic Computation in Software Science (SCSS2008) RISCTechnical Report Series 08-08 pages 57ndash68 2008

[11] H M Cundy and A P Rollett Mathematical Models Oxford University Press 1961

[12] J K Brunton Polygonal Knots The Mathematical Gazette 45(354)299ndash301 1961

[13] K Sakaguchi On Polygons Made by Knotting Slips of Paper Technical Report of ResearchInstitute of Education Nara University of Education 1855ndash58 1982

[14] J Maekawa Introduction of the study of knot tape In Origami5 Proceedings of the FourthInternational Meeting of Origami Science Mathematics and Education (5OSME) pages 395ndash403 2011

[15] D A Cox Galois Theory Wiley-Interscience 2004

[16] F Ghourabi T Ida and A Kasem Proof Documents for Automated Origami Theorem ProvingIn Automated Deduction in Geometry volume 6877 of LNCS pages 78ndash97 Springer 2011

63

Automated Verification of Equivalence on

Quantum Cryptographic Protocols

Takahiro Kubota1 Yoshihiko Kakutani1 Go Kato2

Yasuhito Kawano2 and Hideki Sakurada2

1 The University of Tokyo Tokyo Japantakahirok11 30kakutaniissu-tokyoacjp

2 NTT Communication Science Laboratories Kanagawa Japankatogokawanoyasuhitosakuradahidekilabnttcojp

Abstract

It is recognized that security verification of cryptographic protocols tends to be difficultand in fact some flaws on protocol designs or security proofs were found after they had beenpresented The use of formal methods is a way to deal with such complexity Especiallyprocess calculi are suitable to describe parallel systems Bisimilarity which denotes thattwo processes behave indistinguishably from the outside is a key notion in process calculiHowever by-hand verification of bisimilarity is often tedious when the processes have manylong branches in their transitions We developed a software tool to automatically verifybisimulation relation in a quantum process calculus qCCS and applied it to Shor andPreskillrsquos security proof of BB84 The tool succeeds to verify the equivalence of BB84 andan EDP-based protocol which are discussed in their proof

1 Introduction

Security proofs of cryptographic protocols tend to be complex and difficult to verify Thisfact has been recognized in the classical cryptography and there is a line of researches to dealwith the complexity of verification [1 2] Since by-hand proofs are prone to human error andtime consumption efforts have been put into automating security proofs and verification in theclassical cryptography Security proofs are also complex in the quantum cryptography where wemust also consider attacks using entanglements The first security proof of BB84 quantum keydistribution (QKD) protocol by Mayers [3] is about 50 pages long After that paper researchershave been seeking simpler proofs [4 5] Since QKD is one of the closest application to practicein the quantum information field it is important to examine QKD systemsrsquo security formallyand make it machine-checkable

There are several formal frameworks for quantum protocols Feng et al developed a processcalculus qCCS [6] In this calculus a protocol is formalized as a configuration A configurationis a pair of a process and a quantum state corresponding to quantum variables Weak openbisimulation relation on qCCS configurations is defined Weakly open bisimilar configurationshave the same transitions up to internal ones and reveal the identical quantum states to theoutsider (adversary) in each step The relation is proven to be closed by parallel composition ofprocesses A use case of a process calculus for formal verification is to prove weak bisimilarityof implementation and specification described as configurations qCCS has been applied toquantum teleportation superdense coding and BB84 protocols

To extend application of formal methods to security proofs we applied qCCS to Shor andPreskillrsquos security proof of BB84 [4] in the previous paper [7] In Shor and Preskillrsquos securityproof security of BB84 is proven to be equivalent to that of another protocol based on anentanglement distillation protocol (EDP) and then the latter is proven to be secure We

64

Automated Verification of Equivalence on Quantum Cryptographic Protocols Kubota et al

formalized BB84 and the EDP-based protocol as configurations and proved their bisimilarityby hand However by-hand verification of bisimilarity is often tedious when configurationshave many long branches in their transitions In this paper we present a software tool to verifybisimilarity of given two qCCS configurations There are two main contributions of our work

First we implemented a software tool that formally verifies bisimilarity of qCCS configu-rations without recursive structures A protocol possibly takes security parameters for variouspurposes As for BB84 it takes two parameters one determines the length of qubits whichAlice sends to Bob in the first quantum communication and the other is for tolerated error-ratein the eavesdropping detection step Such parameters are passed to the verifier as symbols andare interpreted appropriately In our verifierrsquos framework quantum states and operations aredescribed as symbols Since attacks from the adversary are also treated as symbols our verifiercan deal with unspecified attacks To examine the behavioural equivalence adversaryrsquos viewsdenoted by partial traces must be checked to be equal in each step of a protocol The verifierautomatically checks the equality using user-defined equations

Second we applied our verifier to Shor and Preskillrsquos security proof of BB84 [4] The verifiertakes as input two configurations denoting BB84 and the EDP-based protocol and equationsabout the properties of error-correcting codes and measurement of the halves of EPR pairsThe verifier succeeds to verify the bisimilarity of the configurations of the two protocols

The package of the verifier is available from httphagiissu-tokyoacjp~tkqccs

verifiertargz It includes a user manual and and example scripts in the folders doc andscriptsRelated Work The authors of qCCS presented the notion of symbolic bisimulation for quan-tum processes [8] A purpose is to verify bisimilarity algorithmically They proved the strong(internal actions should be simulated) symbolic bisimilarity is equivalent to the strong openbisimilarity and actually presented an algorithm to verify symbolic ground (outsiders do notperform quantum operations adaptively) bisimilarity Since our purpose is to apply a pro-cess calculus to security proofs where adversarial interference must be taken into account weimplemented a tool that verifies weak open bisimilarity on the basis of the original qCCS [6]

2 The Verifier

Formal Framework The verifier employs a sublanguage of qCCS where the syntax of recur-sion and the use of classical data are restricted The framework is still expressive because ourtarget protocols do not need recursion and classical probability distributions can be representedas quantum states denoted by diagonal operators The syntax of the processes in the verifier isas follows

P = discard(q) | cqP | cqP | meas b then P saem | op[q]P | P ||P | PL

Intuitively discard(q)means termination of a process keeping a sequence of quantum variablesq secret cqP sends a quantum variable q to a channel c and then executes P cqP receivesquantum data to a variable q from a channel c and then executes P meas b then P saem

measures a quantum bit b and executes P if the outcome is 0 or terminates if the outcome is1 op[q]P performs a superoperator op to quantum variables q and then executes P P ||P prime

executes P and P prime in parallel PL where L is a set of channels executes P keeping channelsin L private Let qv(P ) be the set of quantum variables that occur in a process P cqP meas b then P saem op[q]P and P ||P prime are defined only if q isin qv(P ) b isin qv(P ) q sub qv(P )and qv(P ) cap qv(P prime) = empty respectively In our verifier each quantum variable is defined with its

65

Automated Verification of Equivalence on Quantum Cryptographic Protocols Kubota et al

qubit-length that is indicated by a natural number symbol declared beforehand The adoptionof natural number symbols is important to treat security parameters in the verifier Quantumstates are represented as character strings called environments The syntax of the environmentsis given as follows

ρ = X[q] | op[q](ρ) | ρ ρ | proji[b](ρ) | Tr[q](ρ)

Let qv(ρ) be the set of quantum variables that occur in an environment ρ X[q] meansthat quantum variables q are in a quantum state X op[q](ρ) is a quantum state after theapplication of operation op to quantum variables q in an environment ρ ρ ρprime represents thetensor product of ρ and ρprime but ρ ρprime and ρprime ρ are identified in the verifier ρ ρprime is definedonly if qv(ρ) cap qv(ρprime) = empty proji[b](ρ) means the reduced density operator |i〉〈i|bρ|i〉〈i|b withi isin 0 1 Tr[q](ρ) means the partial trace of ρ by q We call a pair 〈P ρ〉 of a process Pand an environment ρ a configuration only if qv(P ) sub qv(ρ) because quantum states of qubitsoccurring in P must be defined in ρ For example an agent that sends the halves of n EPR pairsto the outside is formalized as a configuration 〈cqdiscard(r) EPR[qr]ANY[s]〉 where thequantum variables q r are of the qubit length n and the quantum variable s is defined with anarbitrary qubit-length EPR[qr] is interpreted to (|00〉〈00|+ |00〉〈11|+ |11〉〈00|+ |11〉〈11|)otimesn

qr

and ANY[s] is arbitrarily for adversaryrsquos density operatorsA labelled transition system based on the original one [6] is implemented in the verifier

Transitions are interpreted as interactions between configurations and the adversary For exam-

ple the configuration above performs a transition 〈cqdiscard(r) EPR[qr]ANY[s]〉cqminusminusrarr

〈discard(r) EPR[qr]ANY[s]〉 where the adversary can recognize that the quantum vari-able q is sent through the channel c Transitions caused by internal actions such as quantumoperations internal communications and conditional branches are labelled τ The label τ intu-itively means that the action is invisible from the outside The transition rules of conditionalbranch are 〈meas b then P saem ρ〉

τminusrarr 〈P proj0[b](ρ)〉 and 〈meas b then P saem ρ〉

τminusrarr

〈discard(qv(P )) proj1[b](ρ)〉 These may decrease the trace of the density operator de-noting a quantum state Since the trace indicates the probability to reach to a configurationwe can restore the probability from configurations to conditional branches We identify thebranches that are evoked by an identical quantum variable Eventually probability is absorbedin quantum states and excluded from the transition system

The transition system of the original qCCS is probabilistic which is caused by the mea-surement construction M [qx] in the syntax [6] It measures an observable M of a quantumvariable q and stores the result in a classical variable x There are two ways to formalize quan-tum measurement since one can be also formalized as a superoperator Because only M [qx]evokes a probabilistic branch processes with different formalization of measurement are notbisimilar in general We proposed a criteria how to select the way in our previous work [7] weshould use M [qx] if a process behaves differently according to the measurement For examplethe case where a process performs different labeled transitions is typical Otherwise we shouldformalize measurement by a superoperator In our verifierrsquos framework M [qx] cannot be writ-ten independently Instead the syntax meas b then P saem is the composition of M [qx] andthe conditional branch in the original qCCS This restriction and the conditions on quantumvariables prevent the situation where two configurations with the different ways of formalizationof measurement are not bisimilarProcedure to Check Bisimulation Weak bisimulation relation [6] is defined on qCCS con-figurations Roughly speaking weakly bisimilar configurations (1) perform identical labelledtransitions up to τ transitions and (2) reveal identical density operators whatever operations theadversary performs to her quantum variables The adversaryrsquos view is denoted by the partial

66

Automated Verification of Equivalence on Quantum Cryptographic Protocols Kubota et al

trace Tr[q](ρ) when the global quantum state is ρ and q are the quantum variables that arenot revealed to the adversary The verifier takes as input two configurations and user-definedequations on environments and returns true or false It is designed to be sound with respectto the original qCCS that is two configurations are bisimilar if the verifier returns true withthem and some valid equations This is because

Reqs = (CD) |The verifier returns true given CD and eqs

is a bisimulation relation for all valid equations eqs Precisely Reqs is converted accordinglybecause meas b then P saem is decomposed to M [bx] and a conditional branch which performsa two-step transition in the branch with x = 0 The recursive procedure to verify bisimilarityis as follows Since the transitions of the processes written in our sublanguage are finite theprocedure always terminates

1 The procedure takes as input two configurations 〈P0 ρ0〉 〈Q0 σ0〉 and user-defined equa-tions on environments

2 If P0 and Q0 can perform any τ -transitions of superoperator applications they are allperformed at this point Let 〈P ρ〉 and 〈Q σ〉 be the obtained configurations

3 Whether qv(P ) = qv(Q) is checked If it does not hold the procedure returns false

4 Whether Tr[qv(P )](ρ) = Tr[qv(Q)](σ) is checked with user-defined equations Theprocedure to check the equality of quantum states are described in the next subsectionIf it does not hold the procedure returns false

5 A new superoperator symbol E[qv(ρ)minus qv(P )] that stands for an adversarial operationis generated

6 For each 〈P prime ρprime〉 such that 〈P E[qv(ρ) minus qv(P )](ρ)〉αminusrarr 〈P prime ρprime〉 the procedure checks

whether there exists 〈Qprime σprime〉 such that 〈Q E[qv(σ) minus qv(Q)](σ)〉τlowastminusrarr

αminusrarr

τlowastminusrarr 〈Qprime σprime〉 and

the procedure returns true with the input 〈P prime ρprime〉 and 〈Qprime σprime〉 If there exists it goes tothe next step 7 Otherwise it returns false

7 For each 〈Qprime σprime〉 such that 〈Q E[qv(σ) minus qv(Q)](σ)〉αminusrarr 〈Qprime σprime〉 the procedure checks

whether there exists 〈P prime ρprime〉 such that 〈P E[qv(ρ) minus qv(P )](ρ)〉τlowastminusrarr

αminusrarr

τlowastminusrarr 〈P prime ρprime〉 and

the procedure returns true with the input 〈Qprime σprime〉 and 〈P prime ρprime〉 If there exists it returnstrue Otherwise it returns false

The step 2 prominently reduces the search space Indeed 〈op1[q]P ||op

2[r]Q ρ〉 and

〈P ||QF rop2

(E qop1

(ρ))〉 are bisimilar and F rop2

(E qop1

(ρ)) = E qop1

(F rop2

(ρ)) holds because q cap r = emptyholds Therefore superoperators that can originally cause τ transitions are disposedEquality Test of Quantum States To test the equality of given two environments the verifierchecks whether they are transformed to the same form There are two kinds of transformationstrace out and application of user-defined rules

Partial trace is significant to test the equality of quantum states For example two differentquantum states op1[q](X[q]Y[r]Z[s]) and op2[r](U[q]V[r]Z[s]) have the same par-tial trace Z[s] under Tr[qr] for arbitrary interpretation of the superoperators op1 op2 andthe quantum states X Y Z U V The verifier eliminates symbols of superoperators and quantumstates according to the partial trace rules below

Tr[q](E[r](ρ)) = Tr[q](ρ) if r sub q (1) Tr[q](ρ) = Tr[r](Tr[s](ρ)) if q = r cup s (2)

Tr[q](E[r](ρ)) = E[r](Tr[q](ρ)) if q cap r = empty (3) Tr[q](ρ lowast ρq lowast σ) = ρ lowast σ (4)

67

Automated Verification of Equivalence on Quantum Cryptographic Protocols Kubota et al

If r sub q holds Tr[q](E[r](ρ)) is rewritten to Tr[q](ρ) eliminating E[r] by the rule (1)otherwise by the rules (2) and (3) the trace-out symbol with quantum variables that are disjointto targets of superoperator goes inside of itrsquos application After eliminating superoperatorsquantum states are traced out by the rule (4)

If an objective quantum state has a part that matches to the left-hand side of a user-defined equation the part is rewritten to the right-hand side To apply a user-definedequation the verifier automatically solves commutativity of superoperators or partial tracesthat are applied to disjoint sets of quantum variables For example if the objectivequantum state is Tr[q](hadamard[s] (EPR[qr]X[s])) and a user defines an equationTr[q](EPR[qr])=Tr[q](PROB [qr]) (E1) the application goes as follows

Tr[q](hadamard[s](EPR[qr]X[s])) = hadamards[s](Tr[q](EPR[qr]X[s])) (by 5)

= hadamard[s](Tr[q](PROB[qr]X[s])) (by E1)

Since the trace-out rules may have become applicable after applications of user-defined rulesthe trace-out procedure is applied again In each opportunity to test the equality of quantumstates each user-defined equation is applied only once This guarantees whatever rules a userdefines the equality test terminates

3 Application to Shor and Preskillrsquos Security Proof

The two protocols BB84 and the EDP-based protocol [4] are formalized as qCCS configurationson the basis of our previous work [7] Readers can find the script scriptsshor-preskillscrin the package The interpretations of the symbols of the quantum states and the superoperatorsthat are used in the formalization are also included as docshor-preskill symbolspdfOn Channels As in general QKD protocols three kinds of channels are used public quantumchannels private classical channels and public no-interpolate classical channels Since thesyntax has channel restriction PL formalization of private channels is straightforward Publicno-interpolate classical channels are realized by copying the data If a quantum variable q wherea classical value is assigned is sent through a public no-interpolate channel c this is formalizedas copy[qQ]cqdQ c where Q is a new quantum variable a superoperatorcopy copies the value of q to Q and d is a new non-restricted channel q will securely sentthrough the restricted channel c and an adversary obtains the same value accessing Q througha public channel d Note that the value of q can be copied because it is classicalEquations for the Proof We defined 10 equations in the verifier Equations are interpretedto those on density operators and proven correct For example the equation below tells theverifier that the halves of EPR pairs are indistinguishable from the uniform distribution Thisis used to check that the adversaryrsquos views are identical in the EDP-based protocol and BB84before Alice in the EDP-based protocol measures her halves of the check qubits

equation E7

Tr[q1_A](EPR[q1_Aq2_A]) = Tr[q1_A](PROB[q1_Aq2_A])

end

The user-defined rule above is interpreted to an equation trq1 A(|00〉〈00|+ |00〉〈11|+ |11〉〈00|+

|11〉〈11|)otimesnq1 Aq2 A = trq1 A(|00〉〈00|+ |11〉〈11|)otimesn

q1 Aq2 A The other rules are related to CSS codespartial traces and measurement of quantum states We obtained them by formalizing theequality of quantum states that are discussed in the original proof [4]

It is actually natural to express quantum states as symbols with some equations in inputs Incryptographic protocols the dimension of quantum states and superoperators cannot be fixed

68

Automated Verification of Equivalence on Quantum Cryptographic Protocols Kubota et al

as a certain number as they depend on security parameters In addition qubits going throughpublic channels are potentially interpolated by the adversary Since arbitrary computationby the adversary must be considered it should be described as an unspecified superoperatorTherefore quantum states are difficult to be expressed as concrete matrices which can benumerically analyzed Although quantum states are treated symbolically automatic calculationof partial traces is still possible focusing on occurrence of quantum variables in environmentsExperiment Result We ran the verifier with the input of shor-preskillscr We used anote PC with Intel Core i5 CPU M 460 253GHz and 1GB memory The transition tree ofthe EDP-based protocol has 621 nodes and 165 paths and that of BB84 has 588 nodes and 165paths The verifier checked the bisimilarity of the two protocols in 1598 seconds The recursiveprocedure was called 951 times

4 Conclusions

We presented a software tool to check bisimulation of qCCS configurations and applied it to asecurity proof of BB84 [4] In security proofs equivalence on protocols is often discussed Itcan be described as bisimulation relation but it is nearly impossible to check by hand if statetransitions of processes have many long branches In addition the equality of an adversaryrsquosview between two protocols has to be checked in each step An adversaryrsquos view is calculatedfrom a global quantum states which is possibly denoted by a huge matrix The verifier doesexhausting parts of proofs of behavioral equivalence namely it checks the correspondence ofall state transitions up to invisible ones and an adversaryrsquos view up to equations On the otherhand a user only have to examine the correctness of formalization of protocols and validityof equations that he defines It could be difficult to find all appropriate equations for a proofimmediately The verifier is also able to show environments andor processes when the checkprocedure returns false With the information a user can modify equations to inputFuture WorkWe plan to define probabilistic bisimilarity which denotes that configurations be-have indistinguishably up to some probability This will be helpful to prove ldquoindistinguishabilityup to negligible probabilityrdquo of protocols It is quite common argument in the cryptography

References

[1] S Halevi A plausible approach to computer-aided cryptographic proofs Cryptology ePrint ArchiveReport 2005181 2005

[2] B Blanchet A D Jaggard A Scedrov and J-K Tsay Computationally sound mechanized proofsfor basic and public-key kerberos In Proceedings of the 2008 ACM symposium on Informationcomputer and communications security pages 87ndash99 2008

[3] D Mayers Unconditional security in quantum cryptography J ACM 48351ndash406 May 2001

[4] P W Shor and J Preskill Simple proof of security of the bb84 quantum key distribution protocolPhys Rev Lett 85(2)441ndash444 Jul 2000

[5] H-K Lo and H F Chau Unconditional security of quantum key distribution over arbitrarily longdistances Phys Rev Lett 283(5410)2050ndash2056 Mar 1999

[6] Y Deng and Y Feng Open bisimulation for quantum processes In Theoretical Computer Sciencevolume 7604 of LNCS pages 119ndash133 2012

[7] T Kubota Y Kakutani G Kato Y Kawano and H Sakurada Application of a process calculusto security proofs of quantum protocols In Proceedings of WORLDCOMPFCS2012 Jul 2012

[8] Y Feng Y Deng and M Ying Symbolic bisimulation for quantum processes arXiv preprintarXiv12023484 2012

69

A Modified Parallel F4 Algorithm for Shared

and Distributed Memory Architectures

Severin Neumann

Fakultat fur Mathematik und InformatikUniversitat Passau D-94030 Passau Germany

neumansfimuni-passaude

Abstract

In applications of symbolic computation an often required but complex procedure is findingGrobner bases for polynomial ideals Hence it is obvious to realize parallel algorithms tocompute them There are already flavours of the F4 algorithm like [4] and [13] using thespecial structure of the occurring matrices to speed up the reductions on parallel architec-tures with shared memory In this paper we start from these and present modificationsallowing efficient computations of Grobner bases on systems with distributed memory Toachieve this we concentrate on the following objectives decreasing the memory consump-tion and avoiding communication overhead We remove not required steps of the reductionsplit the columns of the matrix in blocks for distribution and review the effectiveness of theSIMPLIFY function Finally we evaluate benchmarks with up to 256 distributed threads ofan implementation being available at httpsgithubcomsvrnmparallelGBC

1 Introduction

Parallelization is one of the most used methods to improve the performance of existing softwareBut it should be introduced systematically One chooses the most time-consuming segments ofa program and tries to improve these first In applications of symbolic computation an oftenrequired but complex procedure is finding Grobner bases for polynomial ideals Therefore itis obvious to realize parallel versions of algorithms to compute them Although it is possibleto use Buchbergerrsquos algorithm [14] we favour Faugerersquos algorithm F4 [3] since the reduction isdone due to matrix transformation which is known for being well parallelizable

There are already parallel flavours of F4 like [4] and [13] using the special structure ofthe occurring matrices to speed up the reduction Both approaches have been developed formulticore and multiprocessor systems with shared memory For these systems the number ofparallel processing units is limited and currently there are not many platforms serving morethan 64 processors Compared with that clusters of several suchlike computers can have antheoretical unlimited number of processors This advantage comes with the downside of dis-tributed memory realizing algorithms requires to consider that data has to be transfered Bythat memory duplication and communication overhead are introduced

In the following we start from the mentioned developments for shared memory systemsand present modifications which will finally allow efficient computation of Grobner bases alsofor systems with distributed memory To achieve this we have concentrated on the followingobjectives reducing the memory consumption and avoiding communication overhead Weremove needless steps of the reduction split the columns of the matrix in blocks for distributionand review the effectiveness of the SIMPLIFY function

At the end we will evaluate benchmarks of an implementation using eight distributed nodeshaving 32 processor cores each The source code is available at httpsgithubcomsvrnmparallelGBC

70

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

2 Notations

In the following we will use the notation of [11] Hence K denotes a field and K[x1 xn] thepolynomial ring over K in n indeterminantes Tn is defined as the set of all terms xα1

1 middot middotxαnn

σ is a term ordering on this set For a polynomial f isin K[x1 xn] with f =summ

i=1 ci middot tiwhere ci isin K and ti isin T

n for all i we call the set Supp(f) = t1 tm support of f Thenthe leading term of f is defined as LTσ(f) = tk = maxσ(Supp(f)) and the leading coefficientis LCσ(f) = ck

Let F = f1 fs isin K[x1 xn] 0 be a set of polynomials Then I = 〈F〉 is theideal generated by F The elements of the set B = (i j) | 1 le i lt j lt s are called criticalpairs For each critical pair exists an S-polynomial Sij = 1

LCσ(fi)middot tij middot fi minus

1LCσ(fj)

middot tji middot fj

with tij =lcm(LTσ(fi)LTσ(fj))

LTσ(fi)and tji =

lcm(LTσ(fj)LTσ(fi))LTσ(fj)

The set F is a σ-Grobner basis of I if for all critical pairs the S-polynomials can be reducedto zero by the elements of F with respect to σ

If not stated otherwise we will use the degree reverse lexicographic termordering (DegRevLex)and the finite field with 32003 elements (F32003) for examples and benchmarks

3 Preliminaries

The F4 algorithm was introduced by Faugere in 1999 [3] By using the special structure ofthe matrix and column-based parallelism Faugere and Lachartre introduced a parallelizationimproving the performance remarkable [4] We have presented another modification [13] for F4speeding up the computation by row-based parallelization

In the following we give a quick summary about Grobner bases computation and the men-tioned developments For a given set of polynomials F = f1 fs isin K[x1 xn] 0generating an ideal I = 〈F〉 a σ-Grobner basis G = g1 gt isin K[x1 xn] can be com-puted using the F4 algorithm by the following four steps

1 Create and update the set of critical pairs B using Gebauerrsquos and Mollerrsquos UPDATE func-tion [6] This function guarantees that the leading terms tij middot fi = tji middot fj of the minuendand subtrahend of the S-polynomial is unique among the critical pairs

2 Select a subset of all critical pairs for reduction using the normal or the sugar cubestrategy [7] At this point the details are not relevant For our benchmarks we chose thesugar cube strategy Although we have to mention that our implementation supports thenormal strategy and for some of the polynomial systems we used as example this strategymight perform better

3 Symbolic preprocess the selected pairs to obtain a coefficient matrix representing theS-polynomials The matrix is additionally filled with rows representing reduction polyno-mials for each term which can be reduced using elements of the partial computed Grobnerbasis G The SIMPLIFY method can be applied to reuse results of previous reductions

4 Reduce the generated matrix until row-echelon form This is equivalent to top-reducingthe S-polynomials All non-zero rows of this matrix having leading terms which are notdivisible by any element of G are inserted into G As long as new elements are found thealgorithm continues with step 1

The most time-consuming step is the reduction of the coefficient matrix The mentioned par-allelizations of Lachartre and Faugere as well as our own approach concentrate on speeding

71

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

up this step We want to show how to use these improvements also for distributed parallelarchitectures therefore we have to review them

Starting after symbolic preprocessing we obtain a coefficient matrix M which has to bereduced to a row-echelon form M has n rows and m columns with m ge n and can bedecomposed in submatrices

1 Submatrices S1 and S2 arise from the subtrahends and minuends of the S-polynomialsSince the UPDATE function guarantees that all polynomials have distinct leading terms therepresenting rows have unique pivot columns Therefore S1 and S2 are upper-triangular

2 Submatrix R represents the reduction polynomials They were computed during symbolicpreprocessing For each reducible term there is only one reduction polynomial Becauseof that R is upper-triangular

3 Finally these submatrices can be split up in pivot and non-pivot columns The pivots of Rand S1 are forming the submatrix A and the non-pivots the submatrix B The submatrixS2 is split into C containing its pivots and D containing the non-pivot columns Thisnotation was introduced in [4]

The following example demonstrates the construction of a matrix occurring during Grobnerbases computations

Example 1 Let K = K32003 P = K[x1 x2 x3] and let the polynomials g1 = x21 + x2

2g2 = x1 middot x2 + x2

2 + x2 middot x3 and g3 = x22 + x2

3 + x3 form the ideal I = 〈g1 g2 g3〉 for which aGrobner basis with respect to DegRevLex should be computed Using UPDATE we get the criticalpairs (2 3) and (1 2) They have the same sugar degree sugar(g2 g3) = 3 = sugar(g1 g2) Sowe reduce the following polynomials

f12 =(x21 + x2

2) middot x2 = x21 middot x2 + x3

2

f21 =(x1 middot x2 + x22 + x2 middot x3) middot x1 = x2

1 middot x2 + x1 middot x22 + x1 middot x2 middot x3

f23 =(x1 middot x2 + x22 + x2 middot x3) middot x2 = x1 middot x

22 + x3

2 + x22 middot x3

f32 =(x22 + x2

3 + x3) middot x1 = x1 middot x22 + x1 middot x

23 + x1 middot x3

and as set of reduction polynomials we obtain

r1 =g3 middot x2 = x32 + x2 middot x

23 + x2 middot x3

r2 =g2 middot x3 = x1 middot x2 middot x3 + x22 middot x3 + x2 middot x

23

r3 =g3 middot x3 = x22 middot x3 + x3

3 + x23

At the end we get the following matrix M

f12f23r1r2r3f21f32

1 0 1 0 0 0 0 0 0 0 00 1 1 0 1 0 0 0 0 0 00 0 1 0 0 0 1 0 0 1 00 0 0 1 1 0 1 0 0 0 00 0 0 0 1 0 0 1 0 0 11 1 0 1 0 0 0 0 0 0 00 1 0 0 0 1 0 0 1 0 0

One can easily see the mentioned structure of the matrix The upper left submatrix is A andits pivots are highlighted Below is C and the non-pivot columns are forming B and D

72

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

Using this decomposition the (full) reduction of the matrix can be computed using thefollowing algorithm

1 Primary reduction Reduce B to Aminus1 middotB

2 Secondary reduction Reduce D to D minus C middotAminus1 middotB

3 Final reduction Reduce D to its reduced row-echelon form using Gaussian elimination

4 Optional reduction Reduce B using the pivots of D

Especially the primary reduction can be efficiently parallelized since the matrix is in uppertriangular form and so all pivots are known The primary and secondary reduction can becomputed in parallel because a reduced row of B can be applied independently on rows of D

After the final reduction all non-zero rows of D are elements of the Grobner basis andcan be used to compute further critical pairs Matrix (AB) does not contain any requiredelements because by construction the pivots of A are equivalent to leading terms which arealready contained in the Grobner basis Hence the fourth step is optional and only required ifSIMPLIFY is used

There are two different approaches to achieve parallelization Column-based as suggestedby Faugere and Lachatre and row-based as suggested by us Actually these two are not mu-tually exclusive and we will use this property to advance the parallelism on architectures withdistributed memory In the following we will use the row-based approach for shared memoryparallelism but one can easily see that all modifications are also applicable to the column-basedapproach of Faugere and Lachatre

4 Matrix Distribution

In the case of the matrix reduction during Grobner basis computation we have to considerhow to distribute the coefficient matrices with least duplication and communication Like anyother parallel and distributed algorithm for transforming matrices into row echelon form wecan choose between row- and column-based distribution or a combination of both

If row-based or combined distribution is chosen the algorithm scatters rows or blocks amongthe computation nodes and these need to send rows from one to each other if they are requiredfor further reductions To reduce the communication overhead this needs to use a strategywhich decides how the matrix is distributed Since we use rows-based parallelization for theshared memory level and since the column-based distribution does play well with the specialproperties of Grobner basis computations we didnrsquot analyse the effectiveness of the row-basedor combined approach

If column-based distribution is chosen the pivot matricesA and C have to be send to all nodesand the non-pivot matrices B and D can be distributed without duplication Since all pivotsare preset for primary and secondary reduction this approach does only require communicationbefore and after all reductions are done

Furthermore the matrices are sparse and by using appropriate matrix formats the commu-nication overhead can be reduced even more We chose to store the off-diagonal elements of Aand C in a coordinate list ie there is one list storing tuples of row column and value Thisformat allows reordering in parallel executable sets to improve the row-based parallelization aspresented in [13] For B and D a modified list of lists format is used storing pairs of row indexand value for each column This allows to distribute columns independently As suggested in[8 Chapter 6] the columns are distributed round-robin to optimize load balancing Afterwards

73

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

each node can use row-based parallelism on the local shared memory The following shows thedistribution of the matrix constructed in example 1

Example 2 Using two parallel nodes the matrix M of the previous example is decomposedinto one coordinate list and two lists of lists Afterwards the pivots are sent to both nodes andthe two sets of non pivot columns are distributed among the nodes Finally the two nodes areholding the following data

Node 1 Node 2

(A C)(411) (431) (201)(211) (351)(051)(151)(161)

(B D)5 (61)7 (41)9 (43)

(A C)(411) (431) (201)(211) (351)(051)(151)(161)

(B D)6 (21) (31)8 (61) -10 (41) -

Table 1 shows that the final reduction can be computed on a single node because thesubmatrix D consumes only a tiny fraction of the whole matrix One can easily check thatthis is true in general the submatrices S1 and S2 have s rows each and the submatrix R hasr rows There are p pivot columns and n non-pivot columns Hence the coefficient matrix has2 middots+r rows and p+n columns After primary and secondary reduction the final reduction onlyrequires the submatrix D which has s remaining rows and n columns Therefore all reducedcolumns can be gathered on one node which executes the Gaussian elimination on D

Polynomial System Sugar degree primary matrix final matrix ratio ()Gametwo 7 [10] 17 7731 x 5818 2671x2182 13Cyclic 8 [1] 14 3819 x 4244 612x1283 48Cyclic 9 16 70251 x 75040 4014x10605 08

Katsura 12 [9] 9 12141 x 11490 2064x2155 32Katsura 13 9 26063 x 23531 4962x4346 35Eco 12 [12] 9 12547 x 10937 2394x1269 22Eco 13 10 25707 x 24686 2883x2310 10F966 [5] 9 60274 x 63503 4823x9058 11

Table 1 Ratio of primary matrix and final matrix during reduction for selected problems

The optional reduction is an obstacle for the effectiveness of the algorithm since it requiresthat the reduced matrix D has to be distributed again to be applied on B Because of that weexamine if the optional reduction is useful at all Even more we put to test if the SIMPLIFY

method and distributed computation play well together

5 Simplifying the F4 Algorithm

Removing the optional reduction may scale down the required communication overhead andthe reduction time Even more if SIMPLIFY isnrsquot used during symbolic preprocessing the

74

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

distributed matrix has not to be gathered completely since the columns of the reduced matrixB are not required after primary and secondary reduction

Algorithm 1 SIMPLIFY

Input t isin Tn a term f isin K[x1 xn] a polynomial F isin (Fk)k=1dminus1) where Fk is

finite subset of K[x1 xn]Output a non evaluated product ie an element of Tn timesK[x1 xn]foreach u isin list of divisors of t do1

if existj(1 le j lt d) such that (u middot f) isin Fj then2

Fj is the row echelon form of Fj wrt σ 3

there exists a (unique) p isin Fj

+such that LTσ(p) = LTσ(u middot f) 4

if u 6= t then return SIMPLIFY( tu pF) else return (1 p)5

end6

end7

The SIMPLIFY method does not guarantee that a reduction is improved by reusing previousresults Actually SIMPLIFY proves it effectiveness mostly by application Hence we requirea best possible implementation of the method Algorithm 1 is a repetition of the originalSIMPLIFY [3] It leaves some details open and there are some possibilities for optimization

bull Searching through all divisors of t is time consuming regarding the fact that only somedivisors of u will satisfy the condition (u f) isin Fj for j isin (1 le j lt d)

bull To check if there exists a j with (u f) in Fj it is important how Fj is stored A naiveimplementation will require to loop over all rows of Fj until the condition is satisfied

bull This algorithm does not check if there is another jprime 6= j satisfying the condition andprovides a better replacement

To address these issues we propose the following modifications

bull All rows of F1 Fdminus1 are stored in a two-dimensional map The first key is a polynomialf and the second is a term u This allows to update (u f) if a better replacement is foundBy that only one value per pair is stored This will decrease the required memory

bull The first map should provide a fast random access to the value of key f and the secondmap should have an ordering to allow a decreasing iteration of the possible terms In thisway the search space for possible replacements is reduced to the multiples of f only

bull The value of a map element is the reduced form of f middot u

We call this data structure SimplifyDB We can provide an improved version of SIMPLIFY asshown by algorithm 2 Additionally we have to introduce a function to update the SimplifyDB

Therefore after reduction we execute algorithm 3 for each row of Fj

+ The insertion step allows

us to compare candidates for the SimplifyDB In our implementation for two candidates thebetter is the one which has less elements in its support This is equivalent to the first weightedlength function wlen(p) = Supp(p) in [2] At this point we didnrsquot try any other suggestedweighted length function

SIMPLIFY can be improved even more During symbolic preprocessing it is called twiceonce for the selected critical pair (m f) with m isin T

n and f isin G and once to create reduction

75

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

Algorithm 2 SIMPLIFY with SimplifyDB

Input t isin Tn a term f isin K[x1 xn] a polynomial SimplifyDB

Output a non evaluated product ie an element of Tn timesK[x1 xn]foreach u le t isin SimplifyDB[f ] do1

if u divides t then2

p = SimplifyDB[f ][u] 3

if u 6= t then return SIMPLIFY( tu p SimplifyDB) else return (1p) 4

end5

end6

Algorithm 3 Insertion into SimplifyDB

Input t isin Tn a term f p isin K[x1 xn] polynomials SimplifyDB

Output SimplifyDBif existu isin SimplifyDB[f ] t = u then1

Replace SimplifyDB[f ][u] with p if it is better 2

else3

SimplifyDB[f ][t] = p 4

end5

polynomials mprime middot f with mprime isin Tn and f prime isin G As one can easily see the second input parameter

is always an element of G So it stands to reason to restrict SIMPLIFY

SIMPLIFY(t i) where i is the index of gi isin G

Still there is the recursive call of SIMPLIFY taking a polynomial p as parameter which mightnot be an element of G Recall that p was found in the SimplifyDB using f and a term u = t

z

with z isin Tn With the knowledge that f = gi isin G we can write p = f middotuminus r = gi middotuminus r where

r isin K[x1 xn] is the sum of all reductions applied on f during a previous reduction stepThe recursive call is looking for another polynomial pprime which simplifies z middot p = z middot (gi middot u minus r)If such a polynomial pprime exists we can write pprime = z middot (gi middot u minus r) minus rprime = z middot u middot gi minus (z middot r minus rprime)Hence if the SimplifyDB stores pprime at index (gi z middot u) instead of (p z) the recursion is obsoleteand SIMPLIFY can be replaced with algorithm 4 being recursion free

Algorithm 4 New SIMPLIFY algorithm

Input t isin Tn a term i is the index of gi isin G SimplifyDB

Output a non evaluated product ie an element of Tn timesK[x1 xn]foreach u le t isin SimplifyDB[f ] do1

if u divides t then return ( tu SimplifyDB[f ][u]) 2

end3

Before benchmarking different variants of the distributed versions of the algorithm a firstlook at timings using only shared memory will thin out the number of combinations Forthe following computations we used a system with 48 AMD Opteron

TM

6172 cores having64 gigabyte of main memory The implementation of the parallelization for the shared memoryis presented in [13] and in its latest version it is realized using Intel Rcopy Threading Building Blocks(TBB) and Open Multi-Processing (OpenMP) for parallelization

76

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

Table 2 shows that the optional reduction is mostly useless and can be left out duringGrobner basis computation Table 3 shows that our new recursion-free SIMPLIFY is also inpractice faster and even more memory efficient

Finally SIMPLIFY is improving performance by increasing memory usage and so for solvinglarger polynomial systems it might be possible to find a solution within the bounds of availablememory by disabling SIMPLIFY Consequently we will compare computations with and withoutthe improved SIMPLIFY for the distributed parallel implementation in the following section

Polynomial systems without optional reduction with optional reductionmax matrix size runtime max matrix size runtime

Gametwo 7 7808 x 5895 2846 7731 x 5818 2985Cyclic 8 3841 x 4295 1118 3819 x 4244 1215Cyclic 9 70292 x 75080 6067 70251 x 75040 6283

Katsura 12 12142 x 11491 3449 12141 x 11490 3666Katsura 13 26063 x 23531 1522 26063 x 23531 1692Eco 12 12575 x 11349 2522 12547 x 10937 2836Eco 13 25707 x 24686 9176 25707 x 24686 1037F966 60898 x 63942 9832 60274 x 63503 1185

Table 2 Comparison of computations with and without optional reduction The new SIMPLIFY

algorithm was used in both cases

Polynomial with new SIMPLIFY with original SIMPLIFY without SIMPLIFYsystems runtime (s) memory runtime memory runtime memory

Gametwo 7 2846 459MB 2882 721MB 2997 262MBCyclic 8 1118 262MB 1443 393MB 1228 131MBCyclic 9 6067 156GB 6492 240GB 5429 210GB

Katsura 12 3449 655MB 3928 157GB 4374 328MBKatsura 13 1522 256GB 1872 727GB 2071 917MBEco 12 2522 328MB 3875 138GB 5087 262MBEco 13 9176 114GB 1364 577GB 2182 852MBF966 9832 256GB 2182 113GB 2125 125GB

Table 3 Comparison of original and new SIMPLIFY

6 Benchmarks

For the following benchmarks of our distributed implementation we used a cluster of up toeight systems having 16 Intel Rcopy Xeon Rcopy E5-2670 cores with hyperthreading and 64GB of RAMallowing us using up to 256 parallel threads For data distribution we use the Message PassingInterface (MPI) and the BoostMPI wrapper

Table 4 compares once again runtimes for computations with and without SIMPLIFY usingone two or four nodes For all polynomial input systems the computation time goes up andthe distribution has no positive effect However we accomplished to speed-up the reductiontime This is not an inconsistency The overall runtime goes up due to the communication

77

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

overhead and the possibility to improve the performance is limited to decreasing the reductiontime Hence the problem is the small size of the given polynomial systems Figure 1 illustratesthis issue for Cyclic 9

Table 5 adds further and more difficult examples Especially for Katsura 15 and Cyclic 10the distributed parallelization takes effect providing a speed-up of 23 and 27 for the overallcomputation time and 57 and 50 for the reduction using four respectively eight nodes Exclud-ing the Eco 14 system the computation is most effective without SIMPLIFY and in particularfor Cyclic 10 computations were not even possible with it due to memory overflows

Eco 14 is an counterexample because it is not possible to decrease the computation timeusing a distributed system This is caused by the effectiveness of SIMPLIFY for the probleminstance

The crashed computations for Katsura 15 and for Cyclic 10 without SIMPLIFY with twonodes are caused by a not yet solved overflow in the MPI implementation if more than 512 MBhave to be transfered in one operation This does not happen with four or eight nodes becausethe matrix size for each node decreases by factor two respectively four

At the end no distributed computation with SIMPLIFY is faster and hence it should beremoved in further developments of distributed parallel algorithms for Grobner bases compu-tations

Polynomial systems with SIMPLIFY without SIMPLIFY nodes 1 2 4 1 2 4

Gametwo 7 2985 3455 5603 2848 3853 2888(5549) (6709) (6010) (6630) (4607) (3427)

Cyclic 8 7798 1112 9520 7497 1406 2078(1327) (1707) (1953) (1332) (1473) (1168)

Cyclic 9 5060 5182 4947 3306 3617 4276(2222) (1952) (1388) (1499) (1224) (7373)

Katsura 12 4200 4636 5523 2859 3997 6685(6083) (8220) (7762) (6699) (4535) (3362)

Katsura 13 1874 1900 1864 1396 1588 1760(4046) (4661) (3682) (5003) (3107) (1815)

Eco 12 2135 2940 4149 2498 4108 8802(2564) (3760) (3953) (6458) (3664) (3097)

Eco 13 9178 1065 1209 1114 1575 2126(1210) (1632) (1462) (3865) (2310) (1467)

F966 9188 1062 1321 9360 1392 1851(2086) (2629) (2391) (3859) (2632) (1870)

Table 4 Distributed computation (and reduction) times for 12 or 4 nodes

78

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

1woS 2woS 4woS 1wS 2wS 4wS

0

100

200

300

400

500

600

Overhead

Reduction

Prepare

Update

Figure 1 Computation time in detail for Cyclic 9 with and without SIMPLIFY

Poly sys with SIMPLIFY without SIMPLIFY nodes 1 2 4 8 1 2 4 8

Katsura 14 9575 8310 7489 7448 7756 6599 6754 991(3139) (2634) (2012) 1691 (3984) (2244) (1351) (86)

Katsura 15 5719 crashed 3440 3252 5615 3857 3252 3372(2571) (-) 1272 1008 (3781) (1960) (1094) (666)

Cyclic 10 crashed crashed crashed crashed 30400 crashed 13270 11280(-) (-) (-) (-) (25240) (-) (7862) (5010)

Eco 14 5098 5194 5526 626 8005 7870 9967 1660(1106) (1177) (9802) (8938) (4113) (2240) (1277) (7824)

Table 5 Distributed computation (and reduction) times for larger input systems

7 Conclusion

We have shown that the parallelization of the F4 algorithm can be expanded form a sharedmemory system to a cluster of distributed nodes providing a multiple of the computation powerof a single system This was primarily achieved by using column-based parallelism removingthe optional reduction and the SIMPLIFY function It allowed us to solve larger input systemslike Katsura 15 or Cyclic 10 almost three times faster using four or respectively eight distributednodes Some work is still required to optimize the speed-up and the communication of the nodeshas to be improved to make solving of even larger problem instances possible

79

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

References

[1] Goran Bjorck and Uffe Haagerup All cyclic p-roots of index 3 found by symmetry-preservingcalculations 2008

[2] Michael Brickenstein Slimgb Grobner bases with slim polynomials Revista Matematica Com-

plutense 23(2)453ndash466 2010

[3] Jean-Charles Faugere A new efficient algorithm for computing Grobner bases (F4) Journal of

Pure and Applied Algebra 139(1ndash3)61ndash88 June 1999

[4] Jean-Charles Faugere and Sylvain Lachartre Parallel Gaussian Elimination for Grobner basescomputations in finite fields In Proceedings of the 4th International Workshop on Parallel and

Symbolic Computation PASCO rsquo10 pages 89ndash97 New York USA July 2010 ACM

[5] Jean-Charles Faugere Moreau Francois De Saint Martin and Fabrice Rouillier Design of regularnonseparable bidimensional wavelets using Groebner basis techniques IEEE Transactions on

Signal Processing 46(4)845ndash856 1998

[6] Rudiger Gebauer and H Michael Moller On an installation of buchbergerrsquos algorithm Journal

of Symbolic Computation 6275ndash286 December 1988

[7] Alessandro Giovini Teo Mora Gianfranco Niesi Lorenzo Robbiano and Carlo Traverso rdquoOnesugar cube pleaserdquo or selection strategies in the buchberger algorithm In Proceedings of the 1991

international symposium on Symbolic and algebraic computation ISSAC rsquo91 pages 49ndash54 NewYork USA 1991 ACM

[8] Gene H Golub and Charles F Van Loan Matrix Computations Johns Hopkins Studies in theMathematical Sciences Johns Hopkins University Press 1996

[9] Shigetoshi Katsura Wataru Fukuda Sakari Inawashiro Nahomi Fujiki and Rudiger GebauerDistribution of effective field in the ising spin glass of the plusmnj model at t = 0 Cell Biochemistry

and Biophysics 11309ndash319 1987

[10] David M Kreps and Robert Wilson Sequential equilibria Econometrica 50(4)863ndash94 July 1982

[11] Martin Kreuzer and Lorenzo Robbiano Computational Commutative Algebra 1 ComputationalCommutative Algebra Springer 2000

[12] Alexander Morgan Solving polynomial systems using continuation for engineering and scientific

problems Classics in applied mathematics SIAM 2009

[13] Severin Neumann Parallel reduction of matrices in Grobner bases computations In Vladimir PGerdt Wolfram Koepf Ernst W Mayr and Evgenii V Vorozhtsov editors Computer Algebra in

Scientific Computing volume 7442 of Lecture Notes in Computer Science pages 260ndash270 SpringerBerlin Heidelberg 2012

[14] Kurt Siegl A parallel factorization tree grobner basis algorithm In Parallel Symbolic Computation

PASCO 1994 Proceedings of the First International Symposium River Edge USA 1994 WorldScientific Publishing Co Inc

80

Generating Asymptotically Non-Terminant

Initial Variable Values for Linear Diagonalizable

Programs

Rachid Rebiha1lowast Nadir Matringe23 and Arnaldo Vieira Moura1

1 Institute of Computing UNICAMP University of Campinas SP Brasilrachidicunicampbr

2 Universit de Poitiers Laboratoire Mathmatiques et Applications France3 Institue de Mathematiques de Jussieu Universite Paris 7-Denis Diderot France

Abstract

We present the key notion of asymptotically non-terminant initial variable values fornon-terminant loop programs We show that those specific values are directly associated toinital variable values for which the corresponding loop program does not terminate Con-sidering linear diagonalizable programs we describe powerful computational methods thatgenerate automatically and symbolically a semi-linear space represented by a linear systemof equalities and inequalities Each element of this space provides us with asymptoticallynon-terminant initial variable values Our approach is based on linear algebraic methodsWe obtain specific conditions using certain basis and matrix encodings related to the loopconditions and instructions

1 Introduction

Research on formal methods for program verification [12 15 8 17] aims at discovering math-ematical techniques and developing their associated algorithms to establish the correctness ofsoftware hardware concurrent systems embedded systems or hybrid systems Static programanalysis [12 15] is used to check that a software is free of defects such as buffer overflows orsegmentation faults which are safety properties or termination and non-termination which areliveness properties Proving termination of while loop programs is necessary for the verificationof liveness properties that any well behaved and engineered system or any safety critical em-bedded system must guarantee We could list here many verification approaches that are onlypractical depending on the facility with which termination can be automatically determinedVerification of temporal properties of infinite state systems [20] is another example

Recent work on automated termination analysis of imperative loop programs has focusedon a partial decision procedure based on the discovery and synthesis of ranking functions Suchfunctions map the loop variable to a well-defined domain where their value decreases furtherat each iteration of the loop [9 10] Several interesting approaches based on the generationof linear ranking functions have been proposed [3 4] for loop programs where the guards andthe instructions can be expressed in a logic supporting linear arithmetic For the generation ofsuch functions there are effective heuristics [14 10] and in some cases there are also completemethods for the synthesis of linear ranking functions [16] On the other hand it is easy togenerate a simple linear terminant loop program that does not have a linear ranking functionAnd in this case such complete synthesis methods [16] fail to provide a conclusion about thetermination or the non termination of such a program

lowastSupported by FAPESP grant 201108947-1 and FAPESP grant BEPE 201304734-9

81

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

In this work we address the non-termination problem for linear while loop programs Inother words we consider the class of loop programs where the loop condition is a conjunc-tion of linear inequalities and the assignments to each of the variables in the loop instructionblock are affine or linear forms In matrix notation linear loop programs will be representedin a general form as while (Bx gt b) x = Ax + c (ie A and B are matrices b and c arevectors of real numbers and that x is a vector of variables) Without loss of generality theterminationnon-termination analysis for such a class of linear programs could be reduced tothe problem of terminationnon-termination for homogeneous linear programs [6 21] Thosebeing programs where linear assignments consist of homogeneous expressions and where thelinear loop condition consists of at most one inequality Concerning effective program trans-formations and simplification techniques non-termination analysis for programs presented in amore complex form can often be reduced to an analysis of a program expressed in this basicaffine form Despite tremendous progress over the years [6 5 7 13 11 2 1] the problem offinding a practical sound and complete methods for determining or analyzing non termina-tion remains very challenging for this class of programs and for all initial variable values Westarted our investigation from our preliminary technical reports [19 18] where we introduced atermination analysis in which algorithms ran in polynomial time complexity Here consideringa non terminating loop we introduce new static analysis methods that compute automaticallyand in polynomial time complexity the set of initial input variable values for which the programdoes not terminate and also a set of initial inputs values for which the program does terminateThis justifies the innovation of our contributions ie none of the other mentioned related workis capable of generating such critical information over non-terminating loops We summarizeour contributions as follows

bull To the best of our knowledge we introduce a new key notion for non-termination and ter-mination analysis for loop programs we identify the important concept of asymptoticallynon-terminant initial variable values ANT for short Any asymptotically non-terminantinitial variable values can be directly related to an initial variable value for which theconsidered program does not terminate

bull Our theoretical contributions provide us with efficient computational methods running inpolynomial time complexity and allowing the exact computation of the set of all asymp-totically non-terminant initial variable values for a given loop program

bull We generate automatically a set of linear equalities and inequalities describing a semi-linear space that represents symbolically the set of all asymptotically non-terminant initialvariable values The set of ANT values contains the set of non-terminant initial variablevalues On the other hand the complementary set of ANT values is a precise under-approximation of the set of terminant inputs for the same program

Example 11 (Motivating Example) Consider the following program depicted below on theleft We show a part of the output of our algorithm below on the right

(i) Pseudo code

while(2x+3y-zgt0)

x= y + z

y= -(12)x+(32)y -(12)z

z=(32)x -(32)y+(12)z

(ii) Output of our prototype

Locus of ANT

[[4u[1]+u[2]+u[3]gt0]

AND[u[1]+4u[2]+4u[3]gt0]

AND[-u[1]+u[2]-u[3]=0]]

OR[[-u[1]+u[2]-u[3]gt0]]

82

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

The semi-linear ANT = u = (u1 u2 u3)⊤ isin E | 4u1 + u2 + u3 gt 0 and u1 + 4u2 + 4u3 gt

0 andminusu1 + u2 minus u3 = 0 cup u = (u1 u2 u3)⊤ isin E | minus u1 + u2 minus u3 gt 0 represents symbolically

all asymptotically initial variable values that are directly associated to initial variable valuesfor which the program does not terminate On the other hand the complementary of this setco-ANT = u = (u1 u2 u3)

⊤ isin E | 4u1 + u2 + u3 le 0 or u1 + 4u2 + 4u3 le 0 orminusu1 + u2 minus u3 6=0 cap u = (u1 u2 u3)

⊤ isin E | minus u1 + u2 minus u3 le 0 is a precise under-approximation of the setof all initial variable values on which the program terminates

The rest of this article is organized as follows Section 2 can be seen as a preliminarysection where we introduce some key notions and results from linear algebra which will be usedto build our computational methods In this section we also present our computational modelfor programs and some further notations Section 3 introduces the new notion of asymptoticallynon-terminant initial variable values Section 4 provides the main theoretical contributionsof this work This section also presents our computational methods that generate a symbolicrepresentation of the asymptotically non-terminant variable values for linear programs Weprovide a complete dicussion in Section 5 Finally Section 6 states our conclusions

2 Linear Algebra and Linear Loop Programs

Here we present key linear algebraic notions and results which are central in the theoretical andalgorithmic development of our methods We denote by M(mnK) the set of mtimes n matriceswith entries in K and simply M(nK) when m = n The Kernel of A also called its nullspacedenoted by Ker(A) is Ker(A) = v isin K

n | A middot v = 0Km In fact when we deal with squarematrices these Kernels are Eigenspaces Let A be a ntimes n square matrix with entries in K Anonzero vector x isin K is an eigenvector for A associated with the eigenvalue λ isin K if A middotx = λxie (A minus λIn) middot x = 0 where In is the n times n identity matrix The nullspace of (A minus λIn) iscalled the eigenspace of A associated with eigenvalue λ Let n be a positive integer we willdenote R

n by E and its canonical basis by Bc = (e1 en) Let A be a square matrix inM(nR) Let us introduce the notation Spec(A) for the set of eigenvalues of A in R and wewill write Spec(A)lowast for the set Spec(A)minus 0 For λ isin Spec(A) we will denote by Eλ(A) thecorresponding eigenspace Throughout the paper we write dλ for the dimension of Eλ(A) Wewill say that A is diagonalizable if E = oplusλisinSpec(A)Eλ(A) Let A be a diagonalizable matrixFor each eigenspace Eλ(A) we will take a basis Bλ = (eλ1 eλdλ

) and we define

B = cupλisinSpec(A)Bλ

as a basis for E

Definition 21 Let x belong to E We denote by xλ its component in Eλ(A) If x admits the

decompositionsum

λisinSpec(A)(sumdλ

i=1 xλieλi) in B we have xλ =sumdλ

i=1 xλieλi

We denote by P the transformation matrix corresponding to B whose columns are the vectorsof B decomposed in Bc Letting di denote the integer dλi

for the ease of notation we recallthe following lemma

Lemma 21 We have Pminus1AP = diag(λ1Id1 λtIdt) We denote by D the matrix Pminus1AP

As we will obtain our results using the decomposition of x in B we recall how one obtains itfrom the decomposition of x in Bc

83

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

Lemma 22 Let x isin E If x =sumn

i=1 xiei = (x1 xn)⊤ isin Bc and x decomposes as

sumtj=1(

sumdj

i=1 xλj ieλj i) in B the coefficients xλj i are those of the column vector Pminus1x in Bc

Throughout the paper we write lt gt for the canonical scalar product on E which is given by lt

x y gt=sumn

i=1 xiyi and recall as it is standard in static program analysis that a primed symbolxprime refers to the next state value of x after a transition is taken Next we present transitionsystems as representations of imperative programs and automata as their computational models

Definition 22 A transition system is given by 〈x L T l0Θ〉 where x = (x1 xn) is a setof variables L is a set of locations and l0 isin L is the initial location A state is given by aninterpretation of the variables in x A transition τ isin T is given by a tuple 〈lpre lpost qτ ρτ 〉where lpre and lpost designate the pre- and post- locations of τ respectively and the transitionrelation ρτ is a first-order assertion over x cup xprime The transition guard qτ is a conjunction ofinequalities over x Θ is the initial condition given as a first-order assertion over x Thetransition system is said to be linear when ρτ is an affine form

We will use the following matrix notations to represent loop programs and their associatedtransitions systems

Definition 23 Let P be a loop program represented by the transition system 〈x =(x1 xn) l0 T = 〈l l qτ ρτ 〉 l0Θ〉 We say that P is a linear loop program if the followingconditions hold

bull Transition guards are conjunctions of linear inequalities We represent the loop conditionin matrix form as V x gt b where V isin M(mnR) and b isin R

m By V x gt b we mean thateach coordinate of vector V x is greater than the corresponding coordinate of vector b

bull Transition relations are affine or linear forms We represent the linear assignments inmatrix form as x = Ax+ c where A isin M(nR) and c isin R

n

The linear loop program P = P (A V b c) will be represented in its most general form aswhile (V x gt b) x = Ax+ c

In this work we use the following linear loop program classifications

Definition 24 We identify the following three types of linear loop programs from the morespecific to the more general form

bull Homogeneous We denote by PH the set of programs where all linear assignments consistof homogeneous expressions and where the linear loop condition consists of at most oneinequality If P is in PH then P will be written in matrix form as while (lt v x gtgt

0) x = Ax where v is a (ntimes 1)-vector corresponding to the loop condition and whereA isin M(nR) is related to the list of assignments in the loop We say that P has ahomogeneous form and it will also be denoted as P (A v)

bull Generalized Condition We denote by PG the set of linear loop programs where the loopcondition is generalized to a conjunction of multiple linear homogeneous inequalities

bull Affine Form We denote by P A the set of loop programs where the inequalities and theassignments are generalized to affine expressions If P is in P A it will be written aswhile (V x gt b) x = Ax+ c for A and V in M(nR) b isin R

m and c isin Rn

84

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

Without lost of generality the static analysis for the class of linear programs P A could bereduced to the problem of terminationnon-termination for homogeneous linear programs inPH In this work we consider programs in PH The generalization to programs in P A canalready be done and it will be reported elsewhere

3 Asymptotically Non-terminant Variable Values

In this section we present the new notion of asymptotically non-terminant variable values Itwill prove to be central in analysis of termination in general Let A be a matrix in M(nR)and v be a vector in E Consider the program P (A v) while (lt v x gtgt 0) x = Ax whichtakes values in E We first give the definition of the termination of such a program

Definition 31 The program P (A v) is said to be terminating on x isin E if and only iflt vAk(x) gt is not positive for some k ge 0

In other words Definition 31 states that if the program P (A v) performs k ge 0 loopiterations from initial variables xin E we obtain x = Ak(x) Thus if lt vAk(x) gtle 0the loop condition is violated and so P (a v) terminates Next we introduce the followingimportant notion

Definition 32 We say that x isin E is an asymptotically non terminating value for P (A v) ifthere exists kx ge 0 such that P (A v) is non terminating on Akx(v) We will write that x isANT for P (A v) or simply x is ANT We will also write that P (A v) is ANT on x

Note that if P (A v) is non terminating on Akx(x) then lt vAk(x) gt is gt 0 for k ge kxThe following result follows directly from the previous definition

Corollary 31 An element x isin E is ANT if and only if lt vAk(x) gt is positive for k largeenough

If the set of ANT points is not empty we say that the program P (A v) is ANT We willalso write NT for non terminant For the programs we study here the following lemma alreadyshows the importance of such a set

Lemma 31 The program P (A v) is NT if and only if it is ANT

Proof It is clear that NT implies ANT (ie NT sube ANT ) as a NT point of P (A v) is ofcourse ANT (with kx = 0) Conversely if P (A v) is ANT call x an ANT point then Akx(x)is a NT point of P (A v) and so P (A v) is NT

As one can easily see the set of NT points is included in the set of ANT points But themost important property of the ANT set remains in the fact that each of its point provides uswith an associated element in NT for the corresponding program In other words each elementx in the ANT set even if it does not necessarily belong to the NT set refers directly to initialvariable values yx = Ak[x](x) for which the program does not terminate ie yx is an NT pointWe can say that there exists a number of loop iterations k[x] departing from the initial variable

values x such that Ak[x](x) correspond to initial variable values for which P (A v) does notterminate But it does not necessarily implies that x is also an NT point for P (A v) In factprogram P (A v) could terminate on the initial variable values x by performing a number of

85

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

loop iterations strictly smaller than k[x] On the other hand the complementary set co-ANT

provides us with a quite precise under approximation of the set of all initial variable values forwhich the program terminates

The set of ANT points of a program is also important to the understanding of the terminationof a program with more than one conditional linear inequality as well as for termination overthe rationals for example This will be reported elsewhere

4 Automated generation of ANT loci

In this section we show how we generate automatically and exactly the ANT Locus ie the setof all ANT points for linear diagonalizable programs over the reals We represent symbolicallythe computed ANT Locus by a semi-linear space defined by linear equalities and inequalitiesConsider the program P (A v) while (lt v x gtgt 0) x = Ax The study of ANT setsdepends on the spectrum of A Recall the introductory discussion and Definition 21 at Section2

Proposition 41 For x in E and k ge 1 the scalar product lt vAk(x) gt is equal to

sum

λisinSpec(A)

λk lt v xλ gt=sum

λisinSpec(A)lowast

λk lt v xλ gt

Proof It is a direct consequence of the equality Ak(xλ) = λkxλ

41 The regular case

We first analyze the situation where A is what we call regular

Definition 41 We say that A is regular if Spec(A) cap[

minus Spec(A)]

is an empty set ie ifλ belongs to Spec(A) then minusλ does not belong to Spec(A)

In this case we make the following observation

Proposition 42 Let micro be the nonzero eigenvalue of largest absolute value if it exists such thatlt v xmicro gt is nonzero For k large the quantity lt vAk(x) gt is equivalent to microk lt v xmicro gt

Proof Indeed we can write lt vAk(x) gt as

microk lt v xmicro gt +sum

λ|λ|lt|micro|

λk lt v xλ gt= microk(lt v xmicro gt +sum

λ|λ|lt|micro|

λk

microklt v xλ gt)

and λk

microk approaches zero when k goes to infinity

We then define the following sets

Definition 42 For micro a positive eigenvalue of A we define Smicro as follows

Smicro = x isin Elt v xmicro gtgt 0 lt v xλ gt= 0 for |λ| gt |micro|

86

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

In order to obtain Smicro for all positive eigenvalues micro of A one needs to calculate lt v xmicro gtand lt v xλ gt for all eigenvalues λ such that |λ| gt |micro| For all eigenvalues λ involved inthe computation of Smicro one also needs to evaluate the coefficients cλi =lt v eλi gt for all

eigenvectors eλi isin B and 1 le i le dλ Thus we have lt v xλ gt=sumdλ

i=1 cλixλi Now we onlyneed to compute the coefficient xλi which are those of the column vector Pminus1x in Bc whereP is the transformation matrix corresponding to B See Lemma 22

We ca now state the following theorem allowing the exact computation of the ANT Locusfor the regular case

Theorem 41 The program P (A v) is ANT on x if and only if x belongs to

microgt0isinSpec(A)

Smicro

Proof Let x belong to E If all lt v xλ gt are zero for λ isin Spec(A) then lt vAk(x) gt= 0and x is not ANT Otherwise let micro be the eigenvalue of largest absolute value such thatlt v xmicro gt is nonzero Then according to Proposition 42 the sign of lt vAk(x) gt is the signof microk lt v xmicro gt for k large If micro is negative this sign will be alternatively positive and negativedepending on the parity of k and x is not ANT If micro is positive this sign will be the sign oflt v xmicro gt hence x will be ANT if and only if lt v xmicro gt is positive This proves the result

Example 41 (Running example) Consider the program P (A v) depicted as follows

(i) Pseudo code

while(x+y-2zgt0)

x= x-4y-4z

y= 8x-11y-8z

z= -8x+8y+5z

(ii) Associated matrices

A =

1 minus4 minus48 minus11 minus8minus8 8 5

and v =

11minus2

Step 1 Diagonalization of the matrix A

P =

1 1 12 1 0minus2 0 1

D =

1 0 00 minus3 00 0 minus3

and Pminus1 =

1 minus1 minus1minus2 3 22 minus2 minus1

Using our notations the obtained eigenvectors (ie the column vectors of P ) are denoted asfollows e11 = (1 2minus2)⊤ eminus31 = (1 1 0)⊤ eminus32 = (1 0 1)⊤

Step 2 We compute Smicro for all positive micro isin Spec(A)lowast

bull We compute first the coefficients cλic11 =lt v e11 gt=lt (1 1minus2)⊤ (1 2minus2)⊤ gt= 7

cminus31 =lt v eminus31 gt=lt (1 1minus2)⊤ (1 1 0)⊤ gt= 2

cminus32 =lt v eminus31 gt=lt (1 1minus2)⊤ (1 0 1)⊤ gt= minus1

bull We compute the coefficient xλi which are those of the column vector Pminus1 middotu in Bc whereu = (u1 u2 u3) is the vector encoding the initial variable values

Pminus1

u1

u2

u3

=

u1 minus u2 minus u3)minus2u1 + 3u2 + 2u3)2u1 minus 2u2 minus u3)

=

x11

xminus31

xminus32

We can now proceed to the generation of the linear constraints defining a semi-linear space

87

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

describing symbolically and exactly Smicrolt v x1 gt= c11x11 = 7(u1 minus u2 minus u3)lt v xminus3 gt= cminus31xminus31 + cminus32xminus32 = minus6u1 + 8u2 + 5u3)Hence we have S1 = u = (u1 u2 u3)

⊤ isin E | (u1minusu2minusu3 gt 0)and(minus6u1+8u2+5u3 = 0)

Step 3 We apply Theorem 41 to generate the ANT Locus It reduces to the semi-linear spaceS1 = u = (u1 u2 u3)

⊤ isin E | (u1 minus u2 minus u3 gt 0) and (minus6u1 + 8u2 + 5u3 = 0)

42 The general case handling linear diagonalizable programs

For the general case in the asymptotic expansion of lt vAk(x) gt one can have compensationsbetween λk lt v xλ gt and (minusλ)k lt v xλ gt as these terms can be zero when k is even forinstance and of a well determined sign when k is odd We thus need to take care of this issueTo this end we introduce the following notation

Definition 43 If λ does not belong to Spec(A) for any x isin E we write xλ = 0

We have the following propositions which give the asymptotic behavior of lt vAk(x) gt

Proposition 43 Let micro be the nonzero eigenvalue of largest absolute value if it exists suchthat lt v x|micro| + xminus|micro| gt is nonzero For k large the quantity lt vA2k(x) gt is equivalent to

|micro|2k(lt v x|micro| + xminus|micro| gt)

Proof Indeed we can write lt vA2k(x) gt as

micro2k(lt v x|micro| gt + lt v xminus|micro| gt) +sum

|λ||λ|lt|micro|

λ2k(lt v x|λ| gt + lt v xminus|λ| gt)

= micro2k(lt v x|micro| gt + lt v xminus|micro| gt) +sum

|λ||λ|lt|micro|

λ2k

micro2k(lt v x|λ| gt + lt v xminus|λ| gt))

and λk

microk approaches to zero when k goes to infinity

Proposition 44 Let micro be the nonzero eigenvalue of largest absolute value if it exists suchthat lt v x|micro| minus xminus|micro| gt is nonzero For k large the quantity lt vA2k+1(x) gt is equivalent to

|micro|2k+1(lt v x|micro| minus xminus|micro| gt)

Proof The proof is similar to the proof of Proposition 43

As in the previous Section we introduce the following relevant sets

Definition 44 For |micro| in |Spec(A)lowast| we define the sets S0|micro| and S1

|micro| as follows

S0|micro| = x isin Elt v x|micro| + xminus|micro| gtgt 0 lt v x|λ| + xminus|λ| gt= 0 for |λ| gt |micro| and

S1|micro| = x isin Elt v x|micro| minus xminus|micro| gtgt 0 lt v x|λ| minus xminus|λ| gt= 0 for |λ| gt |micro|

In order to compute the sets S0|micro| and S1

|micro| we obtain the coefficients cλi =lt v eλi gt for alleigenvalues λ If the λ appearing as index in the coefficient cλi is not an eigenvalue then we fix

cλi = 0 and dλ = 0 (see Definition 43) Thus we have lt v x|λ| + xminus|λ| gt=sumd|λ|

i=1 c|λ|ix|λ|i +sumdminus|λ|

i=1 cminus|λ|ixminus|λ|i and lt v x|λ| minus xminus|λ| gt=sumd|λ|

i=1 c|λ|ix|λ|i minussumdminus|λ|

i=1 cminus|λ|ixminus|λ|iWe finally obtain the following main theorem

88

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

Theorem 42 The program P (A v) is ANT on x if and only if x belongs to the set

(|micro||microprime|)isin|Spec(A)lowast|times|Spec(A)lowast|

S0|micro| cap S1

|microprime|

Proof It is obvious that x is ANT if and only if lt vA2k(x) gt and lt vA2k+1(x) gt are bothpositive for k large Now reasoning as in the proof of Theorem 41 but using Propositions 43and 44 instead of Proposition 42 we obtain that lt vA2k(x) gt is positive for k large if andonly if x belongs to S0

|micro| for some micro isin |Spec(A)lowast| and that lt vA2k+1(x) gt is positive for k

large if and only if x belongs to S1|microprime| for some microprime isin |Spec(A)lowast| The result follows

The following two examples illustrate how Theorem 42 applies to different cases

Example 42 (Running example) Consider the program P (A v) depicted as follows

(i) Pseudo code

while(2x+3y-zgt0)

x=15x+18y-8z+6s-5t

y=5x+3y+z-t-3s

z=-4y+5z-4s-2t

s=-43x-46y+17z-14s+15t

t=26x+30y-12z+8s-10t

(ii) Associated matrices

A =

15 18 minus8 6 minus55 3 1 minus1 minus30 minus4 5 minus4 minus2

minus43 minus46 17 minus14 1526 30 minus12 8 minus10

v =

11231

Step 1 Diagonalization of the matrix A

P =

2 1 minus1 1 1minus1 0 2 0 minus1minus2 0 2 minus1 minus2minus4 minus1 0 minus2 minus12 2 1 2 1

D =

minus3 0 0 0 00 minus1 0 0 00 0 0 0 00 0 0 1 00 0 0 0 2

and Pminus1 =

minus3 minus3 1 minus1 1minus1 minus2 1 0 1minus5 minus4 1 minus1 210 10 minus3 2 minus4minus7 minus6 1 minus1 3

We obtain the following eigenvectors written using our notation e01 = (minus1 2 2 0 1)⊤e11 = (1 0minus1minus2 2)⊤ e21 = (1minus1minus2minus1 1)⊤ eminus11 = (1 0 0minus1 2)⊤ and eminus31 =(2minus1minus2minus4 2)⊤

Step 2 Computing Smicro for all positive micro isin Spec(A)lowast

bull Our algorithm first computes the coefficients cλi We obtain c01 = 6 c11 = minus5c21 = minus6 cminus11 = 0 and cminus31 = minus13

bull Then our algorithm computes the coefficients of the decomposition of the initial vari-able values in B They are those of the column vector Pminus1 middot u in Bc where u =(u1 u2 u3 u4 u5)

⊤ is the vector encoding the initial variable values

Pminus1

u1

u2

u3

u4

u5

=

minus3u1 minus 3u2 + u3 minus u4 + u5

minusu1 minus 2u2 + u3 + u5

minus5u1 minus 4u2 + u3 minus u4 + 2u5

10u1 + 10u2 minus 3u3 + 2u4 minus 4u5

minus7u1 minus 6u2 + u3 minus u4 + 3u5

=

xminus31

xminus11

x01

x11

x21

Now the algorithm obtains all the non-zero terms appearing in the definition of S0|λ| and S1

|λ|

lt v x|1| + xminus|1| gt= c11x11 = minus5(10u1 + 10u2 minus 3u3 + 2u4 minus 4u5)lt v x|2| + xminus|2| gt= c21x21 = minus6(minus7u1 minus 6u2 + u3 minus u4 + 3u5)

89

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

lt v x|minus3| + xminus|minus3| gt= cminus31xminus31 = minus13(minus3u1 minus 3u2 + u3 minus u4 + u5)lt v x|minus3| minus xminus|minus3| gt= minuscminus31xminus31 = 13(minus3u1 minus 3u2 + u3 minus u4 + u5)

All the sets S0|λ| and S1

|λ| can now be computed exactly

S0

|1| = u isin E | 5(10u1 + 10u2 minus 3u3 + 2u4 minus 4u5) gt 0 and minus6(minus7u1 minus 6u2 + u3 minus u4 + 3u5) = 0 and

minus 13(minus3u1 minus 3u2 + u3 minus u4 + u5) = 0

S1

|1| = u isin E|5(10u1 + 10u2 minus 3u3 + 2u4 minus 4u5) gt 0 and minus6(minus7u1 minus 6u2 + u3 minus u4 + 3u5) = 0 and

13(minus3u1 minus 3u2 + u3 minus u4 + u5) = 0

S0

|2| = u isin E| minus 6(minus7u1 minus 6u2 + u3 minus u4 + 3u5) gt 0 and minus13(minus3u1 minus 3u2 + u3 minus u4 + u5) = 0

S0

|2| = u isin E| minus 6(minus7u1 minus 6u2 + u3 minus u4 + 3u5) gt 0 and minus13(minus3u1 minus 3u2 + u3 minus u4 + u5) = 0

S1

|2| = u isin E| minus 6(minus7u1 minus 6u2 + u3 minus u4 + 3u5) gt 0 and 13(minus3u1 minus 3u2 + u3 minus u4 + u5) = 0

S0

|minus3| = u isin E| minus 13(minus3u1 minus 3u2 + u3 minus u4 + u5) gt 0

S1

|minus3| = u isin E| 13(minus3u1 minus 3u2 + u3 minus u4 + u5) gt 0

Step 3 We apply Theorem 42 to generate the ANT LocusThe algorithm computes the following intersections S0

1 capS11 S

01 capS1

2 S01 capS1

3 S02 capS1

1 S02 capS1

2 S02 cap S1

3 S03 cap S1

1 S03 cap S1

2 and S03 cap S1

1 In fact the previous computational step already allows our algorithm to perform implicit sim-plifications For instance it appears that S0

|1| = S1|1| S

0|1| = S1

|1| = S0|minus1| = S1

|minus1| S0|2| = S1

|2|

and that S0|minus3| cap S1

|minus3| is the empty set According to Theorem 42 the ANT locus reduces tothe following semi-linear space

u = (u1 u2 u3 u4 u5)⊤ isin E | minus 10u1 minus 10u2 + 3u3 minus 2u4 + 4u5 gt 0 and

minus 7u1 minus 6u2 + u3 minus u4 + 3u5 = 0 and

minus 3u1 minus 3u2 + u3 minus u4 + u5 = 0⋃

u = (u1 u2 u3 u4 u5)⊤ isin E | minus 10u1 minus 10u2 + 3u3 minus 2u4 + 4u5 gt 0 and

minus 3u1 minus 3u2 + u3 minus u4 + u5) gt 0 and

minus 7u1 minus 6u2 + u3 minus u4 + 3u5 = 0⋃

u = (u1 u2 u3 u4 u5)⊤ isin E | 7u1 + 6u2 minus u3 + u4 minus 3u5 gt 0 and

minus 3u1 minus 3u2 + u3 minus u4 + u5 = 0

5 Discussions

This work is complementary to our previous work [19] which dealt with termination analysisIn [19] we first prove a sufficient condition for the termination of homogeneous linear programsThis statement was conjectured in the important work of [21] where the first attempt toprove this result contains non trivial mistakes As we shown in [19] the actual proof of thissufficient condition requires expertise in several independent mathematical fields Also thenecessary condition proposed in [21] does not apply as expected in practice We then wentto generalize the previous result and to the best of our knowledge we presented the firstnecessary and sufficient condition (NSC for short) for the termination of linear programsIn fact this NSC exhibits a complete decidability result for the class of linear programs on all

90

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

initial values Moreover departing from this NSC we showed the scalability of these approachesby demonstrating that one can directly extract a sound and complete computational methodrunning in polynomial time complexity to determine termination or nontermination for linearprograms On the other hand all other related and previous works mentioned in this paper donot provide any techniques capable of generating automatically the set of initial input variablevalues for which a loop does not terminate The main contributions of this paper remain ona sound and complete computational method to compute the set of input variable values forwhich the programs do not terminate The overall time complexity of our algorithm is also oforder O(n3) As can be seen the main results ie Theorems 41 and 42 provide us with adirect symbolic representation of the ANT set Even if those theorems are rigorously stated andproofs are quite technical they are really easy to apply we only need to compute the explicitterms S0

|micro| and S1|microprime| in order to directly obtain a formula representing exactly and symbolically

the ANT set In a same manner we extended this techniques to linear program not necessarilydiagonalizable and we obtained similar theoretical and practical results As their associatedproofs are more technical they would required more space to be fully expressed and we left themfor an ensuing report In other more recent work on termination static analysis for programsover the rationals or the integers with several conditional linear inequalities we also show thatthe notion ANT remains central

6 Conclusion

We presented the new notion of asymptotically non-terminant initial variable values for linearprograms Considering a linear diagonalizable program our theoretical results provided us withsound complete and fast computational methods allowing the automated generation of the setsof all asymptotically non-terminant initial variable values represented symbolically and exactlyby a semi-linear space eg conjunctions and disjunctions of linear equalities and inequalitiesAlso by taking the complementary set of the semi-linear set of ANT initial variable values weobtain a precise under-approximation of the set of terminant initial variable values for the (non-terminant) program Actually this type of method can be vastly generalized to tackle the ter-mination and non-termination problem of linear programs not necessarily diagonalizable withmore than one conditional linear inequality on rational or integer initial values for instanceWe leave this investigation for an ensuing report

References

[1] Amir M Ben-Amram and Samir Genaim On the linear ranking problem for integer linear-constraint loops In Proceedings of the 40th annual ACM SIGPLAN-SIGACT symposium onPrinciples of programming languages POPL rsquo13 pages 51ndash62 New York NY USA 2013 ACM

[2] Amir M Ben-Amram Samir Genaim and Abu Naser Masud On the termination of integer loopsIn VMCAI pages 72ndash87 2012

[3] Aaron R Bradley Zohar Manna and Henny B Sipma Linear ranking with reachability In InCAV pages 491ndash504 Springer 2005

[4] Aaron R Bradley Zohar Manna and Henny B Sipma Termination analysis of integer linearloops In In CONCUR pages 488ndash502 Springer-Verlag 2005

[5] Aaron R Bradley Zohar Manna and Henny B Sipma Termination of polynomial programsIn In VMCAIrsquo2005 Verification Model Checking and Abstract Interpretation volume 3385 ofLNCS pages 113ndash129 Springer 2005

91

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

[6] Mark Braverman Termination of integer linear programs In In Proc CAV06 LNCS 4144 pages372ndash385 Springer 2006

[7] Hong Yi Chen Shaked Flur and Supratik Mukhopadhyay Termination proofs for linear simpleloops In Proceedings of the 19th international conference on Static Analysis SASrsquo12 pages 422ndash438 Berlin Heidelberg 2012 Springer-Verlag

[8] Edmund M Clarke Orna Grumberg and Doron Peled Model Checking MIT Press CambridgeMA 2000

[9] Michael Colon and Henny Sipma Synthesis of linear ranking functions In Proceedings of the 7thInternational Conference on Tools and Algorithms for the Construction and Analysis of SystemsTACAS 2001 pages 67ndash81 London UK 2001 Springer-Verlag

[10] Michael A Colon and Henny B Sipma Practical methods for proving program termination InIn CAV2002 Computer Aided Verification volume 2404 of LNCS pages 442ndash454 Springer 2002

[11] Byron Cook Andreas Podelski and Andrey Rybalchenko Termination proofs for systems codeSIGPLAN Not 41(6)415ndash426 June 2006

[12] P Cousot and R Cousot Abstract interpretation and application to logic programs Journal ofLogic Programming 13(2ndash3)103ndash179 1992

[13] Patrick Cousot and Radhia Cousot An abstract interpretation framework for termination SIG-PLAN Not 47(1)245ndash258 January 2012

[14] Dennis Dams Rob Gerth and Orna Grumberg A heuristic for the automatic generation of rankingfunctions In Workshop on Advances in Verification pages 1ndash8 2000

[15] Zohar Manna Mathematical Theory of Computation McGraw-Hill 1974

[16] Andreas Podelski and Andrey Rybalchenko A complete method for the synthesis of linear rankingfunctions In VMCAI pages 239ndash251 2004

[17] Jean-Pierre Queille and Joseph Sifakis Specification and verification of concurrent systems incesar In Proceedings of the 5th International Symposium in Programming pages 337ndash351 LondonUK 1982 Springer-Verlag

[18] Rachid Rebiha Nadir Matringe and Arnaldo V Moura A complete approach for terminationanalysis of linear programs Technical Report IC-13-08 Institute of Computing University ofCampinas February 2013

[19] Rachid Rebiha Nadir Matringe and Arnaldo V Moura Necessary and sufficient condition fortermination of linear programs Technical Report IC-13-07 Institute of Computing University ofCampinas February 2013

[20] Henny B Sipma Tomas E Uribe and Zohar Manna Deductive model checking Form MethodsSyst Des 15(1)49ndash74 July 1999

[21] Ashish Tiwari Termination of linear programs In Rajeev Alur and Doron Peled editors ComputerAided Verification 16th International Conference CAV 2004 Boston MA USA volume 3114 ofLecture Notes in Computer Science pages 70ndash82 Springer 2004

92

Data Conversion Method between a Natural

Number and a Binary Tree for an Inductive

Proof and Its Application

Kazuko Takahashi1 Shizuo Yoshimaru1lowast

and Mizuki Goto1

1 School of Science and Technology Kwansei Gakuin Universityktakakwanseiacjp

2 School of Science and Technology Kwansei Gakuin Universityshizuoyoshimarugmailcom

3 School of Science and Technology Kwansei Gakuin Universitybub85144kwanseiacjp

Abstract

This paper presents modeling of a binary tree that represents a natural number andgives an inductive proof for its properties using theorem provers We define a function forconverting data from a natural number into a binary tree and give an inductive proof forits well-definedness We formalize this method develop a computational model based onit and apply it to an electronic cash protocol We also define the payment function onthe binary tree and go on to prove the divisibility of electronic cash using the theoremprovers IsabelleHOL and Coq respectively Furthermore we discuss the effectiveness ofthis method

1 Introduction

Theorem proving is an important technique to provide a certified system or to ensure bug-free programming Several theorem provers which may be called proof assistants have beendeveloped including ACL2 [11] PVS [19] IsabelleHOL [16] Coq [4] Agda [17] and so onThese tools help users to develop formal proofs either interactively or semi-automaticallytypically using induction as the proof strategy There are numerous applications for suchprovers There are relatively few practical applications of these tools in most fields comparedto their use in pure mathematics although there are some outstanding results in microprocessordesign [10] C compilers [14] operating system kernels [12] security protocols [1] and securecard systems [3 13] To use these provers successfully it is necessary to construct a suitablemodel and then select an appropriate proof strategy In practical applications it may be difficultto form a natural inductive model and so it may be necessary to build a data structure whichcan be difficult for these provers to handle

We have previously attempted to prove the divisibility of an electronic cash protocol [21] Inthis experience we have encountered difficulties in proving the properties regarding the functionthat converts a natural number to a binary tree The binary tree is a complete binary treewhere a Boolean value is attached to each node and the value of which is defined as a sum ofthe value of the left and right subtrees The problem can be reduced to the fact that there existsa function that cannot be defined in a primitive recursive form on an inductively defined datastructure Because a natural number has a linear structure with only one successor whereas a

lowastCurrently Nochu Information System CoLTD

93

Data Conversion Revisited Takahashi Yoshimaru and Goto

binary tree has a branching structure with two successors at each branching point the inductionschemes are different which complicates the proof

To solve this problem we introduced a bit sequence as an intermediate data structure anddefined the function from a natural number to a binary tree as a composition of two recursivefunctions via a bit sequence Specifically the first function describes the mapping from anatural number to an intermediate bit sequence and the second function is the mapping fromthe bit sequence to the binary tree We formalized this model and associated proof method andapplied it to the divisibility of an electronic cash protocol using IsabelleHOL However thisprevious work had several drawbacks First the model was complicated because of an intricatelabeling for the nodes of a tree a simpler and more natural model for this specific binary treehas subsequently been identified Second the proof was incomplete as one of the lemmas thatrelates the bit sequence to the binary tree was left as an axiom Third the effectiveness of themethod was not discussed we did not know whether this method could be applied similarlywith theorem provers other than IsabelleHOL or whether a large number of modificationswould be required In this paper we provide a simplified model give complete proofs of thedivisibility using the theorem provers IsabelleHOL and Coq and discuss the effectiveness ofthe method

The rest of this paper is organized as follows In Section 2 we describe in detail the problemsof data conversion and our solution In Sections 3 and 4 we present a formalization and aninductive proof of the divisibility of an electronic cash protocol In Section 5 we provide adiscussion and in Section 6 we present our conclusions

2 Data Conversion Formalization

21 Problem

First we illustrate the problem of converting between a natural number and a binary treewhich are data structures with different induction schemes

Let NAT and BTREE be a natural number and a binary tree respectively NAT is induc-tively defined with one successor BTREE is inductively defined in such a form that there aretwo successors ie

nat_p(0)

nat_p(n) =gt nat_p(Suc(n))

tree_p(Tip)

tree_p(lt) amp tree_p(rt) =gt tree_p(Node(_ltrt))

where Suc denotes the successor function Node is a constructor for a tree rsquo rsquo denotes ananonymous variable that corresponds to a parent node lt and rt are the left and right subtreesrespectively and T ip is a leaf node The symbols amp and =gt denote conjunction and implicationrespectively

Consider data conversion between NAT and BTREE Let f be a function that maps fromNAT to BTREE and g be a function that maps from BTREE to NAT We assume that thesefunctions are defined inductively in the following form

f NAT --gt BTREE

f(Suc(n)) = c1(f(n))

f(0) = Tip

94

Data Conversion Revisited Takahashi Yoshimaru and Goto

g BTREE --gt NAT

g(Node(_ltrt)) = c2(g(lt) g(rt))

g(Tip) = 0

where c1 is a function from BTREE to BTREE and c2 is a function from NATtimes NAT to NATConsider proving the following relationship between f and g

g(f(n)) = n

We use the following induction scheme IS on NAT to prove it

foralln( (forallnprimenprime lt n =rArr g(f(nprime)) = nprime) =rArr g(f(n)) = n ) [IS]

The proof proceeds by rewriting g(f(n)) in succession as follows

g(f(n)) = g(f(c2(n1 n2)))= g(Node( f(n1) f(n2)))= c2(g(f(n1)) g(f(n2)))= c2(n1 n2)

where c2(n1 n2) = n for a certain n1 n2 lt nThe induction scheme IS is used to proceed from the third line to the fourth line To succeed

in this proof there are two problems to be solved The first is the progression from the first lineto the second line we have to prove the equality f(c2(n1 n2)) = Node( f(n1) f(n2)) Thisproblem is how to divide a natural number into two parts suitably The second and arguablymore challenging problem is that we cannot find c1 that defines f in a recursive form naturallyConsider the function f which maps a natural number to a binary tree The forms of the datastructures f(n) and f(Suc(n)) are considerably different and the differences depend on thevalues of n For example compare the operation of adding a leaf node labeled ldquoTruerdquo to thebinary tree shown in Figure 1 In this figure (a) shows the operation of adding a node to thebinary tree that has two leaf nodes labeled ldquoTruerdquo and (b) shows the operation of adding anode to the binary tree that has three leaf nodes labeled ldquoTruerdquo These operations cannot berepresented uniformly therefore f(n) cannot be uniformly defined for all n Furthermore evenif f is defined the proof over the properties on f is not straightforward

(a)

T F F F

T T

(b)

T T T TT T T F

T

T T T

T T

T T

T

T

Figure 1 Operation on adding a ldquoTruerdquo node to a binary tree

On the other hand the definition of g is simpler because it is a conversion from a data typethat is not totally-ordered to one that is totally-ordered

22 Solution

To solve the problem shown above we introduce the bit sequence BS as an intermediate datastructure between NAT and BTREE

95

Data Conversion Revisited Takahashi Yoshimaru and Goto

221 Conversion from BS to BTREE

First we describe the conversion from BS to BTREE We choose a specific binary tree used inan electronic cash protocol This tree is a complete binary tree and a Boolean value is attachedto each node the value of which is defined as a sum of the values of its left and right subtrees

Let b0b1 bn be a sequence of Boolean values that corresponds to a natural number kThen k = bprime0 middot 2

n + bprime1 middot 2nminus1 + + bprimen middot 20 where bprimei = 10 for bi = TrueFalse (1 le i le n)

respectively We encode bprime0 middot2n as the left tree and the remainder as the right tree The function

from BS to BTREE is defined as follows

bs_to_btree() = (Tipfalse)

bs_to_btree(bbs) = (if b

then Node(true create_btree(truelength(bs)) bs_to_btree(bs) )

else Node(true bs_to_btree(bs) create_btree(falselength(bs)) )

)

where is an operator combining the head and tail of the list T ip indicates a leaf node thefunction create btree(bool nat) creates a binary tree of height nat in which all nodes are labeledwith bool and length(list) denotes the length of list 1 Intuitively when scanning the datafrom the head of BS descending by one bit corresponds to descending one subtree in BTREEThe induction scheme for the bit sequence is that if some property holds on a bit sequence bsit also holds on bbs If b = True (ie k ge 2n) then all nodes in the left subtree are labeledTrue this is referred to as a full tree However if b = False (ie k lt 2n) then none of thenodes in the right tree are labeled True this is referred to as an empty tree Thus the datatypes BS and BTREE are matched in their induction schemes

Let a bit sequence be represented as a list the elements of which are either True or FalseFigure 2 shows the conversion of the bit sequence [True False T rue] into a binary tree Inthis figure the black trees are full trees the white trees are empty trees and the dotted treesare the others

T

T T T

FTFTT

[TrueFalseTrue] [FalseTrue] [True]

Figure 2 The mapping between a bit sequence and a binary tree

Because the binary tree corresponding to [True False T rue] is not an empty tree the rootnode is labeled True Because the first bit in the sequence is True the left tree is a full treeThe tree to the right of it is the tree corresponding to the remaining bit sequence [False T rue]after the first bit has been extracted Now consider the coding of [False T rue] because the

1We can define a mirror tree in which left and right subtrees are exchanged

96

Data Conversion Revisited Takahashi Yoshimaru and Goto

first bit of the sequence is False the right tree must be an empty tree and the left tree isthe tree corresponding to the remaining bit sequence Then we consider the coding of [True]because the first bit of the bit sequence is True the left tree is a full tree and the right tree isthe binary tree corresponding to the remaining bit sequence Finally we obtain a T ip for [ ]

T

T

T

T F

T

T

T T T T T F F F

Figure 3 The binary tree for [True False T rue]

The binary tree obtained from [True False T rue] is thus as follows (Figure 3)

( True

( True ( TrueTrueTrue ) ( TrueTrueTrue ) )

( True ( TrueTrueFalse ) ( FalseFalseFalse ) )

)

The function bs to btree can give an inductive definition that provides for the division of ninto n1 and n2 corresponding to the left and right subtrees respectively in the proof processfor IS in the previous subsection

222 Conversion from NAT to BS

Next we give a definition for the conversion from NAT to BS We show two different modelsone using a general function and one using a primitive recursive function

First we define the general function naive nat to bs This is defined in an iterative formand determines the value of a a bit sequence from the least-significant bit as follows

naive_nat_to_bs(0) = [False]

naive_nat_to_bs(1) = [True]

naive_nat_to_bs(n) = (naive_nat_to_bs(div(n2))) ([mod(n2) = 1])

where is the concatenation operator for lists div(n 2) and mod(n 2) return the result ofdivision of n by 2 and its remainder respectively

Second we define the primitive recursive function nat to bs This is defined in a tail-recursive form and determines the value of a bit sequence from the most-significant bit Thedefinition is more complex than that of the iterative form

nat_to_bs(0) = [false]

nat_to_bs(Suc(n)) = calc(lg(Suc(n))Suc(n))

calc(0m) = [true]

calc(Suc(n)m) = (if 2^n lt= m) then True(calc(nm-2^(Suc(n))))

else False(calc(nm))

lg(n) = (if nlt=1 then 0

else Suc(lg (div(n2))))

97

Data Conversion Revisited Takahashi Yoshimaru and Goto

where lg is a key function that returns the place number of the bit sequence corresponding toa given argument ie the natural number m that satisfies m le log n lt m+ 1 The followingtable shows the relationship of a natural number nat a bit sequence bs and the value of lgNote that when n increases by 1 the location in the bit sequence which is equal to the heightof the tree increases logarithmically

nat bs lg

1 1 02 10 13 11 14 100 25 101 26 110 27 111 28 1000 39 1001 3

223 Conversion from NAT to BTREE

Finally nat to btree is defined as the composition of the two functions naive nat to bs andbs to btree or the composition of nat to bs and bs to btree nat to bs and bs to btree are prim-itive recursive functions whereas naive nat to bs is a recursive function

The definition of nat to bs is more suitable to an induction scheme than that ofnaive nat to bs because induction is typically applied from the head to the tail

In the next two sections we apply this formalization to the electronic cash protocol definedin [18] and prove its divisibility

3 Modeling of an Electronic Cash Protocol

31 Ideal Electronic Cash

An electronic cash (e-cash) protocol is in general a combination of cryptography techniquessuch as zero-knowledge proof and public key encryption We consider the ideal e-cash protocolproposed by Okamoto [18] In this protocol a coin of some monetary value is encoded asa binary tree and a payment function is defined over it This binary tree approach makese-cash efficient and unlinkable and is used in many divisible e-cash schemes [7 8 15 18]We formalize this protocol and prove its divisibility on a data level ie a user can spend acoin in several separate transactions by dividing its value without overspending if and only ifa payment function satisfies the payment rules This is one of the properties that an ideale-cash protocol should satisfy We define the data structure of money and define two primitiverecursive functions of money amount and pay on money The definitions are shown using Coqcode in this section

32 Definition of money

A coin is represented as a binary tree called money Each node of the tree represents a certaindenomination The root node is assigned the monetary value of the money and the values of

98

Data Conversion Revisited Takahashi Yoshimaru and Goto

all other nodes are defined as half the value of their parent nodesMoney is defined as an inductive function It is a binary tree where nodes are labeled with

Boolean values The label True means that a node is usable while False means that it is notFor a given Boolean value b and a natural number n we can create money in which all of thenodes have the label b

Inductive money Type =

| Tip bool -gt money

| Node bool -gt money -gt money -gt money

Fixpoint create_money(b bool)(n nat) money =

match n with

| 0 =gt Tip b

| S nrsquo =gt Node b (create_money b nrsquo) (create_money b nrsquo)

end

33 Creation of money from a natural number

cash is a function that createsmoney corresponding to a given natural number that is defined asa composition of bs to money and naive nat to bs (or nat to bs) bs to money can be definedin a manner similar to that of bs to btree

Definition cash(n nat) money = bs_to_money (naive_nat_to_bs n)

Note that cash is the money that satisfies a specific condition whereas type money al-lows any complete binary tree whose nodes are labeled as Boolean values For exampleNode(false T ip(true) T ip(true)) is an element of money but not a result of a function cash

34 Calculation of the amount of money

The function money amount computes the amount of money that can be used If the rootnode is labeled True the amount of the tree is the sum of that of the left tree and the righttree otherwise the amount is 0

Fixpoint money_amount(m money) nat =

match m with

| Tip true =gt 1

| Tip false =gt 0

| Node true l r =gt money_amount l + money_amount r

| Node false _ _ =gt 0

end

35 Payment

Payment rules are set in [18] as follows when we spend some amount from the coin we searchfor a node (or combination of nodes) whose value is equal to the payment value and then cancelthese nodes at the same time all of the ancestors and all of the descendants are also canceledOverspending is prevented if and only if these rules are satisfied

The function pay corresponds to payment according to the payment rules When we pay nfrom money where n is less than or equal to the amount of money then we pay all of n fromthe left tree and the right tree remains as it is if the amount of the left tree is more than n

99

Data Conversion Revisited Takahashi Yoshimaru and Goto

Otherwise we exhaust the left tree in the payment and pay the remainder from the right treeFor example money amount(pay(cash(13) 4) = 9

In the following code eq nat dec and lt dec are functions on NAT that denote rsquo=rsquo and rsquoltrsquorespectively change false is a function that changes the label of a node to False

Fixpoint pay(m money)(n nat) money =

match m with

| Tip true =gt Tip (if eq_nat_dec n 0 then true else false)

| Node true l r =gt

if lt_dec (money_amount l) n

then Node true (change_false l) (pay r (n - money_amount l))

else Node true (pay l n) r

| _ =gt m

end

4 Proof of Properties

We prove three properties on the divisibility of the e-cash protocol On proving these propertiesinductively we apply the method proposed in Section 2

In this section we only show the outline of the proof focusing on how induction is appliedThe complete Coq proof is shown in the Appendix

First the distribution property over money amount holds

money amount(Node( left right)) =money amount(left) +money amount(right) middot middot middot (1)

This can readily be proved We rewrite the left side of the given equation

41 Well-definedness of cash

The monetary value of money created by cash from a natural number is equal to that valueThis property is represented as follows

forall n (money amount (cash(n)) = n)

and is proved using the properties of the bit sequence Below we show a case in which the firstbit b of the sequence is True When it is False the proof proceeds in the same manner

money amount(cash(n))= money amount(bs to money(bbs)) middot middot middot (2)= money amount( Node(true

bs to money(bs) create money(true length(bs) ) middot middot middot (3)= money amount(bs to money(bs))+

money amount(create money(true (length(bs)))) middot middot middot (4)

Formula (2) is obtained by unfolding cash where nat to bs(n) = bbs formula (3) isobtained by unfolding bs to money and formula (4) is obtained by the distribution propertyof money amount (1)

The first term of formula (4) is transformed as follows

100

Data Conversion Revisited Takahashi Yoshimaru and Goto

money amount(bs to money(bs))= money amount(bs to money(nat to bs(nminus 2lg n))) middot middot middot (5)= money amount(cash(nminus 2lgn)) middot middot middot (6)

Formula (5) is obtained using case split tactics on n property of lg and several other tacticsFormula (6) is obtained by unfolding cash

The second term of formula (4) is transformed as follows

money-amount(create money(true length(bs)))= money amount(cash(2lgn)) (7)

Here we use the following induction scheme of NAT

if forall k k lt n money amount(cash(k)) = kthen money mount(cash(n)) = n holds

We can prove 2lg n le n and nminus 2lg n lt n If 2lg n lt n we apply this type of induction toboth formulas (6) and (7) and so formula (4) is finally transformed into the following form

money amount(cash(2lg n)) +money amount(cash(nminus 2lg n))= 2lg n + (nminus 2lg n)= n

In case 2lg n = n the proof is simpler without using induction

42 Well-definedness of pay

The amount remaining after payment is the difference between the original value and thepayment value This property is represented as follows 2

forall nforall m (money amount(pay(cash(n)m)) = nminusm)

This is derived from the following lemma

forall cforall n (money-amount(pay(c n)) = money-amount(c)minus n

which is proved as follows When we pay n from c if n does not exceed the amount of c wepay m1 from the left subtree as far as possible and pay the remainder m2 from the right treem1 and m2 are determined as follows if n lt money amount(left) then m1 = n and m2 = 0otherwise m1 = money amount(left) and m2 = n minus money amount(left) This is provedusing induction Below we show an inductive case because the proof is simple for the basecase

money amount(pay(cm1 +m2))= money amount(pay(Node( left right)m1 +m2)) middot middot middot (8)= money amount(pay(leftm1)) +money amount(pay(rightm2)) middot middot middot (9)= money amount(left)minusm1 +money amount(right) minus m2 middot middot middot (10)= (money amount(left) + money amount(right)) minus (m1 + m2)= money amount(Node( left right)) minus (m1 +m2) middot middot middot (11)= money amount(c) minus (m1 +m2)

2Note that nminusm = 0 when m gt n

101

Data Conversion Revisited Takahashi Yoshimaru and Goto

Formula (8) is obtained by expanding c Formula (9) is obtained by the distribution propertyofmoney amount and the property of payment onmoney Formula (10) is obtained by applyinginduction tomoney Formula (11) is obtained from the distribution property ofmoney amount

43 Divisibility

Given that ms is a list of values each of which corresponds to a transaction if a user paysfrom the head of this list in succession then the remainder is the correct value This propertyis represented as follows

forallnforallms( n ge listsum(ms)

=rArr money amount (foldl(pay(cash(n)ms))) = n minus listsum(ms) )

Here foldl and listsum are the functions handling a list Let ms be a list [m1 mk]foldl(pay(cms)) is rewritten in the following form

(pay( (pay(cm1) mk)

and listsum(ms) is rewritten in the following form

m1 + + mk

This theorem can be proved using the result of the proofs for the above two properties ofwell-definedness

5 Discussion

Modeling the e-cash protocol and proving the properties described in the previous sections wereperformed using the theorem provers IsabelleHOL and Coq respectively First we comparethese two provers

Both of them are interactive theorem-proving environments based on inductive theoremproving The data types and functions are defined in recursive form and the proof proceeds byconnecting suitable tactics

IsabelleHOL has a more powerful engine for automatic proof than Coq A proof may suc-ceed simply by using the lsquoautorsquo command without connecting multiple lemmas in IsabelleHOLwhereas a user must specify tactics manually in Coq However the proof procedure in Coq iseasier to understand

Both provers are based on typed logics and adopt higher-order functions In Coq type-checking is richer and proof-checking is reduced to type checking It requires the user to provethe termination of a recursive function IsabelleHOL also requires the user to prove thetermination of a recursive function but has a stronger automatic mechanism and user doesnot need to supply much input

We developed a model for an e-cash protocol and set out to prove three properties of themodel using IsabelleHOL and subsequently translated the model into Coq The translationwas basically straightforward The definition of a primitive recursive function using primrec inIsabelleHOL was translated to Fixpoint in Coq the definition of a recursive function usingfun was translated to Function the definition of a non-recursive function using definitionwas translated to Definition In addition we must prove the termination of the functionintroduced via Function

102

Data Conversion Revisited Takahashi Yoshimaru and Goto

The tactics used in the proofs of two provers were quite different Generally more tactics arerequired in Coq however the proof in Coq provides a useful basis from which to make a proofin IsabelleHOL Actually we completed the proof of the unproved lemma in IsabelleHOL byreferring to the proof in Coq From this experience it is expected that similar modeling withother provers is possible and that the existing proofs will be useful as a basis for forming proofsin those other provers All definitions and proofs in IsabelleHOL and Coq are shown in [22]

In the field of protocol verification there are a number of works on the verification ofsecurity protocols using IsabelleHOL (eg[2]) However they mainly proved security or safetyof protocols To the best of our knowledge there exists no research on a proof that focuses onthe divisibility of electronic cash protocols using a theorem-proving approach

Bijection between the set of natural numbers and rooted trees has been discussed in severalworks [5 6 9] In these works prime decomposition of the natural numbers was used toconstruct the corresponding rooted tree They used an incomplete tree in which each primenumber forms an individual branch It appears to be impossible to define this bijection in aninductive manner Attempts to provide the mechanical proof were not made and the correctnessof the methods has not been proved using theorem provers On the other hand we propose amethod for automated theorem proving using a complete binary tree

The data conversion method described here is applicable to conversion from an inductivelydefined data structure with one successor to one with n successors by introducing a list inwhich each element takes n values as an intermediate data structure instead of a bit sequenceFollowing this transformation the proof can proceed in a similar manner to the one shown inthis paper although the number of lemmas would increase Moreover it can be extended todata conversion from data structures with m successors to data structures with n successors bycomposing two data-conversion functions ie one from an inductively defined data structurewith m successors to that with one successor and then a second function from an inductivelydefined data structure with one successor to one with n successors

6 Conclusion

We have described a function for converting data from a natural number to a binary treeand have given an inductive proof for its well-definedness We have described a method ofintroducing a bit sequence as an intermediate data structure to provide a model for inductivelydefined data structures with different induction schemes We formalized this method developeda computational model based on it and applied it to an electronic cash protocol We succeededin proving the properties of divisibility of the protocol using the theorem provers IsabelleHOLand Coq and discussed the effectiveness of the method

In future we would like to investigate other functions andor properties on such a binarytree that is handled here and develop methods of their inductive proof

References

[1] Arsac W Bella G Chantry X and Compagna L Multi-Attacker Protocol Validation J ofAutomated Reasoning 46(3-4)353-388 (2011)

[2] Bella G Massacci B and Paulson L Verifying the SET Purchase Protocols J of AutomatedReasoning 365 37 (2006)

[3] Bella G Inductive Verification of Smart Card Protocols J of Computer Security 11(1)87-132(2003)

103

Data Conversion Revisited Takahashi Yoshimaru and Goto

[4] Bertot Y and Castran P Interactive Theorem Proving and Program Development - CoqrsquoArtThe Calculus of Inductive Constructions Springer Verlag (1998)

[5] Beyer T and Hedetniemi S M Constant Time Generation of Rooted Trees SIAM J Comput9(4)706-712 (1980)

[6] Cappello P A New Bijection between Natural Numbers and Rooted Trees 4th SIAM Conferenceon Discrete Mathematics (1988)

[7] Chan A Frankel Y and Tsiounins Y Easy Come - Easy Go Divisible Cash EUROCRYPT98pp 561-575 (1998)

[8] Canard S and Gouget A Divisible E-Cash Systems Can Be Truly Anonymous EURO-CRYPT2007 pp482-497 (2007)

[9] Gobel F On a 1-1-Correspondence between Rooted Trees and Natural Numbers J of Combina-torial Theory Series B(29)141-143 (1980)

[10] Hardin D S (ed) Design and Verification of Microprocessor Systems for High-Assurance Appli-cations Springer Verlag (2010)

[11] KaufmannM Monolios P and Moore J S Computer-Aided Reasoning An Approach KluwerAcademic Publishers (2000)

[12] Klein G et al seL4 Formal Verification of an Operating-System Kernel Commun ACM 53(6)107-115 (2010)

[13] Kurita T and Nakatsugawa Y The Application of VDM to the Industrial Development ofFirmware for a Smart Card IC Chip Int J of Software and Informatics 3(2-3)343-355 (2009)

[14] Leroy X Formal Verification of a Realistic Compiler Communications of the ACM 52(7)107-115(2009)

[15] Nakanishi T and Sugiyama Y An Efficiently Improvement on an Unlinkable Divisible ElectronicCash System IEICE Trans on Fundamentals E85-A(19)2326-2335 (2002)

[16] Nipkow T Paulson L and Wenzel M IsabelleHOL A Proof Assistant for Higher-Order LogicSpringer Verlag (2002)

[17] Norell U Dependently Typed Programming in Agda Advanced Functional Programming 2008pp230-266 (2008)

[18] Okamoto T An Efficient Divisible Electronic Cash Scheme The proceedings of Cryptorsquo95pp438-451 (1995)

[19] OwreS RushbyJM and ShankarN PVS A Prototype Verification System The proceedingsof CADE-11 pp748-752 (1992)

[20] Sprenger C Zurich E T H Basin D et al Cryptographically Sound Theorem Proving 19thIEEE Computer Security Foundations Workshop (2006)

[21] Takahashi K and Yoshimaru S Formalization of Data Conversion for Inductive Proof Tunisia-Japan Workshop on Symbolic Computation in Software Science (SCSS 2009) pp135-150 (2009)

[22] httpistksckwanseiacjp~ktakaEMONEY

104

Data Conversion Revisited Takahashi Yoshimaru and Goto

Appendix Proof for E-cash protocol in Coq (tail-recursiveversion)

Require Import Omega List Arith Div2 Bool Recdef Wf_nat

Theorem well_definedness_of_pay

forall(m money)(n nat)

n lt= money_amount m

-gt money_amount(pay m n) = money_amount m - n

Proof

intros m

induction m intros n LNM destruct b simpl in try reflexivity

destruct (eq_nat_dec n 0)

rewrite e reflexivity

assert(n = 1) by omega

rewrite H reflexivity

destruct (lt_dec (money_amount m1) n) simpl

rewrite IHm2 try omega

replace (money_amount (change_false m1)) with 0 try omega

destruct m1 simpl reflexivity

rewrite IHm1 omega

Qed

Lemma bit_sequence_distribution

forall(bs list bool)(b bool)

money_amount(bs_to_money(bs ++ (bnil))) =

2 money_amount(bs_to_money bs) + (if b then 1 else 0)

Proof

intros bs b

induction bs simpl in

destruct b reflexivity

assert(forall(bl bool)money_amount (create_money bl (length

(bs ++ b nil))) =

money_amount (create_money bl (length bs)) + money_amount

(create_money bl (length bs)))

intros clear IHbs destruct bl induction bs simpl try omega

destruct a simpl in rewrite IHbs repeat rewrite plus_0_r

repeat rewrite plus_assoc rewrite H omega

Qed

Lemma one_reminder_div2

forall(n nat)

(2 div2 n) + (if one_reminder n then 1 else 0) = n

Proof

intros n

case_eq (one_reminder n) intros induction n using lt_wf_ind

destruct n try discriminate

destruct n try reflexivity

simpl in H

simpl

replace (S (div2 n + S (div2 n + 0) + 1))

with (S (S (2 div2 n + 1)))

105

Data Conversion Revisited Takahashi Yoshimaru and Goto

repeat f_equal

rewrite H0 try reflexivity try omega

apply H

simpl

omega

destruct n try reflexivity

destruct n try discriminate

simpl in H

simpl

replace (S (div2 n + S (div2 n + 0) + 0))

with (S (S (2 div2 n + 0)))

repeat f_equal

rewrite H0 try reflexivity try omega

apply H

simpl

omega

Qed

Theorem well_definedness_of_cash

forall(n nat)

money_amount (cash n) = n

Proof

intros n

induction n using lt_wf_ind

destruct n try (simpl reflexivity)

destruct n try (simpl reflexivity)

unfold cash rewrite bit_sequence_equation

case_eq (one_reminder (S (S n))) intros

rewrite bit_sequence_distribution unfold cash in H rewrite H

try (apply lt_div2 apply lt_0_Sn)

pose (one_reminder_div2 (S (S n)))

rewrite H0 in e apply e

Qed

Definition listsum(ns list nat) nat = fold_right plus 0 ns

Definition payment_amount(m money)(ns list nat) nat =

money_amount (fold_left pay ns m)

Theorem Divisibility

forall(n nat)(ns list nat)

listsum ns lt= n -gt

payment_amount (cash n) ns = n - listsum ns

Proof

intros n ns LSM

induction ns using rev_ind simpl in

rewrite lt- minus_n_O

apply well_definedness_of_cash

unfold payment_amount in

unfold listsum in

rewrite fold_left_app

rewrite fold_right_app in simpl in

rewrite plus_0_r in

106

Data Conversion Revisited Takahashi Yoshimaru and Goto

assert(fold_right plus 0 ns + x lt= n)

generalize n LSM

clear IHns LSM n

induction ns intros simpl in

omega

assert(fold_right plus x ns lt= n - a) by omega

apply IHns in H omega

rewrite well_definedness_of_pay rewrite IHns simpl in try omega

replace (fold_right plus x ns) with ((fold_right plus 0 ns) + x)

omega

clear IHns H LSM

induction ns simpl

reflexivity

rewrite lt- IHns info omega

Qed

107

Computer Algebra Investigation of Known

Primitive Triangle-Free Strongly Regular

Graphs

Mikhail Klin and Matan Ziv-Av

Ben-Gurion University of the Negevklincsbguacil

matansvgaliborg

Abstract

With the aid of computer algebra systems COCO and GAP with its packages we areinvestigating all seven known primitive triangle-free strongly regular graphs on 5 10 1650 56 77 and 100 vertices These graphs are rank 3 graphs having a rich automorphismgroup The embeddings of each graph from this family to other ones are described the au-tomorphic equitable partitions are classified all equitable partitions in the graphs on up to50 vertices are enumerated Basing on the reported computer aided results and using tech-niques of coherent configurations a few new models of these graphs are suggested whichare relying on knowledge of just a small part of symmetries of a graph in consideration

1 Introduction

This paper appears on the edge between computer algebra systems and algebraic graph theory(briefly AGT) and is mainly devoted to the computer aided investigation of the known primitivetriangle free strongly regular graphs

In fact there are 7 such graphs those on 5 10 16 50 56 77 and 100 vertices The largestone denoted by NL2(10) is the universal graph for this family in the sense that all seven graphsare induced subgraphs of NL2(10) We denote by F the family of those 7 graphs

The history of the discovery of the graphs from F and in particular of NL2(10) is quitestriking Indeed the graph NL2(10) was discovered twice once in 1956 by Dale Mesner andsecond time independently in 1968 by D G Higman and C C Sims The details of thishistory are considered in [15] see also a very brief summary in Section 4

The graphs on 5 10 and 50 vertices form a very significant subfamily consisting of theknown Moore graphs One more possible member of this series (see eg [16]) would have 3250vertices its existence is an open problem of a great significance Moore graphs and their naturalgeneralizations are objects of much interest in extremal graph theory they serve as the bestexamples of optimal network topologies Discovery of a new primitive triangle free stronglyregular graph would be a high level sensation in modern mathematics

This text is oriented towards an interdisciplinary audience though its kernel is strictlyrelated to a concrete kind of application of computer algebra in AGT

Section 2 provides in compact form the necessary background about strongly regular graphssee [11] [5] for more details while in section 3 we briefly introduce the tools of computer algebraused in AGT The seven graphs from the family F are presented in section 4

Our first main result is introduced in Section 5 full description of embeddings of (primitiveand imprimitive) triangle free strongly regular graphs into the graphs in F

108

Triangle-free strongly regular graphs Klin Ziv-Av

The next topic of our investigation is related to equitable partitions with a special emphasison automorphic equitable partitions see definitions in Section 6 The search strategy is de-scribed in Section 7 though much more details may be found in [28] We report the completeenumeration of automorphic equitable partitions and partial results for the general case

Sections 8ndash10 reflect our efforts to understand a few of the computer aided results and topresent them in a computer free form (completely or at least relatively)

In Section 8 we deal with the graph NL2(10) and describe it in a sense locally that isvia so-called metric equitable partitions obtained from the embeddings of a quadrangle anda graph K33 without one edge (Atkinson configuration) with 4 and 8 cells respectively Thespectrum of the second partition contains all of the eigenvalues of NL2(10) (the case of fullspectrum) Some modifications of the famous Robertson model (see [21]) appear in Section 9while in Section 10 we present a handful of models for some other graphs in F

It is worthy to mention that for generations of mathematicians the graphs in F appear asa source of ongoing aesthetic admiration see especially the home page of Andries Brouwer [6]We believe that some of our models shed a new light on those graphs

Last but not least is that as a rule the models we suggest rely on a relatively small subgroupof the group Aut(Γ) for Γ isin F In this way we provide promising patterns for those researcherswho wish in future to face a challenge to try to construct new primitive triangle free stronglyregular graphs cf Section 11

2 Strongly regular graphs a brief survey

An undirected graph Γ is called a strongly regular graph (SRG) with parameters (v k λ micro) ifit is a regular graph of order v and valency k and every pair of adjacent vertices has exactly λcommon neighbors while every pair of non-adjacent vertices has exactly micro common neighborsSometimes we use an extended set of parameters (v k l λ micro) where l is the number of non-neighbors of a vertex that is l = v minus k minus 1

If A = A(Γ) is the adjacency matrix of an undirected graph Γ then Γ is strongly regular ifand only if A2 = kI + λA+ micro(J minus I minus A) This implies that (I A J minus I minus A) is the standardbasis of a rank 3 homogeneous coherent algebra In other words (∆ΓΓ) are the basic graphsof a rank 3 symmetric association scheme (here Γ is the complement of Γ while ∆ contains allthe loops) The adjacency matrix of a strongly regular graph has exactly 3 distinct eigenvaluesFor a strongly regular graph we denote by

bull r gt s the two eigenvalues of A(Γ) different from k r is always positive while s is alwaysnegative

bull f g the multiplicity of the eigenvalues r s respectively

A formula for f and g is given by g f = 12

[(v minus 1)plusmn 2k+(vminus1)(λminusmicro)radic

(λminusmicro)2+4(kminusmicro)

]

A quadruple of parameters (v k λ micro) for which f and g as given by the preceding formulasare positive integers is called a feasible set of parameters See [6] for a list of feasible parametersets with some information about known graphs for some of the sets

A strongly regular graph Γ is called primitive if both Γ and its complement Γ are connectedThis is equivalent to primitivity of the related association scheme (∆ΓΓ)

109

Triangle-free strongly regular graphs Klin Ziv-Av

3 Computer algebra tools in AGT

During the last two decades the significance of the use of computer algebra systems in AGTincreased drastically Such systems are exploited in the search for new combinatorial objectsthe enumeration of objects with prescribed parameters and the understanding of algebraic andstructural properties of a given combinatorial object Γ (such as the automorphism group Aut(Γ)its action and orbits on the ingredients of Γ enumeration of substructures of Γ embeddings ofΓ into larger structures etc)

An ideal case is when the computer aided understanding of an object Γ is followed by furthertheoretical generalizations The foremost goal of this paper is to share with the reader manynew interesting properties of the graphs in the family F in order to promote the search for newprimitive tfSRGs

Below are the main tools we use

bull COCO is a set of programs for dealing with coherent configurations including construc-tion enumeration of subschemes and calculation of automorphism groups

Developed in 1990-2 Moscow USSR mainly by Faradzev and Klin [8] [9]

bull WL-stabilization ndash Weisfeiler-Leman stabilization is an efficient algorithm for calcu-lating coherent closure of a given matrix (see [25] [3]) Two implementations of theWL-stabilization are available (see [2])

bull GAP an acronym for ldquoGroups Algorithms and Programmingrdquo is a system for com-putation in discrete abstract algebra [10] [22] It supports easy addition of extensions(packages in gap nomenclature) that are written in the GAP programming languagewhich can add new features to the GAP system

One such package GRAPE [23] is designed for construction and analysis of finite graphsGRAPE itself is dependent on an external program nauty [18] in order to calculate theautomorphism group of a graph Another package is DESIGN used for construction andexamination of block designs

bull COCO v2 ndash The COCO v2 initiative aims to re-implement the algorithms in COCOWL-stabilization and DISCRETA as a GAP package In addition the new package shouldessentially extend abilities of current version basing on new theoretical results obtainedsince the original COCO package was written

We refer to [14] for a more detailed discussion of the ways in which computer algebra systemsare used in AGT for the purpose of experimentation and further theoretical generalizations

4 The seven known primitive triangle-free strongly regu-

lar graphs

A graph Γ is called triangle free if it admits no triangles that is cliques of size 3 If Γ is also astrongly regular graph then it is called a triangle free strongly regular graph (tfSRG for short)A graph is triangle free if any two neighbors have no common neighbors therefore a tfSRG isan SRG with λ = 0

The 7 known primitive tfSRGs with orders from 5 to 100 vertices are

1 Pentagon with parameters (5 2 0 1) Its automorphism group is D5 of order 10

110

Triangle-free strongly regular graphs Klin Ziv-Av

0

1

2 3

4

25

26

27 28

29

10

11

12 13

14

Figure 1 Hoffman-Singleton graph Robertson model

2 Petersen graph with parameters (10 3 0 1) Its automorphism group is isomorphic to S5

of order 120 A simple model has as vertices 2-subsets of a set of size 5 with two verticesadjacent if the subsets are disjoint

3 Clebsch graph with parameters (16 5 0 2) Usually denoted by 5 Its automorphismgroup is isomorphic to (S5 ≀S2)

pos of order 1920 A simple model is 4-dimensional cube Q4

together with long diagonals or Cayley graph CAY (E24 0001 0010 0100 1000 1111)

4 Hoffman-Singleton graph (HoSi) with parameters (50 7 0 1) Its automorphism group isisomorphic to PΣU(3 52) of order 252000 ([4]) The simplest model is Robertson model([21]) 5 pentagons marked P0 P4 and 5 pentagrams marked Q0 Q4 with vertexi of Pj joined to vertex i+ jk (mod 5) of Qk

5 Gewirtz (or Sims-Gewirtz) graph with parameters (56 10 0 2) Its automorphism groupof order 80640 is a non split extension of PSL3(4) by E22 A simple model is as theinduced subgraph of NL2(10) on the common non-neighbors of two adjacent vertices

6 Mesner graph with parameters (77 16 0 4) The automorphism group is of order 887040and is isomorphic to the stabilizer of a point in the automorphism group of NL2(10) Onesimple model is induced subgraph of NL2(10) on non-neighbors of a vertex

7 NL2(10) with parameters (100 22 0 6) also known as the Higman-Sims graph Its auto-morphism group contains Higman-Sims sporadic simple group as a subgroup of index 2We refer to [15] for a detailed presentation of the original construction of this graph byDale Mesner as it appeared on [19] [20]

Recall that the graph NL2(10) on 100 vertices was constructed twice by Dale Mesner inhis Thesis in 1956 [19] and later on by Higman and Sims in 1968 when they discovered anew sporadic simple group Moreover in 1964 Mesner proved its uniqueness We denote thisgraph by NL2(10) following the parametrization for a family of putative graphs introduced byMesner in [20] In [15] the history of this discovery as well as of related events is discussed withmany details A new wave of interest in tfSRGs stimulated by [15] was especially productivefor us It became clear that this is the time to arrange a serious comprehensive investigation ofdiverse structural properties of the graphs in the family F The goal is to attract the attentionof researchers to such an information in order to provide new ideas how efforts for the searchof new tfSRGs should be arranged We also wish to share with the reader some surprising newfeatures of the graphs in the family F observed with the aid of a computer

111

Triangle-free strongly regular graphs Klin Ziv-Av

5 Embeddings of tfSRGs into known primitive tfSRGs

Usually in graph theory a graph ∆ = (V prime Eprime) is called a subgraph of a graph Γ = (VE) if

V prime sube V and Eprime sube E Of special interest are induced subgraphs in this case Eprime = E capV prime

2

whereX2

is the set of all 2-subsets of X

Proposition 1 A subgraph ∆ of diameter 2 of a graph Γ with no triangles is an inducedsubgraph

Proof Assume that ∆ is not induced then there exists an edge uw isin E uw 6isin Eprime withuw isin V prime Since the diameter of ∆ is 2 there exist a v which is adjacent in ∆ (and thereforein Γ) to u w thus u v w is a triangle in Γ which is a contradiction

The enumeration of all tfSRGs inside of known tfSRGs was the first serious computationalchallenge in this project The results of its complete solution are discussed below

A non-empty imprimitive tfSRG is either a complete bipartite graph (Kllsim= 2 Kl) or

a graph s K2 consisting of s edges with no common vertices Note that K22 is simply aquadrangle

Lemma 2 Graph NL2(10) does not contain subgraph K33

Proof Originally we obtained this result with the aid of a computer In fact easy proof followsfrom the non-edge decomposition of Γ = NL2(10) (see eg [15]) without any assumptions aboutits uniqueness Indeed let ∆ be a subgraph of Γ which is isomorphic to K33 Assume thattwo bipartite parts of ∆ consist of subsets a b c d e f of vertices Consider now non-edgedecomposition of Γ with respect to a b then c belongs to the cell of size 60 while d e fbelong to the cell of size 6 thus c has just g = 2 neighbors in the latter cell a contradictionwith the valency of c equal to 3 in ∆

As a corollary we obtain that every known primitive tfSRG does not contain K33 andmoreover does not contain Kll when l ge 3

Another simple theoretical result (see eg [28]) claims that the number of quadrangles in an

SRG with parameters (v k l λ micro) is equal tovk2 (

λ

2)+vl2 (

micro

2)2 When λ = 0 this reduces to vlmicro(microminus1)

8 Similar formula may be obtained for the number of 2K2 The numbers of imprimitive tfSRGsinside of graphs in F are given in Table 1 in the supplement while the number of orbits of suchembeddings (with respect to Aut(Γ) for Γ isin F) are given in Table 2

Note that there is no induced subgraph of NL2(10) isomorphic to 12 K2 so both tablesin Supplement A end with s = 11 for s K2

Similar computer results are presented in Tables 3 and 4 (Supplement A) for the embeddingsof a graph from the family F into a larger graph in F

Here the final picture is less sophisticated There are just two cases where for pair of graphsXY isin F there exist more than one orbit of embeddings (up to action of Aut(Y )) of X intoY Namely in these terms there are 9 embeddings of Petersen graph into Mesner graph and 5embeddings into NL2(10) Computer free understanding of these embeddings remains a quiteinteresting task for future investigations of the links between the graphs in the family F

In all other cases there exists (up to isomorphism) at most one embedding for consideredpair (XY ) For most pairs there is a reasonably clear explanation in literature such as twoHoSi inside NL2(10) see eg [12] as well as Robertson model of HoSi [21] which explainspositions in it for both pentagon and Petersen graph

Beside this there are two more embeddings which are not immediately evident

112

Triangle-free strongly regular graphs Klin Ziv-Av

The first pair is the embedding of the Petersen graph into Gewirtz graph In fact inthis embedding the Petersen graph appears as a subgraph of the second constituent of theGewirtz graph which in turn is a graph ∆ of valency 8 on 45 vertices It turns out thatAut(∆) sim= Aut(S6) This graph ∆ generates a non-Schurian association scheme with threeclasses see eg [24] [13] example W38 The graph ∆ may be also described as the distance2 graph of the distance transitive graph of diameter 4 and valency 4 on 45 vertices akageneralized octagon GO(2 1) aka line graph of Tuttersquos 8-cage (see [5] for more details) Inthis context the task of explanation of the embedding of Petersen graph into ∆ seems to be anice exercise in AGT though out of the framework of this presentation

The second exceptional pair is the embedding of the Clebsch graph 5 into NL2(10) Thispair is of a definite independent interest and thus is considered separately in Section 10

Finally we mention that the classification of cocliques in graphs from F may be regardedas a degenerate case of subject in this section Indeed empty graph is a particular case of animprimitive tfSRG We however disregard this problem referring to information presented onthe home page of Andries Brouwer [6]

6 Equitable partitions

Let Γ = (VE) be a graph A partition τ of the vertex set V τ = V1 Vs is calledequitable partition (briefly EP) if for i j isin 1 s the numbers |Γ(v) cap Vj | are equal for allv isin Vi Here Γ(v) = u isin V |u v isin E Usually an EP τ is accompanied by intersectiondiagram which represents a kind of quotient graph Γτ on which all intersection numbers aredepicted Many such diagrams appear in [5] The quotient graph Γτ is in fact a multigraphIts (collapsed) adjacency matrix B consists of all intersection numbers

Obviously entries of B are non-negative integers and for a regular graph Γ of valency k thesum of each row in B is k

If H is a subgroup of Aut(Γ) then the set of orbits of H is an EP of Γ Such an EP is calledautomorphic (briefly AEP)

Proposition 3 ([11]) Let Γ be a graph A = A(Γ) the adjacency matrix of Γ If a partitionτ is EP of Γ with matrix B then the characteristic polynomial of B divides the characteristicpolynomial of A

In fact there are more necessary conditions for a prescribed matrix B to be the adjacencymatrix of a suitable EP of Γ which are formulated in terms of spectral graph theory see eg[7] They create a solid background for a clever search of potential EPs in a given graph Γ

7 Search for equitable partitions

In this project we distinguished two alternative problems for the complete search of EPs ingraphs of F

First problem is to enumerate all automorphic EPs Here we strongly rely on the level ofgroup theoretical ldquointellectrdquo of GAP Indeed for groups of relatively small order (say up to afew thousands) GAP allows to establish efficiently the structure of a considered group as wellas the lattice of its subgroups

However for four graphs in F the group G = Aut(Γ) has larger order thus with the growingof |G| extra theoretical input is required For example in case of G = Aut(NL2(10)) we wereusing information from the website of the Atlas of Finite Group Representations ([26]) about

113

Triangle-free strongly regular graphs Klin Ziv-Av

the maximal subgroups of G (this information goes back to [17]) This knowledge together withad hoc tricks inside of GAP made it possible to describe all subgroups of G up to equivalencyclasses with respect to EPs The fact that all groups G = Aut(Γ) Γ isin F are subgroups ofAut(NL2(10)) was also quite beneficial

Finally we successfully enumerated all automorphic EPs for all Γ isin FThe second problem is much more sophisticated to enumerate all EPs for all graphs in FFor the smallest three graphs in F the results were achieved via simple brute force see

corresponding tables in Supplement BFor HoSi we used a few complementary strategies in the search for all EPs First we attacked

partitions with ldquolargerdquo number of cells say s gt 5 Here we introduced extra parameter thesize of the smallest cell which varies from 1 to 9 Each such case was considered separately

On the second stage we step by step enumerated cases 2 le s le 5 by enumerating possiblecollapsed adjacency matrices for each case and for any such matrix enumerating all EPs

The description of our computer activities together with detailed discussion of the resultsis presented in [28] An extra advantage of the enumeration in HoSi is that it serves as a kindof a pleasant interaction of a human and a computer Indeed in spite of the fact that the mainpart of computation was fulfilled by GAP a human can follow search explain its logic and stepby step to comprehend all ongoing results

We admit however that the extra advantage of HoSi is that here parameter micro takes itssmallest possible value of 1 (for a primitive SRG) As soon as micro gt 1 and v is growing theproblem is becoming essentially more difficult

This is why already for the Gewirtz graph with v = 56 we only succeeded in enumeration ofall EPs for which the stabilizer has order at least 2 There are 688 such EPs The enumerationof the rigid EPs cannot be completed by a computer in a reasonable time

The full enumeration of all EPs for the largest two graphs in F (on 77 and 100 vertices) atthis stage looks intractable Only modest particular cases may be proceeded efficiently

We refer to Supplement B for Tables 5 6 and 7 which summarize our activities for bothconsidered problems see [28] for more information

As was mentioned in the introduction one of the main goals of this project is to detect anumber of ldquonicerdquo EPs which may serve as a training model for future search of new primitivetfSRGs At this stage this kind of job only partially relies on the support from computer finallya humanrsquos insight still turns out to be very significant Below we report about interestinginterpretations created by us for a handful of detected EPs

8 Quadrangle and Atkinson EPs of NL2(10)

Recall that Γ = NL2(10) has100middot77middot6middot5

8 = 28875 quadrangles This is a simple result obtainedon a combinatorial level without any knowledge of structure of Γ

Provided that Γ and G = Aut(Γ) are known we easily obtain (with the use of a computer)that all quadrangles in Γ form one orbit under G and stabilizer H of a quadrangle in G hasorder 3072 is isomorphic as abstract group to (Z4 times Z2)(Z4 times Z2)) Z2) Z2) Z3) Z2) Z2

and has in action on V (Γ) four orbits of lengths 4 8 24 and 64Thus we may consider an automorphic EP of size s = 4 There is sense to try again

combinatorial arguments in order to determine all invariants of this EP without any priorknowledge of Γ and its group Fortunately this turns out to be possible

Proposition 4 Let τ be a metric decomposition with respect to a prescribed quadrangle Qinside of Γ Then τ is EP s = 4 sizes of cells are 4 8 24 64 and (with respect to this

114

Triangle-free strongly regular graphs Klin Ziv-Av

ordering of cells) B =

2 4 0 162 0 12 80 4 2 161 1 6 14

See proof in [28]In principle next stage should be to describe a model of NL2(10) in terms of the group

H of order 3072 or one of its subgroups which is transitive on all cells of the quadrangle EPNevertheless in this text we are avoiding this task Instead of we prefer to split the quadrangleEP to one with larger number of cells and to proceed with that new one

A note [1] was published before the announcement of CFSG The author considered 13parameter sets for tfSRGs which may be also rank 3 graphs with the number v of verticeswhere 100 lt v le 1000 and proved that such graphs can not be constructed with the aid ofknown 2-transitive permutation groups Part of exposed details is related to consideration of aconfiguration A (graph K33 minus one edge) in putative graph

We got impression that [1] is overseen through a generation of mathematicians and it mightbe helpful to analyze existence of A (we call it Atkinson configuration) in known tfSRGs

It turns out that A appears only in graphs on 77 and 100 vertices Here we analyze itsposition in Γ = NL2(10)

Let us fix at A a quadrangle for example with the vertices a b c f Then two extra ver-tices have two neighbors in the selected quadrangle namely ends of two non-edges respectively

Now we embed A into the considered above quadrangle decomposition splitting in it cell ofsize 8 into two cells of size 2 (exactly our d e) and the remainder This immediately impliessplit of the cell of size 64 into two cells of sizes 16 and 48 The cell of size 24 is forced to besplit into subcells of sizes 12 6 6 depending on the number of neighbors in d e being 1 2and 0 respectively

A more careful analysis (see [28]) shows that we are still getting an EP

Proposition 5 A metrical decomposition τ(A) of a tfSRG with the parameters of NL2(10)with respect to configuration A is EP with s = 8 and cells of sizes 4 2 16 48 6 12 6 6 Ithas collapsed matrix B as follows with Spec(B) = 22 25 (minus8)2

B =

2 1 4 12 3 0 0 02 0 8 0 0 6 6 01 1 2 12 0 3 0 31 0 4 10 1 3 2 12 0 0 8 0 6 2 40 1 4 12 3 2 0 00 2 0 16 2 0 0 20 0 8 8 4 0 2 0

Originally the proof was obtained with the aid of com-puter analysis of Γ = NL2(10) Later on an outline of asimilar proof as for quadrangle configuration was againobtained without prior knowledge of Γ

Further consideration of τ(A) was fulfilled inside ofknown graph Γ and its group Aut(Γ) It turns out thatH = Aut(τ(A)) sim= D4timesS4 is a group of order 192 H hasexactly 8 orbits on the set V (Γ) thus A is an automorphicEP

Describing further stabilizers of H on each of the 8orbits we elaborated the following ad hoc model of Γ

We start from the auxiliary graph ∆ depicted in Figure 2We identify elements of each orbit in τ(A) with suitable sets of structures described with

the aid of ∆ In fact each set of structures appears as orbit of action of the group H Thus itis enough to describe a representative of each orbit

For example the elements in the cell of size 16 are the vertices of ∆ while the elements ofthe cell of size 4 are the four columns of ∆ The most tricky to find was a representation of the7th cell of size 6

115

Triangle-free strongly regular graphs Klin Ziv-Av

12 13 14 15

8 9 10 11

4 5 6 7

0 1 2 3

Figure 2 Auxiliary graph ∆

We think that this piecewise model of Γ appearing from areasonably small solvable group of order 192 may serve as anoptimistic message for those researchers who are hunting for newtfSRGs see also comments in Section 11

9 Some modifications of Robertson

model

The Robertson model of the Hoffman-Singleton graph (see Figure1) partitions the vertices into five pentagons and five pentagramsand describes a simple arithmetic rule for the edges connectingpentagons and pentagrams (see Section 4) Let pij (qij) be vertexj of pentagon (pentagram) i

Since NL2(10) has an EP to two cells of size 50 where theinduced graph on each cell is isomorphic to HoSi this model can be extended to a model ofNL2(10)

In both cases we get an EP with a collapsed adjacency matrix that has a transitive au-tomorphism group (a permutation g isin Sn is an automorphism of a matrix M isin F

ntimesn if thepermutation matrix Mg commutes with M) We are therefore interested in equitable partitionswith this property

In the list of equitable partitions of HoSi we find another such partition with 10 cells of sizefive The collapsed adjacency matrix of this partition isM The spectrum ofM is 7 24 (minus3)5so it has the full spectrum of HoSi

M =

0 2 2 0 0 0 0 1 1 12 0 1 0 1 2 0 0 1 02 1 0 2 0 0 1 0 0 10 0 2 0 1 1 2 0 0 10 1 0 1 0 2 0 1 0 20 2 0 1 2 0 1 0 1 00 0 1 2 0 1 0 1 2 01 0 0 0 1 0 1 0 2 21 1 0 0 0 1 2 2 0 01 0 1 1 2 0 0 2 0 0

The cells of this partition can be de-scribed in the Robertson model of HoSi foreach i isin [1 5] we construct two cellsp11+i p21+i p32+i p44+i p52+iq11+i q21+i q35+i q43+i q55+i

If we consider this matrix M as the adjacencymatrix of a color graph then the basic graph for thecolor 1 is the Petersen graph while the basic graphfor the color 2 is a cycle of length 10 For compar-ison acting similarly with the Robertson partitionwe get a graph K55

The stabilizer of the (ordered) partition inAut(HoSi) is isomorphic to the dihedral group D5

of order 10 as is the automorphism group of M

The coherent closure of the partition (more specifically of the graph with its vertices coloredaccording to the partition) is a Schurian coherent configuration of rank 300 with the stabilizerof the partition as its automorphism group

This EP of HoSi can be extended to an EP of NL2(10) of 20 independent sets of size 5 Inthis case the matrix has spectrum 22 213 (minus8)6 so this EP has full spectrum as well

The automorphism group of this matrix has order 240 and is isomorphic to Z2 times S5 whilethe stabilizer of the ordered partition is again D5 of order 10

The coherent closure of the partition is a Schurian coherent configuration of rank 1200 withthe stabilizer of the partition as its automorphism group

116

Triangle-free strongly regular graphs Klin Ziv-Av

7 7 7

7 7 7

7 74 4

2 2 2

2 2 2

Figure 3 AEP of Gewirtz graph by a semiregular subgroup of order 7

10 A few more models

The calculated data both about embeddings of tfSRGs inside tfSRGs and about EPs can beused to present new models and constructions for tfSRGs Here we offer a few examples withoutgoing into a lot of details

Example 1 (Two Wagner graphs in Clebsch graph) Wagner graph also known as Mobiusladder of order 8 denoted by M8 is a cubic graph on 8 vertices A simple model for it is aCay(Z8 1minus1 4) The spectrum is 3 12minus1 and Aut(M8) = D8

In one of the three EPs of 5 into two cells of size 8 the induced subgraph on each cell isthe Wagner graph The stabilizer of ordered partition inside Aut(5) is D8

Example 2 (Non-automorphic EP of HoSi) We can construct an EP of HoSi into two cellsby taking one of the cells to be the 20 vertices of two Petersen graphs (any two pentagons andtwo pentagrams in Robertson model) The stabilizer of this partition is D10 of order 20 so itis not automorphic

Example 3 (Inside Gewirtz graph six 7-cycles) There is one automorphic partition of Gewirtzgraph into 8 cells of size 7 The induced graph on 6 of the cells is a cycle of length 7 while theinduced graph on the other two cells has no edges

From the intersection diagram (Figure 3) we see that this partition can be merged to an

equitable partition with 2 cells of sizes 42 and 14 with adjacency matrix

(8 26 4

)

The induced graph on the cell of size 42 of valency 8 is a coherent graph Its coherent closureis a rank 6 imprimitive non-Schurian association scheme This graph is not a rational graphwith spectrum 8 222 (minus1)7 (1 +

radic2)6 (1minus

radic2)6

The induced graph on the cell of size 14 is a bipartite graph with two parts of size 7 It isthe co-Heawood graph that is the bipartite complement to the Heawood graph the Levi graph ofFano plane This is by necessity true since a regular bipartite graph of valency 4 and order 14in which every vertex belongs to exactly one quadrangle is the co-Heawood graph

A Brouwer ([6]) notes that this co-Heawood graph is a subgraph of the Gewirtz graph

Example 4 (Gewirtz graph inside of Mesner graph through the group Z7) We start witha semiregular subgroup Z7 of order 7 this time inside of the automorphism group of Mesnergraph We get an AEP with 11 cells of size 7 the collapsed matrix N of order 11 is presentedin [28] It turns out that Aut(N) sim= S2 ≀ S3 (the wreath product) is a group of order 72 withorbits of sizes 6 2 13 There are three non-equivalent possibilities to merge from this AEP a

117

Triangle-free strongly regular graphs Klin Ziv-Av

non-automorphic EP with 3 cells of sizes 14 21 42 and a collapsed matrix

4 6 6

4 0 12

2 6 8

which

has full spectrumEach of the cases provides also an EP for the Gewirtz graph with two cells of sizes 14 and

42 Thus as a by product we obtain other (cf Example 3) embeddings of the co-Heawoodgraph into the Gewirtz graph This example demonstrates ldquoirregularitiesrdquo which may causeinteresting EPs unpredictable from the first sight

Example 5 (Clebsch graph inside NL2(10)) Recall that up to the automorphism group ofΓ = NL2(10) there is one embedding of 5 into Γ The equitable partition resulting from thisembedding allows us to describe another model for NL2(10)

We start from a group H2 = Z4 times S4 of order 96 with orbits of lengths 16 16 48 128 The collapsed adjacency matrix of the corresponding automorphic equitable partition is Bprimeprime(shown below) Clearly the induced graph on the first cell of the partition is isomorphic to 5

In principle one may try as in previous sections to reconstruct the corresponding matrix Bfrom scratch not relying on knowledge of the graph Γ and its group A promising starting pointwould be justification of existence of a coclique of size 8 and its adjacency with the induced 5

We however prefer to exploit at this stage another possibility Namely it turns out thatthe stabilizers of A and 5 inside of Γ have maximal possible intersection K = Z4timesS3 of order24 K defines an AEP with 11 cells of sizes 2 4 4 6 6 6 12 12 12 12 24 and matrix Bprime

Bprime =

0 2 2 0 0 6 0 6 0 6 01 2 1 3 0 0 3 3 3 0 61 1 2 0 3 0 3 0 3 3 60 2 0 0 4 2 2 0 2 6 40 0 2 4 0 2 2 6 2 0 42 0 0 2 2 0 4 0 4 0 80 1 1 1 1 2 4 3 2 3 41 1 0 0 3 0 3 2 3 3 60 1 1 1 1 2 2 3 4 3 41 0 1 3 0 0 3 3 3 2 60 1 1 1 1 2 2 3 2 3 6

Bprimeprime =

5 4 9 3 14 2 12 0 43 4 11 3 14 0 12 2 42 8 6 6 0

It is easy to recognize how Bprime is split from the matrix B of the metric EP of the configurationA Then we merge the Bprime into Bprimeprime

The cell of size 48 is a merging of the last 3 cells the cell of size 8 is merging of cell of sizes2 and 6 (5th cell) while the cell of size 12 is a merging of two remaining cells of size 6 Eachcell of size 16 is a merging of cells of sizes 4 and 12

Example 6 (Reconstruction of NL2(10) from a subgroup of order 2) Using information inthe atlas [26] (or direct calculation using GAP) we see that G = Aut(NL2(10)) containsone conjugacy class of involutions with no fixed points From such an involution i we getan AEP into 50 cells of size 2 We investigated the quotient graph Γ of this AEP and itscollapsed adjacency matrix denoted by B The structure of Γ may be recovered by consideringthe centralizer CG(i) However we prefer to rely on information of combinatorial nature The

graph Γ has a natural EP into cells of sizes 20 and 30 (representing edges and non-edges inNL2(10))

The induced (color) graph on 20 vertices is the graph K1010 from which a 1-factor is removedThe induced graph on 30 vertices is the incidence graph of generalized quadrangle of order

2 GQ(2)

118

Triangle-free strongly regular graphs Klin Ziv-Av

This equitable partition corresponds to an equitable partition of Γ = NL2(10) into two cellsof sizes 40 and 60

11 Concluding comments

The presentation in this extended abstract is a tip of iceberg Much more concrete informationmay be found in [28] while [27] subject of ongoing polishing and development will reflect alldetected computer data about the graphs from family F We see also more potential to returnagain to construction of further models for graphs in F in particular relying on non-automorphicEPs The new attempts to achieve at least in part enumeration of all EPs of restricted size ofcells for graphs on 77 and 100 vertices are also on agenda The paper [16] as well as a numberof private communications of M Macaj to author MK create a background to attack in nearestfuture the problem of existence of new tfSRGs with relatively small parameters The parameterset on 162 vertices seems to be first interesting and realistic target

It should be mentioned that the results in [16] as well as in numerous private communica-tions of M Macaj to the author MK show that a putative new primitive triangle free stronglyregular graph Γ with prescribed parameters will have a relatively small automorphism groupAut(Γ) very concrete restrictions on the cycle structure of elements in Aut(Γ) are typicallyavailable Transformation of those restrictions to the language of equitable partitions may beregarded as a reasonable starting platform for attempts to construct a new tfSRG

Note however that many experts in AGT do not believe at all that a new tfSRG existsNeedless to say that this question creates a great challenge for the modern scientific community

Acknowledgments

We thank Andy Woldar for ongoing collaboration in this project We acknowledge Sven Re-ichard and Christian Pech for sharing with us their draft versions of COCO II Ongoing com-munication with Martin Macaj is very helpful and stimulative We also are pleased to thankPeter Cameron and Jozef Siran for interest expressed to the topic of our research

References

[1] M D Atkinson On rank 3 groups having λ = 0 Canad J Math 29(4)845ndash847 1977

[2] L Babel S Baumann and M Luedecke Stabcol An efficient implementation of the weisfeiler-leman algorithm Technical Report TUM-M9611 Technical University Munich 1996

[3] L Babel I V Chuvaeva M Klin and D V Pasechnik Algebraic combinatorics in mathematicalchemistry methods and algorithms ii program implementation of the weisfeiler-leman algorithmTechnical Report TUM-M9701 Fakultat fur Mathematik TU Munc 1997 httpwww-litmatumdeveroeffhtml96068019html

[4] C T Benson and N E Losey On a graph of Hoffman and Singleton J Combinatorial TheorySer B 1167ndash79 1971

[5] A E Brouwer A M Cohen and A Neumaier Distance-regular graphs volume 18 of Ergeb-nisse der Mathematik und ihrer Grenzgebiete (3) [Results in Mathematics and Related Areas (3)]Springer-Verlag Berlin 1989

[6] AE Brouwer httpwwwwintuenl~aebgraphs

119

Triangle-free strongly regular graphs Klin Ziv-Av

[7] Dragos Cvetkovic Peter Rowlinson and Slobodan Simic An introduction to the theory of graphspectra volume 75 of London Mathematical Society Student Texts Cambridge University PressCambridge 2010

[8] I A Faradzev and M H Klin Computer package for computations with coherent configurationsIn Proc ISSAC pages 219ndash223 Bonn 1991 ACM Press

[9] I A Faradzev M H Klin and M E Muzichuk Cellular rings and groups of automorphisms ofgraphs In Investigations in algebraic theory of combinatorial objects volume 84 of Math Appl(Soviet Ser) pages 1ndash152 Kluwer Acad Publ Dordrecht 1994

[10] The GAP Group GAP ndash Groups Algorithms and Programming Version 4412 2008

[11] Chris Godsil and Gordon Royle Algebraic graph theory volume 207 of Graduate Texts in Mathe-matics Springer-Verlag New York 2001

[12] Paul R Hafner On the graphs of Hoffman-Singleton and Higman-Sims Electron J Combin11(1)Research Paper 77 33 pp (electronic) 2004

[13] M Klin C Pech and P-H Zieschang Flag algebras of block designs i initial notions steiner2-designs and generalized quadrangles November 1998

[14] Mikhail Klin Christian Pech Sven Reichard Andrew Woldar and Matan Ziv-Av Examples ofcomputer experimentation in algebraic combinatorics Ars Math Contemp 3(2)237ndash258 2010

[15] Mikhail H Klin and Andrew J Woldar Dale Mesner Higman amp Sims and the strongly regulargraph with parameters (100 22 0 6) Bull Inst Combin Appl 6313ndash35 2011

[16] Martin Macaj and Jozef Siran Search for properties of the missing Moore graph Linear AlgebraAppl 432(9)2381ndash2398 2010

[17] Spyros S Magliveras The subgroup structure of the Higman-Sims simple group Bull AmerMath Soc 77535ndash539 1971

[18] B D McKay nauty userrsquos guide (version 15) 1990

[19] Dale Marsh Mesner An investigation of certain combinatorial properties of partially balancedincomplete block experimental designs and association schemes with a detailed study of designs oflatin square and related types ProQuest LLC Ann Arbor MI 1956 Thesis (PhD)ndashMichiganState University

[20] Dale Marsh Mesner Negative latin square designs Mimeo notes 410 Institute of Statistics UNCNC 1964

[21] George Neil Robertson Graphs minimal under girth valency and connectivity constraints Pro-Quest LLC Ann Arbor MI 1969 Thesis (PhD)ndashUniversity of Waterloo (Canada)

[22] Martin Schonert et al GAP ndash Groups Algorithms and Programming ndash version 3 release 4 patch-level 4 Lehrstuhl D fur Mathematik Rheinisch Westfalische Technische Hochschule AachenGermany 1997

[23] Leonard H Soicher GRAPE a system for computing with graphs and groups In Groups andcomputation (New Brunswick NJ 1991) volume 11 of DIMACS Ser Discrete Math TheoretComput Sci pages 287ndash291 Amer Math Soc Providence RI 1993

[24] Edwin R van Dam Three-class association schemes J Algebraic Combin 10(1)69ndash107 1999

[25] B Weisfeiler On construction and identification of graphs Number 558 in Lecture Notes in MathSpringer Berlin 1976

[26] Robert Wilson Peter Walsh Jonathan Tripp Ibrahim Suleiman Richard Parker Simon NortonSimon Nickerson Steve Linton John Bray and Rachel Abbott Atlas of finite group representa-tions - version 3 httpbrauermathsqmulacukAtlasv3

[27] M Ziv-Av Protocols with computer data related to the investigation of known primitive trangle-free strongly regular graphs httpwwwmathbguacil~zivavmath

[28] M Ziv-Av Results of computer algebra calculations for triangle free strongly regular graphshttpwwwmathbguacil~zivavmatheqpartpdf

120

Triangle-free strongly regular graphs Klin Ziv-Av

A Data about embeddings of tfSRGs inside tfSRGs

Quadrangle edge 2 edges 3 4 5 6Pentagon 0 5 0 0 0 0 0Petersen 0 15 15 5 0 0 0Clebsch 40 40 60 40 10 0 0HoSi 0 175 7875 128625 845250 2170350 1817550

Gewirtz 630 280 15120 245280 1370880 2603664 1643040Mesner 6930 616 55440 1330560 10589040 28961856 24641232NL2(10) 28875 1100 154000 5544000 67452000 301593600 477338400

7 edges 8 9 10 11HoSi 40150 15750 3500 350 0

Gewirtz 104160 7560 1400 112 0Mesner 3664320 166320 30800 2464 0NL2(10) 258192000 14322000 924000 154000 11200

Table 1 Number of imprimitive tfSRGs inside tfSRGs

Quadrangle edge 2 edges 3 4 5 6Pentagon 0 1 0 0 0 0 0Petersen 0 1 1 1 0 0 0Clebsch 1 1 1 1 1 0 0HoSi 0 1 1 4 10 21 15

Gewirtz 1 1 2 9 30 48 36Mesner 1 1 1 7 26 56 50NL2(10) 1 1 1 2 7 14 17

7 edges 8 9 10 11HoSi 8 1 1 1 0

Gewirtz 5 2 2 1 0Mesner 14 2 2 1 0NL2(10) 14 3 2 2 1

Table 2 Number of orbits of imprimitive tfSRGs inside tfSRGs

Pentagon Petersen Clebsch HoSi Gewirtz Mesner NL2(10)Pentagon 1 12 192 1260 8064 88704 443520Petersen 1 16 525 13440 1921920 35481600Clebsch 1 0 0 0 924000HoSi 1 0 0 704

Gewirtz 1 22 1030Mesner 1 100NL2(10) 1

Table 3 Number of primitive tfSRGs inside tfSRGs

121

Triangle-free strongly regular graphs Klin Ziv-Av

Pentagon Petersen Clebsch HoSi Gewirtz Mesner NL2(10)Pentagon 1 1 1 1 1 1 1Petersen 1 1 1 1 9 5Clebsch 1 0 0 0 1HoSi 1 0 0 1

Gewirtz 1 1 1Mesner 1 1NL2(10) 1

Table 4 Number of orbits of primitive tfSRGs inside tfSRGs

B Data about equitable partitions of primitive tfSRGs

Pentagon Petersen Clebsch HoSi Gewirtz Mesner NL2(10)EP 3 11 46 163Aut 3 11 38 89 154 236 607

Table 5 Number of orbits of equitable partitions and of automorphic equitable partitions forknown tfSRGs

Size 1 3 5 TotalEP 1 1 1 3Aut 1 1 1 3

Size 1 2 3 4 5 6 7 10 TotalEP 1 2 2 2 1 1 1 1 11Aut 1 2 2 2 1 1 1 1 11

Size 1 2 3 4 5 6 7 8 9 10 12 16 TotalEP 1 4 6 12 5 7 3 4 1 1 1 1 46Aut 1 4 5 10 3 5 2 4 1 1 1 1 38

Size 1 2 3 4 5 6 7 8 9 10 11EP 1 6 8 16 18 20 19 18 11 11 8Aut 1 4 5 7 6 9 9 11 4 9 4Size 12 13 14 15 16 18 20 28 30 50 TotalEP 7 7 2 2 1 2 3 1 1 1 163Aut 4 4 2 1 1 2 3 1 1 1 89

Table 6 Numbers of EPs and automorphic EPs by size of partition for four small graphs

122

Triangle-free strongly regular graphs Klin Ziv-Av

Size 1 2 3 4 5 6 7 8 9 10 11 12 13Aut 1 5 9 12 12 14 15 16 14 11 7 7 6Size 14 16 17 18 19 20 23 28 31 32 35 56 TotalAut 5 3 3 2 2 4 1 1 1 1 1 1 154

Size 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15Aut 1 3 5 8 11 10 20 14 19 12 18 12 16 9 14Size 16 17 18 19 20 21 23 25 29 33 41 45 49 77 TotalAut 5 12 5 9 1 8 4 8 6 2 1 1 1 1 236

Size 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15Aut 1 6 15 21 28 29 31 42 34 35 37 49 30 31 27Size 16 17 18 19 20 21 22 23 24 25 26 27 28 29Aut 26 18 18 13 26 14 11 7 9 6 6 5 2 1Size 30 31 32 33 34 35 39 40 45 50 53 60 65 100 TotalAut 7 1 3 2 2 3 1 4 1 1 1 1 1 1 607

Table 7 Numbers of automorphic EPs by size of partition for larger graphs

123

Usage of Invariants for Symbolic Verification of

Requirements

Short Paper

Alexander Letichevsky1 Alexander Godlevsky1 Anton Guba1 Alexander

Kolchin1 Oleksandr Letychevskyi1 Vladimir Peschanenko2

1 VM Glushkov Institute of Cybernetics Kiev Ukraineletcyfranet godlissorgua antongubaukrnet kolchin avyahoocom litissorgua

2 Kherson State University Kherson Ukrainevladimiriusgmailcom

The main goal of the paper is finding of pre- and post-invariants for transitions betweensymbolic states in the system that must be verified and use them for verification purposesSystems are specified by basic protocols [1] This specification defines a transition system withtransitions s rarr s

prime where s and sprime are symbolic states b is a basic protocol The main problem

of verification is a reachability problem for given properties expressed in specification logiclanguage

We present double approximation method of verification based on computing invariants Themethod is implemented as an iterative algorithm which solves in parallel reachability problemand computes lower and upper approximations of invariants for basic protocols

Currently there are a lot of significant works devoted to computing invariants which areconsidered for loops in programs Loops are marked explicitly - syntactic constructions likewhile and others When we deal with requirement specifications we do not deal with explicitmarked loops moreover basic protocols provide non-deterministic order Existing methodsusually ignore the conditions of the loops Invariants formulae which is obtained as a resultinclude unreachable states and therefore could be used in verification only in the following wayif a property does not intersect with the invariant formula then it is unreachable if intersectsthen conclusion cannot be done Therefore the problem of modification of existing methodsor to develop a new algorithm that could be applied in practice of requirements verification isactual

Research of problems of automatic program invariants generation for a variety of data al-gebras was performed starting from 70-th years in Institute of Cybernetics of NAS of UkraineTheir main results are presented in [2] Double approximation method is the dynamic iterativemethod of invariants generation and it is based on these results and adapted for requirementsverification The method also can be applied to program verification if a program is consideredas a special case of basic protocol specification The method has been implemented in VRS(Verification of Requirement Specifications) system [3] and IMS (Insertion Modeling System)system [4]

References

[1] A Letichevsky J Kapitonova V Volkov A Letichevsky Jr S Baranov V Kotlyarov T WeigertSystem Specification with Basic Protocols Cybernetics and System Analyses vol 4 2005 p 3-21

[2] Godlevsky AB Kapitonova YV Krivoy SL Letichevsky AA Iterative methods of programanalysis Cybernetics vol 2 1989 9-19

[3] Verification for Requirement Specification (VRS) httpissorguaISSVRStoolhtm lastviewed May 2013

[4] APS and IMS Systems httpapsystemorgua last viewed May 2013

124

Lebesgue Constants and Optimal Node Systems

via Symbolic Computations

Short Paper

Robert Vajda

University of Szeged Szeged Hungaryvajdarmathu-szegedhu

Abstract

Polynomial interpolation is a classical method to approximate continuous functionsby polynomials To measure the correctness of the approximation Lebesgue constantsare introduced For a given node system X(n+1) = x1 lt lt xn+1 (xj isin [a b])the Lebesgue function λn(x) is the sum of the modulus of the Lagrange basis polynomialsbuilt on X(n+1) The Lebesgue constant Λn assigned to the function λn(x) is its maximumover [a b] The Lebesgue constant bounds the interpolation error ie the interpolationpolynomial is at most (1 + Λn) times worse then the best approximation The minimumof the Λnrsquos for fixed n and interval [a b] is called the optimal Lebesgue constant Λlowast

n Forspecific interpolation node systems such as the equidistant system numerical results forthe Lebesgue constants Λn and their asymptotic behavior are known [3 7] However togive explicit symbolic expression for the minimal Lebesgue constant Λlowast

n is computationallydifficult In this work motivated by Rack [5 6] we are interested for expressing the minimalLebesgue constants symbolically on [minus1 1] and we are also looking for the characterizationof the those node systems which realize the minimal Lebesgue constants We exploited theequioscillation property of the Lebesgue function [4] and used quantifier elimination andGroebner Basis as tools [1 2] Most of the computation is done in Mathematica [8]

Acknowledgement The research of the author was partially supported by the HSRF(OTKA) grant number K83219

References

[1] D S Arnon - G E Collins - S McCallum Cylindrical Algebraic Decomposition I The BasicAlgorithm In Caviness-Johnson (eds) Quantifier Elimination and Cylindrical Algebraic Decom-position 136-151 Springer 1998

[2] B Buchberger Ein Algorithmus zum Auffinden der Basiselemente des Restklassenringes nach einemnulldimensionalen Polynomideal (An algorithm for finding the basis elements in the residue classring modulo a zero dimensional polynomial ideal) PhD Thesis Innsbruck 1965

[3] J S Hesthaven From electrostatics to almost optimal nodal sets for polynomial interpolation in asimplex SIAM J Numer Anal Vol 35 No 2 655-676 1998

[4] T A Kilgore A characterization of the Lagrange interpolating projection with minimal Tchebycheffnorm J Approx Theory 24 (1978) no 4 273-288

[5] H-J Rack An example of optimal nodes for interpolation International Journal of MathematicalEducation in Science and Technology 15 (3) 355-357 1984

[6] H-J Rack An example of optimal nodes for interpolation revisited Advances in Applied Mathe-matics and Approximation Theory Springer Proceedings in Mathematics amp Statistics Volume 41117-120 2013

[7] S J Simon Lebesgue constants in polynomial interpolation Annales Mathematicae et Informaticae33 109-123 2006

[8] Wolfram Research Inc Mathematica Version 90 Champaign Illinois 2012

125

Author Index

Alpuente Marıa 4

Ballis Demis 4

Buchberger Bruno 1

Comini Marco 19 31

Frechina Francisco 4

Ghourabi Fadoua 50

Godlevsky Alexander 124

Goto Mizuki 93

Guba Anton 124

Ida Tetsuo 50

Kakutani Yoshihiko 64

Kato Go 64

Kawano Yasuhito 64

Klin Mikhail 108

Kolchin Alexander 124

Kubota Takahiro 64

Letichevsky Alexander 124

Letychevskyi Oleksandr 124

Li Wei 2

Matringe Nadir 81

Moura Arnaldo 81

Neumann Severin 70

Ouaknine Joel 3

Peschanenko Vladimir 124

Rebiha Rachid 81

Sakurada Hideki 64

Sapina Julia 4

Takahashi Kazuko 50 93

Torella Luca 19 31

Vajda Robert 125

Yoshimaru Shizuo 93

Ziv-Av Matan 108

Keyword Index

algebraic number 125

automated verification 64

BB84 64

bottom-up semantics 31

computational model 93

computational origami 50

computer algebra 108

debugging 4

Distributed 70

elecronic cash protocol 93

equitable partitions 108

F4 70

formal methods 64

geometrical constraint solving 50

Groebner basis 125

Grobner Basis 70

induction scheme 93

invariants 124

knot fold 50

Lebesgue constant 125

Linear Algebra 81

maude 4

MPI 70

Parallel 70

polynomial interpolation 125

process calculi 64

program animation 4

property-oriented specifications 19

quantifier elimination 125

quantum cryptography 64

requirements specification 124

resultant 125

rewriting logic 4

semantics-based inference methods 19

slicing 4

Static Analysis 81

stepping 4

strongly regular graphs 108

symbolic verification 124

term rewriting 31

Term Rewriting Systems 19 31

Termination Analysis 81

theorem proving 50

theorem proving methods 93

  • Introduction
  • Preliminaries
  • Rewriting Modulo Equational Theories
  • Exploring the Computation Tree
    • Expanding a Program State
    • Computing a Fragment of the Computation Tree
      • Particularizing the Exploration
        • Interactive Stepper
        • Forward Trace Slicer
          • Implementation
          • Conclusions
          • Introduction
            • Notations
              • Many notions of equivalence
              • Deriving specifications from TRSs
                • An effective instance of the presented method
                  • Conclusions and future work
                  • Introduction
                  • Preliminaries
                  • Modeling the small-step rewriting behavior
                    • The semantic domain
                      • Linearizing Narrowing
                        • Operational denotations of TRSs
                          • Evaluation Function
                          • Properties of the TRS operational denotation
                            • Fixpoint denotations of TRSs
                              • Properties of the TRS fixpoint denotation
                                  • Conclusions
                                  • Technical Proofs
                                  • Introduction
                                  • Notations
                                  • Origami Geometrical Construction
                                    • Huzitas Fold Operations
                                    • Extensions
                                      • Knot Fold
                                        • Geometrical Properties
                                        • Geometrical Constraint Solving Approach
                                          • Regular Heptagon by the Knot Fold
                                            • Geometrical Constraints
                                            • Construction by Eos
                                            • Algebraic Interpretation
                                              • Proof
                                                • Theorem to Prove
                                                • Proof by Eos
                                                • Proof Results
                                                  • Conclusion
                                                    • Acknowledgments
                                                      • Introduction
                                                      • The Verifier
                                                      • Application to Shor and Preskills Security Proof
                                                      • Conclusions
                                                      • Introduction
                                                      • Notations
                                                      • Preliminaries
                                                      • Matrix Distribution
                                                      • Simplifying the F4 Algorithm
                                                      • Benchmarks
                                                      • Conclusion
                                                      • Introduction
                                                      • Linear Algebra and Linear Loop Programs
                                                      • Asymptotically Non-terminant Variable Values
                                                      • Automated generation of ANT loci
                                                        • The regular case
                                                        • The general case handling linear diagonalizable programs
                                                          • Discussions
                                                          • Conclusion
                                                          • Introduction
                                                          • Data Conversion Formalization
                                                            • Problem
                                                            • Solution
                                                              • Conversion from BS to BTREE
                                                              • Conversion from NAT to BS
                                                              • Conversion from NAT to BTREE
                                                                  • Modeling of an Electronic Cash Protocol
                                                                    • Ideal Electronic Cash
                                                                    • Definition of money
                                                                    • Creation of money from a natural number
                                                                    • Calculation of the amount of money
                                                                    • Payment
                                                                      • Proof of Properties
                                                                        • Well-definedness of cash
                                                                        • Well-definedness of pay
                                                                        • Divisibility
                                                                          • Discussion
                                                                          • Conclusion
                                                                          • Introduction
                                                                          • Strongly regular graphs a brief survey
                                                                          • Computer algebra tools in AGT
                                                                          • The seven known primitive triangle-free strongly regular graphs
                                                                          • Embeddings of tfSRGs into known primitive tfSRGs
                                                                          • Equitable partitions
                                                                          • Search for equitable partitions
                                                                          • Quadrangle and Atkinson EPs of NL2(10)
                                                                          • Some modifications of Robertson model
                                                                          • A few more models
                                                                          • Concluding comments
                                                                          • Data about embeddings of tfSRGs inside tfSRGs
                                                                          • Data about equitable partitions of primitive tfSRGs
Page 3: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,

Preface

Symbolic Computation is the science of computing with symbolic objects (terms formulaeprograms representations of algebraic objects etc) Powerful symbolic algorithms have beendeveloped during the past decades like theorem proving automated reasoning software veri-fication model checking rewriting formalization of mathematics network security Grobnerbases characteristic sets telescoping for recurrence relations etc

The purpose of the International Symposium on Symbolic Computation in Software Science- SCSS is to promote research on theoretical and practical aspects of symbolic computationin software sciences The symposium provides a forum for active dialog between researchersfrom several fields of computer algebra algebraic geometry algorithmic combinatorics compu-tational logic and software analysis and verification

This yearrsquos SCSS edition is the fifth in the SCSS workshop series and is organized at theResearch Institute for Symbolic Computation (RISC) of the Johannes Kepler University Linzduring July 5-6 2013 With the focus of promoting the exchange of ideas and experiences fromapplications of symbolic computation in software science SCSS 2013 has attracted researchersfrom across a number of fields including computer algebra algebraic geometry term rewritingprocess algebras and program verification

We are very excited to have three excellent keynote speakers Bruno Buchberger (RISC-Linz) Wei Li (Beihang University) and Joel Ouaknine (Oxford University) Our invited speak-ers have significant research expertise and insights into the challenges and opportunities for thegrowing SCSS community

We would like to thank the program committee members and reviewers for all their effortsThanks also go to the steering committee members for their valuable advice and guidanceWe would also like to thank Andrei Voronkov for his help on EasyChair Finally we alsoacknowledge partial funding from the strategical program Innovative Upper Austria 2010 Plusand the Doctoral Program ldquoComputational Mathematicsrdquo (W1214) - DK1 project

Laura Kovacs Programme ChairTemur Kutsia Symposium Chair

Symposium Organization

Symposium Chair

Temur Kutsia Research Institute for Symbolic Computa-

tion - RISC Austria

Program Chair

Laura Kovacs Chalmers University of Technology Sweden

Program Committee

Marıa Alpuente Technical University of Valencia Spain

Serge Autexier DFKI Germany

Nikolaj Bjorner Microsoft Research USA

Adel Bouhoula Ecole superieure des communications de Tu-

nis Tunisia

Iliano Cervesato Carnegie Mellon University - Qatar Cam-

pus Qatar

Horatiu Cirstea Loria France

Jurgen Giesl RWTH Aachen Germany

Tetsuo Ida Tsukuba University Japan

Paul Jackson School of Informatics University of Edin-

burgh UK

Tudor Jebelean Research Institute for Symbolic Computa-

tion - RISC Austria

Cezary Kaliszyk University of Innsbruck Austria

Fairouz Kamareddine Heriot-Watt University UK

Laura Kovacs Chalmers University of Technology Sweden

Temur Kutsia Research Institute for Symbolic Computa-

tion - RISC Austria

Stephan Merz INRIA-LORIA Nancy France

Ali Mili New Jersey Institute of Technology USA

Yasuhiko Minamide University of Tsukuba Japan

Pierre-Etienne Moreau INRIA-LORIA Nancy France

Andre Platzer Carnegie Mellon University USA

Stefan Ratschan Czech Academy of Sciences The Czech Re-

public

Rachid Rebiha University of Lugano Switzerland and IC

Unicamp Brazil

Enric Rodrıguez Car-

bonell

Technical University of Catalonia Spain

Sorin Stratulat Universite Paul Verlaine France

Thomas Sturm Max Planck Institute for Informatics Ger-

many

Additional Reviewers

Cabarcas Daniel

Eder Christian

Gay Simon

Ghorbal Khalil

Ghourabi Fadoua

Kredel Heinz

Martins Joao G

Vigneron Laurent

Table of Contents

Invited Papers

Mathematics of 21st Century A Personal View 1

Bruno Buchberger

A Semantic Framework for Program Debugging 2

Wei Li

Decision Problems for Linear Recurrence Sequences 3

Joel Ouaknine

Regular Papers

Parametric Exploration of Rewriting Logic Computations 4

Marıa Alpuente Demis Ballis Francisco Frechina and Julia

Sapina

Automatic Inference of Term Equivalence in Term Rewriting

Systems 19

Marco Comini and Luca Torella

A Condensed Goal-Independent Fixpoint Semantics Modeling

the Small-Step Behavior of Rewriting 31

Marco Comini and Luca Torella

Logical and Algebraic Views of a Knot Fold of a Regular

Heptagon 50

Fadoua Ghourabi Tetsuo Ida and Kazuko Takahashi

Automated Verification of Equivalence on Quantum

Cryptographic Protocols 64

Takahiro Kubota Yoshihiko Kakutani Go Kato Yasuhito

Kawano and Hideki Sakurada

A modified parallel F4 algorithm for shared and distributed

memory architectures 70

Severin Neumann

Generating Asymptotically Non-terminant Initial Variable

Values for Linear Diagonalizable Programs 81

Rachid Rebiha Nadir Matringe and Arnaldo Moura

Data Conversion Method between a Natural Number and a

Binay Tree for an Inductive Proof and Its Application 93

Kazuko Takahashi Shizuo Yoshimaru and Mizuki Goto

Computer algebra investigation of known primitive

triangle-free strongly regular graphs 108

Matan Ziv-Av and Mikhail Klin

Short Papers

Usage of Invariants for Symbolic Verification of Requirements 124

Alexander Letichevsky Alexander Godlevsky Anton Guba

Alexander Kolchin Oleksandr Letychevskyi and Vladimir

Peschanenko

Lebesgue Constants and Optimal Node Systems via Symbolic

Computations 125

Robert Vajda

Mathematics of 21st Century

A Personal View

Bruno Buchberger

Research Institute for Symbolic Computation - RISC

Johannes Kepler University Linz Austria

BrunoBuchbergerriscuni-linzacat

Extended Abstract

Mathematics of 19th century and before was rich in content intuition strong ideas motivationfrom natural sciences and had a coherent view of all fields of mathematics (geometry algebraanalysis number theory )

Mathematics of 20th century added three important aspects mathematical logic as themathematical meta-theory of mathematics formalism and abstractness and reduction to firstprinciples (ldquoBourbakismrdquo) and the notion of computing (both as an exact mathematicalnotion and as the foundation of the revolutionary device rdquoprogrammable computerrdquo) In factthe three aspects have a lot to do with each other and are fundamentally interrelated Howeverin practice the three aspects were (and still are) pursued by three different communities Thedeep insights of logicians on the nature of mathematics are hardly used in ever-day practiceof ldquoworking mathematiciansrdquo ldquopure mathematiciansrdquo are often proud that they do not touchthe computer except for writing e-mails typing in LaTeX and using web search and computerscientists often think that what they are doing does not need mathematics or even is oppositeto mathematics

In my view as indicated by trends in late 20th century in 21st century mathematics willevolve as - or return to be - a unified body of mathematical logic abstract structural math-ematics and computer mathematics with no boundaries between the three aspects ldquoWorkingmathematiciansrdquo will have to master the three aspects equally well and integrate them in theirdaily work More specifically working in mathematics will proceed on the ldquoobject levelrdquo ofdeveloping new mathematical content (abstract knowledge and computational methods) andat the same time on the ldquometa-levelrdquo of developing automated reasoning methods for support-ing research on the object level This ldquomassage of the mathematical brainrdquo by jumping backand forth between the object and the meta-level will guide mathematics onto a new level ofsophistication

Symbolic computation is just a way of expressing this general view of mathematics of the21st century and it also should be clear that software science is just another way of expressingthe algorithmic aspect of this view

In the talk we will exemplify the spirit of this new type of mathematics by a report onthe Theorema system being developed in the speakerrsquos research group Theorema is both alogic and a software frame for doing mathematics in the way sketched above On the objectlevel Theorema allows to prove and program within the same logical frame and on the meta-level it allows to formulate reasoning techniques that help proving and programming on theobject level In particular we will show how this type of doing mathematics allows to mimicthe invention process behind the speakerrsquos theory of Grobner bases which provides a generalmethod for dealing with multivariate nonlinear polynomial systems

1

A Semantic Framework for Program Debugging

Wei Li

State Key Laboratory of Software Development Environment

School of Computer Science and Engineering

Beihang University China

liweinlsdebuaaeducn

Abstract

This work aims to build a semantic framework for automated debugging A debugging pro-

cess consists of tracing locating and fixing processes consecutively The first two processes

are accomplished by a tracing procedure and a locating procedure respectively The tracing

procedure reproduces the execution of a failed test case with well-designed data structures and

saves necessary information for locating bugs The locating procedure will use the informa-

tion obtained from the tracing procedure to locate ill-designed statements and to generate a

fix-equation the solution of which is a function that will be used to fix the bugs A structural

operational semantics is given to define the functions of the tracing and locating procedure

Both procedures are proved to terminate and produces one fix-equation The main task of

fixing process is to solve the fix-equation It turns out that for a given failed test case there

exist three different types of solutions 1 the bug is solvable there exists a solution of the

fix-equation and the program can be repaired 2 There exists a non-linear error in the pro-

gram the fix-equation generated at each round of the locating procedure is solvable but a new

bug will arise when the old bug is being fixed 3 There exists a logical design error and the

fix-equation is not solvable

2

Decision Problems for Linear Recurrence

Sequences

Joel Ouaknine

Department of Computer Science

Oxford University United Kingdom

JoelOuakninecsoxacuk

Abstract

Linear recurrence sequences (LRS) such as the Fibonacci numbers permeate vast areas ofmathematics and computer science In this talk we consider three natural decision problemsfor LRS namely the Skolem Problem (does a given LRS have a zero) the Positivity Problem

(are all terms of a given LRS positive) and the Ultimate Positivity Problem (are all but finitelymany terms of a given LRS positive) Such problems (and assorted variants) have applicationsin a wide array of scientific areas such as theoretical biology (analysis of L-systems pop-ulation dynamics) economics (stability of supply-and-demand equilibria in cyclical marketsmultiplier-accelerator models) software verification (termination of linear programs) proba-bilistic model checking (reachability and approximation in Markov chains stochastic logics)quantum computing (threshold problems for quantum automata) discrete linear dynamicalsystems (reachability and invariance problems) as well as combinatorics statistical physicsterm rewriting formal languages cellular automata generating functions etc

We shall see that these problems have deep and fascinating connections to rich mathematicalconcepts and conjectures particularly in the fields of analytic and algebraic number theorydiophantine geometry and approximation real algebraic geometry mathematical logic andcomplexity theory

3

Parametric Exploration of

Rewriting Logic Computations lowast

M Alpuente1 D Ballis2 F Frechina1 and J Sapina1

1 DSIC-ELP Universitat Politecnica de ValenciaCamino de Vera sn Apdo 22012 46071 Valencia Spain

alpuenteffrechinajsapinadsicupves2 DIMI Universita degli Studi di Udine

Via delle Scienze 206 33100 Udine Italy demisballisuniudit

Abstract

This paper presents a parameterized technique for the inspection of Rewriting Logiccomputations that allows the non-deterministic execution of a given rewrite theory to befollowed up in different ways Starting from a selected state in the computation tree theexploration is driven by a user-defined inspection criterion that specifies the explorationmode By selecting different inspection criteria one can automatically derive useful debug-ging facilities such as program steppers and more sophisticated dynamic trace slicers thatfacilitate the detection of control and data dependencies across the computation tree Ourmethodology which is implemented in the Anima graphical tool allows users to capture theimpact of a given criterion validate input data and detect improper program behaviors

1 Introduction

Program animation or stepping refers to the very common debugging technique of executingcode one step at a time allowing the user to inspect the program state and related databefore and after the execution step This allows the user to evaluate the effects of a givenstatement or instruction in isolation and thereby gain insight into the program behavior (ormisbehavior) Nearly all modern IDEs debuggers and testing tools currently support this modeof execution optionally where animation is achieved either by forcing execution breakpointscode instrumentation or instruction simulation

Rewriting Logic (RWL) is a very general logical and semantic framework which is particu-larly suitable for formalizing highly concurrent complex systems (eg biological systems [7] andWeb systems [2 6]) RWL is efficiently implemented in the high-performance system Maude [9]Roughly speaking a rewriting logic theory seamlessly combines a term rewriting system (TRS)together with an equational theory that may include equations and axioms (ie algebraic lawssuch as commutativity associativity and unity) so that rewrite steps are performed modulo theequations and axioms

In recent years debugging and optimization techniques based on RWL have received growingattention [1 13 16 17] but to the best of our knowledge no practical animation tool forRWLMaude has been formally developed To debug Maude programs Maude has a basictracing facility that allows the user to advance through the program execution letting himherselect the statements to be traced except for the application of algebraic axioms that are not

lowastThis work has been partially supported by the EU (FEDER) and the Spanish MEC project ref TIN2010-21062-C02-02 and by Generalitat Valenciana ref PROMETEO2011052 This work was carried out during thetenure of D Ballisrsquo ERCIM lsquoAlain Bensoussanrdquo Postdoctoral Fellowship The research leading to these resultshas received funding from the European Union Seventh Framework Programme (FP72007-2013) under grantagreement n 246016 F Frechina was supported by FPU-ME grant AP2010-5681

4

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

under user control and are never recorded as execution steps in the trace All rewrite steps thatare obtained by applying the equations or rules for the selected function symbols are shown inthe output trace so that the only way to simplify the displayed view of the trace is by manuallyfixing the traceable equations or rules Thus the trace is typically huge and incomplete andwhen the user detects an erroneous intermediate result it is difficult to determine where theincorrect inference started Moreover this trace is either directly displayed or written to afile (in both cases in plain text format) thus only being amenable for manual inspection bythe user This is in contrast with the enriched traces described below which are complete (allexecution steps are recorded by default) and can be sliced automatically so that they can bedramatically simplified in order to facilitate a specific analysis Also the trace can be directlydisplayed or delivered in its meta-level representation which is very useful for further automatedmanipulation

Contributions This paper presents the first parametric (forward) exploration technique forRWL computations Our technique is based on a generic animation algorithm that can be tunedto work with different modalities including incremental stepping and automated forward slicingThe algorithm is fully general and can be applied for debugging as well as for optimizing anyRWL-based tool that manipulates RWL computations Our formulation takes into account theprecise way in which Maude mechanizes the rewriting process and revisits all those rewrite stepsin an instrumented fine-grained way where each small step corresponds to the application ofan equation equational axiom or rule This allows us to explain the input execution trace withregard to the set of symbols of interest (input symbols) by tracing them along the executiontrace so that in the case of the forward slicing modality all data that are not descendants ofthe observed symbols are simply discarded

Related Work Program animators have existed since the early years of programmingAlthough several steppers have been implemented in the functional programming community(see [10] for references) none of these systems applies to the animation and forward slicing ofMaude computations An algebraic stepper for Scheme is defined and formally proved in [10]which is included in the DrScheme programming environment The stepper reduces Schemeprograms to values (according to the reduction semantics of Scheme) and is useful for explainingthe semantics of linguistic facilities and for studying the behavior of small programs It explainsa programrsquos execution as a sequence of reduction steps based on the ordinary laws of algebra forthe functional core of the language and more general algebraic laws for the rest of the languageIn order to discover all of the steps that occur during the program evaluation the stepperrewrites (or rdquoinstrumentsrdquo) the code The inserted code uses a mechanism called ldquocontinuationmarksrdquo to store information about the programrsquos execution as it is running and makes calls tothe stepper before after and during the evaluation of each program expression Continuationmarks allow the stepper to reuse the underlying Scheme implementation without having to re-implement the evaluator The stepperrsquos implementation technique also applies to both ML andHaskell since it supports states continuations multiple threads of control and lazy evaluation[10]

In [4 5] an incremental backward trace slicer was presented that generates a trace slice ofan execution trace T by tracing back a set of symbols of interest along (an instrumented versionof) T while data that are not required to produce the target symbols are simply discarded Thiscan be very helpful in debugging since any information that is not strictly needed to delivera critical part of the result is discarded which helps answer the question of what programcomponents might affect a lsquoselected computationrdquo However for the dual problem of ldquowhatprogram components might be affected by a selected computationrdquo a kind of forward expansionis needed which has been overlooked to date

5

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

Plan of the paper Section 2 recalls some fundamental notions of RWL and Section 3summarizes the rewriting modulo equational theories defined in Maude Section 4 formulatesthe exploration as a parameterized procedure that is completely controlled by the user whileSection 5 formalizes three different inspection techniques that are obtained as an instance ofthe generic scheme Finally Section 6 reports on a prototypical implementation of the proposedtechniques and Section 7 concludes

2 Preliminaries

Let us recall some important notions that are relevant to this work We assume some basicknowledge of term rewriting [18] and Rewriting Logic [14] Some familiarity with the Maudelanguage [9] is also required

We consider an order-sorted signature Σ with a finite poset of sorts (Slt) that models theusual subsort relation [9] We assume an S-sorted family V = VssisinS of disjoint variable setsτ(ΣV)s and τ(Σ)s are the sets of terms and ground terms of sort s respectively We writeτ(ΣV) and τ(Σ) for the corresponding term algebras The set of variables that occur in a termt is denoted by Var(t) In order to simplify the presentation we often disregard sorts when noconfusion can arise

A position w in a term t is represented by a sequence of natural numbers that addressesa subterm of t (Λ denotes the empty sequence ie the root position) By notation w1w2we denote the concatenation of positions (sequences) w1 and w2 Positions are ordered by theprefix ordering that is given the positions w1 and w2 w1 le w2 if there exists a position u suchthat w1u = w2

Given a term t we let Pos(t) denote the set of positions of t By t|w we denote the subtermof t at position w and t[s]w specifies the result of replacing the subterm t|w by the term s

A substitution σ equiv x1t1 x2t2 is a mapping from the set of variables V to the set ofterms τ(ΣV) which is equal to the identity almost everywhere except over a set of variablesx1 xn The domain of σ is the set Dom(σ) = x isin V | xσ 6= x By id we denote theidentity substitution The application of a substitution σ to a term t denoted tσ is defined byinduction on the structure of terms

tσ =

xσ if t = x x isin V

f(t1σ tnσ) if t = f(t1 tn) n ge 0

For any substitution σ and set of variables V σ |V denotes the substitution obtained from σby restricting its domain to V (ie σ |V (x) = xσ if x isin V otherwise σ |V (x) = x) Given twoterms s and t a substitution σ is a matcher of t in s if sσ = t The term t is an instance ofthe term s iff there exists a matcher σ of t in s By matchs(t) we denote the function thatreturns a matcher of t in s if such a matcher exists

A (labelled) equation is an expression of the form [l] λ = ρ where λ ρ isin τ(ΣV) V ar(ρ) subeV ar(λ) and l is a label ie a name that identifies the equation A (labelled) rewrite rule isan expression of the form [l] λ rarr ρ where λ ρ isin τ(ΣV) V ar(ρ) sube V ar(λ) and l is a labelWhen no confusion can arise rule and equation labels are often omitted The term λ (resp ρ)is called left-hand side (resp right-hand side) of the rule λrarr ρ (resp equation λ = ρ)

6

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

3 Rewriting Modulo Equational Theories

An order-sorted equational theory is a pair E = (Σ∆cupB) where Σ is an order-sorted signature∆ is a collection of (oriented) equations and B is a collection of equational axioms (ie algebraiclaws such as associativity commutativity and unity) that can be associated with any binaryoperator of Σ The equational theory E induces a congruence relation on the term algebraτ(ΣV) which is denoted by =E A rewrite theory is a triple R = (Σ∆ cup BR) where(Σ∆ cupB) is an order-sorted equational theory and R is a set of rewrite rules

Example 31The following rewrite theory encoded in Maude specifies a close variant of the fault-tolerantclient-server communication protocol of [15]

mod CLIENT-SERVER-TRANSF is inc INT + QID sorts Content State Msg Cli Serv Addressee

Sender Data CliName ServName Question Answer subsort Msg Cli Serv lt State subsort Addressee Sender CliName ServName lt Qid subsort Question Answer Data lt Nat

ops Srv Srv-A Srv-B Cli Cli-A Cli-B -gt Qid op null -gt State op _amp_ State State -gt State [assoc comm id null] op _lt-_ Addressee Content -gt Msg op __ Sender Data -gt Content op [____] CliName ServName Question Answer -gt Cli op na -gt Answer op [_] ServName -gt Serv [ctor] op f ServName CliName Data -gt Data

vars C S Addr Qid vars Q D A Nat var CNT [Content]

eq [succ] f(S C Q) = s(Q)

rl [req] [C S Q na] =gt[C S Q na] amp S lt- C Q

rl [reply] S lt- C Q amp [S] =gt[S] amp C lt- S f(S C Q)

rl [rec] C lt- S D amp [C S Q A] =gt[C S Q A]

rl [dupl] (Addr lt- CNT) =gt(Addr lt- CNT) amp (Addr lt- CNT)

rl [loss] (Addr lt- CNT) =gt null endm

The specification models an environment where several clients and servers coexist Eachserver can serve many clients while for the sake of simplicity we assume that each clientcommunicates with a single server

The names of clients and servers belong to the sort Qid Clients are represented as 4-tuplesof the form [C S Q D] where C is the clientrsquos name S is the name of the server it wants tocommunicate with Q is a natural number that identifies a client request and D is either a naturalnumber that represents the server response or the constant value na (not available) when theresponse has not been yet received Servers are stateless and are represented as structures [S]with S being the serverrsquos name All messages are represented as pairs of the form Addr lt- CNTwhere Addr is the addresseersquos name and CNT stands for the message contents Such contentsare pairs AddrN with Addr being the senderrsquos name and N being a number that representseither a request or a response

The server S uses a function f (only known to the server itself) that given a question Q

from client C the call f(S C Q) computes the answer s(Q) where s(Q) is the successor of Q Thisfunction is specified by means of the equation succ

Program states are formalized as a soup (multiset) of clients servers and messages whereasthe system behavior is formalized through five rewrite rules that model a faulty communicationenvironment in which messages can arrive out of order can be duplicated and can be lostSpecifically the rule req allows a client C to send a message with request Q to the server SThe rule reply lets the server S consume the client request Q and send a response messagethat is computed by means of the function f The rule rec specifies the client reception of aserver response D that should be stored in the client data structure Indeed the right-handside [C S Q A] of the rule includes an intentional barely perceptible bug that does not let theclient structure be correctly updated with the incoming response D The correct right-hand sideshould be [C S Q D] Finally the rules dupl and loss model the faulty environment and have

7

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

the obvious meaning messages can either be duplicated or lost

Given a rewrite theory (Σ ER) with E = ∆ cup B the rewriting modulo E relation (insymbols rarrRE) can be defined by lifting the usual rewrite relation on terms [12] to the E-congruence classes [t]E on the term algebra τ(ΣV) that are induced by =E [8] that is [t]Eis the class of all terms that are equal to t modulo E Unfortunately rarrRE is in generalundecidable since a rewrite step t rarrRE tprime involves searching through the possibly infiniteequivalence classes [t]E and [tprime]E

The exploration technique formalized in this work is formulated by considering the preciseway in which Maude proves the rewrite steps (see Section 52 in [9]) Actually the Maudeinterpreter implements rewriting modulo E by means of two much simpler relations namelyrarr∆B and rarrRB These allow rewrite rules and equations to be intermixed in the rewritingprocess by simply using an algorithm of matching modulo B We define rarrRcup∆B as rarrRB

cup rarr∆B Roughly speaking the relation rarr∆B uses the equations of ∆ (oriented from leftto right) as simplification rules thus for any term t by repeatedly applying the equations assimplification rules we eventually reach a normalized term tdarr∆ to which no further equationscan be applied The term t darr∆ is called a canonical form of t wrt ∆ On the other handthe relation rarrRB implements rewriting with the rules of R which might be non-terminatingand non-confluent whereas ∆ is required to be terminating and Church-Rosser modulo B inorder to guarantee the existence and unicity (modulo B) of a canonical form wrt ∆ for anyterm [9]

Formally rarrRB and rarr∆B are defined as follows given a rewrite rule r = (λ rarr ρ) isin R(resp an equation e = (λ = ρ) isin ∆) a substitution σ a term t and a position w of t

trσwrarrRB tprime (resp t

eσwrarr∆B tprime) iff λσ =B t|w and tprime = t[ρσ]w When no confusion can arise we

simply write trarrRB tprime (resp trarr∆Btprime) instead of t

rσwrarrRB tprime (resp t

eσwrarr∆B tprime)

Under appropriate conditions on the rewrite theory a rewrite step modulo E on a term t canbe implemented without loss of completeness by applying the following rewrite strategy [11](i) reduce t wrt rarr∆B until the canonical form t darr∆ is reached (ii) rewrite t darr∆ wrt rarrRB

A computation C in the rewrite theory (Σ∆ cupBR) is a rewrite sequence

s0 rarrlowast∆B s0darr∆ rarrRB s1 rarrlowast

∆B s1darr∆

that interleaves rarr∆B rewrite steps and rarrRB rewrite steps following the strategy mentionedabove Terms that appear in computations are also called (program) states

A computation tree TR(s) for a term s and a rewrite theory R is a tree-like representationof all the possible computations in R that originate from the initial state s More preciselyTR(s) is a labelled tree whose root node label identifies the initial state s and whose edges arelabelled with rewrite steps of the form t rarrRcup∆B tprime so that any node in TR(s) represents aprogram state of a computation stemming from s

Example 32

Consider the rewrite theory of Example 31 together with the initial state [Srv-A] amp [Cli-A

Srv-A7na] amp [Cli-BSrv-A17na] In this case the computation tree consists of severalinfinite computations that start from the considered initial state and model interactions betweenclients Cli-A and Cli-B and server Srv-A The computed tree is depicted in the following picturewhere for the sake of simplicity we only display the equations and rules that have been appliedat each rewrite step while other information such as the computed substitution and the rewrite

8

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

position are omitted in the depicted tree

Query Go

Go

Go

Go

Go

Go

GoGoBack

Back

Back

Back

Back

Back

BackBack Anima

[Srv-A] amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]s0

req[Srv-A] amp (Srv-A lt- Cli-A7) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s1 req[Srv-A] amp (Srv-A lt- Cli-B17) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s2

reply[Srv-A] amp (Cli-A lt- Srv-Af(Serv-ACli-A7)) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s3 reqdupl[Srv-A] amp (Srv-A lt- Cli-A7) amp (Srv-A lt- Cli-A7) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s4 req[Srv-A] amp (Srv-A lt- Cli-A7) amp (Srv-A lt- Cli-B17) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s5 loss[Srv-A] amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s6

succ[Srv-A] amp (Cli-A lt- Srv-A8) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s7

Options

Given a computation C it is always possible to expand C in an instrumented computationCinst in which each application of the matching modulo B algorithm is mimicked by the explicitapplication of a suitable equational axiom which is also oriented as a rewrite rule [3]

Also typically hidden inside the B-matching algorithms some flatunflat transformationsallow terms that contain operators that obey associative-commutative axioms to be rewrittenThese transformations allow terms to be reordered and correctly parenthesized in order toenable subsequent rewrite steps Basically this is achieved by producing a single auxiliaryrepresentative of their AC congruence class [3] For example consider a binary AC operatorf together with the standard lexicographic ordering over symbols Given the B-equivalencef(b f(f(b a) c)) =B f(f(b c) f(a b)) we can represent it by using the ldquointernal sequencerdquo

of transformations f(b f(f(b a) c))flatminusrarr lowast

Bf(a b b c)unflatminusrarr lowast

Bf(f(b c) f(a b)) where the firstsubsequence corresponds to a flattening transformation sequence that obtains the AC canonicalform while the second one corresponds to the inverse unflattening transformation This wayany given instrumented computation consists of a sequence of (standard) rewrites using theequations (rarr∆) rewrite rules (rarrR) equational axioms and flatunflat transformations (rarrB)By abuse of notation since equations and axioms are both interpreted as rewrite rules in ourformulation we often abuse the notation λrarr ρ to denote rules as well as (oriented) equationsand axioms Given an instrumented computation Cinst by |Cinst| we denote its length mdashthat isthe number of rewrite steps that occur in Cinst We use the functions head(Cinst) and tail(Cinst)to respectively select the first rewrite step in Cinst and the instrumented computation yieldedby removing the first rewrite step from Cinst In the sequel we also assume the existence of afunction instrument(C) which takes a computation C and delivers its instrumented counterpart

Example 33Consider the rewrite theory of Example 31 together with the following computation

C = [Cli Srv 7 na] amp [Srv] amp Cli lt- Srv f(Srv Cli 7) rarr∆B

[Cli Srv 7 na]amp [Srv] amp Cli lt- Srv 8 rarrRB

[Cli Srv 7 7] amp [Srv]

The corresponding instrumented computation Cinst which is produced by instrument(C) isgiven by 1) suitably parenthesizing states by means of flatteningunflattening transformations

9

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

when needed and 2) making commutative ldquostepsrdquo explicit by using the (oriented) equationalaxiom (X amp Y rarr Y amp X) in B that models the commutativity property of the (juxtaposition)operator amp Note these transformations are needed to enable the application of the rule rec

(of R) to the seventh state

Cinst = [Cli Srv 7 na] amp [Srv] amp Cli lt- Srv f(Srv Cli 7)succminusrarr∆

[Cli Srv 7 na] amp [Srv] amp Cli lt- Srv 8unflatminusrarrB

[Cli Srv 7 na] amp ([Srv] amp Cli lt- Srv 8)commminusrarrB

[Cli Srv 7 na] amp (Cli lt- Srv 8 amp [Srv])flatminusrarrB

[Cli Srv 7 na] amp Cli lt- Srv 8 amp [Srv]unflatminusrarrB

([Cli Srv 7 na] amp Cli lt- Srv 8) amp [Srv]commminusrarrB

(Cli lt- Srv 8 amp [Cli Srv 7 na]) amp [Srv]recminusrarrR

[Cli Srv 7 7] amp [Srv]

4 Exploring the Computation Tree

Computation trees are typically large and complex objects to deal with because of the highly-concurrent nondeterministic nature of rewrite theories Also their complete generation andinspection are generally not feasible since some of their branches may be infinite as they encodenonterminating computations

However one may still be interested in analysing a fragment of a given computation tree fordebugging or program comprehension purposes This section presents an exploration techniquethat allows the user to incrementally generate and inspect a portion T bull

R(sbull) of a computationtree TR(s) by expanding (fragments of) its program states into their descendants starting fromthe root node The exploration is an interactive procedure that is completely controlled by theuser who is free to choose the program state fragments to be expanded

41 Expanding a Program State

A state fragment of a state s is a term sbull that hides part of the information in s that is theirrelevant data in s are simply replaced by special bull-variables of appropriate sort denoted bybulli with i = 0 1 2 Given a state fragment sbull a meaningful position p of sbull is a positionp isin Pos(sbull) such that sbull|p 6= bulli for all i = 0 1 By MPos(sbull) we denote the set thatcontains all the meaningful positions of sbull Symbols that occur at meaningful positions of astate fragment are called meaningful symbols By Varbull(exp) we define the set of all bull-variablesthat occur in the expression exp

Basically a state fragment records just the information the user wants to observe of a givenprogram state

The next auxiliary definition formalizes the function fragment(t P ) that allows a statefragment of t to be constructed wrt a set of positions P of t The function fragment relies onthe function freshbull whose invocation returns a (fresh) variable bulli of appropriate sort which isdistinct from any previously generated variable bullj

Definition 41 Let t isin τ(ΣV) be a state and let P be a set of positions st P sube Pos(t)Then the function fragment(t P ) is defined as follows

fragment(t P ) = recfrag(t PΛ) where

10

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

function inspect(sbull Cinstr I)1 if |Cinstr | = 1 then2 return I(sbull Cinstr )3 elseif |Cinstr | gt 14 if I(sbull head(Cinstr ))= nil then5 return inspect(I(sbull head(Cinstr ))

tail(Cinstr ) I)6 else7 return nil8 end9 endendf

function expand(sbull sR I)1 Ebull

R = empty

2 for each srσwrarrRcup∆B t

with w isin MPos(sbull)

3 Cinst = instrument(srσwrarrRcup∆B t)

4 tbull = inspect(sbull Cinst I)

5 if tbull 6= nil then EbullR = Ebull

R cup sbullrrarr tbull

6 end7 return Ebull

R

endf

Figure 1 The inspect function Figure 2 The expand function

recfrag(t P p) =

f(recfrag(t1 P p1) recfrag(tn P pn))

if t=f(t1 tn) and p isin P

t if t isin V and p isin P

freshbull otherwise

and P = u | u le p and p isin P is the prefix closure of P

Roughly speaking fragment(t P ) yields a state fragment of t wrt a set of positions P thatincludes all symbols of t that occur within the paths from the root to any position in P whileeach maximal subterm t|p with p 6isin P is replaced by means of a freshly generated bull-variable

Example 42Let t = d(f(g(a h(b)) c) a) be a state and let P = 11 12 be a set of positions of t Byapplying Definition 41 we get the state fragment tbull = fragment(t P ) = d(f(g(bull1 bull2) c) bull3)and the set of meaningful positions MPos(tbull) = Λ 1 11 12

An inspection criterion is a function I(sbull srσwrarrK t) that given a rewrite step s

rσwrarrK t with

K isin ∆ RB and a state fragment sbull of s computes a state fragment tbull of the state t Roughlyspeaking an inspection criterion controls the information content conveyed by term fragmentsresulting from the execution of standard rewrite steps Hence distinct implementations of the

inspection criteria I(sbull srσwrarrK t) may produce distinct fragments sbull

rrarr tbull of the considered

rewrite step We assume that the special value nil is returned by the inspection criterionwhenever no fragment tbull can be delivered Several examples of inspection criteria are shown inSection 5

The function inspect of Figure 1 allows an inspection criterion I to be sequentially appliedalong an instrumented computation Cinstr in order to generate the fragment of the last stateof the computation Specifically given an instrumented computation s0 rarrK s1 rarrK rarr snn gt 0 the computation is traversed and the inspection criterion I is recursively applied oneach rewrite step si rarrK si+1 wrt the input fragment sbulli to generate the next fragment sbulli+1

The expansion of a single program state is specified by the function expand(sbull sR I) ofFigure 2 which takes as input a state s and its fragment sbull to be expanded wrt a rewritetheory R and an inspection criterion I Basically expand unfolds the state fragment sbull wrt

all the possible rewrite steps srσwrarrRcup∆B t that occur at the meaningful positions of sbull and

stores the corresponding fragments of sbullrrarr tbull in the set Ebull Note that to compute the state

11

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

fragment tbull for a rewrite step srσwrarrRcup∆B t and a state fragment sbull expand first generates the

instrumented computation Cinst of the considered step and then applies the inspection criterionI over C by using the inspect function

42 Computing a Fragment of the Computation Tree

The construction of a fragment T bullR(sbull0) of a computation tree TR(s0) is specified by the function

explore given in Figure 3 Essentially explore formalizes an interactive procedure that startsfrom a tree fragment (built using the auxiliary function createTree) which only consists of theroot node sbull0 and repeatedly uses the function expand to compute rewrite step fragments thatcorrespond to the visited tree edges wrt a given inspection criterion The tree T bull

R(sbull0) is builtby choosing at each loop iteration of the algorithm the tree node that represents the statefragment to be expanded by means of the auxiliary function pickLeaf (T bull

R(sbull0)) which allowsthe user to freely select a node sbull from the frontier of the current tree T bull

R(sbull0) Then T bullR(sbull0)

is augmented by calling addChildren(T bullR(sbull0) s

bull expand(sbull sR I)) This function call adds allthe edges sbull rarr tbull which are obtained by expanding sbull to the tree T bull

R(sbull0)The special value EoE (End of Exploration) is used to terminate the inspection process

when the function pickLeaf (T bullR(sbull0)) is equal to EoE no state to be expanded is selected and

the exploration terminates delivering the computed fragment T bullR(sbull0)

function explore(sbull0 s0R I)1 T bull

R(sbull0) = createTree(sbull0)2 while(sbull = pickLeaf (T bull

R(sbull0)) 6= EoE) do3 T bull

R(sbull0) = addChildren(T bullR(sbull0) s

bull expand(sbull sR I))4 od5 return T bull

R(sbull0)endf

Figure 3 The explore function

5 Particularizing the Exploration

The methodology given in Section 4 provides a generic scheme for the exploration of com-putation trees wrt a given inspection criterion I that must be provided by the user Inthis section we show three implementations of the criterion I that produce three distinct ex-ploration strategies In the first case the considered criterion allows an interactive programstepper to be derived in which rewriting logic computations of interest can be animated Inthe second case we implement a partial stepper that allows computations with partial inputsto be animated Finally in the last example the chosen inspection criterion implements anautomated forward slicing technique that allows relevant control and data information to beextracted from computation trees

51 Interactive Stepper

Given a computation tree TR(s0) for an initial state s0 and a rewrite theory R the stepwiseinspection of the computation tree can be directly implemented by instantiating the explorationscheme of Section 4 with the inspection criterion

Istep(sbull s

rσwrarr K t) = t

12

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

that always returns the reduced state t of the rewrite step srσwrarr K t with K isin ∆ RB

This way by starting the exploration from a state fragment that corresponds to the wholeinitial state s0 (ie sbull0 = s0) the call explore(s0R Istep) generates a fragment T bull

R(sbull0) of thecomputation tree TR(s0) whose topology depends on the program states that the user decidesto expand during the exploration process

Example 51Consider the rewrite theoryR in Example 31 and the computation tree in Example 32 Assumethe user starts the exploration by calling explore(s0R Istep) which allows the first level of thecomputation tree to be unfolded by expanding the initial state s0 wrt the inspection criterion

Istep This generates the tree TbullR(s0) containing the edges s0

reqrarr s1 s0

reqrarr s2 Now if the user

carries on with the exploration of program state s1 and then quits s1 will be expanded and thetree T bull

R(s0) will be augmented accordingly Specifically the resulting T bullR(s0) will include the

following edges s0reqrarr s1 s0

reqrarr s2 s1

succrarr s3 s1

reqrarr s4 s1

duplrarr s4 s1

reqrarr s5 s1

lossrarr s6

It is worth noting that all the program state fragments produced by the program stepperdefined above are ldquoconcreterdquo (ie state fragments that do not include bull-variables) Howeversometimes it may be useful to work with partial information and hence with state fragmentsthat abstract ldquoconcreterdquo program states by using bull-variables This approach may help to focususerrsquos attention on the parts of the program states that the user wants to observe disregardingunwanted information and useless rewrite steps

Example 52Consider the following two rewrite rules [r1] f(x b) rarr g(x) and [r2] f(a y) rarr h(y) togetherwith the initial state f(a b) Then the computation tree in this case is finite and only contains

the tree edges f(a b)r1xaΛ

rarr g(a) and f(a b)r2ybΛ

rarr h(b) Now consider the state fragmentf(bull1 b) where only the second input argument is relevant If we decided to expand the initialstate fragment f(bull1 b) we would get the tree fragment represented by the single rewrite step

f(bull1 b)r1rarr g(bull1) since the partial input encoded into f(bull1 b) cannot be rewritten via r2

In light of Example 52 and our previous considerations we define the following inspectioncriterion

Ipstep(sbull s

rσwrarr K t) = if sbull

rσbullwrarr K tbull then return tbull else return nil

Roughly speaking given a rewrite step micro srσwrarr K t with K isin ∆ RB the criterion

Ipstep returns a state fragment tbull of the reduced state t whenever sbull can be rewritten to tbull

using the very same rule r and position w that occur in microThe particularization of the exploration scheme with the criterion Ipstep allows an interac-

tive partial stepper to be derived in which the user can work with state information of interestthereby producing more compact and focused representations of the visited fragments of thecomputation trees

52 Forward Trace Slicer

Forward trace slicing is a program analysis technique that allows computations to be simplifiedwrt a selected fragment of their initial state More precisely given a computation C withinitial state s0 and a state fragment sbull0 of s0 forward slicing yields a simplified view Cbull of Cin which each state s of the original computation is replaced by a state fragment sbull that only

13

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

function Islice(sbull s

λrarrρσwrarr t)

1 if w isin MPos(sbull) then2 θ = xfreshbull | x isin V ar(λ)3 λbull = fragment(λMPos(Varbull(sbull|w)) cap Pos(λ))

4 ψλ = 〈|θmatchλbull(sbull|w)|〉

5 tbull = sbull[ρψλ]w6 else7 tbull = nil8 fi9 return tbull

endf

Figure 4 Inspection criterion that models forward slicing of a rewrite step

records the information that depends on the meaningful symbols of sbull0 while unrelated dataare simply pruned away

In the following we define an inspection criterion Islice that implements the forward slicingof a single rewrite step The considered criterion takes two parameters as input namely a

rewrite step micro = (srσwrarr K t) (with r = λ rarr ρ and K isin ∆ RB) and a state fragment

sbull of a state s It delivers the state fragment tbull which includes only those data that arerelated to the meaningful symbols of sbull Intuitively the state fragment tbull is obtained fromsbull by ldquorewritingrdquo sbull at position w with the rule r and a suitable substitution that abstractsunwanted information of the computed substitution with bull-variables A rigorous formalizationof the inspection criterion Islice is provided by the algorithm in Figure 4

Note that by adopting the inspection criterion Islice the exploration scheme of Section 4automatically turns into an interactive forward trace slicer that expands program states usingthe slicing methodology encoded into the inspection criterion Islice In other words given acomputation tree TR(s0) and a user-defined state fragment sbull0 of the initial state s0 any branchsbull0 rarr sbull1 rarr sbulln in the tree T bull

R(sbull0) which is computed by the explore function is the slicedcounterpart of a computation s0 rarrRcup∆B s1 rarrRcup∆B sn (wrt the state fragment sbull0) thatappears in the computation tree TR(s0)

Roughly speaking the inspection criterion Islice works as follows When the rewrite stepmicro occurs at a position w that is not a meaningful position of sbull (in symbols w 6isin MPos(sbull))trivially micro does not contribute to producing the meaningful symbols of tbull This amounts tosaying that no relevant information descends from the state fragment sbull and hence the functionreturns the nil value

On the other hand when w isin MPos(sbull) the computation of tbull involves a more in-depthanalysis of the rewrite step which is based on a refinement process that allows the descendantsof sbull in tbull to be computed The following definition is auxiliary

Definition 53 (substitution update) Let σ1 and σ2 be two substitutions The update ofσ1 wrt σ2 is defined by the operator 〈| |〉 as follows

〈|σ1 σ2|〉 = σ|Dom(σ1) where

xσ =

xσ2 if x isin Dom(σ1) capDom(σ2)xσ1 otherwise

The operator 〈|σ1 σ2|〉 updates (overrides) a substitution σ1 with a substitution σ2 where bothσ1 and σ2 may contain bull-variables The main idea behind 〈| |〉 is that for the slicing of the

14

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

rewrite step micro all variables in the applied rewrite rule r are naıvely assumed to be initiallybound to irrelevant data bull and the bindings are incrementally updated as we apply the rule r

More specifically we initially define the substitution θ = xfreshbull | x isin V ar(ρ) thatbinds each variable in λ rarr ρ to a fresh bull-variable This corresponds to assuming that all theinformation in micro which is introduced by the substitution σ can be marked as irrelevant Thenθ is refined as follows

We first compute the state fragment λbull = fragment(λMPos(Varbull(sbull|w))capPos(λ)) that onlyrecords the meaningful symbols of the left-hand side λ of the rule r wrt the set of meaningfulpositions of sbull|w Then by matching λbull with sbull|w we generate a matcher matchλbull(sbull|w) thatextracts the meaningful symbols from sbull|w Such a matcher is then used to compute ψλ which

is an update of θ wrt matchλbull(sbull|w) containing the meaningful information to be trackedFinally the state fragment tbull is computed from sbull by replacing its subterm at position w withthe instance ρψλ of the right-hand side of the applied rule r This way we can transfer all therelevant information marked in sbull into the fragment of the resulting state tbull

Example 54Consider the computation tree of Example 32 whose initial state is

s0 = [Srv-A] amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

Let sbull0 = bull amp [Cli-Abull7 bull ] amp bull be a state fragment1 of s0 where only request 7 of ClientCli-A is considered of interest By sequentially expanding the nodes sbull0 s

bull1 s

bull3 and s

bull5 wrt

the inspection criterion Islice we get the following fragment of the given computation tree

Query Go

Go

Go

Go

Go

Go

GoGoBack

Back

Back

Back

Back

Back

BackBack AnimaOptions

bull amp [Cli-Abull7bull] amp bullsbull0

reqbull amp (bull lt- Cli-A7) amp [Cli-Abull7na] amp bullsbull1

reqduplbull amp (bull lt- Cli-A7) amp (bull lt- Cli-A7) amp [Cli-Abull7na] amp bull

sbull2 reply[bull] amp (Cli-A lt- bullf(bullCli-A7)) amp [Cli-Abull7na] amp bull

sbull3 lossbull amp [Cli-Abull7na] amp bullsbull4

succ[bull] amp (Cli-A lt- bull8) amp [Cli-Abull7na] amp bullsbull5

req[bull] amp (bull lt- Cli-A7) amp(Cli-A lt- bull8) amp [Cli-Abull7na] amp bull

sbull6 dupl[bull] amp (Cli-A lt- bull8) amp(Cli-A lt- bull8) amp [Cli-Abull7na] amp bull

sbull7 loss[bull] amp [Cli-Abull7na] amp bullsbull8 rec

[bull] amp [Cli-Abull77] amp bullsbull9

Note that the slicing process automatically computes a tree fragment that represents apartial view of the protocol interactions from client Cli-Arsquos perspective Actually irrelevantinformation is hidden and rules applied on irrelevant positions are directly ignored whichallows a simplified fragment to be obtained favoring its inspection for debugging and analysispurposes In fact if we observe the highlighted computation in the tree we can easily detectthe wrong behaviour of the rule rec Specifically by inspecting the state fragment sbull9 = ([bull]amp [Climinus A bull 7 7] amp bull) which is generated by an application of the rule rec we immediatelyrealize that the response 8 produced in the parent state sbull5 has not been stored in sbull9 whichclearly indicates a buggy implementation of the considered rule

1Throughout the example we omit indices from the considered bull-variables to keep notation lighter andimprove readability So any variable bulli i = 0 1 is simply denoted by bull

15

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

Finally it is worth noting that the forward trace slicer implemented via the criterion Islicediffers from the partial stepper given at the end of Section 51 Given a state fragment sbull and

a rewrite steprσwrarrK t Islice always yields a fragment tbull when the rewrite occurs at a meaningful

position By contrast the inspection criterion Ipstep encoded in the partial stepper may fail toprovide a computed fragment tbull when sbull does not rewrite to tbull

Example 55

Consider the same rewrite rules and initial state f(bull1 b) of Example 52 By expanding f(bull1 b)wrt the inspection criterion Islice we get the computation tree fragment with tree edgesf(bull1 b)

r1rarr g(bull1) and f(bull1 b)r2rarr h(b) whereas the partial stepper only computes the tree edge

f(bull1 b)r1rarr g(bull1) as shown in Example 52

6 Implementation

The exploration methodology developed in this paper has been implemented in the Anima

tool which is publicly available at httpsafe-toolsdsicupvesanima The underlyingrewriting machinery of Anima is written in Maude and consists of about 150 Maude functiondefinitions (approximately 1600 lines of source code)

Anima also comes with an intuitive Web user inter-

Database

Anima Client

JAX-RS API

Initial State Rewriting LogicSpecification Animation

Anima Web Service

Anima Core

Figure 5 Anima architecture

face based on AJAX technology which allows usersto graphically display and animate computation treefragments The core exploration engine is specified asa RESTful Web service by means of the Jersey JAX-RS API

The architecture of Anima is depicted in Figure 5and consists of five main components Anima ClientJAX-RS API AnimaWeb Service Database and An-ima Core The Anima Client is purely implementedin HTML5 and JSP It represents the front-end layerof our tool and provides an intuitive versatile Webuser interface which interacts with the Anima Web Service to invoke the capabilities of theAnima Core and save partial results in the Database component

A screenshot that shows the Anima tool at work on the case study that is described inExample 54 is given in Figure 6

These are the main features provided by Anima

1 Inspection strategies The tool implements the three inspection strategies described inSection 5 As shown in Figure 6 the user can select a strategy by using the selectorprovided in the option pane

2 ExpandingFolding program states The user can expand or fold states by right-clicking onthem with the mouse and by selecting the ExpandFold Node options from the contextualmenu For instance in Figure 6 a state fragment on the frontier of the computed treehas been selected and is ready to be expanded through the Expand Node option

3 Selecting meaningful symbols State fragments can be specified by highlighting the statesymbols of interest either directly on the tree or in the detailed information window

16

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

GoGoGoGoGoBackBackBackBackBack Anima

Options

View

Rule Labels

State Labels

Zoom 100

- +

Interactive StepperInteractive StepperInteractive StepperInteractive StepperInteractive Stepper

Simple Advanced

ON OFF

ON Transition information from state to sbull1 sbull2

Rule

rl [reply] S lt- C Q amp [S] =gt [S] amp C lt- S f(S C Q)

amp [Cli-Abull7na]

bull amp [Cli-Abull7bull] amp bull

sbull0

req

bull amp (bull lt- Cli-A7) amp [Cli-Abull7na] amp bull

sbull1

reqdupl

bull amp (bull lt- Cli-A7) amp (bull

lt- Cli-A7) amp [Cli-Abull

7na] amp bull

sbull2 reply

[bull] amp (Cli-A lt- bullf(bullCl

i-A7))

amp bull

sbull3 loss

bull amp [Cli-Abull7na] amp bull

sbull4

Expand node

Fold node

Show full information

Show transition information

Expand view

Collapse view

Figure 6 Anima at work

4 Search mechanism The search facility implements a pattern language that allows stateinformation of interest to be searched on huge states and complex computation trees Theuser only has to provide a filtering pattern (the query) that specifies the set of symbols thatheshe wants to search for and then all the states matching the query are automaticallyhighlighted in the computation tree

5 Transition information Anima facilitates the inspection of a selected rewrite step s rarr tthat occurs in the computation tree by underlining its redex in s and the reduced subtermin t Some additional transition information is also displayed in the transition informa-tion window (eg the ruleequation applied the rewrite position and the computedsubstitution of the considered rewrite step) by right-clicking on the corresponding option

7 Conclusions

The analysis of execution traces plays a fundamental role in many program analysis approachessuch as runtime verification monitoring testing and specification mining We have presenteda parametrized exploration technique that can be applied to the inspection of rewriting logiccomputations and that can work in different ways Three instances of the parameterized ex-ploration scheme (an incremental stepper an incremental partial stepper and a forward traceslicer) have been formalized and implemented in the Anima tool which is a novel program an-imator for RWL The tool is useful for Maude programmers in two ways First it concretelydemonstrates the semantics of the language allowing the evaluation rules to be observed inaction Secondly it can be used as a debugging tool allowing the users to step forward andbackward while slicing the trace in order to validate input data or locate programming mis-takes

17

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

References

[1] M Alpuente D Ballis M Baggi and M Falaschi A FoldUnfold Transformation Frameworkfor Rewrite Theories extended to CCT In Proc 2010 ACM SIGPLAN Workshop on PartialEvaluation and Program Manipulation PEPM 2010 pages 43ndash52 ACM 2010

[2] M Alpuente D Ballis J Espert and D Romero Model-checking Web Applications with Web-TLR In Proc of 8th Intrsquol Symposium on Automated Technology for Verification and Analysis(ATVA 2010) volume 6252 of LNCS pages 341ndash346 Springer-Verlag 2010

[3] M Alpuente D Ballis J Espert and D Romero Backward Trace Slicing for Rewriting LogicTheories In Proc CADE 2011 volume 6803 of LNCSLNAI pages 34ndash48 Springer-Verlag 2011

[4] M Alpuente D Ballis F Frechina and D Romero Backward Trace Slicing for ConditionalRewrite Theories In Proc LPAR-18 volume 7180 of LNCS pages 62ndash76 Springer-Verlag 2012

[5] M Alpuente D Ballis F Frechina and J Sapina Slicing-Based Trace Analysis of RewritingLogic Specifications with iJulienne In Matthias Felleisen and Philippa Gardner editors Procof 22nd European Symposium on Programming ESOP 2013 volume 7792 of Lecture Notes inComputer Science pages 121ndash124 Springer 2013

[6] M Alpuente D Ballis and D Romero Specification and Verification of Web Applications inRewriting Logic In Formal Methods Second World Congress FM 2009 volume 5850 of LNCSpages 790ndash805 Springer-Verlag 2009

[7] M Baggi D Ballis and M Falaschi Quantitative Pathway Logic for Computational Biology InProc of 7th Intrsquol Conference on Computational Methods in Systems Biology (CMSB rsquo09) volume5688 of LNCS pages 68ndash82 Springer-Verlag 2009

[8] R Bruni and J Meseguer Semantic Foundations for Generalized Rewrite Theories TheoreticalComputer Science 360(1ndash3)386ndash414 2006

[9] M Clavel F Duran S Eker P Lincoln N Martı-Oliet J Meseguer and C Talcott MaudeManual (Version 26) Technical report SRI Intrsquol Computer Science Laboratory 2011 Availableat httpmaudecsuiucedumaude2-manual

[10] J Clements M Flatt and M Felleisen Modeling an Algebraic Stepper In Proc 10th EuropeanSymposium on Programming volume 2028 of LNCS pages 320ndash334 Springer-Verlag 2001

[11] F Duran and J Meseguer A Maude Coherence Checker Tool for Conditional Order-SortedRewrite Theories In Proc of 8th International Workshop on Rewriting Logic and Its Applications(WRLArsquo10) number 6381 in LNCS pages 86ndash103 Springer-Verlag 2010

[12] JW Klop Term Rewriting Systems In S Abramsky D Gabbay and T Maibaum editorsHandbook of Logic in Computer Science volume I pages 1ndash112 Oxford University Press 1992

[13] N Martı-Oliet and J Meseguer Rewriting Logic Roadmap and Bibliography Theoretical Com-puter Science 285(2)121ndash154 2002

[14] J Meseguer Conditional Rewriting Logic as a Unified Model of Concurrency Theoretical Com-puter Science 96(1)73ndash155 1992

[15] J Meseguer The Temporal Logic of Rewriting A Gentle Introduction In Concurrency Graphsand Models Essays Dedicated to Ugo Montanari on the Occasion of his 65th Birthday volume5065 pages 354ndash382 Berlin Heidelberg 2008 Springer-Verlag

[16] A Riesco A Verdejo R Caballero and N Martı-Oliet Declarative Debugging of RewritingLogic Specifications In Recent Trends in Algebraic Development Techniques 19th Intrsquol WorkshopWADT 2008 volume 5486 of LNCS pages 308ndash325 Springer-Verlag 2009

[17] A Riesco A Verdejo and N Martı-Oliet Declarative Debugging of Missing Answers for MaudeIn 21st Intrsquol Conference on Rewriting Techniques and Applications RTA 2010 volume 6 of LIPIcspages 277ndash294 Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik 2010

[18] TeReSe editor Term Rewriting Systems Cambridge University Press Cambridge UK 2003

18

Automatic Inference of Term Equivalence in

Term Rewriting Systems

Marco Comini1 and Luca Torella2

1 DIMI University of Udine Italymarcocominiuniudit

2 DIISM University of Siena Italylucatorellaunisiit

Abstract

In this paper we propose a method to automatically infer algebraic property-orientedspecifications from Term Rewriting Systems Namely having three semantics with suitableproperties given the source code of a TRS we infer a specification which consists of a setof most general equations relating terms that rewrite for all possible instantiations to thesame set of constructor terms

The semantic-based inference method that we propose can cope with non-constructor-based TRSs and considers non-ground terms Particular emphasis is put on avoiding thegeneration of ldquoredundantrdquo equations that can be a logical consequence of other ones

1 Introduction

In the last years there has been a growing interest in the research on automatic inference ofhigh-level specifications from an executable or the source code of a system This is probablydue to the fact that the size of software systems is growing over time and certainly one cangreatly benefit from the use of automatic tools There are several proposals like [1 7 6] whichhave proven to be very helpful

Specifications have been classified by their characteristics [8] It is common to distin-guish between property-oriented specifications and model-oriented or functional specificationsProperty-oriented specifications are of higher description level than other kinds of specificationsthey consist of an indirect definition of the systemrsquos behavior by stating a set of propertiesusually in the form of axioms that the system must satisfy [11 10] In other words a specifi-cation does not represent the functionality of the program (the output of the system) but itsproperties in terms of relations among the operations that can be invoked in the program (ieidentifies different calls that have the same behavior when executed) This kind of specifica-tions is particularly well suited for program understanding the user can realize non-evidentinformation about the behavior of a given function by observing its relation to other functionsMoreover the inferred properties can manifest potential symptoms of program errors which canbe used as input for (formal) validation and verification purposes

We can identify two mainstream approaches to perform the inference of specifications glass-box and black-box The glass-box approach [1] assumes that the source code of the programis available In this context the goal of inferring a specification is mainly applied to documentthe code or to understand it Therefore the specification must be more succinct and compre-hensible than the source code itself The inferred specification can also be used to automatethe testing process of the program or to verify that a given property holds [1] The black-boxapproach [7 6] works only by running the executable This means that the only informationused during the inference process is the input-output behavior of the program In this setting

19

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

the inferred specification is often used to discover the functionality of the system (or services ina network) [6] Although black-box approaches work without any restriction on the consideredlanguage ndash which is rarely the case in a glass-box approach ndash in general they cannot guaranteethe correctness of the results (whereas indeed semantics-based glass-box approaches can)

For this work we developed a (glass-box) semantic-based algebraic specification synthesismethod for the Term Rewriting Systems formalism that is completely automatic ie needsonly the source TRS to run Moreover the outcomes are very intuitive since specifications aresets of equations of the form e1 = e2 where e1 e2 are generic TRS expressions so the userdoes not need any kind of extra knowledge to interpret the results The underpinnings of ourproposal are radically different from other works for functional programming since the presenceof non-confluence or non-constructor-based TRSs poses several additional problems

11 Notations

We assume that the reader is familiar with the basic notions of term rewriting For a thoroughdiscussion of these topics see [9] In the paper we use the following notations V denotes a(fixed) countably infinite set of variables and T (ΣV) denotes the terms built over signatureΣ and variables V T (Σempty) are ground terms Substitutions over T (Σempty) are called groundsubstitutions Σ is partitioned in D the defined symbols and C the constructor symbols

T (CV) are constructor terms Substitutions over T (CV) are said constructor substitutionsC[t1 tn] denotes the replacement of t1 tn in context C A TRS R is a set of rules l rarr r

where l = f(t1 tn) l r isin T (ΣV) var(r) sube var(l) and f isin D t1 tn are the argumentpatterns of l rarr r and need not necessarily be in T (CV) unlike in functional programmingwhere only constructor-based TRSs are considered (with ti isin T (CV))

2 Many notions of equivalence

In the functional programming paradigm an equation e1 = e2 is typically interpreted as aproperty that holds for any well-typed constructor ground instance of the variables occurringin the equation Namely for all bindings of variables with well-typed (constructor ground)terms ϑ the constructor term computed for the calls e1ϑ and e2ϑ is the same In functionalprogramming we can consider only constructor instances because by having constructor-basedconfluent TRSs the set of values for non-constructor instances is the same as for constructorones

Differently from the functional programming case the TRS formalism admits variables ininitial terms and defined symbols in the patterns of the rules moreover rules are evaluatednon-deterministically and can rewrite to many constructor terms Thus an equation can beinterpreted in many different ways We will discuss the key points of the problem by means ofa (very simple) illustrative example

Example 21 Consider the following (non constructor based) TRS R where we provide a prettystandard definition of the arithmetic operations + - and (modulo)

0 + x -gt x x - 0 -gt x x s(y) -gt (x - s(y)) s(y)

s(x) + y -gt s(x+y) s(x) - s(y) -gt x - y (0 - s(x)) s(y) -gt y - x

Note that since the TRS formalism is untyped a term like 0 + a is admissible and is evaluatedto constructor term a

20

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

For this TRS one could expect to have in its property-oriented specification equations like

(x + y) + z = x + (y + z) (21)

x - (y + z) = (x - y) - z (22)

(x - y) - z = (x - z) - y (23)

0 + x = x (24)

x + 0 = x (25)

x + y = y + x (26)

These equations of the form e1 = e2 can be read as the (observable) outcomes of e1 are thesame of e2 The first essential thing is to formalize the meaning of ldquoobservable outcomesrdquo ofthe evaluation of an expression e (which contains variables) In the TRS formalism we haveseveral possible combinations First it is technically possible to literally interpret variables ine and decide to observe either the set of normal forms of e or the set of constructor terms ofe However as can be quickly verified only (24) is valid in either of these forms Indeedconsider for example terms x - (y + z) and (x - y) - z For both terms no rule can beapplied hence they are both (non constructor) normal forms and thus (22) is not literally validClearly this is quite a radical choice An interesting alternative would be to request that forany possible interpretation of variables with any term the expressions rewrite to the same setof constructor terms Formally by defining the rewriting behavior of a term t as

BJtRK ∶= ϑ sdot s∣ tϑETHrarrR

lowast s s isin T (CV) ϑ∶V rarr T (ΣV) dom(ϑ) sube var(t) (27)

we can interpret e1 = e2 as e1 =RB e2 ∶lArrrArr BJe1RK = BJe2RK In the following we call thisequivalence rewriting behavior equivalence Actually eqs (21) to (24) are valid wrt =RB

Note that if we would have chosen to use normal forms instead of constructor terms in (27)(ie s rarr instead of s isin T (CV)) then we would still have the same situation described beforewhere only (24) holds

The other equations (eqs (25) and (26)) are not valid in this sense For instance BJx + 0K =xt sdot si(0)∣tETHrarrlowast si(0) 1 while BJxK = xt sdot v∣tETHrarr

R

lowast v v isin T (CV) (and then ε sdot x isin BJxK ∖

BJx + 0K) These equations are not valid essentially because we have variables which cannotbe instantiated but if we consider ground constructor instancies which ldquotriggerrdquo in either terman evaluation to constructor terms then we actually obtain the same constructor terms Forexample for t1 = x and t2 = x + 0 for all ϑi = xsi(0) we have BJt1ϑiK = BJt2ϑiK = ε sdot si(0)∣Thus (25) holds in this sense

Decidedly also this notion of equivalence is interesting for the user We can formalize it ast1 =G t2 ∶lArrrArr forallϑ ground constructor BJt1ϑK cupBJt2ϑK sube ε sdot t∣t isin T (CV)rArr BJt1ϑK = BJt2ϑK Wewill call it ground constructor equivalence Note that =G is the only possible notion in the purefunctional paradigm where we can just have evaluations of ground terms and where we haveonly confluent constructor-based TRSs In this case the latter definition boils down to twoexpressions are equivalent if all its ground constructor instances rewrite to the same constructorterm This fact allows one to have an intuition of the reason why the problem of specificationsynthesis is definitively more complex in the full TRS paradigm

Since we do not consider only constructor-based TRSs there is another very relevant differ-ence wrt the pure functional case For instance let us consider the TRS Q obtained by addingthe rule g((x - y) - z) -gt x - (y + z) to TRS R of Example 21 Let t1 = x - (y + z)

1Here by si(0) we mean i repeated applications of s to 0 including the degenerate case for i = 0

21

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

and t2 = (x-y)-z We have BJt1QK = BJt2QK = x0 y0 z0 sdot 0xs(0) y0 z0 sdot s(0)xs(0) ys(0) z0 sdot 0xs(0) y0 zs(0) sdot 0 ∣ While the term g(t2) has this same be-havior BJg(t1)QK = empty

In general in the case of the TRS formalism terms embedded within a context do notnecessarily manifest the same behavior Thus it is also interesting to additionally ask to theequivalence notion =RB that the behaviors must be the same also when the two terms areembedded within any context Namely e1 =C e2 ∶lArrrArr forall contextC BJC[e1]RK = BJC[e2]RKWe call this equivalence contextual equivalence We can see that =C is (obviously) strongerthan =RB which is in turn stronger than =G Actually they are strictly stronger Indeed onlyeqs (21) and (24) are valid wrt =C (while eqs (22) and (23) are not)

We believe that all these notions are interesting for the user thus we formalize our notionof (algebraic) specification as follows

Definition 22 A specification S is a set of (sequences of) equations of the form t1 =K t2 =K =K tn with K isin CRB G and t1 t2 tn isin T (ΣV)

Thus for TRS Q we would get the following (partial) specification

(x + y) + z =C x + (y + z) 0 + x =C x

x - (y + z) =RB (x - y) - z (x - y) - z =RB (x - z) - y

x + y =G y + x x + 0 =G x

(x + y) z =G ((x z) + (y z)) z (x + y) y =G x y

(x - y) z =G (((x + z) z) - (y z)) z

In the following we present a first proposal of a semantics-based method that infers such spec-ifications for TRSs and tackles the presented issues (and discuss about its limitations) It isan adaptation for the TRS paradigm of ideas from [2] for the Functional Logic paradigm Thisadaptation is not straightforward since the Functional Logic paradigm is quite similar to theFunctional paradigm but considerably different from the TRS paradigm Moreover this worksignificantly extends the inference process by tackling equations like f(x y) = f(y x) which arereally important

3 Deriving specifications from TRSs

The methodology we are about to present is parametric wrt three semantics evaluation func-tions which need to enjoy some properties Namely

ERBJt RK gives the rewriting behavior (RB) semantics of term t with (definitions from) TRSR This semantics has to be fully abstract wrt rewriting behavior equivalence Namelywe require that ERBJt1 RK = ERBJt2 RK lArrrArr t1 =RB t2

EC Jt RK gives the contextual (C) semantics of the term t with the TRS R This semantics hasto be fully abstract wrt contextual equivalence Namely EC Jt1 RK = EC Jt2 RK lArrrArrt1 =C t2

EGJt RK gives the ground (G) semantics of the term t with the TRS R This semanticshas to be fully abstract wrt ground constructor equivalence Namely EGJt1 RK =EGJt2 RK lArrrArr t1 =G t2

22

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

The idea underlying the process of inferring specifications is that of computing the semanticsof various terms and then identify all terms which have the same semantics However not allequivalences are as important as others given the fact that many equivalences are simplelogical consequences of others For example if ti =C si then for all constructor contexts CC[t1 tn] =C C[s1 sn] thus the latter derived equivalences are uninteresting and shouldbe omitted Indeed it would be desirable to synthesize the minimal set of equations from whichby deduction all valid equalities can be derived This is certainly a complex issue in testingapproaches With a semantics-based approach it is fairly natural to produce just the relevantequations The (high level) idea is to proceed bottom-up by starting from the evaluation ofsimpler terms and then newer terms are constructed (and evaluated) by using only semanticallydifferent arguments Thus by construction only non-redundant equations are produced

There is also another source of redundancy due to the inclusion of relations =K For examplesince =C is the finer relation t =C s implies t =RB s and t =G s To avoid the generation of coarserredundant equations a simple solution is that of starting with =C equivalences and once theseare all settled to proceed only with the evaluation of the =RB equivalences of non =C equivalentterms Thereafter we can evaluate the =G equivalences of non =RB equivalent terms

Clearly the full computation of a programsrsquo semantics is not feasible in general For themoment for the sake of comprehension we prefer to present the conceptual framework leavingout of the picture the issues related to decidability We will show a possible decidable instanceof the method in Section 31

Let us describe in more detail the specification inference process The input of the processconsists of a TRS to be analyzed and two additional parameters a relevant API Σr and amaximum term size max size The relevant API allows the user to choose the operations inthe program that will be present in the inferred specification whereas the maximum term sizelimits the size of the terms in the specification As a consequence these two parameters tunethe granularity of the specification both making the process terminating and allowing the userto keep the specification concise and easy to understand

The output consists of a set of equations represented by equivalence classes of terms (withdistinct variables) Note that inferred equations may differ for the same program dependingon the considered API and on the maximum term size Similarly to other property-orientedapproaches the computed specification is complete up to terms of size max size ie it includesall the properties (relations) that hold between the operations in the relevant API and that areexpressible by terms of size less or equal than max size

Terms are classified by their semantics into a data structure which we call classificationconsisting (conceptually) of a set of equivalence classes (ec) formed by

bull sem(ec) the semantics of (all) the terms in that classbull rep(ec) the representative term of the class (rep(ec) isin terms(ec))bull terms(ec) the set of terms belonging to that equivalence classbull epoch(ec) an integer to record the moment of introduction of that equivalence class

The representative term is the term which is used in the construction of nested expressionswhen the equivalence class is considered To output smaller equations it is better to choose thesmallest term in the class (wrt the function size) but any element of terms(ec) can be used

The inference process consists of successive phases one for each kind of equality (in orderof discriminating power ie C RB G) as depicted in Figure 1

Computation of the initial classification (epochs 0 and 1) The first phase of the algo-rithm is the computation of the initial classification that is needed to compute the classificationwrt =C We initially create a classification which contains

23

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

Inference Process

Computation of the initial classification

Generation of =C -classification

Generation of =RB -classification

Generation of =G -classification

Generation of =C -equations

Generation of =RB -equations

Generation of =G -equations

Specification

TRS

Program

API

max size

Figure 1 A general view of the inference process

bull one class for a free (logical) variable ⟨EC JxK x x 0⟩bull the classes for any constructor symbol ie for all cn

2 isin C and x1 xn distinct variables

⟨EC JtK t t 0⟩ where t = c(x1 xn)

Then for all symbols fn of the relevant API Σr and distinct variables x1 xn we add

to classification the term t = f(x1 xn) with semantics s = EC Jt RK and epoch m = 1This operation denoted addEC (t sm) is the most delicate part of the method If we wouldnot consider the generation of ldquopermutedrdquo equations like f(x y) = f(y x) then the wholeactivity would just boil down to look for the presence of s in some equivalence class and thenupdating the classification accordingly (like in [2]) Handling of permutations cannot be done bynaıvely adding all (different) permutations of s In this way we would generate many redundantequations Consider for instance the TRS Q

f(abc) -gt 0

f(bac) -gt 0

f(acb) -gt 0

f(bca) -gt 0

f(cab) -gt 0

f(cba) -gt 0

From the minimal set f(x y z) =C f(y x z) =C f(x z y) we can generate all other valid per-mutations like f(x y z) =C f(y z x) =C f(z x y) Thus in this case we should only generatepermutated equations where we just swap two variables However for the TRS R

f(abc) -gt 0 f(bca) -gt 0 f(cab) -gt 0

f(x y z) neC f(y x z) neC f(x z y) but f(x y z) =C f(y z x) Moreover f(x y z) =C f(z x y)can be deduced by this Thus in this case we should only generate permutated equations witha rotation of three variables since all other rotations of three variables are just a consequence

Thus not all permutations have to be considered while adding a semantics to a classificationand it is not necessary to look for all permutations within the semantics already present in theclassification To generate only a minimal set of necessary permutated equations we need toconsider for each k variables a set Πn

k of generators of the permutations of n variables whichdo not move n minus k variables (note that Πn

1 = id ) Then for a term t = f(x1 xn) westart sequentially for i from 1 to n and look if for some π isin Πn

i we have an equivalence classec in the current classification whose semantics coincides with sπ (ie ec = ⟨sπ tprime T mprime⟩) Ifit is found then the term tπminus1 is added to the set of terms in ec (ie ec is transformed inecprime = ⟨sπ tprime T cup tπminus1 mprime⟩) and we stop Otherwise we iterate with next i If all fails a newequivalence class ⟨s t T m⟩ has to be created but we have to determine the right term set

2Following the standard notation fn denotes a function f of arity n

24

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

T (to possibly generate equations like f(x y) = f(y x)) We initially start with T = t andj = n and sequentially for i from 2 to j we check if for some π isin Πj

i we have s = sπ If wefind it we add tπ to T and decrement j by i minus 1 (i variables are now used in a valid equationand thus from this moment on i minus 1 variables have no longer to be considered) Otherwise wecontinue with next i The final T is used for the new equivalence class

For example for t = f(x y z) in TRS Q we start with variables x y z and T = t Nowconsider for instance π = (xy) isin Π3

2 Since EC JtK = EC JtπK then T = f(x y z) f(y x z)and then we drop x and remain with variables y z Now we have only πprime = (y z) isin Π2

2 andsince EC JtK = EC JtπprimeK then T = f(x y z) f(y x z) f(x z y) we drop y and (thus) finishInstead for t = f(x y z) in TRS R we start with variables x y z and T = t Now considerfor instance π1 = (xy) isin Π3

2 Since EC JtK ne EC Jtπ1K then we consider π2 = (y z) isin Π3

2 and sinceEC JtK ne EC Jtπ2K we increase i Now we have only π3 = (xy z) isin Π3

3 and since EC JtK = EC Jtπ3Kthen T = f(x y z) f(y z x) we drop x y and (thus) finish

Generation of =C classification (epochs 2 and above) The second phase of the algo-rithm is the (iterative) computation of the successive epochs until we complete the constructionof the classification of terms wrt =C At each iteration (with epoch k) for all symbols fnof the relevant API Σr we select from the current classification all possible combinations of nequivalence classes ec1 ecn such that at least one eci was newly produced in the previousiteration (ie whose epoch is k minus 1) We build the term t = f(rep(ec1) rep(ecn)) whichby construction has surely not been considered yet Then if size(t) le max size we computethe semantics s = EC Jt RK and update the current classification by adding to classification theterm t and its semantics s (addEC (t s k)) as described before

If we have produced new equivalence classes then we continue to iterate This phase eventu-ally terminates because at each iteration we consider by construction terms which are differentfrom those already existing in the classification and whose size is strictly greater than the sizeof its subterms (but the size is bounded by max size)

The following example illustrates how the iterative process works

Example 31 Let us use the program R of Example 21 and choose as relevant API the func-tions + - and In the first step the terms

t11 = x + y t12 = x - y t13 = x y

are built Since (all permutations of) the semantics of all these terms are different and differentfrom the other semantics already in the initial classification three new classes are added to theinitial classification

During the second iteration the following two terms (among others) are built

bull the term t21 = (xrsquo + yrsquo) + y is built as the instantiation of x in t11 with (a renamedapart variant of) t11 and

bull the term t22 = x + (xrsquo + yrsquo) as the instantiation of y in t11 with t11

The semantics of these two terms is the same s but it is different from the semantics of theexisting equivalence classes Thus during this iteration (at least) the new equivalence classecprime ∶= ⟨s t21 t21 t22 n⟩ is computed Hereafter only the representative of the class will beused for constructing new terms Since we have chosen t21 instead of t22 as the representativeterms like (x + (xrsquo + yrsquo)) z will never be built

Thanks to the closedness wrt context of the semantics this strategy for generating terms issafe In other words when we avoid to build a term it is because it is not able to produce a

25

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

behavior different from the behaviors already included by the existing terms thus we are notlosing completeness

Generation of the =C specification Since by construction we have avoided much redun-dancy thanks to the strategy used to generate the equivalence classes we now have only to takeeach equivalence class with more than one term and generate equations for these terms

Generation of =RB equations The third phase of the algorithm works on the former clas-sification by first transforming each equivalence class ec by replacing the C-semantics sem(ec)with ERBJrep(ec) RK and terms(ec) with the (singleton) set rep(ec) After the transforma-tion some of the previous equivalence classes which had different semantic constructor termsmay now have the same RB -semantics and then we merge them making the union of the termsets terms(ec)

Thanks to the fact that before merging all equivalence classes were made of just singletonterm sets we cannot generate (again) equations t1 =RB t2 when an equation t1 =C t2 had beenalready issued Let us clarify this phase by an example

Example 32 Assume we have a classification consisting of three equivalence classes with C-semantics s1 s2 and s3 and representative terms t11 t22 and t31

ec1 = ⟨s1 t11t11 t12 t13⟩ ec2 = ⟨s2 t22t21 t22⟩ ec3 = ⟨s3 t31t31⟩

We generate equations t11 =C t12 =C t13 and t21 =C t22Now assume that ERBJt11K = w0 and ERBJt22K = ERBJt31K = w1 Then (since t12 t13 and

t21 are removed) we obtain the new classification

ec4 = ⟨w0 t11 t11 n⟩ ec5 = ⟨w1 t22 t22 t31 n⟩

Hence the only new equation is t22 =RB t31 Indeed equation t11 =RB t12 is uninterestingsince we already know t11 =C t12 and equation t21 =RB t31 is redundant (because t21 =C t22 andt22 =RB t31)

The resulting (coarser) classification is then used to produce the =RB equations as donebefore by generating equations for all non-singletons term sets

Generation of the =G equations In the last phase we transform again the classificationby replacing the RB -semantics with the G-semantics (and terms(ec) with the set rep(ec))Then we merge eventual equivalence classes with the same semantics and finally we generate=G equations for non singleton term sets

Theorem 33 (Correctness) For all equations e1 = e2 generated in the second third andforth phase we have that e1 =C e2 e1 =RB e2 and e1 =G e2 respectively

Proof By construction of equivalence classes in the second phase an equation t1 = t2 isgenerated if and only if the semantics EC Jt1 RK = EC Jt2 RK Then since EC Jt1 RK =EC Jt2 RK lArrrArr t1 =C t2 the first part of thesis follows immediately Then by the succes-sive trasformation and reclassification in the third phase we issue an equation t1 = t2 if andonly if ERBJt1 RK = ERBJt2 RK Then since ERBJt1 RK = ERBJt2 RK lArrrArr t1 =RB t2 we havethe second part of thesis The proof of the third part of thesis since EGJt1 RK = EGJt2 RK lArrrArrt1 =G t2 is analogous

26

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

Example 34 Let us recall (again) the programR of Example 21 The terms x + y and y + xbefore the transformation belong to two different equivalence classes (since their rewritingbehavior is different) Anyway after the transformation the two classes are merged since theirG-semantics is the same namely x0 y0 sdot 0xs(0) y0 sdot s(0)x0 ys(0) sdot s(0) ∣

We now present some examples to show how our proposal deals with non-contructor basedor non-confluent TRS plus some to show that we can infer several non-trivial equations

Example 35 Consider the definition for the boolean data type with constructor terms trueand false and boolean operations and or not and imp

and(true x) -gt x

and(false x) -gt false

or(true x) -gt true

or(false x) -gt x

not(true) -gt false

not(false) -gt true

imp(false x) -gt true

imp(true x) -gt x

This is a pretty standard ldquoshort-cutrdquo definition of boolean connectives With our method weget the following equations

not(or(xy)) =C and(not(x)not(y)) imp(xy) =C or(not(x)y)

not(and(xy)) =C or(not(x)not(y)) not(not(x)) =G x

and(xand(yz)) =C and(and(xy)z) and(xy) =G and(yx)

Example 36 Let us consider the following non-constructor based TRS implementing someoperations over the naturals in Peano notation

x - 0 -gt x

s(x) - s(y) -gt x - y

g(x) -gt chk(x - s(x))

chk(0) -gt 0

chk(s(x)) -gt s(x)

chk(0 - s(x)) -gt err

The definition of - is a standard definition of the minus operation over naturals The chk

function simply returns the natural passed as argument or returns err if the argument is anot defined subtraction It is easy to see that the TRS is not constructor-based because ofthe presence of the - in the pattern of a rule The artificial function g which checks if thesubtraction of a number by its successor is a natural number is doomed to return err Withour classification we actually derive equation g(x) =C err

Example 37 Let us consider the following (artificial) non-orthogonal TRS

coin -gt 0

coin -gt 1

d(x) -gt g(xx)

g(01) -gt true

t(x) -gt k(xxx)

k(101) -gt true

The coin function can return both 0 and 1 The functions d and t call an auxiliary functionduplicating and triplicating (respectively) the variable received as argument Functions f andg require a specific combination of 0 and 1 to return the constructor term true Notice thatto reach the constructor term true from d and t respectively it is necessary to use a nondeterministic function able to rewrite to both 0 and 1 Some of the inferred equations for thisTRS are t(x) =C d(x) and t(coin) =C g(coincoin) =C k(coincoincoin) =C d(coin)

27

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

Example 38 Let us consider the following TRS that computes the double of numbers inPeano notation

double (0) -gt 0

double(s(x)) -gt s(s(double(x)))

dbl(x) -gt plus(xx)

plus(0y) -gt y

plus(s(x)y) -gt s(plus(xy))

Some of the inferred equations for the TRS are

dbl(dbl(double(x))) =G dbl(double(dbl(x))) (31)

double(x) =G dbl(x) (32)

dbl(dbl(x)) =G dbl(double(x))=Gdouble(dbl(x)) =G double(double(x)) (33)

plus(double(x)y) =G plus(dbl(x)y) (34)

We can observe that all equations hold with the =G relation and not with the =RB relationThis is due to the fact that the two functions dbl and dbl even if at a first sight could seemto evaluate the same constructor terms can behave differently For instance if we add to theTRS the two rules coin -gt 0 and coin -gt s(0) we can notice that the terms double(coin)and dbl(coin) return different constructor terms This is due to the non determinism ofthe coin function that exploits the right non-linearity of function dbl While double(coin)

evaluates to 0 and s(s(0)) the term dbl(coin) can be reduced even to s(0) (by dbl(coin)

rarr plus(coincoin) rarr2 plus(0s(0)) rarr s(0))This characteristic of the program is not easy to realize by just looking at the code

Example 39 Let us consider the following TRS defining two functions over an extension ofthe Peano notation able to handle negative integers

abs(-(x)) -gt abs(x)

abs(s(x)) -gt s(x)

abs(0) -gt 0

f(-(-(x))) -gt f(x)

f(0) -gt 0

f(s(x)) -gt s(x)

f(-(s(x))) -gt 0

Function abs is a standard definition of the absolute value function f returns its input if it isa positive number and 0 if it is not Some of the inferred equations are f(f(x)) =C abs(f(x))

and f(abs(x)) =C abs(abs(x))

Example 310 Let us consider the following program which implements a two-sided queue in a(non-trivial) efficient way The queue is implemented as two lists where the first list correspondsto the first part of the queue and the second list is the second part of the queue reversed Theinl function adds the new element to the head of the first list whereas the inr function addsthe new element to the head of the second list (the last element of the queue) The outl (outr)function drops one element from the left (right) list unless the list is empty in which case itreverses the other list and then swaps the two lists before removal

new -gt Q(Nil Nil)

inl(xQ(xs ys)) -gt Q((xxs)ys)

inr(xQ(xs ys)) -gt Q(xs (xys))

outl(Q(Nil ys)) -gt

Q(tail(rev(ys))Nil)

outl(Q((xxs)ys)) -gt Q(xsys)

outr(Q(xs Nil)) -gt

Q(Nil tail(rev(xs)))

outr(Q(xs (yys))) -gt Q(xsys)

null(Q((xxs)ys)) -gt False

null(Q(Nil (xxs))) -gt False

null(Q(Nil Nil)) -gt True

28

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

tail ((xxs)) -gt xs

rev(xs) -gt rv rsquo(xs Nil)

rv rsquo(Nil ys) -gt ys

rv rsquo((xxs)ys) -gt rv rsquo(xs (xys))

With our method (amongst others) we derive

null(new) =C True (35)

new =C outl(inl(xnew)) =C outr(inr(xnew)) (36)

outl(inl(xq)) =C outr(inr(xq)) (37)

inr(xinl(yq)) =C inl(yinr(xq)) (38)

inl(xoutl(inl(yq))) =C outr(inl(xinr(yq))) (39)

null(inl(xnew)) =C null(inr(xnew)) =C False (310)

We can see different kinds of non-trivial equations eqs (36) and (37) state that adding andremoving one element produces always the same result independently from the side in which weadd and remove it Equations (38) and (39) show a sort of restricted commutativity betweenfunctions

31 An effective instance of the presented method

In a semantics-based approach one of the main problems to be tackled is effectiveness Thesemantics of a program is in general infinite and thus some approximation has to be used inorder to have a terminating method To experiment on the validity of our proposal we startedby using a novel (condensed) fixpoint semantics which we have developed for left-linear TRSsthat is fully abstract wrt =C

3 Such semantics is defined as the fixpoint of an immediateconsequences operator P JRK We have opted for this semantics because it has some propertieswhich are very important from a pragmatical point of view

bull it is condensed meaning that denotations are the smallest possible (between all thosesemantics which induce the same program equivalence) This is a very relevant (if notessential) feature to develop a semantic-based tool which has to compute the semantics

bull The semantics ERB can be obtained directly by transforming the EC semantics concretelyjust by loosing internal structure Therefore no (costly) computation of ERB is needed

We have implemented the basic functionality of the proposed methodology in a prototype writ-ten in Haskell TRSynth available at httpsafe-toolsdsicupvestrsynth (for a detaileddescription see [4]) The implementation of =G equality is still ongoing work because we arelacking of a suitable implementation of the G-semantics

To achieve termination the prototype computes a fixed number k of steps of P JRK Thenit proceeds with the classification as described in Section 3 Clearly in presence of terms withinfinite solutions with such a rough approximation we may loose both correctness (by mis-takenly equating terms which become semantically different after k iterates) and completeness(by mistakenly not equating terms which will become semantically equivalent) Neverthelessthe results are encouraging For instance TRSynth detects all =C and =RB which we showed inexamples (except of Example 38 because of a bug in the computation of the semantics)

3The writing of articles related to the formal definition of this semantics is in progress [3]

29

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

4 Conclusions and future work

This paper discusses about the issues that arise for the automatic inference of high-levelproperty-oriented (algebraic) specifications because of non-confluent or non-constructor basedTRS Then a first proposal which overcomes these issues is presented

Our method computes a concise specification of program properties from the source code ofa TRS We hope to have convinced the reader (with all examples) that we reached our maingoal that is to get a concise and clear specification (that is useful for the programmer in orderto discover unseen properties or detect possible errors)

We have developed a prototype that implements the basic functionality of the approach Weare aware that many other attempts to guarantee termination could be used in other instanciesof the presented method Certainly given our know-how in the future we will experiment withabstractions obtained by abstract interpretation [5] (our novel semantics itself has been obtainedas an abstract interpretation) Actually we already have an ongoing work to implement thedepth(k) abstract version of our semantics In the depth(k) abstraction terms (occurring in thenodes of the semantic trees) are ldquocutrdquo at depth k by replacing them with cut variables distinctfrom program variables Hence for a given signature Σ the universe of abstract semantic treesis finite (although it increases exponentially wrt k) Therefore the finite convergence of thecomputation of the abstract semantics is guaranteed

References

[1] G Ammons R Bodık and J R Larus Mining specifications In 29th ACM SIGPLAN-SIGACTsymposium on Principles of programming languages (POPLrsquo02) pages 4ndash16 New York NY USA2002 Acm

[2] G Bacci M Comini M A Feliu and A Villanueva Automatic Synthesis of Specifications forFirst Order Curry Programs In Proceedings of the 14th symposium on Principles and practice ofdeclarative programming pages 25ndash34 New York NY USA 2012 ACM

[3] M Comini and L Torella A Condensed Goal-Independent Fixpoint Semantics Modeling theSmall-Step Behavior of Rewriting Technical Report DIMI-UD012013RR Dipartimento diMatematica e Informatica Universita di Udine 2013

[4] M Comini and L Torella TRSynth a Tool for Automatic Inference of Term Equivalence inLeft-linear Term Rewriting Systems In E Albert and S-C Mu editors PEPM rsquo13 Proceedingsof the ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation pages 67ndash70Acm 2013

[5] P Cousot and R Cousot Abstract Interpretation A Unified Lattice Model for Static Analysisof Programs by Construction or Approximation of Fixpoints In Proceedings of the 4th ACMSIGACT-SIGPLAN symposium on Principles of programming languages Los Angeles CaliforniaJanuary 17ndash19 pages 238ndash252 New York NY USA 1977 ACM Press

[6] C Ghezzi A Mocci and M Monga Synthesizing intensional behavior models by graph trans-formation In 31st International Conference on Software Engineering (ICSErsquo09) pages 430ndash4402009

[7] J Henkel C Reichenbach and A Diwan Discovering Documentation for Java Container ClassesIEEE Transactions on Software Engineering 33(8)526ndash542 2007

[8] A A Khwaja and J E Urban A property based specification formalism classification TheJournal of Systems and Software 832344ndash2362 2010

[9] TeReSe editor Term Rewriting Systems Cambridge University Press Cambridge UK 2003

[10] H van Vliet Software EngineeringndashPrinciples and Practice John Wiley 1993

[11] J M Wing A specifierrsquos introduction to formal methods Computer 23(9)10ndash24 1990

30

A Condensed Goal-Independent Fixpoint

Semantics Modeling the Small-Step Behavior of

Rewriting

Marco Comini1 and Luca Torella2

1 DIMI University of Udine Italy mdash marcocominiuniudit

2 DIISM University of Siena Italy mdash lucatorellaunisiit

Abstract

In this paper we present a novel condensed narrowing-like semantics that contains theminimal information which is needed to describe compositionally all possible rewritings ofa term rewriting system We provide its goal-dependent top-down definition and moreimportantly an equivalent goal-independent bottom-up fixpoint characterization

We prove soundness and completeness wrt the small-step behavior of rewriting forthe full class of term rewriting systems

1 Introduction

Nowadays the formalism of Term Rewriting Systems (TRSs) is used besides for functionalprogramming also for many other applications (like specification of communication protocolsto mention one) There has been a lot of research on the development of tools for the formalverification and (in general) automatic treatmentmanipulation of TRSs Within the proposalsthere are semantics-based approaches which can guarantee correctness by construction How-ever they cannot employ directly the construction of the semantics since in general it is infiniteThus some kind of approximation has to be used

Given the potentiality of application of the TRS formalism we have turned our attentiontoward the development of semantics-based TRS manipulation tools with the intention to useAbstract Interpretation theory as fundament to devise semantics approximations correct byconstruction However as also noted by [9] defining a suitable (concrete) semantics is usuallythe first crucial step in adapting the general methodology of Abstract Interpretation to thesemantic framework of the programming language at hand When a concrete semantics isused to define via abstract interpretation abstract (approximate) semantics to be employedto develop semantics-based manipulation tools it is particularly relevant if it is condensedand defined compositionally In the literature a semantics is said to be condensing when thesemantics of an instance of an expression (term goal call) can be obtained with a semanticoperation directly from the semantics of the (un-instantiated) expression In such a situationonly the semantics for most general expressions can be maintained in denotations We saythat a semantics is condensed when the denotations themselves do not contain redundancy iewhen it is not possible to semantically derive the components of a denotation from the othercomponents Indeed the abstract semantics operations which are obtained from a condensedconcrete semantics involve the use of the join operation (of the abstract domain) at each iterationin parallel onto all components of rules instead of using several subsequent applications for allcomponents This has a twofold benefit On one side it speeds up convergence of the abstractfixpoint computation On the other side it considerably improves precision

In [2] we developed an automatic debugging methodology for the TRS formalism based onabstract interpretation of the big-step rewriting semantics that is most commonly considered

31

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

in functional programming ie the set of constructor termsnormal forms However theresulting tool was inefficient The main reason for this inefficiency is because the chosen concretesemantics is not condensing and thus because of its accidental high redundancy it causes thealgorithms to use and produce much redundant information at each stage In contrast thesame methodology gave good results in [5] because it was applied to a condensed semantics

The constructor termsnormal forms semantics is not condensed because it contains allpossible rewritings but there are many possible rewritings which can be obtained by someother ones since rewriting is closed under substitution (stability) and replacement (t ETHrarr

R

lowast s

implies C[t]p ETHrarrR

lowast C[s]p) Thus in [1] we tried to directly devise a semantics fully abstract

wrt the big-step rewriting semantics with the specific objective to avoid all redundancy whilestill characterizing the rewritings of any term In particular we searched a semantics which

bull has a compositional goal-independent definitionbull is the fixpoint of a bottom-up constructionbull is as condensed as possible

Unfortunately (in [1]) we just partially achieved this goal since the semantics is defined only forsome classes of TRSs In the meantime for a (quite) different language in [4 3] we obtainedmdashfor the full languagemdasha semantics with the mentioned characteristics by following a differentapproach

1 Define a denotation fully abstract wrt the small-step behavior of evaluation of expres-sions which enjoys the mentioned properties

2 Obtain by abstraction of this small-step semantics a denotation (which enjoys the men-tioned properties) correct wrt the big-step behavior

This approach has the additional advantage that the small-step semantics can be reused alsoto develop other semantics more concrete than the big-step one (for instance semantics whichcan model functional dependencies that are suitable to develop pre-post verification methods)

Unfortunately in the case of the TRS formalism we do not have a suitable small-step se-mantics to start with For Curry we defined the small-step semantics by collecting just themost general traces of the small-step operational semantics which correspond (in our case) tothe rewriting derivations of the terms f(x1 xn) The problem is that we cannot obtainjust from the traces of all f(x1 xn) the rewriting derivations of all (nested) terms withoutusing again (directly or indirectly) the rewriting mechanism In fact usually f(x1 xn) isimmediately a normal form because we cannot instantiate variables however there are manyinstances which can trigger the rules Narrowing [7] can seem a possible solution to this prob-lem but we have an issue related to the interference of non-confluence (ie non-determinism)with non-linearity as shown by this example

Example 11Let us consider the following TRS R

coin rarr Tail Head ne Tail rarr True diff (x)rarr x ne xcoin rarrHead Tail ne Head rarr True

We have rewriting derivations diff (x) ETHrarr x ne x ↛ diff (Head) ETHrarr Head ne Head ↛ diff (Tail) ETHrarrTail ne Tail ↛ while diff (coin)ETHrarrlowast True Moreover we have the narrowing derivation diff (x) ε

x ne x 32

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

Narrowing can instantiate variables (according to rules) but a variable is instantiated with thesame term in all of its occurrences (it would make little sense to do differently for a top-downresolution mechanism) However Example 11 shows that it is not possible to retrieve thatdiff (coin) ETHrarrlowast True from all possible narrowing derivations of diff (x) since the only narrowingderivation (of diff (x)) does not reach True

In this paper we define a variation of narrowing (linearizing narrowing) which admits dif-ferent instances of variables with multiple occurrences With linearizing narrowing we definea denotation fully abstract wrt the small-step behavior of rewriting which enjoys the men-tioned properties for generic TRSs without restrictions The outline to achieve this is thefollowing

bull We gather all linearizing narrowing derivations into trees (Definition 310)bull We show that all possible rewritings can be reconstructed from linearizing narrowing trees(Theorem 314)

bull We define top-down condensed denotations OJRK by collecting just the linearizing nar-rowing trees of most general terms (f(ETHrarrxn)) and we prove that with a suitable semanticevaluation function E we can reconstruct any linearizing narrowing tree starting from

OJRK (Theorem 323)bull By using E we define a (bottom-up) immediate consequence operator whose least fixpointF JRK is equal to OJRK (Theorem 330) Thus from F JRK we can reconstruct all possiblerewritings of R and we have full abstraction wrt the rewriting behavior (Corollary 331)

Note that the proofs of all results are in the appendix

2 Preliminaries

We assume that the reader is familiar with the basic notions of term rewriting For a thoroughdiscussion of these topics see [10] In the paper we use the following notions and notations

We writeETHrarron for the list of syntactic objects o1 on Given a monotonic function F ∶ Lrarr Lover lattice L whose bottom is and lub is ⊔ by F uarrk we denote function λxF k(x) and byF uarrω function λx⊔F k(x)∣k isin N By lfp(F ) we denote the least fixed point of F (and recallthat for a continuos F lfp(F ) = F uarrω)Terms and Substitutions

Σ denotes a signature and V denotes a (fixed) countably infinite set of variables T (ΣV)denotes the terms built over signature Σ and variables V Σ is partitioned in D the definedsymbols (also called operations) and C the constructor symbols (also called data constructors)

T (CV) are called constructor terms The set of variables occurring in a term t is denoted byvar(t) while the sequence (in order) of variables occurring in a term t is denoted by ETHrarrvar(t) Aterm is linear if it does not contain multiple occurrences of any variable LT (ΣV) denotes theset of linear terms

t∣p denotes the subterm of t at position p and t[s]p denotes the result of replacing thesubterm t∣p by the term s

Given a substitution ϑ = x1t1 xntn we denote by dom(σ) and range(σ) the domainset x1 xn and the range set ⋃n

i=1 var(ti) respectively The identity substitution is denotedby ε By tσ we denote the application of σ to t σV denotes the restriction of substitution σto set V sube V σϑ denotes the composition of ϑ and σ ie the substitution st x(σϑ) = (xσ)ϑfor any x isin V Given two substitutions ϑ1 and ϑ2 and two terms t1 and t2 we say that ϑ1

33

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

(respectively t1) is more general than ϑ2 (respectively t2) denoted ϑ1 ⪯ ϑ2 (respectively t1 ⪯ t2)if and only if there exists a substitution σ st ϑ1σ = ϑ2 (respectively t1σ = t2) We denote by≃ the induced equivalence ie ϑ ≃ σ if and only if there exists a renaming ρ st ϑρ = σ (andσρminus1 = ϑ) With σ uarr σprime we indicate the lub (wrt ⪯) of σ and σprime

A substitution ϑ is an unifier for terms t and s if tϑ = sϑ t and s unifyare unifiable whenthere exists a unifier A unifier σ for t and s is a most general unifier denoted as σ =mgu(t s)when σ ⪯ ϑ for any unifier ϑ of t and s

Rewriting

A term rewriting system (TRS for short) R is a set of rules l rarr r where l r isin T (ΣV) var(r) subevar(l) l = f(t1 tn) and f isin D t1 tn are the argument patterns of l rarr r and neednot necessarily be in T (CV) unlike in functional programming where only constructor-basedTRSs are considered (ie with ti isin T (CV)) We denote by RΣ the set of all TRSs defined onsignature Σ

Given TRS R a rewrite step tpETHrarrR

tprime is defined if there are a position p in t l rarr r isin R and

a substitution η with dom(η) sube var(l) such that t∣p = lη and tprime = t[rη]p As usual we omit towrite position p when it is not relevant and omit R when is clear from the context Moreoverwe use ETHrarrlowast to denote the transitive and reflexive closure of the rewriting relation ETHrarr

A term t is called a normal form denoted by t↛ if there is no term s such that tETHrarrlowast sA substitution x1t1 xntn is R-normalized (wrt a TRS R) if all ti are normal forms

(which trivially includes the case when ti isin T (CV))Full Narrowing

In the paper with s≪X we denote a renamed apart variant s of an element belonging to a setof syntactic objects X ie a renaming of variable names of some x isin X that does not containvariables that appear in the context of the definition where s ≪ X is used (this is also calledldquousing fresh variables names in srdquo)

The combination of variable instantiation and rewriting is called narrowing [7] Formally a

(full) narrowing step tσp

Rtprime is defined if there is a position p in t l rarr r ≪R and σ =mgu(t∣p l)

such that t∣p notin V and tprime = (t[r]p)σ In such a case we have that tσpETHrarrR

tprime Again we omit to

write position p when it is not relevant and omit R when is clear from the contextt denotes that there is no term s such that t s

3 Modeling the small-step rewriting behavior

In this section we introduce the concrete semantics which is suitable to model the small-steprewriting behavior In order to formally state such relationship we first need to formally definethe concept of small-step rewriting behavior

Definition 31 (Rewriting behavior) Given t0 isin T (ΣV) and R isin RΣ the small-step rewrit-ing behavior of t0 in R is

BssJt0 in RK ∶= t0 ETHrarrR

t1 ETHrarrR⋯ETHrarrR

tnminus1 ETHrarrR

tn∣forallti isin T (ΣV) (31)

and the small-step rewriting behavior of R is BssJRK ∶= ⋃tisinT (ΣV)BssJt in RK

34

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

This notion of observable behavior induces the definition of TRS equivalence

forallR1 R2 isin RΣR1 asympss R2 ∶lArrrArr BssJR1 K = BssJR2 K (32)

Thanks to the following property we can restrain the check of Bss equivalence of two TRSs tolinear terms Moreover in the sequel we will also restrict our attention only to denotations forlinear terms

Proposition 32 Let R1 R2 isin RΣ Then R1 asympss R2 lArrrArr R1 is a variant of R2 lArrrArr forallt isinLT (ΣV) BssJt in R1 K = BssJt in R2 K

31 The semantic domain

We now define a notion of ldquohypothetical rewritingrdquo which resembles full narrowing [7] butit ldquodecouplesrdquo multiple occurrences of variables This way we maintain the potentiality tochoose different evolutions of the rewritings of redexes once variables are instantiated with nonconstructor terms

The semantic domain of our semantics will be made of trees with all possible derivations ofthis variation of narrowing

311 Linearizing Narrowing

Definition 33 (Term Linearization) Let t isin T (ΣV) r isin LT (ΣV) and σ∶ V rarr V We saythat (r σ) is a linearization of t denoted (r σ) = lin(t) if rσ = t and var(t) sube var(r) Thesubstitution σ will be called delinearizator

If a term is linear then lin(t) = (t ε) while for non-linear terms we can have different possibilities(for instance lin(f(xx)) = (f(x y)yx) = (f(z x)zx) = ) However the followingconstructions which involve linearization are actually independent upon the particular choiceof linearization in the sense that all possible different results are variants (analogously to whathappens for the choice of different mgursquos)

It may be useful to note that a delinearizer σ has one binding for each (further) multipleoccurrence of a variable

Definition 34 (Linearizing Narrowing Derivation) Let t s isin LT (ΣV) and R isin RΣ There

exists a linearizing narrowing step tθp

OcircrArrσR

s if there exist a position p of t l rarr r ≪ R

θprime =mgu(t∣p l) and σ∶ V rarr V such that

t∣p notin V (s σ) = lin(t[rθprime]p) θ = θprimevar(t)We omit to write position p when it is not relevant and omit R when is clear from the context

A sequence t0θ1

OcircrArrσ1

t1 θn

OcircrArrσn

tn is called linearizing narrowing derivation With t0θ

OcircrArrσ

lowast tn we

denote the existence of a linearizing narrowing derivation such that θ = θ1⋯θn and σ = σ1⋯σnNote that in linearizing narrowing derivations we do not apply mgu θ to all reduct (t[r]p)θ asnarrowing does This would not make any difference since terms are kept linear by constructionand thus θ cannot alter the context outside positions being reduced

Linearizing narrowing is correct wrt rewriting (as narrowing is) as proven by the followingtheorem which is the analogous of Theorem 38 of [8] (Theorem 1 of [7]) where we use linearizing

35

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

narrowing instead of narrowing Actually linearizing narrowing is more general than narrowingin the sense that when we have a narrowing derivation then we will surely have a linearizingnarrowing derivation which possibly compute more general instances (in case there are non-linear terms)

Theorem 35 Let R isin RΣ s0 isin LT (ΣV) t0 isin T (ΣV) η0 an R-normalized substitution suchthat t0 = s0η0 and V sub V such that var(s0) cup dom(η0) sube V If t0 ETHrarrlowast tn then there exist a termsn isin LT (ΣV) and substitutions ηn θ σ such that

s0θ

OcircrArrσ

lowast sn tn = snσηn (θηn)V = η0V ηn is R-normalized

where s0θ

OcircrArrσ

lowast sn and t0 ETHrarrlowast tn employ the same rewrite rules at the same positions

Note that while it is always possible to transform rewrite derivations into linearizing narrowingderivations (in the sense of Theorem 35) the opposite does not hold in general as we will showin Example 37 As anticipated we gather all linearizing narrowing derivations (of the sameterm t) into a tree

Definition 36 (Linearizing Narrowing Trees) Let t isin LT (ΣV) A linearizing narrowingtree T for t is a (not necessarily finite) labelled tree which is rooted in t and where

1 paths are linearizing narrowing derivations2 sibling subtrees have the same root terms if and only if their incoming arcs have different

substitutions

We denote with LNTΣ (or simply LNT when clear from the context) the set of all thelinearizing narrowing trees (over Σ) Moreover for any t isin LT (ΣV) we denote with LNTt theset of all linearizing narrowing trees for t

Point 2 ensures that all sibling steps in a linearizing tree are pairwise distinct and thus that wecannot have two different paths of the tree with the same terms and labels

Example 37Consider TRS R of Example 11 The linearizing narrowing tree starting from term diff (x) is

diff (x) x ne x1True

xHead x1Tailε

TruexTa

il x1Head

εε

x1x

This linearizing narrowing derivation diff (x) xHeadx1Tail

OcircOcircOcircOcircOcircOcircrArrx1x

lowast True can be read as if there is a

term t that can rewrite both to Head and Tail then diff (t) rewrites to True Indeed diff (coin)does rewrite to True (a possible rewriting derivation is diff (coin) ETHrarr coin ne coin ETHrarr Head necoin ETHrarr Head ne Tail ETHrarr True)

In this case is not possible to transform these linearizing narrowing derivations into rewritederivations (since diff (x)ETHrarr x ne x↛ as well as diff (t)ETHrarr t ne t↛ for all t isin T (CV))

This example also shows that linearizing narrowing can have longer derivations wrt (stan-dard) narrowing since diff (x) ε

x ne x

36

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

Definition 38 (Variance on LNT) Let t isin LT (ΣV) and T1 T2 isin LNTt We say that T1 andT2 are local variants if there exists a renaming ρ such that T1ρ = T2Two linearizing narrowing trees are local variants if and only if they have the same root t andtheir steps are equal up to renaming of variables which do not occur in t

Note Since the actual choices of local variable names is completely irrelevant from now onwith an abuse of notation by LNT we will actually indicate its quotient wrt localvariance Moreover all linearizing narrowing trees presented in the sequel will actuallybe an arbitrary representative of an equivalence class

Definition 39 (Order on LNT) Let denote with paths(T ) the set of all the paths of T start-ing from the root

Given T1 T2 isin LNT we define T1 ⊑ T2 if and only if paths(T1) sube paths(T2)Given a set T sube LNTt the least upper bound ⊔T is the tree whose paths are ⋃T isinT paths(T )

Dually for the greatest lower bound ⊓It is worth noticing that for any t isin LT (ΣV) LNTt is a complete lattice

By Point 2 of Definition 36 paths is injective thus it establishes an order preserving iso-

morphism (LNTt ⊑) minusminusminusminusminusminusminusminusminusrarrETHrarrlarrlarrETHminusminusminusminusminusminusminusminusminuspaths

prfxtree (paths(LNTt) sube) where the adjoint of paths prfxtree builds

a tree from a set of paths (by merging all common prefixes) So we have two isomorphic rep-resentations of linearizing narrowing trees and in the sequel we can simply write d isin T ford isin paths(T ) The set representation is very convenient for technical definitions while forexamples the tree representation is better suited

Definition 310 (Linearizing Narrowing Tree of a term) Let t isin LT (ΣV) and R isin RΣA linearizing narrowing tree NJt in RK for term t in TRS R is

NJt in RK ∶= d isin LNTt∣d uses rules from RIntuitively NJt in RK denotes the linearizing narrowing behavior of linear term t in TRS Rmodulo local variance (ie local variables are up to renaming)

Example 311Given the following TRS R

m(H (x))rarr d(xK(x)) d(C (x)K (E(y)))rarr f(xx y y)f (A x y F)rarr B(y y) f (E(x) y AA)rarrK(E(y))

The linearizing narrowing tree NJm(x) in RK is

m(x) d(x1K(x2)) f(x3 x4 y y1)B(y y2)

x3Ay1Fy2y

K(E(x4))x3E(x5)

yAy1A

ε

x1C(x3)x2E(y)

x4x3 y1y

xH(x1)

x2x1

Linearizing narrowing trees ldquocapturerdquo the behavioral TRS equivalence asympss since the TRSequivalence induced by N coincides with asympss

Theorem 312 Let R1 R2 isin RΣ Then R1 asympss R2 if and only if for every t isin LT (ΣV)NJt in R1 K =NJt in R2 K

37

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

Even more from linearizing narrowing trees we can completely reconstruct the small-steprewriting behavior To formally prove this we need to introduce the following operation to buildrewriting derivations from linearizing narrowing derivations

Definition 313 Let R isin RΣ and d = s0 θ1OcircrArrσ1

s1θ2OcircrArrσ2

θnOcircrArrσn

sn be a linearizing narrowing deriva-

tion The linear narrowing to rewriting operator is defined as

lfloordrfloor ∶= t0 ETHrarr t1 ETHrarr tk ∣ ξ is an R-normalized substitution 0 le k le nη = θ1 uarr σ1 uarr uarr θk uarr σk forall0 le i le k ti = siηξ (33)

We abuse notation and lift lfloorsdotrfloor also to sets as lfloorSrfloor ∶= ⋃disinSlfloordrfloorIntuitively this operation takes a prefix d of a linear narrowing derivation and if it can simulta-neously satisfy all its computed answers and delinearizators with substitution η then it buildsa rewriting sequence by applying ηξ to all terms of d for any R-normalized substitution ξ

Theorem 314 Let R isin RΣ and t isin LT (ΣV) Then BssJt in RK = lfloorNJt in RKrfloorHence NJt inRK is indeed a condensed representation of BssJt inRK Now the next step for theconstruction of a semantics with the desired characteristics is to achieve compositionality Todo so we should look for a denotation for most general terms f (ETHrarrxn) (of a TRS R) which couldbe used to retrieve with suitable semantic operations NJt in RK for any t isin LT (ΣV)32 Operational denotations of TRSs

The operational denotation of a TRS can be defined as an interpretation giving meaning to thedefined symbols over linearizing narrowing trees ldquomodulo variancerdquo Essentially we define thesemantics of each function in D over formal parameters (whose names are actually irrelevant)

Definition 315 (Interpretations) Let MGTD ∶= f (ETHrarrxn) ∣ fn isin D ETHrarrxn are distinct variablesTwo functions I J ∶MGTD rarr LNTΣ are (global) variants denoted by I cong J if for each

π isinMGTD there exists a renaming ρ such that (I(π))ρ = J(πρ)An interpretation is a function I ∶MGTD rarr LNTΣ modulo variance2 such that for every

π isinMGTD I(π) is a linearizing narrowing tree for πThe semantic domain IΣ (or simply I when clear from the context) is the set of all inter-

pretations ordered by the pointwise extension of ⊑The partial order on I formalizes the evolution of the computation process (I ⊑) is a completelattice and its least upper bound and greatest lower bound are the pointwise extension of ⊔and ⊓ respectively In the sequel we abuse the notations for LNT for I as well The bottomelement of I is I ∶= λππ (for each π isin MGTD) In the sequel we abuse the notations forLNT for I as well

It is important to note that MGTD (modulo variance) has the same cardinality of D (andis then finite) and thus each interpretation is a finite collection (of possibly infinite elements)Hence we will often explicitly write interpretations by cases like

I ∶=⎧⎪⎪⎪⎪⎨⎪⎪⎪⎪⎩

π1 ↦ T1

πn ↦ Tn

for

I(π1) ∶= T1⋮

I(πn) ∶= Tn2ie a family of elements of LNTΣ indexed by MGTD modulo variance

38

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

In the following any I isin I is implicitly considered as an arbitrary function MGT rarr LNT

obtained by choosing an arbitrary representative of the elements of I in the equivalence classgenerated by cong Actually in the sequel all the operators that we use on I are also independentof the choice of the representative Therefore we can define any operator on I in terms of itscounterpart defined on functions MGT rarr LNT

Moreover we also implicitly assume that the application of an interpretation I to a specificπ isin MGT denoted by I(π) is the application I(π) of any representative I of I which is

defined exactly on π For example if I = (λf (x y) f(x y) xc(z)

OcircOcircOcircrArrε

c(y z))congthen I(f(u v)) =

f(u v) uc(z)

OcircOcircOcircrArrε

c(v z)While defined symbols have to be interpreted according to TRS rules constructor symbols

are meant to be interpreted as themselves In order to treat them as a generic case of functionapplication we assume that any interpretation I is also implicitly extended on constructors asI(c(ETHrarrxn)) ∶= c(ETHrarrxn) In the sequel we will use ϕ when we refer to a generic (either constructoror defined) symbol whence f for defined symbols and c for constructor ones

Definition 316 (Operational denotation of TRSs) Let R isin RΣ Then the operationaldenotation of R is

OJRK ∶= (λf (ETHrarrxn) NJf(ETHrarrxn) in RK)cong

(34)

Intuitively O collects the linearizing narrowing tree of each f (ETHrarrxn) in R abstracting from theparticular choice of the variable names ETHrarrxn

Example 317The operational denotation of TRS R of Example 11 is

OJRK =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

coin ↦ coin

Tail

Head

εεεε

x ne y ↦ x ne yTrue

True

xTail yH

ead

εxHead yTailε

diff (x)↦ diff (x) x ne x1True

True

ε

x1x

xHead x1T

ail

εxTail x

1Headε

The (small-step) rewriting behavior of any term t can be ldquoreconstructedrdquo from OJRK bymeans of the following evaluation function E 321 Evaluation Function

When we have the interpretation with the linearizing narrowing tree of f (ETHrarrxn) we can easily

reconstruct the rewriting behavior of any f (ETHrarrtn) for (renamed apart)

ETHrarrtn isin LT (CV) by sim-

ply replacing the most general bindings along a derivation with constructor terms ti (clearly

39

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

pruning branches with inconsistent instances) However with non-constructor nested termsthings gets more involved In practice we have an interleaving of parts of all sub-derivationscorresponding to the evaluation of arguments leaded by the derivation of f (ETHrarrxn) Intuitively thebasic building block of our proposal is the definition of a semantics embedding operation thatmimics parameter passing Namely taken two linearizing narrowing trees T1 T2 and a variablex of (the root of) T1 the tree-embedding operation T1[xT2] transforms T1 by modifying itssteps accordingly to steps of T2 which provides specific actual parameter values to x in placeswhere x in T1 was originally ldquofreelyrdquo instantiated

In order to define T1[xT2] we need to introduce an auxiliary (technical) relation whichworks on single derivations Note that in the sequel to shorten definitions when we adornlinearizing narrowing derivations or trees with a term s like ds or Ts we mean that the headof ds or the root of Ts is term s

Definition 318 Let π isin LT (ΣV) dg be a linearizing narrowing derivation with head g andTb isin LNTb Then dgπTb ⊢ d is the least relation that satisfies the rules

dtπTs ⊢ tmicromicro = larrETHETHmgu(s π) (35a)

dtπTsprime ⊢ d

dtπTs ⊢ tmicroθq

OcircrArrσ

dmicro = larrETHETHmgu(s π) s

θp

OcircrArrσ

Tsprime isin Ts existq s∣p = tmicro∣q (35b)

dt0 π0Ts0 ⊢ dt1 dtn πnTsn ⊢ dtn+1

(t θp

OcircrArrσ

dt0)πTs0 ⊢ tmicro θprimep

OcircrArrσprimeprime

dtn+1

micro = larrETHETHmgu(s0 π)θprime = larrETHETHmgu(tmicro tθ)var(tmicro) x1y1 xnyn = proj (var(πθ) σ)Ts1 Tsn ≪ Ts0

π0 = πθ foralli isin 1 n πi = π0yixiforallj isin 0 n ETHrarrvj =ETHrarrvar(sj)

σprimeprime = (σ cup

n

⋃i=1

ETHrarrvi ETHrarrv0)var(tn+1)

(35c)

where

bull proj (Vσ) = xy isin σ ∣ y isin V bulllarrETHETHmgu(t s) is an mgu θ of t and s such that forallx isin var(t) xθ isin V

Broadly speaking the role of π in a statement dtπTs ⊢ d is that of the ldquoparameter patternrdquoresponsible to constrain ldquofreelyrdquo instantiated formal parameters in dt to the actual parametersvalues which are actually ldquocomingrdquo from Ts More specifically Rules 35 govern the inlaying ofthe steps of a linearizing narrowing tree Ts into a derivation dt In particular

bull The axiom 35a stops any further possible inlayingbull The rule 35b considers the case when we want to proceed with an inner linearizingnarrowing step employing a step coming from Ts In this case t plays the role of contextand the inner step is done accordingly to the one chosen from Ts Note that is it possibleto do the step only if exists q such that s∣p = tmicro∣q Namely the defined symbol over whichthe step is done needs to be ldquovisiblerdquo in tmicro

bull The rule 35c considers the case when we want to do an outermost step First the stephas to be compatible with the way we instantiated t so far namely exists mgu(tmicro tθ)Then we choose from σ only the delinearizers that depend on the variable from whichwe started the embedding Each of these delinearizer comes from the linearization of amultiple occurrence of a same variable z Thus for each rename zprime of z we sequentiallyembed into zprime a (possibly different) sub-derivation coming from a renamed apart variant of

40

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

Ts Note that if we would not have multiple occurrences of z (ie proj (var(πθ) σ) = empty)the rule would simply be

dt0 π0Ts0 ⊢ dt1(t θpOcircrArr

σ

dt0)πTs0 ⊢ tmicro θprimepOcircrArrσ

dt1

micro = larrETHETHmgu(s0 π) θprime = larrETHETHmgu(tmicro tθ)var(tmicro)

π0 = πθ

Note that in Rules 35 we use a selected form of mgu (ie larrETHETHmgu which does not rename variablesin the left argument) in order to avoid to change variable names along the way

Example 319Consider OJRK of Example 317 Let Tcoin ∶= OJRK(coin) and d0 ∶= diff (x) ε

OcircOcircrArrx1x

d1 isinOJRK(diff (x)) where d1 = x ne x1 xHeadx1Tail

OcircOcircOcircOcircOcircOcircOcircrArrε

True

Let us build a proof tree to find a derivation d such that d0xTcoin ⊢ d We have to startwith an application of rule (35c) which (in this case) has two premises since the delinearizatorx1x in the first step of d0 has one binding The first subtree which embeds the Head branchof Tcoin into x is

(35a)TrueHead Head ⊢ True

(35c)d1xHead ⊢ Head ne x1 x1Tail

OcircOcircOcircrArrε

True(35b)

d1xTcoin ⊢ coin ne x1 ε

OcircrArrε

Head ne x1 x1Tail

OcircOcircOcircrArrε

True

acutesup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1cedilsup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1parad3

(PT)

Now we can build the full proof tree (by building the second subtree which starting from d3can finish to embed the Tail branch of Tcoin into x1)

(PT)

(35a)TrueTail Tail ⊢ True

(35c)d2 x1Tail ⊢ Head ne Tail ε

OcircrArrε

True(35b)

d2 x1Tcoin ⊢ Head ne coin ε

OcircrArrε

Head ne Tail ε

OcircrArrε

True(35c)

d3 x1Tcoin ⊢ coin ne coin ε

OcircrArrε

Head ne coin ε

OcircrArrε

Head ne Tail ε

OcircrArrε

True(35c)

d xTcoin ⊢ diff (coin) ε

OcircrArrε

coin ne coin ε

OcircrArrε

Head ne coin ε

OcircrArrε

Head ne Tail ε

OcircrArrε

True

We have analogous proof tree for d xTcoin ⊢ diff (coin) ε

OcircrArrε

coin ne coin ε

OcircrArrε

Tail ne coin ε

OcircrArrε

Tail neHead

ε

OcircrArrε

True In total we have ten possible proof trees four of whom that have derivations

which reach True

Tree-embedding is simply defined by collecting all contributes of dxT ⊢ dprime

Definition 320 (Tree-embedding) Let Tg isin LNTg and Tb isin LNTg such that

1 Tg and Tb do not share any local variable2 x is a variable which does not occur in Tb

Then the tree-embedding operation Tg[xTb] is defined as Tg[xTb] ∶= d∣dg isin Tg dgxTb ⊢ d41

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

The evaluation function is obtained by repeated application of tree-embedding

Definition 321 (Evaluation Function) Let t isin LT (ΣV) and I isin I The evaluation of twrt I denoted E JtKI is defined by induction on the structure of t as follows

E JxKI ∶= x (36a)

E Jϕ(ETHrarrtn)KI ∶= I(ϕ(ETHrarrxn))[x1 E Jt1KI ] [xn E JtnKI ] ETHrarrxn renamed apart distinct (36b)

Example 322Consider OJRK of Example 317 The evaluation of E Jdiff (coin)KOJRK is

E Jdiff (coin)KOJRK = [ by Equation (36b) with n = 1 ]OJRK(diff (x))[x E JcoinKOJRK] = [ by Equation (36b) with n = 0 ]OJRK(diff (x))[xOJRK(coin)]

Then by completing what shown in Example 319 we have that E Jdiff (coin)KOJRK is

diff (coin)

diff (Head)Head ne Head

εεε

ε

coin ne coin

Head ne coinHead ne Head

εε

Head ne Tail Trueεεε

ε

εε

Tail ne coinTail ne Head True

εε

εε

Tail ne Tailεε

εε

coin ne HeadHead ne Head

εε

Tail ne Head Trueεεε

ε

εε

coin ne TailHead ne Tail True

εε

εε

Tail ne Tailεε

εε

εε

diff (Tail)Tail ne Tail

εε

εε

322 Properties of the TRS operational denotation

The following result states formally that from OJRK the evaluation function E can reconstructthe linearizing narrowing tree of any linear term

Theorem 323 For all R isin RΣ and t isin LT (ΣV) E JtKOJRK =NJt in RK

A straightforward consequence of Theorems 323 and 312 is

Corollary 324 For all R1 R2 isin RΣ OJR1 K = OJR2 K if and only if R1 asympss R2

Thus semantics O is fully abstract wrt asympss

33 Fixpoint denotations of TRSs

We will now define a bottom-up goal-independent denotation which is equivalent to O and thus(by Corollary 324) adequate to characterize the small-step behavior for TRSs It is definedas the fixpoint of an abstract immediate operator over interpretations P JRK This operatoris essentially given in terms of evaluation E of right hand sides of rules Namely given aninterpretation I it essentially consists in

42

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

bull building an initial linearizing narrowing step for a most general term according to rulesrsquoleft hand side

bull applying the evaluation operator E to the right hand side of the rule over I Definition 325 Let R isin RΣ P JRK∶ I rarr I is defined for all f isin D (of arity n) as

P JRKI (f(ETHrarrxn)) ∶=⊔f(ETHrarrxn) θ

OcircrArrσ

E JrprimeKI ∣ f(ETHrarrxn)θ rarr r ≪R

(rprime σ) = lin(r) (37)

Moreover we define our fixpoint semantics as F JRK ∶= lfp P JRK

F JRK is well defined since P JRK is continuous

Proposition 326 Let R isin RΣ Then P JRK is continuous

Example 327Let us consider the (artificial) TRS R ∶= g rarr f(h(a)) h(a) rarr h(b) f (h(b)) rarr a taken from[1] which is neither constructor-based nor confluent The evaluation of the right hand sidesof all rules is E Jf(h(a))KI = I(f(x))[x E Jh(a)KI ] = f(x)[xh(a)] = f(h(a)) E Jh(b)KI =h(x)[xb] = h(b) and E JaKI = a Hence

I1∶= P JRKuarr1 =

⎧⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎩

g ↦ g f(h(a))εε

h(x)↦ h(x) h(b)xa

ε

f(x)↦ f(x) axh(b)

ε

In the next iteration we have to evaluate E Jf(h(a))KI1= I

1(f(x))[x E Jh(a)KI

1] Since E Jh(a)KI

1=

I1(h(x))[x E JaKI

1] = h(a) ε

OcircrArrε

h(b) we have

P JRKuarr2 =⎧⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎩

g ↦ g f(h(a)) f(h(b)) aεε

εε

εε

h(x)↦ h(x) h(b)xa

ε

f(x)↦ f(x) axh(b)

ε

Now since P JRKuarr3 = P JRKuarr2 this is also the fixpoint F JRK

Example 328Consider TRS R of Example 11 The iterates of P JRK are

P JRKuarr1 =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

coin ↦ coin

Tail

Head

εεεε

x ne y ↦ x ne yTrue

True

xTail yH

ead

εxHead yTailε

diff (x)↦ diff (x) x ne x1ε

x1x

43

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

P JRKuarr2 =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

coin ↦ coin

Tail

Head

εεεε

x ne y ↦ x ne yTrue

True

xTail yH

ead

εxHead yTailε

diff (x)↦ diff (x) x ne x1True

True

ε

x1x

xHead x1T

ail

εxTail x

1Headε

Now since P JRKuarr3 = P JRKuarr2 this is also the fixpoint F JRK

Example 329Let us consider the TRS R ∶= zeros rarr ∶(0 zeros) take(0 x) rarr nil take(s(n) ∶(y z))) rarr∶(y take(n z)) f (n)rarr take(n zeros) The first two iterates of P JRK are

P JRKuarr1 =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

zeros ↦ zeros ∶(0 zeros)εε

take(x1 y1)↦ take(x1 y1 )

nil

x10

ε ∶(y0 take(x0 z))

x1s(x

0)y1 ∶(y

0 z)ε

f(x0)↦ f(x0) take(x0 zeros)εε

P JRKuarr2 =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

zeros ↦ zeros ∶(0 zeros) ∶(0 ∶(0 zeros))εε

εε

take(x2 y2)↦ take(x2 y2 )

nil

x20

ε ∶(y1 take(x1 z1))∶(y1nil)

εε ∶(y1 ∶(y0 take(x0 z0)))

x1s(x

0)z1 ∶(y

0 z0)

ε

x2s(x

1)y2 ∶(y

1 z1)ε

f(x1)↦ f(x1)

take(x1 zeros)

nil

x10

ε

take(x1 ∶(0 zeros))

nil

x10

ε

∶(0 take(x0 zeros))x

1s(x0)

ε

εε

εε

Note that to highlight the construction order of the various subtrees we used indices in variablesnames that respect the order of introduction and boxed the subtrees which correspond to the

44

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

previous iterate By continuing the computation of the iterates we obtain

F JRK =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

zeros ↦ zeros ∶(0 zeros) ∶(0 ∶(0 zeros))εε

εε

take(x y)↦ take(x y)

nil

x0

ε ∶(yprime take(xprime z))∶(yprimenil)

εε ∶(yprime ∶(yprimeprime take(xprimeprime zprime)))

x primes(x primeprime)z ∶(y primeprime z prime)ε

xs(x prime)y ∶(y prime z)ε

f(x)↦ f(x)

take(x zeros)

nil

x0

ε

take(x ∶(0 zeros))nil

x0

ε

take(x ∶(0 ∶(0 zeros)))εε ∶(0 take(xprime zeros))

∶(0nil)xprime 0

ε

∶(0 take(xprimeprime ∶(0 zeros)))

x primes(x primeprime)

ε

xs(x prime)ε

εε

εε

We can observe that since terms in R are linear the linearizing narrowing trees have justε as delinearizers and actually they are isomorphic to full narrowing trees

331 Properties of the TRS fixpoint denotation

The top-down goal-dependent denotation O and the bottom-up goal-independent denotationF are actually equivalent

Theorem 330 (Equivalence of denotations) Let R isin RΣ Then OJRK = F JRK

A straightforward consequence of Theorem 330 and Corollary 324 is

Corollary 331 (Correctness and full abstraction of F ) Let R1 R2 isin RΣ Then F JR1 K =F JR2 K if and only if R1 asympss R2

4 Conclusions

We have presented a condensed compositional bottom-up semantics for the full class of termrewriting systems which is fully abstract wrt the small-step behavior of rewriting

We are going to use this semantics to define by abstraction a condensed bottom-up se-mantics for the full class of term rewriting systems which is fully abstract wrt the big-stepbehavior of rewriting and thus suitable for semantic-based program manipulation tools Actu-ally we have developed a first proposal of such a semantics (by following this approach) but

45

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

restricted to the class of left-linear TRSs We already used it to develop a semantics-basedautomatic specification synthesis prototype [6] which is giving promising results

However we believe that our notion of linearized narrowing which differently from nar-rowing represents faithfully the small-step behavior of rewriting (in a compact way) could beinteresting for other applications as well

References

[1] M Alpuente M Comini S Escobar M Falaschi and J Iborra A Compact Fixpoint Semanticsfor Term Rewriting Systems Theoretical Computer Science 411(37)3348ndash3371 2010

[2] M Alpuente M Comini S Escobar M Falaschi and S Lucas Abstract Diagnosis of FunctionalPrograms In M Leuschel editor Logic Based Program Synthesis and Transformation ndash 12th

International Workshop LOPSTR 2002 Revised Selected Papers volume 2664 of Lecture Notes

in Computer Science pages 1ndash16 Berlin 2003 Springer-Verlag

[3] G Bacci An Abstract Interpretation Framework for Semantics and Diagnosis of Lazy Functional-

Logic Languages PhD thesis Dipartimento di matematica e Informatica Universita di Udine2011

[4] G Bacci and M Comini A Fully-Abstract Condensed Goal-Independent Bottom-Up FixpointModeling of the Behaviour of First Order Curry Submitted for Publication 2012

[5] M Comini G Levi M C Meo and G Vitiello Abstract Diagnosis Journal of Logic Program-

ming 39(1-3)43ndash93 1999

[6] M Comini and L Torella TRSynth a Tool for Automatic Inference of Term Equivalence inLeft-linear Term Rewriting Systems In E Albert and S-C Mu editors PEPM rsquo13 Proceedings

of the ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation pages 67ndash70Acm 2013

[7] J-M Hullot Canonical Forms and Unification In Proceedings of the 5th International Conference

on Automated Deduction volume 87 of Lecture Notes in Computer Science pages 318ndash334 Berlin1980 Springer-Verlag

[8] A Middeldorp and E Hamoen Completeness results for basic narrowing Applicable Algebra in

Engineering Communication and Computing 5213ndash253 1994 101007BF01190830

[9] H R Nielson and F Nielson Infinitary Control Flow Analysis a Collecting Semantics for ClosureAnalysis In Symposium on Principles of Programming Languages pages 332ndash345 1997

[10] TeReSe editor Term Rewriting Systems Cambridge University Press Cambridge UK 2003

A Technical Proofs

Proof of Proposition 32

Point 1 Implication lArrOcirc is straightforward We prove OcircrArr by reduction to absurd Supposethat R1 asympss R2 and R1 is not a variant of R2 Then there is at least one rule which isdifferent in R1 wrt R2 (or vice versa) Thus by Equation (31) we can have rewritingsteps which employ that rule in BssJR1 K which cannot be in BssJR2 K which is absurd

Point 2 Similarly to previous point but restricting to initial linear terms

In the sequel we use the following results

46

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

Proposition A1 ([8]) Suppose we have substitutions θ ρ ρprime and sets A B of variables suchthat (B minus dom(θ)) cup range(θ) sube A If ρA = ρprimeA then (θρ)A = (θρprime)AProposition A2 ([8]) Let R be a TRS and suppose we have substitutions θ ρ ρprime and setsA B of variables such that the following conditions are satisfied

ρA R-normalized θρprimeA = ρA B sube (A minus dom(θ)) cup range(θA)Then ρprimeB is also R-normalized

Proof of Theorem 35 We prove the thesis by induction on the length of the rewriting derivationfrom t0 to tn The case of length zero is straightforward

Suppose t0 ETHrarr t1 ETHrarr ETHrarr tn is a rewriting derivation of length n gt 0 We may assumewithout loss of generality that var(l) cap V = empty We have (s0η0)∣p = s0∣pη0 = τ l for somesubstitution τ with dom(τ) sube var(l) Let micro ∶= τ cup η0 We have s0∣pmicro = s0∣pη0 = lτ = lmicro so s0∣pand l are unifiable Let θprime

1∶= mgu(s0∣p l) and θ1 ∶= θprime1var(s0∣p) Clearly dom(θ1) cup range(θ1) sube

var(s0∣p) cup var(l) Moreover there exists a substitution ψ such that

θ1ψ = micro (1)

Now let (s1 σ1) ∶= lin(s0[rθprime1]p) By Definition 34

s0θ1p

OcircOcircrArrσ1 lrarrr

s1 (2)

Let V1 ∶= (V minus dom(θ1)) cup range(θ1) cup dom(σ1) andη1 ∶= (σ1ψ)V1

(3)

Clearly dom(η1) sube V1 We have var(s1) = dom(σ1)cup var(s0[rθ1]p) sube dom(σ1)cup var(s0[lθ1]p) =dom(σ1) cup var(s0θ1) sube V1 Therefore var(s1) cup dom(θ1) sube V1 By (1) and (3) we have s1σ1η1 =s1σ1ψ = s0[rθ1]pψ = s0[r]pθ1ψ = s0[r]pmicro = s0micro[rmicro]p Since V cap dom(τ) = empty we have

microV = η0V (4)

Likewise microvar(r) = η0var(r) Hence s0micro[rmicro]p = s0η0[rτ]p = t0[rτ]p = t1 Thust1 = s1σ1η1 (5)

Next we have to verify that (θ1η1)V = η0V By (3) and by Proposition A1 we have that(θ1η1)V = (θ1σ1ψ)V By (1) and (4) (θ1η1)V = (θ1σ1ψ)V Since dom(σ1) notin V we havethat (θ1σ1ψ)V = (θ1ψ)V = microV = η0V Thus

(θ1η1)V = η0V (6)

Now we show that η1 is R-normalized Since dom(η1) sube V1 it suffices to show that η1V1isR-normalized Let B ∶= (V minusdom(θ1))cuprange(θ1V ) Proposition A2 yields the normalization

of η1B Recall that range(θ1) sube var(s0∣p) cup var(l) Let x isin range(θ1) since θ1 is idempotentclearly x notin dom(θ1) If x isin var(s0∣p) sube V then x isin V minus dom(θ1) sube B If x isin var(l) thenx isin var(lθ1) = var(s0∣pθ1) thus x isin range(θ1V ) sube B Thus range(θ1) sube B and then V1 =B cup dom(σ1) By this and (3) since η1B is R-normalized η1V1

is R-normalized as well

47

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

By inductive hypothesis we have a term sn and substitutions θprime σprime and ηn such that

s1θprimeOcircrArrσprime

lowast sn (7)

tn = snσprimeηn (8)

(θprimeηn)V1= η1V1

(9)

ηn is R-normalized (10)

Moreover s1θprimeOcircOcircrArr

σprimeR

lowast sn and t1 ETHrarrR

lowast tn apply the same rewrite rules at the same positions

Let θ ∶= θ1θprime and σ = σ1σprime By (2) and (7) we obtain s0θ

OcircrArrσ

lowast sn By construction this

narrowing derivation makes use of the same rewriting rules at the same positions as the rewritingderivation t0 ETHrarr

R

lowast tn It remains to show that (θηn)V = η0V By (9) and Proposition A1

(θ1θprimeηn)V = (θ1η1)V Therefore by (6) (θηn)V = (θ1η1)V = η0V Proof of Theorem 312 We prove OcircrArr by reduction to absurd Suppose that R1 asympss R2 andexistt isin LT (ΣV) NJt in R1 K neNJt in R2 K This means that there is at least one derivation whichbelongs to NJt in R1 K and not to NJt in R2 K (or vice versa) Hence there is at least a rulewhich is not in common to the two programs Thus R1 asympss R2 which is absurd

We prove lArrOcirc by reduction to absurd Suppose that forallt isin LT (ΣV) NJt inR1 K =NJt inR2 Kand R1 asympss R2 Then there is at least one rule which is different in R1 wrt R2 Thus byEquation (31) and Theorem 35 NJt in R1 K neNJt in R2 K which is absurd

Proof of Theorem 314 We prove the two inclusions separately Inclusion supe is immediate byDefinition 313

Inclusion sube is proved by reduction to absurd Assume that there exists a derivation t0 ETHrarrR

lowast tn

such that it does not belong to lfloorNJt0 inRKrfloor Then by Theorem 35 taken η0 = ε there exists arelaxed narrowing derivation of the form s0

θ1

OcircrArrσ1

θn

OcircrArrσn

sn Note that for each i isin 1n θi andσi are just renaming ηi = ε and ti = siσi σ0 Let η ∶= η0 = ε It is easy to see that there existsηprime such that ηprime = θ1 uarr σ1 uarr uarr θn uarr σn By Definition 313 there exists a rewriting derivationtprime0ETHrarrR

lowast tprimen where tprimei = siηprime for each i isin 1n Moreover dom(σk) isin var(si) for each k isin i+ 1nand θi = (σj)dom(θi) or θi = (σj)dom(θi) for some j Hence siη

prime = siσi σ0 Thus tprimei = ti foreach i isin 1n which is absurd

Lemma A3 Let R a TRS x isin V and t s isin T (ΣV) such that they do not share variables andx isin t x isin s Then NJt in RK[xNJs in RK] =NJtxs in RK

Proof It is sufficient to prove that given dt isin NJt in RK and Ts = NJs in RK if dtxTs ⊢ dthen d isin NJtxs in RK To this aim we will prove a stronger result let π isin T (CV) letTs = NJs in RK and for any dt isin NJt in RK such that dtπTs ⊢ d then d isin NJtη in RK whereη =larrETHETHmgu(s π) We proceed by structural induction on the proof tree

rule 35a) straightforward

rule 35b) By inductive hypothesis dtπTsprime ⊢ dtmicro lArrrArr dtmicro isinNJtmicro inRK If it exists dtmicro then

tmicro∣p = s∣p Moreover existmicroprime such that microprime = larrETHETHmgu(sprime π) and tmicroprime∣p = sprime∣p Thus tmicroθp

OcircrArrσ

dtmicro isinNJtmicro in RK

48

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

rule 35c) By inductive hypothesis we have that dt0 π0Ts0 ⊢ dt1 lArrrArr dt1 isin NJtmicro0 inRK dtn πnTsn ⊢ dtn+1 lArrrArr dtn+1 isin NJtmicron in RK where micro0 = larrETHETHmgu(s0 π0) micron =larrETHETHmgu(sn πn) We know that exists a linearizing narrowing step t

θp

OcircrArrσ

t0 where θ2 =mgu(t∣p l) θ = θ2var(t) (s σ) = lin(rθ2) tmicro = t[s]p We need to prove that it exists the

linearizing narrowing step tmicroθprimep

OcircrArrσprimeprime

tn+1 Since it exists mgu(t∣p l) and mgu(tmicro tθ) thenit exists θ3 such that θ3 = mgu((tmicro)∣p l) Now let θprime ∶= θ3var(tmicro) and (sprime σprime) = lin(rθ3)then tmicro[sprime]p = t Let us observe that t1 = t0micro0 t2 = t0micro0micro1 tn+1 = t0micro0 micron wheremicro0 =larrETHETHmgu(s0 π0) micron =larrETHETHmgu(sn πn) Let microlowast = micro0 micron then tn+1 = t0microlowast = tmicrolowast[smicrolowast]p =tmicro[smicrolowast]p = t

Proof of Theorem 323 We proceed by structural induction on term t

t = x Immediate by Equation (36a)

t = ϕ(ETHrarrtn)

E Jϕ(ETHrarrtn)KOJRK =[ by Equation (36b) ]

= OJRK(ϕ(ETHrarrxn))[x1 E Jt1KOJRK] [xn E JtnKOJRK] =[ by inductive hypothesis ]

=NJϕ(ETHrarrxn) in RK[x1NJt1 in RK] [xnNJtn in RK] =[ by Lemma A3 ]

=NJϕ(ETHrarrtn) in RK

Proof of Proposition 326 It is straightforward to prove that P JP K is monotone and finitarythus it is continuous

Proof of Theorem 330 We prove the two inclusions separately

⊑) Let indicate with Ok all derivations of OJRK with length le k by induction we prove thatforallk Ok ⊑ P JRKuarrk

k = 0) immediate

k gt 0) foralld isin Ok we have that d = f(x) θΛ

OcircrArrσ

dprime such that (by Theorem 323) dprimet isin E JtKOkminus1

Thus by monotonicity of E we have that dprimet isin E JtKP JRKuarrkminus1 By the definition of P d isin P JP KP JRKuarrkminus1 = P JRKuarrk

Thus by Proposition 326 OJRK = ⊔kge0Ok ⊑ ⊔kge0P JRKuarrk = F JRK

⊒) We need to prove that f(ETHrarrxn) θΛ

OcircrArrσ

E JrprimeKOJRK ⊑NJf(ETHrarrxn) inRK By Theorem 323 E JrprimeKOJRK

is a linearizing narrowing tree Since θ = mgu(f(ETHrarrxn l))ETHrarrxnand (σ rprime) = lin(r) we can

conclude that f(ETHrarrxn) θΛ

OcircrArrσ

E JrprimeKOJRK ⊑NJf(ETHrarrxn) in RK

49

Logical and Algebraic Views of a Knot Fold of a

Regular Heptagon

Fadoua Ghourabi1 Tetsuo Ida2 and Kazuko Takahashi1

1 Kwansei Gakuin University Japanghourabikwanseiacjp ktkakwanseiacjp

2 University of Tsukuba Japanidai-eosorg

Abstract

Making a knot on a rectangular origami or more generally on a tape of a finite lengthgives rise to a regular polygon We present an automated algebraic proof that makingtwo knots leads to a regular heptagon Knot fold is regarded as a double fold operationcoupled with Huzitarsquos fold operations We specify the construction by describing thegeometrical constraints on the fold lines to be used for the construction of a knot Thealgebraic interpretation of the logical formulas allows us to solve the problem of howto find the fold operations ie to find concrete fold lines The logical and algebraicframework incorporated in a system called Eos (e-origami system) is used to simulate theknot construction as well as to prove the correctness of the construction based on algebraicproof methods

1 Introduction

From the early history of mathematics the correspondence between geometry and algebra hasbeen recognized and has been the subject of constant study In some sense ancient geometrywas a mother of algebra In particular solving algebraic equations has been related to therealm of Euclidean geometry Early mathematicians notably Khawarizmi and Khayyam gavegeometrical meanings to the solutions of equations Khayyamrsquos insight was that solutions ofcertain cubic equations are points of intersections of conic sections [1] Seven centuries laterafter freeing algebra from geometrical thinking Wantzel proved that solving cubic solutionsis impossible by Euclidean tools ie compass and straightedge [2] Further tools have beeninvented and used to perform constructions that are impossible by Euclidean tools

Paper folding ie origami allows solving cubic equations and hence geometrical construc-tions such as trisection of an arbitrary angle or a regular heptagon are realizable Given anorigami paper what we can do by hand is to construct creases and points The creases areconstructed by folding the paper along the lines which we call fold lines The points are con-structed by the intersection of lines Huzita presented a set of fold operations (known also asHuzitarsquos axioms in literature) with which he showed how to obtain fold lines [3] Huzitarsquos foldoperations are simple to perform by hand but powerful enough to solve cubic equations [4]

The geometrical construction of a regular heptagon has a unique history in that it belongsto the famous classical impossible problems by Euclidean tools Using paper folding the con-struction was shown to be possible In this paper we show another method of constructing aregular heptagon based on an extension of Huzitarsquos fold operations by introducing knottingThe constructions of regular n-gons (in particular of regular pentagon and heptagon) by makingknots have not been rigorously specified and the observation that their constructions purportto problems of solving geometrical constraints is missing

50

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

We investigate the geometrical constraints of the knot fold towards constructions of regu-lar polygons and proofs of the correctness of these constructions The knot fold operation isspecified by an existentially quantified formula of the first-order predicate logic The formulais then translated into a set of algebraic equalities and disequalities which then are solved byspecialized solvers based on Grobner basis theory andor CAD (Cylindrical Algebraic Decom-position) We have developed a computational origami system called Eos [5] using computeralgebra system Mathematica In brief it is an e-origami system which allows us to do virtualorigami It has capabilities of constructing and visualizing origami geometrical objects alge-braically analyzing origami folds and proving the correctness of origami constructions Eos

supports Huzitarsquos fold operations and has been extended to include multi-fold operations Weuse Eos to assist us with our mathematical study of the knot fold

The rest of the paper is organized as follows In Sect 2 we give the notations that we useIn Sect 3 we present Huzitarsquos fold operations and their extensions In Sect 4 we explain thegeometrical properties of the knot fold The construction of regular heptagon by Eos is shownin Sect 5 and its formal and algebraic proof is discussed in Sect 6 In Sect 7 we summarizeour results and point out a direction of further research

2 Notations

In this paper we restrict the use of geometrical objects to points segments and lines Pointsare denoted by a single capital letter of the Latin alphabet eg A B C D X Y etc Linesare denoted by m n t u and v Let X and Y be two points then XY denotes the line passingthrough points X and Y For brevity we often write XY to refer to the line passing through Xand Y We use the same notation to denote the segment between points X and Y Althoughthe meaning of the notation XY should be clear from the context we precede the notation XYwith either the word ldquosegmentrdquo or the word ldquolinerdquo to emphasize which objects we are working

with We also useminusminusrarrXY to denote a vector from point X to point Y The distance between two

points X and Y is denoted by |XY |Since we use Cartesian coordinate system in this paper a line is represented by a linear

equation ax+ by+ c = 0 in variables x and y The sets of all points and lines are denoted by Πand L respectively Abusing the set notation we use X isin m to mean that point X is incidentto line m and X1 Xp sub m to mean that all the points X1 Xp are incident to m

When an origami is folded along a line m some of the points are moved to superpose withtheir reflections across m We denote by Xm the reflection of point X across line m

A simple knot is denoted by K Ki denotes the ith knot The notation K = 〈mn t〉 meansthat the knot K is defined by 3 fold lines (to be explained in Sect 4)m n and t and furthermoreK is obtained by folding along the lines following the order of their appearance in 〈mn t〉

3 Origami Geometrical Construction

31 Huzitarsquos Fold Operations

By O we denote an origami An origami O is supposed to represent a square sheet of paperwith four points on the corners and four edges that is subject to folding1 We call A B Cand D the points on the corner Some intersections of lines may not fit on the square paper

1We could take O to be any convex polygon that can be constructed from a square sheet of paper Howeverthis could be an unnecessary generalization in our study

51

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

As we want to work with these points we consider O to be a sufficiently large (bounded) 2Dplane so that all the points and lines of interest are on O Huzita observed that the degreeof freedom of paper fold by fold lines can be made finite by specifying how certain points andlines are superposed Then he gave the following operations (O1) sim (O6) which serve as basicoperations in the geometrical construction of origamis Operation (O7) was added later byJustin [6] We call collectively (O1) sim (O7) Huzitarsquos fold operations

(O1) Given two distinct points P and Q fold O along the unique line that passes through Pand Q

(O2) Given two distinct points P and Q fold O along the unique line to superpose P and Q

(O3) Given two distinct lines m and n fold O along a line to superpose m and n

(O4) Given a line m and a point P fold O along the unique line passing through P to superposem onto itself

(O5) Given a line m a point P not on m and a point Q fold O along a line passing throughQ to superpose P and m

(O6) Given two lines m and n a point P not on m and a point Q not on n where m and n aredistinct or P and Q are distinct fold O along a line to superpose P and m and Q and n

(O7) Given two linesm and n and a point P not onm fold O along the unique line to superposeP and m and n onto itself

We note that the above statements are slightly different from the original ones To formalizethe above statements with the view to rigorous geometrical construction we restate Huzitarsquosoperations by carefully adding and removing side conditions of degeneracy and incidence [7]In essence treating origamis with a program requires rigorous specification of these operations

Huzitarsquos fold operations determine fold lines by specifying superpositions of constructedpoints and lines In Eos these specifications are formulas in a language of many-sorted first-order predicate logic By the algebraic interpretation of the formulas we derive polynomialequalities The problem of finding fold line(s) is therefore reduced to solving constraints ex-pressed in multi-variate polynomials of degree 3 over the field of origami constructible numbers[8 5]

32 Extensions

The contribution of Huzitarsquos fold operations is powerful enough to perform relevant geometri-cal constructions by way of solving algebraic equations of degree up to 3 Examples of suchconstructions are trisecting an arbitrary angle constructing a regular heptagon etc Somestudies have explored possible extensions of Huzitarsquos fold operations in an attempt to increasethe power of paper folding ie to solve higher degree equations

Alperin and Lang proposed multi-fold method where the origami is folded along more thanone fold line simultaneously [9] The idea is to find fold lines that are mutually dependentThe multi-fold construction allows solving higher degree equations We presented a construc-tion method of angle trisection using 2-fold operation [5] and angle quintisection using 4-foldoperation [10] Although the p-fold method generates an arbitrarily high degree polynomialaccurately folding an origami by p lines simultaneously would be difficult to do by hand evenfor p = 2

52

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

Folding polygonal knots has been traditionally used in Japan For example folding a broadsash for a kimono by a pentagon is a common practice of daily life However it is unknownwhen the knot fold was first mathematically studied The earliest contributions of which weare aware are those of Cundy and Rollett [11] Brunton [12] and Sakaguchi [13] Cundy andRollett showed models of knots that make some regular polygons Brunton elaborated themathematical study of the knot fold and showed that the number of necessary knots dependson the number of the edges of the polygon

4 Knot Fold

In order to determine the geometrical constraints of knot fold we first analyze key geometricalproperties of a knot

41 Geometrical Properties

(a) (b) (c)

Figure 1 Knot-fold of regular pentagon FEIHG

Let us examine the operation of knotting in Fig 1 We make one simple knot by tyingtogether the two ends of the origami tape in Fig 1(a) Note that we use a rectangular shapeof an origami When the height of the tape ie |AD| and |BC| is infinitesimal and both endsof the paper are connected the tape becomes a curve ie an object of study in knot theoryThe knot with 3 crossings is the most basic one in knot theory When we bring the height backto the original without distorting the tape except for folds we obtain the polygonal knot Awell fastened and well flattened knot becomes a polygonal shape as depicted in Fig 1(c) Theobtained polygonal shape exhibits a regular pentagonal form As it is inferred from the knottheory making the knot in Fig 1(c) requires 3 folds along the lines m n and t that extend theedges FE GH and IEn respectively2 The knot K = 〈mn t〉 is the one in Fig 1(c)

When the knot is entirely unfolded we obtain the tape with the creases and the generatedpoints as shown in Fig 2 We note the following geometrical properties The vertices E H andI are lined up on the edge CD whereas vertices F and G are incident to the edge AB The foldalong m passes through F and superposes point H and line AB Point E is the intersectionof m and CD Similarly the fold line n passes through G and the fold along n superposespoint E and line AB Point H is the intersection of n and CD Note that fold lines m and nare mutually defined The fold is a 2-fold operation where m and n are defined simultaneouslyLine t can be determined by applying operation (O5) of Huzitarsquos fold operation set Namely

2Recall that En is the reflection point of E across line n as defined in Sect 2

53

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

Figure 2 Unknotted tape

line t passes through I and superposes G and CD Note that the parameters of (O5) points IG and line CD are considered with respect to the configuration before the fold Refer to Fig 2The origami after the the 2-fold (ie along m and n) is shown in Fig 1(b) The purposes ofthe fold along t is first to construct the vertex I and second to fasten and lock the knot

A purely geometrical proof that the knot fold creates a regular polygon is sketched in [14]In the following we present a formal and automated algebraic proof that uses properties of theoperation of folding such as preservation of some of distances parallelism etc

42 Geometrical Constraint Solving Approach

The question now becomes how to determine the fold lines m n and t such that the knot isa regular pentagon The proof that the knot fold gives rise to regular pentagons shows thateach of the fold line makes angles 2α = 2π

5 with the edges [14] where α = ∡GEH = ∡EHF In origami geometry construction of angles using Huzitarsquos fold operations is not trivial Theproblem of constructing angles is boiled down to a sequence of fold steps which makes theconstruction tedious where the number of intermediate points and lines is prone to increaseFurthermore not all angles are constructible by Huzitarsquos fold operations The construction ofa regular 11-gon whose interior angles are equal to 9π

11 is shown to be impossible by Huzitarsquosfold operations [15] Hence we carefully choose a specification of the knot fold that couldbe extended towards the construction of regular n-gons where n ge 7 We are led to avoidconstruction of angles in order to solve the knot fold construction problem We consider theknot fold construction as a geometrical constraint solving problem without use of angles

Example Regular pentagon

Our method of constructing a regular pentagon by the knot fold uses a multi-fold togetherwith Huzitarsquos fold operations We consider the example in Fig 1 where we make a knotK = 〈mn t〉 We try to define the geometrical properties of K in a systematic way so thatwe can generalize it to the knot fold of regular n-gons where n ge 7 We observe the followinggeometrical properties on m n t E F G H and I

bull Points E and F are incident to mbull Points G and H are incident to nbull Points E H and I are incident to CDbull Points F and G are incident to ABbull The fold line m superposes H and AB ie Hm isin ABbull The fold line n superposes E and AB ie En isin ABbull The fold line t passes through I and superposes G and CD ie I isin t and Gt isin CDbull The distances |EF | |FG| and |GH| are equal

54

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

The above properties are described by the following first order logical formula φK

φK equiv existmn t isin L existEFGH I isin Π

EF sub m and GH sub n and EH I sub CD and FG sub ABand

Hm isin AB and En isin AB and I isin t andGt isin CD and |EF | = |FG| = |GH|

(1)

We used Eos to construct the regular pentagon in Fig 1 It is possible to determine t indepen-dently from m and n We consider the formula (2) that defines the 2-fold operation to solvelines m and n first

φprimeK equiv existmn isin L existEFGH isin Π

EF sub m and GH sub n and EH sub CD and FG sub ABand

Hm isin AB and En isin AB and |EF | = |FG| = |GH|

(2)

The fold line t is obtained by applying operation (O5) Namely line t passes through pointI and superposes point H and line AB

We can prove automatically that the generated shape is a regular pentagon based on Grobnerbases theory We will omit the proof of the correctness of the pentagon knot construction Inthe next sections we will discuss the construction and the proof of a regular heptagon by theknot fold in details

5 Regular Heptagon by the Knot Fold

Brunton studied the construction of regular n-gons where n ge 3 [12] He showed that the

number of necessary knots is Φ(n)2 minus 1 in order to construct a regular n-gon where Φ(n) is

Eulerrsquos totient function Hence to construct a regular heptagon we perform 2 knots K1 andK2 We explained in Sect 4 that a knot can be decomposed into 3-fold operations along threefold lines In the case of regular heptagon we need 5 fold lines m n t u and v whereK1 = 〈mn t〉 and K2 = 〈v um〉 Let EKJIHGF be the constructed regular heptagonFigure 3 exhibits the vertices of the regular heptagon after unfolding K1 and K2 The foldlines are extensions of edges of EKJIHGF as follows Lines m n and t are the extension ofsegment EF IJ and GFn respectively Lines v and u are extensions of segments KEu andHIm respectively Figure 4 shows a sketch of a regular heptagon with the lines m n t u andv

51 Geometrical Constraints

Figure 3 Unfolded regular heptagon EKJIHGF

Lines m and n of the knot K1 = 〈mn t〉 are defined by the following properties on m n tE F I J G and H

55

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

tn

mu

vE

F

G

H

I

J

K

Figure 4 Sketch of a regular heptagon EKJIHGF and lines m n t u and v

bull Points E and F are incident to mbull Points I and J are incident to nbull Points E and J are incident to CDbull Points F I G and H are incident to ABbull The fold line m superposes I and CD ie Im isin CDbull The fold line n superposes F and CD ie Fn isin CDbull The distances |EF | |IJ | |FGn| |IHm| and |GnHm| are equal3

We write formula φK1in a similar fashion to the formula (1)

φK1equiv existmn t isin L existEF I JGH isin Π

EF sub m and I J sub n and F IGH sub AB and E J sub CDand

Im isin CD and Fn isin CD andG isin t and J t isin ABand

|EF | = |IJ | = |FGn| = |IHm| = |GnHm|

(3)

Similarly to our discussion in Sect 42 line t can be constructed independently from lines mand n We therefore can separate the construction t and use φprime

K1in (4) to solve for m and n

first

φprimeK1

equiv existmn existEF I JGH isin Π

EF sub m and I J sub n and F IGH sub AB and E J sub CDand

Im isin CD and Fn isin CDand

|EF | = |IJ | = |FGn| = |IHm| = |GnHm|

(4)

Knot K2 = 〈v um〉 is defined by the following properties on v u m K X H Y Z and F bull Points K and X are on vbull Points H and Y are on ubull Points K and Y are on CDbull Points Z H F and X are on ABbull The fold line v superposes H and CD ie Hv isin CD

3Refering to Fig 3 distances |GFn| and |FGn| are equal due to the fact that reflection across line n preservesthe distances Similarly distances |HIm| and |IHm| are equal

56

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

bull The fold line u superposes X and CD ie Xu isin CDbull The fold line m passes through F and superposes Y and AB ie Y m isin ABbull The distances |KX| |HY | |XFu| |HZv| and |FuZv| are equal

φK2equiv existv um isin L existKXH Y Z F isin Π

KX sub v and HY sub u and KY sub CD and XHZ F sub ABand

Hv isin CD andXu isin CD and F isin m and Y m isin ABand

|KX| = |HY | = |XFu| = |HZv| = |FuZv|

(5)

However referring to Fig 3 points X Y and Z are equal to points Eu Im and ((((Gn)m)u)v)From formula φprime

K1 E I and G are obtained It is possible to determine the fold lines that

make K2 in an easier way than solving constraints in formula (5) as we explain in the nextsub-section

52 Construction by Eos

We first assume that the initial origami is a rectangle ABCD We work with the Cartesiancoordinate system and the coordinates of points A B C and D are (0 0) (wd 0) (wd ht)and (0 ht) respectively The width wd and the height ht can be taken arbitrary Of coursewd is sufficiently larger than ht so that the knot construction is feasible For concreteness ofour presentation using Eos we set wd = 900 and ht = 60 Furthermore let E be an arbitrarybut fixed point on segment CD Let the coordinates of E be (400 ht) for simplicity and clarityof the construction Our objective is to construct a regular heptagon EKJIHGF by the knotfold Recall that the construction requires a 2-fold operation prior to Huzitarsquos fold operations(see Sect 41) The first folding step is the crucial one ie the 2-fold operation

In Eos Huzitarsquos fold operations can be performed using function HO The extension to themulti-fold is natural as HO is implemented with the generality that allows the specification oflogical formulas describing the multi-fold Multi-fold is realized by the call of the followingMathematica function

HO [ H Constraint rarr φ ]

H is a list of points on the origami which determine the faces to be moved φ is a formula in thefirst-order predicate logic The formula φ specifies the constraints that the geometrical objectsconcerned have to satisfy In our example the geometrical constraints that specify the 2-foldoperation are expressed by formula φprime

K1in (4) We write φprime

K1in the language of Eos and call

HO as follows

HO[C A Constraint rarr existmmLineexistnnLineexistff PointexistiiPointexistjjPointexistggPointexisthhPoint

(E f sub m and i j sub n and f i g h sub AB and j isin CDand

im isin CD and fn isin CDand

SqDistance[E f ] == SqDistance[i j] == SqDistance[f gn] ==

SqDistance[i hm] == SqDistance[gn hm])]

(6)

The term SqDistance[XY ] is the square of the distance between X and Y (ie |XY |2)Notations like ldquoexistmmLinerdquo ldquoE f sub mrdquo ldquoimrdquo ldquoim isin CDrdquo are Eos extension of Mathematicasyntax

The evaluation of (6) generates 24 distinct cases of possible configurations of points F GH I and J and lines m and n We deduce that the algebraic interpretation of the constraintsas defined by φprime

K1 is a well constrained system of equations since we obtained finite number of

solutions However not all of the 24 cases are relevant to our construction problem They may

57

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

(a) Case 1 (b) Case 2

(c) Case 3 (d) Case 4

(e) Case 5 (f) Case 6

Figure 5 6 possible cases for lines m and n

correspond to degenerate cases that lead to failure of the proof by Grobner bases In order toeliminate the degenerate cases and also to get a reasonable number of cases we further narrowthe search space of the configuration of points and lines For that we add the following extraconstraints

E isin nandj isin mandSqDistance[E i] == SqDistance[j f ] == SqDistance[E h] == SqDistance[j g]

The sub-formula E isin n and j isin m eliminates the degenerate cases where E and j are equalSub-formula SqDistance[E i] == SqDistance[j f ] == SqDistance[E h] == SqDistance[j g]specifies further conditions on points E F G H I and J We evaluate the following HO call

HO[C A Constraint rarr existmmLineexistnnLineexistff PointexistiiPointexistjjPointexistggPointexisthhPoint

(E f sub m and i j sub n and f i g h sub AB and j isin CDand

im isin CD and fn isin CD and

SqDistance[E f ] == SqDistance[i j] == SqDistance[f gn] ==

SqDistance[i hm] == SqDistance[gn hm]and

E isin n and j isin m and SqDistance[E i] == SqDistance[j f ] == SqDistance[E h] == SqDistance[j g])

MarkPointAt rarr F I J G H]

(7)

Consequently we obtain 6 cases as shown in Fig 5 Two of them namely those in Fig 5(a) andin Fig 5(f) lead to the construction of a regular heptagon Eos allows the user to interactivelychoose the suitable case to proceed with the construction Keyword MarkPointAt tells the Eoshow to label the existentially quantified points f i j g and h The outcome of folding in thecase 6 is shown in Fig 6

Next we apply two operations (O1) to fold along the line FGn and IHm in Fig 6 by callingHO with suitable arguments The lines FGn and IHm are the fold lines t and u respectivelyThe results are shown in Fig 7(a) and 7(b) Finally given the origami of Fig 7(b) we constructthe remaining vertex K We apply operation (O6) to obtain v which brings H and G onto ICand HB respectively Point K is the intersection of IC and line v We obtain the heptagonEKJIHGF in Fig 7(c)

58

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

Figure 6 Step 1 Folds along lines m and n

53 Algebraic Interpretation

This algebraic interpretation is used to ldquoevaluaterdquo the function calls of HO as well as the auto-mated proof of the correctness of the construction We take HO in (7) as an example To obtaingeometrical objects m n F G H I and J the formula in (7) is transformed into a set ofalgebraic equalities Further details of the algebraic interpretation are explained in [8] and [5]

Let the coordinates of A B D and E be (0 0) (900 0) (0 60) and (400 60) respectivelyFor an atomic formula φ let [[φ]] denote the set of polynomial relations that are the algebraicmeaning of φ An atomic formula is interpreted as a set of polynomial relations (equalities orinequalities) and a term is given as a rational function The set of (non-simplified) polynomialequalities (8) ndash (14) is the algebraic interpretation of formula in (7)

400a5+ 60b6+ c7 == 0 c7+ a5x11+ b6y12 == 0 c10+ a8x13+ b9y14 == 0

c10+ a8x15+ b9y16 == 0minus900y12 == 0minus900y14 == 0

minus900y20 == 0minus900y18 == 0minus54000 + 900y16 == 0 (8)

minus54000 +900

(

minus2b6(c7+ a5x13) + a52y14minus b62y14)

a52 + b62== 0 (9)

minus54000 +900

(

minus2b9(c10+ a8x11) + a82y12minus b92y12)

a82 + b92== 0 (10)

(400minus x11)2 + (60minus y12)2 == (x13minus x15)2 + (y14minus y16)2 ==(

y12minusminus2b9(c10+ a8x17) + a82y18minus b92y18

a82 + b92

)2

+

(

x11minusminusa82x17+ b92x17minus 2a8(c10+ b9y18)

a82 + b92

)2

==

(

y14minusminus2b6(c7+ a5x19) + a52y20minus b62y20

a52 + b62

)2

+

(

x13minusminusa52x19+ b62x19minus 2a5(c7+ b6y20)

a52 + b62

)2

==

(

minus2b9(c10+ a8x17) + a82y18minus b92y18

a82 + b92minus

minus2b6(c7+ a5x19) + a52y20minus b62y20

a52 + b62

)2

+

(

minusa82x17+ b92x17minus 2a8(c10+ b9y18)

a82 + b92minus

minusa52x19+ b62x19minus 2a5(c7+ b6y20)

a52 + b62

)2

(11)

59

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

400a8+ 60b9+ c10 6= 0 c7+ a5x15+ b6y16 6= 0 (12)

(minus400 + x13)2 + (minus60 + y14)2 ==

(x11minus x15)2 + (y12minus y16)2 == (minus400 + x19)2 + (minus60 + y20)2 ==

(x15minus x17)2 + (y16minus y18)2 (13)

(minus1 + b9)b9 == 0 (minus1 + a8)(minus1 + b9) == 0 1 + a82 6= 0 (minus1 + b6)b6 == 0

(minus1 + a5)(minus1 + b6) == 0 1 + a52 6= 0 (14)

A line a x + b y + c = 0 is represented by (a b c) together with the constraint (minus1 + b)b =0 and (minus1 + a)(minus1 + b) = 0 and a2 + 1 6= 0 Lines m and n are represented by (a5 b6 c7) and(a8 b9 c10) respectively Hence we have the equalities and disequalities in (14)

The equalities in (8) are the algebraic interpretation of the sub-formula E f sub mandi j subnand f i g h sub AB and j isin CD The first equation 400a5+ 60b6+ c7 == 0 means that point Eat (400 60) is incident to m defined by the equation a5x+ b6y + c7 = 0 Similarly the rest ofthe equations in (8) are interpretations of f at (x11 y12) is on m i at (x13 y14) is on n j at(x15 y16) is on n f is on AB i is on AB h at (x19 y20) is on AB g at (x17 y18) is on ABand j is on CD respectively

The reflection of point i at (x13 y14) across line m is the point im whose coordinates are

(minusa52x13 + b62x13minus 2a5(c7 + b6y14)

a52 + b62minus2b6(c7 + a5x13) + a52y14minus b62y14

a52 + b62)

Equation (9) states that im is incident to CD represented by (0 1 -60) Similarly equation(10) is the algebraic interpretation of fn isin CD Eos transforms rational form p

q== 0 to

p == 0 Note that in (9)ndash(11) q comes from coefficient of lines and q 6= 0 is deduced from (14)The disequalities of (12) states that the coordinates of point E and j do not satisfy the

equation of lines n and m respectively Eos changes the disequalities into equalities by addingslack variables introduced by Rabinowitch trick

Now we examine the equalities (11) and (13) [[SqDistance[E f ]==SqDistance[i j]]] givesrise to the first equality in (11) namely (400minusx11)2+(60minusy12)2 == (x13minusx15)2+(y14minusy16)2where E at (400 60) f at (x11 y12) i at (x13 y14) and j at (x15 y16) The rest of theequalities in (11) and equalities in (13) are obtained in the same way

By solving the above set of polynomial equalities for the coefficients of m and n and coor-dinates of f i j g and h we obtain the 6 cases in Fig 5

6 Proof

61 Theorem to Prove

We prove the following theorem

Theorem 61 Given the origami in Fig 7(c) we have(a) |EF | = |FG| = |GH| = |HI| = |IJ | = |JK| = |KE| and(b) ∡EOF = ∡FOG = ∡GOH = ∡HOI = ∡IOJ = ∡JOK = ∡KOE = 2π

7 where O is thecenter of EKJIHGF

Let θ = ∡EOF and α = eiθ VectorminusminusrarrFG is the rotation of

minusminusrarrEF through θ around center O

To prove the theorem 61 we show that the rotations ofminusminusrarrEF through angles 2θ 3θ 4θ 5θ and

60

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

(a) (b) (c)

Figure 7 Construction of (a) the edge GF (step 2) (b) the edge IH (step 3) and (c) vertex Kand final heptagon EKJIHG (step 4)

6θ givesminusminusrarrGH

minusrarrHI

minusrarrIJ

minusminusrarrJK and

minusminusrarrKE respectively and furthermore that θ = 2π

7 We show thatafter the construction the following holds

forallα isin C (αminusminusrarrEF minus

minusminusrarrFG = 0 rArr

α2minusminusrarrEF minusminusminusrarrGH = 0 and α3minusminusrarrEF minus

minusrarrHI = 0 and α4minusminusrarrEF minus

minusrarrIJ = 0and

α5minusminusrarrEF minusminusminusrarrJK = 0 and α6minusminusrarrEF minus

minusminusrarrKE = 0 and α7 minus 1 = 0)

(15)

Let P be the geometrical constraints accumulated during the construction Let C equiv forallα isinC (C1 rArr C2 and C3 and C4 and C5 and C6 and C7) be the formula (15) P and C form the premise andconclusion of the proposition (16) that we want to prove

P rArr forallα isin C (C1 rArr C2 and C3 and C4 and C5 and C6 and C7) (16)

Formula (16) is semantically equivalent to the conjunctions of the formulas (17)ndash(22)

P rArr forallα isin C (C1 rArr C2) (17)

P rArr forallα isin C (C1 rArr C3) (18)

P rArr forallα isin C (C1 rArr C4) (19)

P rArr forallα isin C (C1 rArr C5) (20)

P rArr forallα isin C (C1 rArr C6) (21)

P rArr forallα isin C (C1 rArr C7) (22)

62 Proof by Eos

We show how the validity of (17) is proved and the rest is achieved in a similar way We addthe conclusion forallα isin C C1 rArr C2 by calling Eos function Goal as follows

Goal[forallααisinComplexes(VectorToComplex[αminusminusrarrEF minus

minusminusrarrFG]==0 rArr

(VectorToComplex[α2minusminusrarrEF minusminusminusrarrGH]==0))]

(23)

Expressions C1 equiv αminusminusrarrEF minus

minusminusrarrFG = 0 and C2 equiv α2minusminusrarrEF minus

minusminusrarrGH = 0 written in the language of

Eos are VectorToComplex[αminusminusrarrEF minus

minusminusrarrFG] and VectorToComplex[α2minusminusrarrEF minus

minusminusrarrGH]==0 respectively

61

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

Function Goal adds the negation of the conclusion to the premise By calling Goal we obtainP and not(forallα isin C (C1 rArr C2)) In order to translate P and not(forallα isin C (C1 rArr C2)) into algebraic formwe fix the coordinate system to be Cartesian with points A B C D and E as follows

map = DefMapping[A Point[0-wd]B Point[wd0]

C Point[wd ht] D Point[0 ht] E Point[0 ht] ]amp(24)

Without loss of generality we set the size of the initial origami to be 2wdtimesht where the widthwd is taken to be arbitrary and the height ht is equal to 1 The point E is fixed at location(0 ht) Finally we check whether the reduced Grobner basis of the algebraic interpretation ofP and not(forallα isin C (C1 rArr C2)) is 1 by calling function Prove

Prove[ldquoKnot Heptagonrdquo Mapping rarr map GroebnerBasis rarr

CoefficientDomain rarr RationalFunctions

MonomialOrder rarr DegreeReverseLexicographic]

(25)

The above call of function Prove tells Eos to compute Grobner basis of the polynomial set[[P and not(forallα isin C (C1 rArr C2))]] Let V be the set of variables in [[P and not(forallα isin C (C1 rArr C2))]] TheGrobner basis computation is carried out in the domain of polynomials whose variables are inV wd and whose coefficients are in functions of Q(wd) Eos computes Grobner basis andgenerates a proof document (whose title is given by the first argument of the call of Prove) [16]

63 Proof Results

The proofs of (17)ndash(22) are successful The CPU time used for Grobner basis computation onMac OS X (Intel Core i7 8G 24GHz) machine varies from 69236984 seconds (for proving (17))to 1994889588 seconds (for proving (20))

7 Conclusion

We presented the construction of a regular heptagon using the knot fold Our method consistsin applying 2-fold operation coupled with Huzitarsquos fold operations The fold lines that makethe knot fold are determined by solving geometrical constraints We further showed the proofof the correctness of the construction of a regular heptagon based on Grobner bases

Note that using Huzitarsquos fold operations (O1) sim (O7) a regular heptagon is constructibleWith Eos we need 9 Huzitarsquos fold operations and more than 10 auxiliary operations such asunfolding and marking supporting points Further investigation of the geometrical constraintsby the knot fold is required to construct regular 11-gon which is impossible by Huzitarsquos foldoperations

Another issue that should be investigated in the future research is the rigidity of the knotfold We need to define the notion of rigidity in mathematical terms in this knot fold as wellas in more general origami that may involve 3D constructions

71 Acknowledgments

We thank Stephen Watt of Western Ontario University for drawing our attention to the knotfold This work is supported by JSPS KAKENHI Grant No 25330007 The first author of thispaper is supported by a postdoctoral fellowship at Kwansei Gakuin University

62

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

References

[1] D S Kasir The Algebra of Omar Khayyam (English translation of Khayyamrsquos original workAl-Jabr Wrsquoal Muqabalah) Teachers College Press 1931

[2] P L Wantzel Recherches sur les moyens de connaıtre si un probleme de geometrie peut se resoudreavec la regle et le compas Journal de Mathematiques Pures et Appliquees pages 366ndash372 1837

[3] H Huzita Axiomatic Development of Origami Geometry In Proceedings of the First InternationalMeeting of Origami Science and Technology pages 143ndash158 1989

[4] R C Alperin A Mathematical Theory of Origami Constructions and Numbers New York Journalof Mathematics 6119ndash133 2000

[5] T Ida A Kasem F Ghourabi and H Takahashi Morleyrsquos Theorem Revisited Origami Con-struction and Automated Proof Journal of Symbolic Computation 46(5)571 ndash 583 2011

[6] J Justin Resolution par le pliage de lrsquoequation du troisieme degre et applications geometriques InProceedings of the First International Meeting of Origami Science and Technology pages 251ndash2611989

[7] F Ghourabi A Kasem and C Kaliszyk Algebraic Analysis of Huzitarsquos Origami Operations andtheir Extensions In Automated Deduction in Geometry LNAILNCS Springer 2013 (to appear)

[8] F Ghourabi T Ida H Takahashi M Marin and A Kasem Logical and Algebraic View ofHuzitarsquos Origami Axioms with Applications to Computational Origami In Proceedings of the22nd ACM Symposium on Applied Computing (SACrsquo07) pages 767ndash772 Seoul Korea 2007

[9] R C Alperin and R J Lang One- Two and Multi-fold Origami Axioms In Origami4 Pro-ceedings of the Fourth International Meeting of Origami Science Mathematics and Education(4OSME) pages 371ndash393 2009

[10] F Ghourabi T Ida and H Takahashi Computational Origami of Angle Quintisection InProceedings of the Workshop in Symbolic Computation in Software Science (SCSS2008) RISCTechnical Report Series 08-08 pages 57ndash68 2008

[11] H M Cundy and A P Rollett Mathematical Models Oxford University Press 1961

[12] J K Brunton Polygonal Knots The Mathematical Gazette 45(354)299ndash301 1961

[13] K Sakaguchi On Polygons Made by Knotting Slips of Paper Technical Report of ResearchInstitute of Education Nara University of Education 1855ndash58 1982

[14] J Maekawa Introduction of the study of knot tape In Origami5 Proceedings of the FourthInternational Meeting of Origami Science Mathematics and Education (5OSME) pages 395ndash403 2011

[15] D A Cox Galois Theory Wiley-Interscience 2004

[16] F Ghourabi T Ida and A Kasem Proof Documents for Automated Origami Theorem ProvingIn Automated Deduction in Geometry volume 6877 of LNCS pages 78ndash97 Springer 2011

63

Automated Verification of Equivalence on

Quantum Cryptographic Protocols

Takahiro Kubota1 Yoshihiko Kakutani1 Go Kato2

Yasuhito Kawano2 and Hideki Sakurada2

1 The University of Tokyo Tokyo Japantakahirok11 30kakutaniissu-tokyoacjp

2 NTT Communication Science Laboratories Kanagawa Japankatogokawanoyasuhitosakuradahidekilabnttcojp

Abstract

It is recognized that security verification of cryptographic protocols tends to be difficultand in fact some flaws on protocol designs or security proofs were found after they had beenpresented The use of formal methods is a way to deal with such complexity Especiallyprocess calculi are suitable to describe parallel systems Bisimilarity which denotes thattwo processes behave indistinguishably from the outside is a key notion in process calculiHowever by-hand verification of bisimilarity is often tedious when the processes have manylong branches in their transitions We developed a software tool to automatically verifybisimulation relation in a quantum process calculus qCCS and applied it to Shor andPreskillrsquos security proof of BB84 The tool succeeds to verify the equivalence of BB84 andan EDP-based protocol which are discussed in their proof

1 Introduction

Security proofs of cryptographic protocols tend to be complex and difficult to verify Thisfact has been recognized in the classical cryptography and there is a line of researches to dealwith the complexity of verification [1 2] Since by-hand proofs are prone to human error andtime consumption efforts have been put into automating security proofs and verification in theclassical cryptography Security proofs are also complex in the quantum cryptography where wemust also consider attacks using entanglements The first security proof of BB84 quantum keydistribution (QKD) protocol by Mayers [3] is about 50 pages long After that paper researchershave been seeking simpler proofs [4 5] Since QKD is one of the closest application to practicein the quantum information field it is important to examine QKD systemsrsquo security formallyand make it machine-checkable

There are several formal frameworks for quantum protocols Feng et al developed a processcalculus qCCS [6] In this calculus a protocol is formalized as a configuration A configurationis a pair of a process and a quantum state corresponding to quantum variables Weak openbisimulation relation on qCCS configurations is defined Weakly open bisimilar configurationshave the same transitions up to internal ones and reveal the identical quantum states to theoutsider (adversary) in each step The relation is proven to be closed by parallel composition ofprocesses A use case of a process calculus for formal verification is to prove weak bisimilarityof implementation and specification described as configurations qCCS has been applied toquantum teleportation superdense coding and BB84 protocols

To extend application of formal methods to security proofs we applied qCCS to Shor andPreskillrsquos security proof of BB84 [4] in the previous paper [7] In Shor and Preskillrsquos securityproof security of BB84 is proven to be equivalent to that of another protocol based on anentanglement distillation protocol (EDP) and then the latter is proven to be secure We

64

Automated Verification of Equivalence on Quantum Cryptographic Protocols Kubota et al

formalized BB84 and the EDP-based protocol as configurations and proved their bisimilarityby hand However by-hand verification of bisimilarity is often tedious when configurationshave many long branches in their transitions In this paper we present a software tool to verifybisimilarity of given two qCCS configurations There are two main contributions of our work

First we implemented a software tool that formally verifies bisimilarity of qCCS configu-rations without recursive structures A protocol possibly takes security parameters for variouspurposes As for BB84 it takes two parameters one determines the length of qubits whichAlice sends to Bob in the first quantum communication and the other is for tolerated error-ratein the eavesdropping detection step Such parameters are passed to the verifier as symbols andare interpreted appropriately In our verifierrsquos framework quantum states and operations aredescribed as symbols Since attacks from the adversary are also treated as symbols our verifiercan deal with unspecified attacks To examine the behavioural equivalence adversaryrsquos viewsdenoted by partial traces must be checked to be equal in each step of a protocol The verifierautomatically checks the equality using user-defined equations

Second we applied our verifier to Shor and Preskillrsquos security proof of BB84 [4] The verifiertakes as input two configurations denoting BB84 and the EDP-based protocol and equationsabout the properties of error-correcting codes and measurement of the halves of EPR pairsThe verifier succeeds to verify the bisimilarity of the configurations of the two protocols

The package of the verifier is available from httphagiissu-tokyoacjp~tkqccs

verifiertargz It includes a user manual and and example scripts in the folders doc andscriptsRelated Work The authors of qCCS presented the notion of symbolic bisimulation for quan-tum processes [8] A purpose is to verify bisimilarity algorithmically They proved the strong(internal actions should be simulated) symbolic bisimilarity is equivalent to the strong openbisimilarity and actually presented an algorithm to verify symbolic ground (outsiders do notperform quantum operations adaptively) bisimilarity Since our purpose is to apply a pro-cess calculus to security proofs where adversarial interference must be taken into account weimplemented a tool that verifies weak open bisimilarity on the basis of the original qCCS [6]

2 The Verifier

Formal Framework The verifier employs a sublanguage of qCCS where the syntax of recur-sion and the use of classical data are restricted The framework is still expressive because ourtarget protocols do not need recursion and classical probability distributions can be representedas quantum states denoted by diagonal operators The syntax of the processes in the verifier isas follows

P = discard(q) | cqP | cqP | meas b then P saem | op[q]P | P ||P | PL

Intuitively discard(q)means termination of a process keeping a sequence of quantum variablesq secret cqP sends a quantum variable q to a channel c and then executes P cqP receivesquantum data to a variable q from a channel c and then executes P meas b then P saem

measures a quantum bit b and executes P if the outcome is 0 or terminates if the outcome is1 op[q]P performs a superoperator op to quantum variables q and then executes P P ||P prime

executes P and P prime in parallel PL where L is a set of channels executes P keeping channelsin L private Let qv(P ) be the set of quantum variables that occur in a process P cqP meas b then P saem op[q]P and P ||P prime are defined only if q isin qv(P ) b isin qv(P ) q sub qv(P )and qv(P ) cap qv(P prime) = empty respectively In our verifier each quantum variable is defined with its

65

Automated Verification of Equivalence on Quantum Cryptographic Protocols Kubota et al

qubit-length that is indicated by a natural number symbol declared beforehand The adoptionof natural number symbols is important to treat security parameters in the verifier Quantumstates are represented as character strings called environments The syntax of the environmentsis given as follows

ρ = X[q] | op[q](ρ) | ρ ρ | proji[b](ρ) | Tr[q](ρ)

Let qv(ρ) be the set of quantum variables that occur in an environment ρ X[q] meansthat quantum variables q are in a quantum state X op[q](ρ) is a quantum state after theapplication of operation op to quantum variables q in an environment ρ ρ ρprime represents thetensor product of ρ and ρprime but ρ ρprime and ρprime ρ are identified in the verifier ρ ρprime is definedonly if qv(ρ) cap qv(ρprime) = empty proji[b](ρ) means the reduced density operator |i〉〈i|bρ|i〉〈i|b withi isin 0 1 Tr[q](ρ) means the partial trace of ρ by q We call a pair 〈P ρ〉 of a process Pand an environment ρ a configuration only if qv(P ) sub qv(ρ) because quantum states of qubitsoccurring in P must be defined in ρ For example an agent that sends the halves of n EPR pairsto the outside is formalized as a configuration 〈cqdiscard(r) EPR[qr]ANY[s]〉 where thequantum variables q r are of the qubit length n and the quantum variable s is defined with anarbitrary qubit-length EPR[qr] is interpreted to (|00〉〈00|+ |00〉〈11|+ |11〉〈00|+ |11〉〈11|)otimesn

qr

and ANY[s] is arbitrarily for adversaryrsquos density operatorsA labelled transition system based on the original one [6] is implemented in the verifier

Transitions are interpreted as interactions between configurations and the adversary For exam-

ple the configuration above performs a transition 〈cqdiscard(r) EPR[qr]ANY[s]〉cqminusminusrarr

〈discard(r) EPR[qr]ANY[s]〉 where the adversary can recognize that the quantum vari-able q is sent through the channel c Transitions caused by internal actions such as quantumoperations internal communications and conditional branches are labelled τ The label τ intu-itively means that the action is invisible from the outside The transition rules of conditionalbranch are 〈meas b then P saem ρ〉

τminusrarr 〈P proj0[b](ρ)〉 and 〈meas b then P saem ρ〉

τminusrarr

〈discard(qv(P )) proj1[b](ρ)〉 These may decrease the trace of the density operator de-noting a quantum state Since the trace indicates the probability to reach to a configurationwe can restore the probability from configurations to conditional branches We identify thebranches that are evoked by an identical quantum variable Eventually probability is absorbedin quantum states and excluded from the transition system

The transition system of the original qCCS is probabilistic which is caused by the mea-surement construction M [qx] in the syntax [6] It measures an observable M of a quantumvariable q and stores the result in a classical variable x There are two ways to formalize quan-tum measurement since one can be also formalized as a superoperator Because only M [qx]evokes a probabilistic branch processes with different formalization of measurement are notbisimilar in general We proposed a criteria how to select the way in our previous work [7] weshould use M [qx] if a process behaves differently according to the measurement For examplethe case where a process performs different labeled transitions is typical Otherwise we shouldformalize measurement by a superoperator In our verifierrsquos framework M [qx] cannot be writ-ten independently Instead the syntax meas b then P saem is the composition of M [qx] andthe conditional branch in the original qCCS This restriction and the conditions on quantumvariables prevent the situation where two configurations with the different ways of formalizationof measurement are not bisimilarProcedure to Check Bisimulation Weak bisimulation relation [6] is defined on qCCS con-figurations Roughly speaking weakly bisimilar configurations (1) perform identical labelledtransitions up to τ transitions and (2) reveal identical density operators whatever operations theadversary performs to her quantum variables The adversaryrsquos view is denoted by the partial

66

Automated Verification of Equivalence on Quantum Cryptographic Protocols Kubota et al

trace Tr[q](ρ) when the global quantum state is ρ and q are the quantum variables that arenot revealed to the adversary The verifier takes as input two configurations and user-definedequations on environments and returns true or false It is designed to be sound with respectto the original qCCS that is two configurations are bisimilar if the verifier returns true withthem and some valid equations This is because

Reqs = (CD) |The verifier returns true given CD and eqs

is a bisimulation relation for all valid equations eqs Precisely Reqs is converted accordinglybecause meas b then P saem is decomposed to M [bx] and a conditional branch which performsa two-step transition in the branch with x = 0 The recursive procedure to verify bisimilarityis as follows Since the transitions of the processes written in our sublanguage are finite theprocedure always terminates

1 The procedure takes as input two configurations 〈P0 ρ0〉 〈Q0 σ0〉 and user-defined equa-tions on environments

2 If P0 and Q0 can perform any τ -transitions of superoperator applications they are allperformed at this point Let 〈P ρ〉 and 〈Q σ〉 be the obtained configurations

3 Whether qv(P ) = qv(Q) is checked If it does not hold the procedure returns false

4 Whether Tr[qv(P )](ρ) = Tr[qv(Q)](σ) is checked with user-defined equations Theprocedure to check the equality of quantum states are described in the next subsectionIf it does not hold the procedure returns false

5 A new superoperator symbol E[qv(ρ)minus qv(P )] that stands for an adversarial operationis generated

6 For each 〈P prime ρprime〉 such that 〈P E[qv(ρ) minus qv(P )](ρ)〉αminusrarr 〈P prime ρprime〉 the procedure checks

whether there exists 〈Qprime σprime〉 such that 〈Q E[qv(σ) minus qv(Q)](σ)〉τlowastminusrarr

αminusrarr

τlowastminusrarr 〈Qprime σprime〉 and

the procedure returns true with the input 〈P prime ρprime〉 and 〈Qprime σprime〉 If there exists it goes tothe next step 7 Otherwise it returns false

7 For each 〈Qprime σprime〉 such that 〈Q E[qv(σ) minus qv(Q)](σ)〉αminusrarr 〈Qprime σprime〉 the procedure checks

whether there exists 〈P prime ρprime〉 such that 〈P E[qv(ρ) minus qv(P )](ρ)〉τlowastminusrarr

αminusrarr

τlowastminusrarr 〈P prime ρprime〉 and

the procedure returns true with the input 〈Qprime σprime〉 and 〈P prime ρprime〉 If there exists it returnstrue Otherwise it returns false

The step 2 prominently reduces the search space Indeed 〈op1[q]P ||op

2[r]Q ρ〉 and

〈P ||QF rop2

(E qop1

(ρ))〉 are bisimilar and F rop2

(E qop1

(ρ)) = E qop1

(F rop2

(ρ)) holds because q cap r = emptyholds Therefore superoperators that can originally cause τ transitions are disposedEquality Test of Quantum States To test the equality of given two environments the verifierchecks whether they are transformed to the same form There are two kinds of transformationstrace out and application of user-defined rules

Partial trace is significant to test the equality of quantum states For example two differentquantum states op1[q](X[q]Y[r]Z[s]) and op2[r](U[q]V[r]Z[s]) have the same par-tial trace Z[s] under Tr[qr] for arbitrary interpretation of the superoperators op1 op2 andthe quantum states X Y Z U V The verifier eliminates symbols of superoperators and quantumstates according to the partial trace rules below

Tr[q](E[r](ρ)) = Tr[q](ρ) if r sub q (1) Tr[q](ρ) = Tr[r](Tr[s](ρ)) if q = r cup s (2)

Tr[q](E[r](ρ)) = E[r](Tr[q](ρ)) if q cap r = empty (3) Tr[q](ρ lowast ρq lowast σ) = ρ lowast σ (4)

67

Automated Verification of Equivalence on Quantum Cryptographic Protocols Kubota et al

If r sub q holds Tr[q](E[r](ρ)) is rewritten to Tr[q](ρ) eliminating E[r] by the rule (1)otherwise by the rules (2) and (3) the trace-out symbol with quantum variables that are disjointto targets of superoperator goes inside of itrsquos application After eliminating superoperatorsquantum states are traced out by the rule (4)

If an objective quantum state has a part that matches to the left-hand side of a user-defined equation the part is rewritten to the right-hand side To apply a user-definedequation the verifier automatically solves commutativity of superoperators or partial tracesthat are applied to disjoint sets of quantum variables For example if the objectivequantum state is Tr[q](hadamard[s] (EPR[qr]X[s])) and a user defines an equationTr[q](EPR[qr])=Tr[q](PROB [qr]) (E1) the application goes as follows

Tr[q](hadamard[s](EPR[qr]X[s])) = hadamards[s](Tr[q](EPR[qr]X[s])) (by 5)

= hadamard[s](Tr[q](PROB[qr]X[s])) (by E1)

Since the trace-out rules may have become applicable after applications of user-defined rulesthe trace-out procedure is applied again In each opportunity to test the equality of quantumstates each user-defined equation is applied only once This guarantees whatever rules a userdefines the equality test terminates

3 Application to Shor and Preskillrsquos Security Proof

The two protocols BB84 and the EDP-based protocol [4] are formalized as qCCS configurationson the basis of our previous work [7] Readers can find the script scriptsshor-preskillscrin the package The interpretations of the symbols of the quantum states and the superoperatorsthat are used in the formalization are also included as docshor-preskill symbolspdfOn Channels As in general QKD protocols three kinds of channels are used public quantumchannels private classical channels and public no-interpolate classical channels Since thesyntax has channel restriction PL formalization of private channels is straightforward Publicno-interpolate classical channels are realized by copying the data If a quantum variable q wherea classical value is assigned is sent through a public no-interpolate channel c this is formalizedas copy[qQ]cqdQ c where Q is a new quantum variable a superoperatorcopy copies the value of q to Q and d is a new non-restricted channel q will securely sentthrough the restricted channel c and an adversary obtains the same value accessing Q througha public channel d Note that the value of q can be copied because it is classicalEquations for the Proof We defined 10 equations in the verifier Equations are interpretedto those on density operators and proven correct For example the equation below tells theverifier that the halves of EPR pairs are indistinguishable from the uniform distribution Thisis used to check that the adversaryrsquos views are identical in the EDP-based protocol and BB84before Alice in the EDP-based protocol measures her halves of the check qubits

equation E7

Tr[q1_A](EPR[q1_Aq2_A]) = Tr[q1_A](PROB[q1_Aq2_A])

end

The user-defined rule above is interpreted to an equation trq1 A(|00〉〈00|+ |00〉〈11|+ |11〉〈00|+

|11〉〈11|)otimesnq1 Aq2 A = trq1 A(|00〉〈00|+ |11〉〈11|)otimesn

q1 Aq2 A The other rules are related to CSS codespartial traces and measurement of quantum states We obtained them by formalizing theequality of quantum states that are discussed in the original proof [4]

It is actually natural to express quantum states as symbols with some equations in inputs Incryptographic protocols the dimension of quantum states and superoperators cannot be fixed

68

Automated Verification of Equivalence on Quantum Cryptographic Protocols Kubota et al

as a certain number as they depend on security parameters In addition qubits going throughpublic channels are potentially interpolated by the adversary Since arbitrary computationby the adversary must be considered it should be described as an unspecified superoperatorTherefore quantum states are difficult to be expressed as concrete matrices which can benumerically analyzed Although quantum states are treated symbolically automatic calculationof partial traces is still possible focusing on occurrence of quantum variables in environmentsExperiment Result We ran the verifier with the input of shor-preskillscr We used anote PC with Intel Core i5 CPU M 460 253GHz and 1GB memory The transition tree ofthe EDP-based protocol has 621 nodes and 165 paths and that of BB84 has 588 nodes and 165paths The verifier checked the bisimilarity of the two protocols in 1598 seconds The recursiveprocedure was called 951 times

4 Conclusions

We presented a software tool to check bisimulation of qCCS configurations and applied it to asecurity proof of BB84 [4] In security proofs equivalence on protocols is often discussed Itcan be described as bisimulation relation but it is nearly impossible to check by hand if statetransitions of processes have many long branches In addition the equality of an adversaryrsquosview between two protocols has to be checked in each step An adversaryrsquos view is calculatedfrom a global quantum states which is possibly denoted by a huge matrix The verifier doesexhausting parts of proofs of behavioral equivalence namely it checks the correspondence ofall state transitions up to invisible ones and an adversaryrsquos view up to equations On the otherhand a user only have to examine the correctness of formalization of protocols and validityof equations that he defines It could be difficult to find all appropriate equations for a proofimmediately The verifier is also able to show environments andor processes when the checkprocedure returns false With the information a user can modify equations to inputFuture WorkWe plan to define probabilistic bisimilarity which denotes that configurations be-have indistinguishably up to some probability This will be helpful to prove ldquoindistinguishabilityup to negligible probabilityrdquo of protocols It is quite common argument in the cryptography

References

[1] S Halevi A plausible approach to computer-aided cryptographic proofs Cryptology ePrint ArchiveReport 2005181 2005

[2] B Blanchet A D Jaggard A Scedrov and J-K Tsay Computationally sound mechanized proofsfor basic and public-key kerberos In Proceedings of the 2008 ACM symposium on Informationcomputer and communications security pages 87ndash99 2008

[3] D Mayers Unconditional security in quantum cryptography J ACM 48351ndash406 May 2001

[4] P W Shor and J Preskill Simple proof of security of the bb84 quantum key distribution protocolPhys Rev Lett 85(2)441ndash444 Jul 2000

[5] H-K Lo and H F Chau Unconditional security of quantum key distribution over arbitrarily longdistances Phys Rev Lett 283(5410)2050ndash2056 Mar 1999

[6] Y Deng and Y Feng Open bisimulation for quantum processes In Theoretical Computer Sciencevolume 7604 of LNCS pages 119ndash133 2012

[7] T Kubota Y Kakutani G Kato Y Kawano and H Sakurada Application of a process calculusto security proofs of quantum protocols In Proceedings of WORLDCOMPFCS2012 Jul 2012

[8] Y Feng Y Deng and M Ying Symbolic bisimulation for quantum processes arXiv preprintarXiv12023484 2012

69

A Modified Parallel F4 Algorithm for Shared

and Distributed Memory Architectures

Severin Neumann

Fakultat fur Mathematik und InformatikUniversitat Passau D-94030 Passau Germany

neumansfimuni-passaude

Abstract

In applications of symbolic computation an often required but complex procedure is findingGrobner bases for polynomial ideals Hence it is obvious to realize parallel algorithms tocompute them There are already flavours of the F4 algorithm like [4] and [13] using thespecial structure of the occurring matrices to speed up the reductions on parallel architec-tures with shared memory In this paper we start from these and present modificationsallowing efficient computations of Grobner bases on systems with distributed memory Toachieve this we concentrate on the following objectives decreasing the memory consump-tion and avoiding communication overhead We remove not required steps of the reductionsplit the columns of the matrix in blocks for distribution and review the effectiveness of theSIMPLIFY function Finally we evaluate benchmarks with up to 256 distributed threads ofan implementation being available at httpsgithubcomsvrnmparallelGBC

1 Introduction

Parallelization is one of the most used methods to improve the performance of existing softwareBut it should be introduced systematically One chooses the most time-consuming segments ofa program and tries to improve these first In applications of symbolic computation an oftenrequired but complex procedure is finding Grobner bases for polynomial ideals Therefore itis obvious to realize parallel versions of algorithms to compute them Although it is possibleto use Buchbergerrsquos algorithm [14] we favour Faugerersquos algorithm F4 [3] since the reduction isdone due to matrix transformation which is known for being well parallelizable

There are already parallel flavours of F4 like [4] and [13] using the special structure ofthe occurring matrices to speed up the reduction Both approaches have been developed formulticore and multiprocessor systems with shared memory For these systems the number ofparallel processing units is limited and currently there are not many platforms serving morethan 64 processors Compared with that clusters of several suchlike computers can have antheoretical unlimited number of processors This advantage comes with the downside of dis-tributed memory realizing algorithms requires to consider that data has to be transfered Bythat memory duplication and communication overhead are introduced

In the following we start from the mentioned developments for shared memory systemsand present modifications which will finally allow efficient computation of Grobner bases alsofor systems with distributed memory To achieve this we have concentrated on the followingobjectives reducing the memory consumption and avoiding communication overhead Weremove needless steps of the reduction split the columns of the matrix in blocks for distributionand review the effectiveness of the SIMPLIFY function

At the end we will evaluate benchmarks of an implementation using eight distributed nodeshaving 32 processor cores each The source code is available at httpsgithubcomsvrnmparallelGBC

70

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

2 Notations

In the following we will use the notation of [11] Hence K denotes a field and K[x1 xn] thepolynomial ring over K in n indeterminantes Tn is defined as the set of all terms xα1

1 middot middotxαnn

σ is a term ordering on this set For a polynomial f isin K[x1 xn] with f =summ

i=1 ci middot tiwhere ci isin K and ti isin T

n for all i we call the set Supp(f) = t1 tm support of f Thenthe leading term of f is defined as LTσ(f) = tk = maxσ(Supp(f)) and the leading coefficientis LCσ(f) = ck

Let F = f1 fs isin K[x1 xn] 0 be a set of polynomials Then I = 〈F〉 is theideal generated by F The elements of the set B = (i j) | 1 le i lt j lt s are called criticalpairs For each critical pair exists an S-polynomial Sij = 1

LCσ(fi)middot tij middot fi minus

1LCσ(fj)

middot tji middot fj

with tij =lcm(LTσ(fi)LTσ(fj))

LTσ(fi)and tji =

lcm(LTσ(fj)LTσ(fi))LTσ(fj)

The set F is a σ-Grobner basis of I if for all critical pairs the S-polynomials can be reducedto zero by the elements of F with respect to σ

If not stated otherwise we will use the degree reverse lexicographic termordering (DegRevLex)and the finite field with 32003 elements (F32003) for examples and benchmarks

3 Preliminaries

The F4 algorithm was introduced by Faugere in 1999 [3] By using the special structure ofthe matrix and column-based parallelism Faugere and Lachartre introduced a parallelizationimproving the performance remarkable [4] We have presented another modification [13] for F4speeding up the computation by row-based parallelization

In the following we give a quick summary about Grobner bases computation and the men-tioned developments For a given set of polynomials F = f1 fs isin K[x1 xn] 0generating an ideal I = 〈F〉 a σ-Grobner basis G = g1 gt isin K[x1 xn] can be com-puted using the F4 algorithm by the following four steps

1 Create and update the set of critical pairs B using Gebauerrsquos and Mollerrsquos UPDATE func-tion [6] This function guarantees that the leading terms tij middot fi = tji middot fj of the minuendand subtrahend of the S-polynomial is unique among the critical pairs

2 Select a subset of all critical pairs for reduction using the normal or the sugar cubestrategy [7] At this point the details are not relevant For our benchmarks we chose thesugar cube strategy Although we have to mention that our implementation supports thenormal strategy and for some of the polynomial systems we used as example this strategymight perform better

3 Symbolic preprocess the selected pairs to obtain a coefficient matrix representing theS-polynomials The matrix is additionally filled with rows representing reduction polyno-mials for each term which can be reduced using elements of the partial computed Grobnerbasis G The SIMPLIFY method can be applied to reuse results of previous reductions

4 Reduce the generated matrix until row-echelon form This is equivalent to top-reducingthe S-polynomials All non-zero rows of this matrix having leading terms which are notdivisible by any element of G are inserted into G As long as new elements are found thealgorithm continues with step 1

The most time-consuming step is the reduction of the coefficient matrix The mentioned par-allelizations of Lachartre and Faugere as well as our own approach concentrate on speeding

71

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

up this step We want to show how to use these improvements also for distributed parallelarchitectures therefore we have to review them

Starting after symbolic preprocessing we obtain a coefficient matrix M which has to bereduced to a row-echelon form M has n rows and m columns with m ge n and can bedecomposed in submatrices

1 Submatrices S1 and S2 arise from the subtrahends and minuends of the S-polynomialsSince the UPDATE function guarantees that all polynomials have distinct leading terms therepresenting rows have unique pivot columns Therefore S1 and S2 are upper-triangular

2 Submatrix R represents the reduction polynomials They were computed during symbolicpreprocessing For each reducible term there is only one reduction polynomial Becauseof that R is upper-triangular

3 Finally these submatrices can be split up in pivot and non-pivot columns The pivots of Rand S1 are forming the submatrix A and the non-pivots the submatrix B The submatrixS2 is split into C containing its pivots and D containing the non-pivot columns Thisnotation was introduced in [4]

The following example demonstrates the construction of a matrix occurring during Grobnerbases computations

Example 1 Let K = K32003 P = K[x1 x2 x3] and let the polynomials g1 = x21 + x2

2g2 = x1 middot x2 + x2

2 + x2 middot x3 and g3 = x22 + x2

3 + x3 form the ideal I = 〈g1 g2 g3〉 for which aGrobner basis with respect to DegRevLex should be computed Using UPDATE we get the criticalpairs (2 3) and (1 2) They have the same sugar degree sugar(g2 g3) = 3 = sugar(g1 g2) Sowe reduce the following polynomials

f12 =(x21 + x2

2) middot x2 = x21 middot x2 + x3

2

f21 =(x1 middot x2 + x22 + x2 middot x3) middot x1 = x2

1 middot x2 + x1 middot x22 + x1 middot x2 middot x3

f23 =(x1 middot x2 + x22 + x2 middot x3) middot x2 = x1 middot x

22 + x3

2 + x22 middot x3

f32 =(x22 + x2

3 + x3) middot x1 = x1 middot x22 + x1 middot x

23 + x1 middot x3

and as set of reduction polynomials we obtain

r1 =g3 middot x2 = x32 + x2 middot x

23 + x2 middot x3

r2 =g2 middot x3 = x1 middot x2 middot x3 + x22 middot x3 + x2 middot x

23

r3 =g3 middot x3 = x22 middot x3 + x3

3 + x23

At the end we get the following matrix M

f12f23r1r2r3f21f32

1 0 1 0 0 0 0 0 0 0 00 1 1 0 1 0 0 0 0 0 00 0 1 0 0 0 1 0 0 1 00 0 0 1 1 0 1 0 0 0 00 0 0 0 1 0 0 1 0 0 11 1 0 1 0 0 0 0 0 0 00 1 0 0 0 1 0 0 1 0 0

One can easily see the mentioned structure of the matrix The upper left submatrix is A andits pivots are highlighted Below is C and the non-pivot columns are forming B and D

72

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

Using this decomposition the (full) reduction of the matrix can be computed using thefollowing algorithm

1 Primary reduction Reduce B to Aminus1 middotB

2 Secondary reduction Reduce D to D minus C middotAminus1 middotB

3 Final reduction Reduce D to its reduced row-echelon form using Gaussian elimination

4 Optional reduction Reduce B using the pivots of D

Especially the primary reduction can be efficiently parallelized since the matrix is in uppertriangular form and so all pivots are known The primary and secondary reduction can becomputed in parallel because a reduced row of B can be applied independently on rows of D

After the final reduction all non-zero rows of D are elements of the Grobner basis andcan be used to compute further critical pairs Matrix (AB) does not contain any requiredelements because by construction the pivots of A are equivalent to leading terms which arealready contained in the Grobner basis Hence the fourth step is optional and only required ifSIMPLIFY is used

There are two different approaches to achieve parallelization Column-based as suggestedby Faugere and Lachatre and row-based as suggested by us Actually these two are not mu-tually exclusive and we will use this property to advance the parallelism on architectures withdistributed memory In the following we will use the row-based approach for shared memoryparallelism but one can easily see that all modifications are also applicable to the column-basedapproach of Faugere and Lachatre

4 Matrix Distribution

In the case of the matrix reduction during Grobner basis computation we have to considerhow to distribute the coefficient matrices with least duplication and communication Like anyother parallel and distributed algorithm for transforming matrices into row echelon form wecan choose between row- and column-based distribution or a combination of both

If row-based or combined distribution is chosen the algorithm scatters rows or blocks amongthe computation nodes and these need to send rows from one to each other if they are requiredfor further reductions To reduce the communication overhead this needs to use a strategywhich decides how the matrix is distributed Since we use rows-based parallelization for theshared memory level and since the column-based distribution does play well with the specialproperties of Grobner basis computations we didnrsquot analyse the effectiveness of the row-basedor combined approach

If column-based distribution is chosen the pivot matricesA and C have to be send to all nodesand the non-pivot matrices B and D can be distributed without duplication Since all pivotsare preset for primary and secondary reduction this approach does only require communicationbefore and after all reductions are done

Furthermore the matrices are sparse and by using appropriate matrix formats the commu-nication overhead can be reduced even more We chose to store the off-diagonal elements of Aand C in a coordinate list ie there is one list storing tuples of row column and value Thisformat allows reordering in parallel executable sets to improve the row-based parallelization aspresented in [13] For B and D a modified list of lists format is used storing pairs of row indexand value for each column This allows to distribute columns independently As suggested in[8 Chapter 6] the columns are distributed round-robin to optimize load balancing Afterwards

73

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

each node can use row-based parallelism on the local shared memory The following shows thedistribution of the matrix constructed in example 1

Example 2 Using two parallel nodes the matrix M of the previous example is decomposedinto one coordinate list and two lists of lists Afterwards the pivots are sent to both nodes andthe two sets of non pivot columns are distributed among the nodes Finally the two nodes areholding the following data

Node 1 Node 2

(A C)(411) (431) (201)(211) (351)(051)(151)(161)

(B D)5 (61)7 (41)9 (43)

(A C)(411) (431) (201)(211) (351)(051)(151)(161)

(B D)6 (21) (31)8 (61) -10 (41) -

Table 1 shows that the final reduction can be computed on a single node because thesubmatrix D consumes only a tiny fraction of the whole matrix One can easily check thatthis is true in general the submatrices S1 and S2 have s rows each and the submatrix R hasr rows There are p pivot columns and n non-pivot columns Hence the coefficient matrix has2 middots+r rows and p+n columns After primary and secondary reduction the final reduction onlyrequires the submatrix D which has s remaining rows and n columns Therefore all reducedcolumns can be gathered on one node which executes the Gaussian elimination on D

Polynomial System Sugar degree primary matrix final matrix ratio ()Gametwo 7 [10] 17 7731 x 5818 2671x2182 13Cyclic 8 [1] 14 3819 x 4244 612x1283 48Cyclic 9 16 70251 x 75040 4014x10605 08

Katsura 12 [9] 9 12141 x 11490 2064x2155 32Katsura 13 9 26063 x 23531 4962x4346 35Eco 12 [12] 9 12547 x 10937 2394x1269 22Eco 13 10 25707 x 24686 2883x2310 10F966 [5] 9 60274 x 63503 4823x9058 11

Table 1 Ratio of primary matrix and final matrix during reduction for selected problems

The optional reduction is an obstacle for the effectiveness of the algorithm since it requiresthat the reduced matrix D has to be distributed again to be applied on B Because of that weexamine if the optional reduction is useful at all Even more we put to test if the SIMPLIFY

method and distributed computation play well together

5 Simplifying the F4 Algorithm

Removing the optional reduction may scale down the required communication overhead andthe reduction time Even more if SIMPLIFY isnrsquot used during symbolic preprocessing the

74

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

distributed matrix has not to be gathered completely since the columns of the reduced matrixB are not required after primary and secondary reduction

Algorithm 1 SIMPLIFY

Input t isin Tn a term f isin K[x1 xn] a polynomial F isin (Fk)k=1dminus1) where Fk is

finite subset of K[x1 xn]Output a non evaluated product ie an element of Tn timesK[x1 xn]foreach u isin list of divisors of t do1

if existj(1 le j lt d) such that (u middot f) isin Fj then2

Fj is the row echelon form of Fj wrt σ 3

there exists a (unique) p isin Fj

+such that LTσ(p) = LTσ(u middot f) 4

if u 6= t then return SIMPLIFY( tu pF) else return (1 p)5

end6

end7

The SIMPLIFY method does not guarantee that a reduction is improved by reusing previousresults Actually SIMPLIFY proves it effectiveness mostly by application Hence we requirea best possible implementation of the method Algorithm 1 is a repetition of the originalSIMPLIFY [3] It leaves some details open and there are some possibilities for optimization

bull Searching through all divisors of t is time consuming regarding the fact that only somedivisors of u will satisfy the condition (u f) isin Fj for j isin (1 le j lt d)

bull To check if there exists a j with (u f) in Fj it is important how Fj is stored A naiveimplementation will require to loop over all rows of Fj until the condition is satisfied

bull This algorithm does not check if there is another jprime 6= j satisfying the condition andprovides a better replacement

To address these issues we propose the following modifications

bull All rows of F1 Fdminus1 are stored in a two-dimensional map The first key is a polynomialf and the second is a term u This allows to update (u f) if a better replacement is foundBy that only one value per pair is stored This will decrease the required memory

bull The first map should provide a fast random access to the value of key f and the secondmap should have an ordering to allow a decreasing iteration of the possible terms In thisway the search space for possible replacements is reduced to the multiples of f only

bull The value of a map element is the reduced form of f middot u

We call this data structure SimplifyDB We can provide an improved version of SIMPLIFY asshown by algorithm 2 Additionally we have to introduce a function to update the SimplifyDB

Therefore after reduction we execute algorithm 3 for each row of Fj

+ The insertion step allows

us to compare candidates for the SimplifyDB In our implementation for two candidates thebetter is the one which has less elements in its support This is equivalent to the first weightedlength function wlen(p) = Supp(p) in [2] At this point we didnrsquot try any other suggestedweighted length function

SIMPLIFY can be improved even more During symbolic preprocessing it is called twiceonce for the selected critical pair (m f) with m isin T

n and f isin G and once to create reduction

75

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

Algorithm 2 SIMPLIFY with SimplifyDB

Input t isin Tn a term f isin K[x1 xn] a polynomial SimplifyDB

Output a non evaluated product ie an element of Tn timesK[x1 xn]foreach u le t isin SimplifyDB[f ] do1

if u divides t then2

p = SimplifyDB[f ][u] 3

if u 6= t then return SIMPLIFY( tu p SimplifyDB) else return (1p) 4

end5

end6

Algorithm 3 Insertion into SimplifyDB

Input t isin Tn a term f p isin K[x1 xn] polynomials SimplifyDB

Output SimplifyDBif existu isin SimplifyDB[f ] t = u then1

Replace SimplifyDB[f ][u] with p if it is better 2

else3

SimplifyDB[f ][t] = p 4

end5

polynomials mprime middot f with mprime isin Tn and f prime isin G As one can easily see the second input parameter

is always an element of G So it stands to reason to restrict SIMPLIFY

SIMPLIFY(t i) where i is the index of gi isin G

Still there is the recursive call of SIMPLIFY taking a polynomial p as parameter which mightnot be an element of G Recall that p was found in the SimplifyDB using f and a term u = t

z

with z isin Tn With the knowledge that f = gi isin G we can write p = f middotuminus r = gi middotuminus r where

r isin K[x1 xn] is the sum of all reductions applied on f during a previous reduction stepThe recursive call is looking for another polynomial pprime which simplifies z middot p = z middot (gi middot u minus r)If such a polynomial pprime exists we can write pprime = z middot (gi middot u minus r) minus rprime = z middot u middot gi minus (z middot r minus rprime)Hence if the SimplifyDB stores pprime at index (gi z middot u) instead of (p z) the recursion is obsoleteand SIMPLIFY can be replaced with algorithm 4 being recursion free

Algorithm 4 New SIMPLIFY algorithm

Input t isin Tn a term i is the index of gi isin G SimplifyDB

Output a non evaluated product ie an element of Tn timesK[x1 xn]foreach u le t isin SimplifyDB[f ] do1

if u divides t then return ( tu SimplifyDB[f ][u]) 2

end3

Before benchmarking different variants of the distributed versions of the algorithm a firstlook at timings using only shared memory will thin out the number of combinations Forthe following computations we used a system with 48 AMD Opteron

TM

6172 cores having64 gigabyte of main memory The implementation of the parallelization for the shared memoryis presented in [13] and in its latest version it is realized using Intel Rcopy Threading Building Blocks(TBB) and Open Multi-Processing (OpenMP) for parallelization

76

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

Table 2 shows that the optional reduction is mostly useless and can be left out duringGrobner basis computation Table 3 shows that our new recursion-free SIMPLIFY is also inpractice faster and even more memory efficient

Finally SIMPLIFY is improving performance by increasing memory usage and so for solvinglarger polynomial systems it might be possible to find a solution within the bounds of availablememory by disabling SIMPLIFY Consequently we will compare computations with and withoutthe improved SIMPLIFY for the distributed parallel implementation in the following section

Polynomial systems without optional reduction with optional reductionmax matrix size runtime max matrix size runtime

Gametwo 7 7808 x 5895 2846 7731 x 5818 2985Cyclic 8 3841 x 4295 1118 3819 x 4244 1215Cyclic 9 70292 x 75080 6067 70251 x 75040 6283

Katsura 12 12142 x 11491 3449 12141 x 11490 3666Katsura 13 26063 x 23531 1522 26063 x 23531 1692Eco 12 12575 x 11349 2522 12547 x 10937 2836Eco 13 25707 x 24686 9176 25707 x 24686 1037F966 60898 x 63942 9832 60274 x 63503 1185

Table 2 Comparison of computations with and without optional reduction The new SIMPLIFY

algorithm was used in both cases

Polynomial with new SIMPLIFY with original SIMPLIFY without SIMPLIFYsystems runtime (s) memory runtime memory runtime memory

Gametwo 7 2846 459MB 2882 721MB 2997 262MBCyclic 8 1118 262MB 1443 393MB 1228 131MBCyclic 9 6067 156GB 6492 240GB 5429 210GB

Katsura 12 3449 655MB 3928 157GB 4374 328MBKatsura 13 1522 256GB 1872 727GB 2071 917MBEco 12 2522 328MB 3875 138GB 5087 262MBEco 13 9176 114GB 1364 577GB 2182 852MBF966 9832 256GB 2182 113GB 2125 125GB

Table 3 Comparison of original and new SIMPLIFY

6 Benchmarks

For the following benchmarks of our distributed implementation we used a cluster of up toeight systems having 16 Intel Rcopy Xeon Rcopy E5-2670 cores with hyperthreading and 64GB of RAMallowing us using up to 256 parallel threads For data distribution we use the Message PassingInterface (MPI) and the BoostMPI wrapper

Table 4 compares once again runtimes for computations with and without SIMPLIFY usingone two or four nodes For all polynomial input systems the computation time goes up andthe distribution has no positive effect However we accomplished to speed-up the reductiontime This is not an inconsistency The overall runtime goes up due to the communication

77

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

overhead and the possibility to improve the performance is limited to decreasing the reductiontime Hence the problem is the small size of the given polynomial systems Figure 1 illustratesthis issue for Cyclic 9

Table 5 adds further and more difficult examples Especially for Katsura 15 and Cyclic 10the distributed parallelization takes effect providing a speed-up of 23 and 27 for the overallcomputation time and 57 and 50 for the reduction using four respectively eight nodes Exclud-ing the Eco 14 system the computation is most effective without SIMPLIFY and in particularfor Cyclic 10 computations were not even possible with it due to memory overflows

Eco 14 is an counterexample because it is not possible to decrease the computation timeusing a distributed system This is caused by the effectiveness of SIMPLIFY for the probleminstance

The crashed computations for Katsura 15 and for Cyclic 10 without SIMPLIFY with twonodes are caused by a not yet solved overflow in the MPI implementation if more than 512 MBhave to be transfered in one operation This does not happen with four or eight nodes becausethe matrix size for each node decreases by factor two respectively four

At the end no distributed computation with SIMPLIFY is faster and hence it should beremoved in further developments of distributed parallel algorithms for Grobner bases compu-tations

Polynomial systems with SIMPLIFY without SIMPLIFY nodes 1 2 4 1 2 4

Gametwo 7 2985 3455 5603 2848 3853 2888(5549) (6709) (6010) (6630) (4607) (3427)

Cyclic 8 7798 1112 9520 7497 1406 2078(1327) (1707) (1953) (1332) (1473) (1168)

Cyclic 9 5060 5182 4947 3306 3617 4276(2222) (1952) (1388) (1499) (1224) (7373)

Katsura 12 4200 4636 5523 2859 3997 6685(6083) (8220) (7762) (6699) (4535) (3362)

Katsura 13 1874 1900 1864 1396 1588 1760(4046) (4661) (3682) (5003) (3107) (1815)

Eco 12 2135 2940 4149 2498 4108 8802(2564) (3760) (3953) (6458) (3664) (3097)

Eco 13 9178 1065 1209 1114 1575 2126(1210) (1632) (1462) (3865) (2310) (1467)

F966 9188 1062 1321 9360 1392 1851(2086) (2629) (2391) (3859) (2632) (1870)

Table 4 Distributed computation (and reduction) times for 12 or 4 nodes

78

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

1woS 2woS 4woS 1wS 2wS 4wS

0

100

200

300

400

500

600

Overhead

Reduction

Prepare

Update

Figure 1 Computation time in detail for Cyclic 9 with and without SIMPLIFY

Poly sys with SIMPLIFY without SIMPLIFY nodes 1 2 4 8 1 2 4 8

Katsura 14 9575 8310 7489 7448 7756 6599 6754 991(3139) (2634) (2012) 1691 (3984) (2244) (1351) (86)

Katsura 15 5719 crashed 3440 3252 5615 3857 3252 3372(2571) (-) 1272 1008 (3781) (1960) (1094) (666)

Cyclic 10 crashed crashed crashed crashed 30400 crashed 13270 11280(-) (-) (-) (-) (25240) (-) (7862) (5010)

Eco 14 5098 5194 5526 626 8005 7870 9967 1660(1106) (1177) (9802) (8938) (4113) (2240) (1277) (7824)

Table 5 Distributed computation (and reduction) times for larger input systems

7 Conclusion

We have shown that the parallelization of the F4 algorithm can be expanded form a sharedmemory system to a cluster of distributed nodes providing a multiple of the computation powerof a single system This was primarily achieved by using column-based parallelism removingthe optional reduction and the SIMPLIFY function It allowed us to solve larger input systemslike Katsura 15 or Cyclic 10 almost three times faster using four or respectively eight distributednodes Some work is still required to optimize the speed-up and the communication of the nodeshas to be improved to make solving of even larger problem instances possible

79

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

References

[1] Goran Bjorck and Uffe Haagerup All cyclic p-roots of index 3 found by symmetry-preservingcalculations 2008

[2] Michael Brickenstein Slimgb Grobner bases with slim polynomials Revista Matematica Com-

plutense 23(2)453ndash466 2010

[3] Jean-Charles Faugere A new efficient algorithm for computing Grobner bases (F4) Journal of

Pure and Applied Algebra 139(1ndash3)61ndash88 June 1999

[4] Jean-Charles Faugere and Sylvain Lachartre Parallel Gaussian Elimination for Grobner basescomputations in finite fields In Proceedings of the 4th International Workshop on Parallel and

Symbolic Computation PASCO rsquo10 pages 89ndash97 New York USA July 2010 ACM

[5] Jean-Charles Faugere Moreau Francois De Saint Martin and Fabrice Rouillier Design of regularnonseparable bidimensional wavelets using Groebner basis techniques IEEE Transactions on

Signal Processing 46(4)845ndash856 1998

[6] Rudiger Gebauer and H Michael Moller On an installation of buchbergerrsquos algorithm Journal

of Symbolic Computation 6275ndash286 December 1988

[7] Alessandro Giovini Teo Mora Gianfranco Niesi Lorenzo Robbiano and Carlo Traverso rdquoOnesugar cube pleaserdquo or selection strategies in the buchberger algorithm In Proceedings of the 1991

international symposium on Symbolic and algebraic computation ISSAC rsquo91 pages 49ndash54 NewYork USA 1991 ACM

[8] Gene H Golub and Charles F Van Loan Matrix Computations Johns Hopkins Studies in theMathematical Sciences Johns Hopkins University Press 1996

[9] Shigetoshi Katsura Wataru Fukuda Sakari Inawashiro Nahomi Fujiki and Rudiger GebauerDistribution of effective field in the ising spin glass of the plusmnj model at t = 0 Cell Biochemistry

and Biophysics 11309ndash319 1987

[10] David M Kreps and Robert Wilson Sequential equilibria Econometrica 50(4)863ndash94 July 1982

[11] Martin Kreuzer and Lorenzo Robbiano Computational Commutative Algebra 1 ComputationalCommutative Algebra Springer 2000

[12] Alexander Morgan Solving polynomial systems using continuation for engineering and scientific

problems Classics in applied mathematics SIAM 2009

[13] Severin Neumann Parallel reduction of matrices in Grobner bases computations In Vladimir PGerdt Wolfram Koepf Ernst W Mayr and Evgenii V Vorozhtsov editors Computer Algebra in

Scientific Computing volume 7442 of Lecture Notes in Computer Science pages 260ndash270 SpringerBerlin Heidelberg 2012

[14] Kurt Siegl A parallel factorization tree grobner basis algorithm In Parallel Symbolic Computation

PASCO 1994 Proceedings of the First International Symposium River Edge USA 1994 WorldScientific Publishing Co Inc

80

Generating Asymptotically Non-Terminant

Initial Variable Values for Linear Diagonalizable

Programs

Rachid Rebiha1lowast Nadir Matringe23 and Arnaldo Vieira Moura1

1 Institute of Computing UNICAMP University of Campinas SP Brasilrachidicunicampbr

2 Universit de Poitiers Laboratoire Mathmatiques et Applications France3 Institue de Mathematiques de Jussieu Universite Paris 7-Denis Diderot France

Abstract

We present the key notion of asymptotically non-terminant initial variable values fornon-terminant loop programs We show that those specific values are directly associated toinital variable values for which the corresponding loop program does not terminate Con-sidering linear diagonalizable programs we describe powerful computational methods thatgenerate automatically and symbolically a semi-linear space represented by a linear systemof equalities and inequalities Each element of this space provides us with asymptoticallynon-terminant initial variable values Our approach is based on linear algebraic methodsWe obtain specific conditions using certain basis and matrix encodings related to the loopconditions and instructions

1 Introduction

Research on formal methods for program verification [12 15 8 17] aims at discovering math-ematical techniques and developing their associated algorithms to establish the correctness ofsoftware hardware concurrent systems embedded systems or hybrid systems Static programanalysis [12 15] is used to check that a software is free of defects such as buffer overflows orsegmentation faults which are safety properties or termination and non-termination which areliveness properties Proving termination of while loop programs is necessary for the verificationof liveness properties that any well behaved and engineered system or any safety critical em-bedded system must guarantee We could list here many verification approaches that are onlypractical depending on the facility with which termination can be automatically determinedVerification of temporal properties of infinite state systems [20] is another example

Recent work on automated termination analysis of imperative loop programs has focusedon a partial decision procedure based on the discovery and synthesis of ranking functions Suchfunctions map the loop variable to a well-defined domain where their value decreases furtherat each iteration of the loop [9 10] Several interesting approaches based on the generationof linear ranking functions have been proposed [3 4] for loop programs where the guards andthe instructions can be expressed in a logic supporting linear arithmetic For the generation ofsuch functions there are effective heuristics [14 10] and in some cases there are also completemethods for the synthesis of linear ranking functions [16] On the other hand it is easy togenerate a simple linear terminant loop program that does not have a linear ranking functionAnd in this case such complete synthesis methods [16] fail to provide a conclusion about thetermination or the non termination of such a program

lowastSupported by FAPESP grant 201108947-1 and FAPESP grant BEPE 201304734-9

81

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

In this work we address the non-termination problem for linear while loop programs Inother words we consider the class of loop programs where the loop condition is a conjunc-tion of linear inequalities and the assignments to each of the variables in the loop instructionblock are affine or linear forms In matrix notation linear loop programs will be representedin a general form as while (Bx gt b) x = Ax + c (ie A and B are matrices b and c arevectors of real numbers and that x is a vector of variables) Without loss of generality theterminationnon-termination analysis for such a class of linear programs could be reduced tothe problem of terminationnon-termination for homogeneous linear programs [6 21] Thosebeing programs where linear assignments consist of homogeneous expressions and where thelinear loop condition consists of at most one inequality Concerning effective program trans-formations and simplification techniques non-termination analysis for programs presented in amore complex form can often be reduced to an analysis of a program expressed in this basicaffine form Despite tremendous progress over the years [6 5 7 13 11 2 1] the problem offinding a practical sound and complete methods for determining or analyzing non termina-tion remains very challenging for this class of programs and for all initial variable values Westarted our investigation from our preliminary technical reports [19 18] where we introduced atermination analysis in which algorithms ran in polynomial time complexity Here consideringa non terminating loop we introduce new static analysis methods that compute automaticallyand in polynomial time complexity the set of initial input variable values for which the programdoes not terminate and also a set of initial inputs values for which the program does terminateThis justifies the innovation of our contributions ie none of the other mentioned related workis capable of generating such critical information over non-terminating loops We summarizeour contributions as follows

bull To the best of our knowledge we introduce a new key notion for non-termination and ter-mination analysis for loop programs we identify the important concept of asymptoticallynon-terminant initial variable values ANT for short Any asymptotically non-terminantinitial variable values can be directly related to an initial variable value for which theconsidered program does not terminate

bull Our theoretical contributions provide us with efficient computational methods running inpolynomial time complexity and allowing the exact computation of the set of all asymp-totically non-terminant initial variable values for a given loop program

bull We generate automatically a set of linear equalities and inequalities describing a semi-linear space that represents symbolically the set of all asymptotically non-terminant initialvariable values The set of ANT values contains the set of non-terminant initial variablevalues On the other hand the complementary set of ANT values is a precise under-approximation of the set of terminant inputs for the same program

Example 11 (Motivating Example) Consider the following program depicted below on theleft We show a part of the output of our algorithm below on the right

(i) Pseudo code

while(2x+3y-zgt0)

x= y + z

y= -(12)x+(32)y -(12)z

z=(32)x -(32)y+(12)z

(ii) Output of our prototype

Locus of ANT

[[4u[1]+u[2]+u[3]gt0]

AND[u[1]+4u[2]+4u[3]gt0]

AND[-u[1]+u[2]-u[3]=0]]

OR[[-u[1]+u[2]-u[3]gt0]]

82

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

The semi-linear ANT = u = (u1 u2 u3)⊤ isin E | 4u1 + u2 + u3 gt 0 and u1 + 4u2 + 4u3 gt

0 andminusu1 + u2 minus u3 = 0 cup u = (u1 u2 u3)⊤ isin E | minus u1 + u2 minus u3 gt 0 represents symbolically

all asymptotically initial variable values that are directly associated to initial variable valuesfor which the program does not terminate On the other hand the complementary of this setco-ANT = u = (u1 u2 u3)

⊤ isin E | 4u1 + u2 + u3 le 0 or u1 + 4u2 + 4u3 le 0 orminusu1 + u2 minus u3 6=0 cap u = (u1 u2 u3)

⊤ isin E | minus u1 + u2 minus u3 le 0 is a precise under-approximation of the setof all initial variable values on which the program terminates

The rest of this article is organized as follows Section 2 can be seen as a preliminarysection where we introduce some key notions and results from linear algebra which will be usedto build our computational methods In this section we also present our computational modelfor programs and some further notations Section 3 introduces the new notion of asymptoticallynon-terminant initial variable values Section 4 provides the main theoretical contributionsof this work This section also presents our computational methods that generate a symbolicrepresentation of the asymptotically non-terminant variable values for linear programs Weprovide a complete dicussion in Section 5 Finally Section 6 states our conclusions

2 Linear Algebra and Linear Loop Programs

Here we present key linear algebraic notions and results which are central in the theoretical andalgorithmic development of our methods We denote by M(mnK) the set of mtimes n matriceswith entries in K and simply M(nK) when m = n The Kernel of A also called its nullspacedenoted by Ker(A) is Ker(A) = v isin K

n | A middot v = 0Km In fact when we deal with squarematrices these Kernels are Eigenspaces Let A be a ntimes n square matrix with entries in K Anonzero vector x isin K is an eigenvector for A associated with the eigenvalue λ isin K if A middotx = λxie (A minus λIn) middot x = 0 where In is the n times n identity matrix The nullspace of (A minus λIn) iscalled the eigenspace of A associated with eigenvalue λ Let n be a positive integer we willdenote R

n by E and its canonical basis by Bc = (e1 en) Let A be a square matrix inM(nR) Let us introduce the notation Spec(A) for the set of eigenvalues of A in R and wewill write Spec(A)lowast for the set Spec(A)minus 0 For λ isin Spec(A) we will denote by Eλ(A) thecorresponding eigenspace Throughout the paper we write dλ for the dimension of Eλ(A) Wewill say that A is diagonalizable if E = oplusλisinSpec(A)Eλ(A) Let A be a diagonalizable matrixFor each eigenspace Eλ(A) we will take a basis Bλ = (eλ1 eλdλ

) and we define

B = cupλisinSpec(A)Bλ

as a basis for E

Definition 21 Let x belong to E We denote by xλ its component in Eλ(A) If x admits the

decompositionsum

λisinSpec(A)(sumdλ

i=1 xλieλi) in B we have xλ =sumdλ

i=1 xλieλi

We denote by P the transformation matrix corresponding to B whose columns are the vectorsof B decomposed in Bc Letting di denote the integer dλi

for the ease of notation we recallthe following lemma

Lemma 21 We have Pminus1AP = diag(λ1Id1 λtIdt) We denote by D the matrix Pminus1AP

As we will obtain our results using the decomposition of x in B we recall how one obtains itfrom the decomposition of x in Bc

83

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

Lemma 22 Let x isin E If x =sumn

i=1 xiei = (x1 xn)⊤ isin Bc and x decomposes as

sumtj=1(

sumdj

i=1 xλj ieλj i) in B the coefficients xλj i are those of the column vector Pminus1x in Bc

Throughout the paper we write lt gt for the canonical scalar product on E which is given by lt

x y gt=sumn

i=1 xiyi and recall as it is standard in static program analysis that a primed symbolxprime refers to the next state value of x after a transition is taken Next we present transitionsystems as representations of imperative programs and automata as their computational models

Definition 22 A transition system is given by 〈x L T l0Θ〉 where x = (x1 xn) is a setof variables L is a set of locations and l0 isin L is the initial location A state is given by aninterpretation of the variables in x A transition τ isin T is given by a tuple 〈lpre lpost qτ ρτ 〉where lpre and lpost designate the pre- and post- locations of τ respectively and the transitionrelation ρτ is a first-order assertion over x cup xprime The transition guard qτ is a conjunction ofinequalities over x Θ is the initial condition given as a first-order assertion over x Thetransition system is said to be linear when ρτ is an affine form

We will use the following matrix notations to represent loop programs and their associatedtransitions systems

Definition 23 Let P be a loop program represented by the transition system 〈x =(x1 xn) l0 T = 〈l l qτ ρτ 〉 l0Θ〉 We say that P is a linear loop program if the followingconditions hold

bull Transition guards are conjunctions of linear inequalities We represent the loop conditionin matrix form as V x gt b where V isin M(mnR) and b isin R

m By V x gt b we mean thateach coordinate of vector V x is greater than the corresponding coordinate of vector b

bull Transition relations are affine or linear forms We represent the linear assignments inmatrix form as x = Ax+ c where A isin M(nR) and c isin R

n

The linear loop program P = P (A V b c) will be represented in its most general form aswhile (V x gt b) x = Ax+ c

In this work we use the following linear loop program classifications

Definition 24 We identify the following three types of linear loop programs from the morespecific to the more general form

bull Homogeneous We denote by PH the set of programs where all linear assignments consistof homogeneous expressions and where the linear loop condition consists of at most oneinequality If P is in PH then P will be written in matrix form as while (lt v x gtgt

0) x = Ax where v is a (ntimes 1)-vector corresponding to the loop condition and whereA isin M(nR) is related to the list of assignments in the loop We say that P has ahomogeneous form and it will also be denoted as P (A v)

bull Generalized Condition We denote by PG the set of linear loop programs where the loopcondition is generalized to a conjunction of multiple linear homogeneous inequalities

bull Affine Form We denote by P A the set of loop programs where the inequalities and theassignments are generalized to affine expressions If P is in P A it will be written aswhile (V x gt b) x = Ax+ c for A and V in M(nR) b isin R

m and c isin Rn

84

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

Without lost of generality the static analysis for the class of linear programs P A could bereduced to the problem of terminationnon-termination for homogeneous linear programs inPH In this work we consider programs in PH The generalization to programs in P A canalready be done and it will be reported elsewhere

3 Asymptotically Non-terminant Variable Values

In this section we present the new notion of asymptotically non-terminant variable values Itwill prove to be central in analysis of termination in general Let A be a matrix in M(nR)and v be a vector in E Consider the program P (A v) while (lt v x gtgt 0) x = Ax whichtakes values in E We first give the definition of the termination of such a program

Definition 31 The program P (A v) is said to be terminating on x isin E if and only iflt vAk(x) gt is not positive for some k ge 0

In other words Definition 31 states that if the program P (A v) performs k ge 0 loopiterations from initial variables xin E we obtain x = Ak(x) Thus if lt vAk(x) gtle 0the loop condition is violated and so P (a v) terminates Next we introduce the followingimportant notion

Definition 32 We say that x isin E is an asymptotically non terminating value for P (A v) ifthere exists kx ge 0 such that P (A v) is non terminating on Akx(v) We will write that x isANT for P (A v) or simply x is ANT We will also write that P (A v) is ANT on x

Note that if P (A v) is non terminating on Akx(x) then lt vAk(x) gt is gt 0 for k ge kxThe following result follows directly from the previous definition

Corollary 31 An element x isin E is ANT if and only if lt vAk(x) gt is positive for k largeenough

If the set of ANT points is not empty we say that the program P (A v) is ANT We willalso write NT for non terminant For the programs we study here the following lemma alreadyshows the importance of such a set

Lemma 31 The program P (A v) is NT if and only if it is ANT

Proof It is clear that NT implies ANT (ie NT sube ANT ) as a NT point of P (A v) is ofcourse ANT (with kx = 0) Conversely if P (A v) is ANT call x an ANT point then Akx(x)is a NT point of P (A v) and so P (A v) is NT

As one can easily see the set of NT points is included in the set of ANT points But themost important property of the ANT set remains in the fact that each of its point provides uswith an associated element in NT for the corresponding program In other words each elementx in the ANT set even if it does not necessarily belong to the NT set refers directly to initialvariable values yx = Ak[x](x) for which the program does not terminate ie yx is an NT pointWe can say that there exists a number of loop iterations k[x] departing from the initial variable

values x such that Ak[x](x) correspond to initial variable values for which P (A v) does notterminate But it does not necessarily implies that x is also an NT point for P (A v) In factprogram P (A v) could terminate on the initial variable values x by performing a number of

85

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

loop iterations strictly smaller than k[x] On the other hand the complementary set co-ANT

provides us with a quite precise under approximation of the set of all initial variable values forwhich the program terminates

The set of ANT points of a program is also important to the understanding of the terminationof a program with more than one conditional linear inequality as well as for termination overthe rationals for example This will be reported elsewhere

4 Automated generation of ANT loci

In this section we show how we generate automatically and exactly the ANT Locus ie the setof all ANT points for linear diagonalizable programs over the reals We represent symbolicallythe computed ANT Locus by a semi-linear space defined by linear equalities and inequalitiesConsider the program P (A v) while (lt v x gtgt 0) x = Ax The study of ANT setsdepends on the spectrum of A Recall the introductory discussion and Definition 21 at Section2

Proposition 41 For x in E and k ge 1 the scalar product lt vAk(x) gt is equal to

sum

λisinSpec(A)

λk lt v xλ gt=sum

λisinSpec(A)lowast

λk lt v xλ gt

Proof It is a direct consequence of the equality Ak(xλ) = λkxλ

41 The regular case

We first analyze the situation where A is what we call regular

Definition 41 We say that A is regular if Spec(A) cap[

minus Spec(A)]

is an empty set ie ifλ belongs to Spec(A) then minusλ does not belong to Spec(A)

In this case we make the following observation

Proposition 42 Let micro be the nonzero eigenvalue of largest absolute value if it exists such thatlt v xmicro gt is nonzero For k large the quantity lt vAk(x) gt is equivalent to microk lt v xmicro gt

Proof Indeed we can write lt vAk(x) gt as

microk lt v xmicro gt +sum

λ|λ|lt|micro|

λk lt v xλ gt= microk(lt v xmicro gt +sum

λ|λ|lt|micro|

λk

microklt v xλ gt)

and λk

microk approaches zero when k goes to infinity

We then define the following sets

Definition 42 For micro a positive eigenvalue of A we define Smicro as follows

Smicro = x isin Elt v xmicro gtgt 0 lt v xλ gt= 0 for |λ| gt |micro|

86

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

In order to obtain Smicro for all positive eigenvalues micro of A one needs to calculate lt v xmicro gtand lt v xλ gt for all eigenvalues λ such that |λ| gt |micro| For all eigenvalues λ involved inthe computation of Smicro one also needs to evaluate the coefficients cλi =lt v eλi gt for all

eigenvectors eλi isin B and 1 le i le dλ Thus we have lt v xλ gt=sumdλ

i=1 cλixλi Now we onlyneed to compute the coefficient xλi which are those of the column vector Pminus1x in Bc whereP is the transformation matrix corresponding to B See Lemma 22

We ca now state the following theorem allowing the exact computation of the ANT Locusfor the regular case

Theorem 41 The program P (A v) is ANT on x if and only if x belongs to

microgt0isinSpec(A)

Smicro

Proof Let x belong to E If all lt v xλ gt are zero for λ isin Spec(A) then lt vAk(x) gt= 0and x is not ANT Otherwise let micro be the eigenvalue of largest absolute value such thatlt v xmicro gt is nonzero Then according to Proposition 42 the sign of lt vAk(x) gt is the signof microk lt v xmicro gt for k large If micro is negative this sign will be alternatively positive and negativedepending on the parity of k and x is not ANT If micro is positive this sign will be the sign oflt v xmicro gt hence x will be ANT if and only if lt v xmicro gt is positive This proves the result

Example 41 (Running example) Consider the program P (A v) depicted as follows

(i) Pseudo code

while(x+y-2zgt0)

x= x-4y-4z

y= 8x-11y-8z

z= -8x+8y+5z

(ii) Associated matrices

A =

1 minus4 minus48 minus11 minus8minus8 8 5

and v =

11minus2

Step 1 Diagonalization of the matrix A

P =

1 1 12 1 0minus2 0 1

D =

1 0 00 minus3 00 0 minus3

and Pminus1 =

1 minus1 minus1minus2 3 22 minus2 minus1

Using our notations the obtained eigenvectors (ie the column vectors of P ) are denoted asfollows e11 = (1 2minus2)⊤ eminus31 = (1 1 0)⊤ eminus32 = (1 0 1)⊤

Step 2 We compute Smicro for all positive micro isin Spec(A)lowast

bull We compute first the coefficients cλic11 =lt v e11 gt=lt (1 1minus2)⊤ (1 2minus2)⊤ gt= 7

cminus31 =lt v eminus31 gt=lt (1 1minus2)⊤ (1 1 0)⊤ gt= 2

cminus32 =lt v eminus31 gt=lt (1 1minus2)⊤ (1 0 1)⊤ gt= minus1

bull We compute the coefficient xλi which are those of the column vector Pminus1 middotu in Bc whereu = (u1 u2 u3) is the vector encoding the initial variable values

Pminus1

u1

u2

u3

=

u1 minus u2 minus u3)minus2u1 + 3u2 + 2u3)2u1 minus 2u2 minus u3)

=

x11

xminus31

xminus32

We can now proceed to the generation of the linear constraints defining a semi-linear space

87

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

describing symbolically and exactly Smicrolt v x1 gt= c11x11 = 7(u1 minus u2 minus u3)lt v xminus3 gt= cminus31xminus31 + cminus32xminus32 = minus6u1 + 8u2 + 5u3)Hence we have S1 = u = (u1 u2 u3)

⊤ isin E | (u1minusu2minusu3 gt 0)and(minus6u1+8u2+5u3 = 0)

Step 3 We apply Theorem 41 to generate the ANT Locus It reduces to the semi-linear spaceS1 = u = (u1 u2 u3)

⊤ isin E | (u1 minus u2 minus u3 gt 0) and (minus6u1 + 8u2 + 5u3 = 0)

42 The general case handling linear diagonalizable programs

For the general case in the asymptotic expansion of lt vAk(x) gt one can have compensationsbetween λk lt v xλ gt and (minusλ)k lt v xλ gt as these terms can be zero when k is even forinstance and of a well determined sign when k is odd We thus need to take care of this issueTo this end we introduce the following notation

Definition 43 If λ does not belong to Spec(A) for any x isin E we write xλ = 0

We have the following propositions which give the asymptotic behavior of lt vAk(x) gt

Proposition 43 Let micro be the nonzero eigenvalue of largest absolute value if it exists suchthat lt v x|micro| + xminus|micro| gt is nonzero For k large the quantity lt vA2k(x) gt is equivalent to

|micro|2k(lt v x|micro| + xminus|micro| gt)

Proof Indeed we can write lt vA2k(x) gt as

micro2k(lt v x|micro| gt + lt v xminus|micro| gt) +sum

|λ||λ|lt|micro|

λ2k(lt v x|λ| gt + lt v xminus|λ| gt)

= micro2k(lt v x|micro| gt + lt v xminus|micro| gt) +sum

|λ||λ|lt|micro|

λ2k

micro2k(lt v x|λ| gt + lt v xminus|λ| gt))

and λk

microk approaches to zero when k goes to infinity

Proposition 44 Let micro be the nonzero eigenvalue of largest absolute value if it exists suchthat lt v x|micro| minus xminus|micro| gt is nonzero For k large the quantity lt vA2k+1(x) gt is equivalent to

|micro|2k+1(lt v x|micro| minus xminus|micro| gt)

Proof The proof is similar to the proof of Proposition 43

As in the previous Section we introduce the following relevant sets

Definition 44 For |micro| in |Spec(A)lowast| we define the sets S0|micro| and S1

|micro| as follows

S0|micro| = x isin Elt v x|micro| + xminus|micro| gtgt 0 lt v x|λ| + xminus|λ| gt= 0 for |λ| gt |micro| and

S1|micro| = x isin Elt v x|micro| minus xminus|micro| gtgt 0 lt v x|λ| minus xminus|λ| gt= 0 for |λ| gt |micro|

In order to compute the sets S0|micro| and S1

|micro| we obtain the coefficients cλi =lt v eλi gt for alleigenvalues λ If the λ appearing as index in the coefficient cλi is not an eigenvalue then we fix

cλi = 0 and dλ = 0 (see Definition 43) Thus we have lt v x|λ| + xminus|λ| gt=sumd|λ|

i=1 c|λ|ix|λ|i +sumdminus|λ|

i=1 cminus|λ|ixminus|λ|i and lt v x|λ| minus xminus|λ| gt=sumd|λ|

i=1 c|λ|ix|λ|i minussumdminus|λ|

i=1 cminus|λ|ixminus|λ|iWe finally obtain the following main theorem

88

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

Theorem 42 The program P (A v) is ANT on x if and only if x belongs to the set

(|micro||microprime|)isin|Spec(A)lowast|times|Spec(A)lowast|

S0|micro| cap S1

|microprime|

Proof It is obvious that x is ANT if and only if lt vA2k(x) gt and lt vA2k+1(x) gt are bothpositive for k large Now reasoning as in the proof of Theorem 41 but using Propositions 43and 44 instead of Proposition 42 we obtain that lt vA2k(x) gt is positive for k large if andonly if x belongs to S0

|micro| for some micro isin |Spec(A)lowast| and that lt vA2k+1(x) gt is positive for k

large if and only if x belongs to S1|microprime| for some microprime isin |Spec(A)lowast| The result follows

The following two examples illustrate how Theorem 42 applies to different cases

Example 42 (Running example) Consider the program P (A v) depicted as follows

(i) Pseudo code

while(2x+3y-zgt0)

x=15x+18y-8z+6s-5t

y=5x+3y+z-t-3s

z=-4y+5z-4s-2t

s=-43x-46y+17z-14s+15t

t=26x+30y-12z+8s-10t

(ii) Associated matrices

A =

15 18 minus8 6 minus55 3 1 minus1 minus30 minus4 5 minus4 minus2

minus43 minus46 17 minus14 1526 30 minus12 8 minus10

v =

11231

Step 1 Diagonalization of the matrix A

P =

2 1 minus1 1 1minus1 0 2 0 minus1minus2 0 2 minus1 minus2minus4 minus1 0 minus2 minus12 2 1 2 1

D =

minus3 0 0 0 00 minus1 0 0 00 0 0 0 00 0 0 1 00 0 0 0 2

and Pminus1 =

minus3 minus3 1 minus1 1minus1 minus2 1 0 1minus5 minus4 1 minus1 210 10 minus3 2 minus4minus7 minus6 1 minus1 3

We obtain the following eigenvectors written using our notation e01 = (minus1 2 2 0 1)⊤e11 = (1 0minus1minus2 2)⊤ e21 = (1minus1minus2minus1 1)⊤ eminus11 = (1 0 0minus1 2)⊤ and eminus31 =(2minus1minus2minus4 2)⊤

Step 2 Computing Smicro for all positive micro isin Spec(A)lowast

bull Our algorithm first computes the coefficients cλi We obtain c01 = 6 c11 = minus5c21 = minus6 cminus11 = 0 and cminus31 = minus13

bull Then our algorithm computes the coefficients of the decomposition of the initial vari-able values in B They are those of the column vector Pminus1 middot u in Bc where u =(u1 u2 u3 u4 u5)

⊤ is the vector encoding the initial variable values

Pminus1

u1

u2

u3

u4

u5

=

minus3u1 minus 3u2 + u3 minus u4 + u5

minusu1 minus 2u2 + u3 + u5

minus5u1 minus 4u2 + u3 minus u4 + 2u5

10u1 + 10u2 minus 3u3 + 2u4 minus 4u5

minus7u1 minus 6u2 + u3 minus u4 + 3u5

=

xminus31

xminus11

x01

x11

x21

Now the algorithm obtains all the non-zero terms appearing in the definition of S0|λ| and S1

|λ|

lt v x|1| + xminus|1| gt= c11x11 = minus5(10u1 + 10u2 minus 3u3 + 2u4 minus 4u5)lt v x|2| + xminus|2| gt= c21x21 = minus6(minus7u1 minus 6u2 + u3 minus u4 + 3u5)

89

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

lt v x|minus3| + xminus|minus3| gt= cminus31xminus31 = minus13(minus3u1 minus 3u2 + u3 minus u4 + u5)lt v x|minus3| minus xminus|minus3| gt= minuscminus31xminus31 = 13(minus3u1 minus 3u2 + u3 minus u4 + u5)

All the sets S0|λ| and S1

|λ| can now be computed exactly

S0

|1| = u isin E | 5(10u1 + 10u2 minus 3u3 + 2u4 minus 4u5) gt 0 and minus6(minus7u1 minus 6u2 + u3 minus u4 + 3u5) = 0 and

minus 13(minus3u1 minus 3u2 + u3 minus u4 + u5) = 0

S1

|1| = u isin E|5(10u1 + 10u2 minus 3u3 + 2u4 minus 4u5) gt 0 and minus6(minus7u1 minus 6u2 + u3 minus u4 + 3u5) = 0 and

13(minus3u1 minus 3u2 + u3 minus u4 + u5) = 0

S0

|2| = u isin E| minus 6(minus7u1 minus 6u2 + u3 minus u4 + 3u5) gt 0 and minus13(minus3u1 minus 3u2 + u3 minus u4 + u5) = 0

S0

|2| = u isin E| minus 6(minus7u1 minus 6u2 + u3 minus u4 + 3u5) gt 0 and minus13(minus3u1 minus 3u2 + u3 minus u4 + u5) = 0

S1

|2| = u isin E| minus 6(minus7u1 minus 6u2 + u3 minus u4 + 3u5) gt 0 and 13(minus3u1 minus 3u2 + u3 minus u4 + u5) = 0

S0

|minus3| = u isin E| minus 13(minus3u1 minus 3u2 + u3 minus u4 + u5) gt 0

S1

|minus3| = u isin E| 13(minus3u1 minus 3u2 + u3 minus u4 + u5) gt 0

Step 3 We apply Theorem 42 to generate the ANT LocusThe algorithm computes the following intersections S0

1 capS11 S

01 capS1

2 S01 capS1

3 S02 capS1

1 S02 capS1

2 S02 cap S1

3 S03 cap S1

1 S03 cap S1

2 and S03 cap S1

1 In fact the previous computational step already allows our algorithm to perform implicit sim-plifications For instance it appears that S0

|1| = S1|1| S

0|1| = S1

|1| = S0|minus1| = S1

|minus1| S0|2| = S1

|2|

and that S0|minus3| cap S1

|minus3| is the empty set According to Theorem 42 the ANT locus reduces tothe following semi-linear space

u = (u1 u2 u3 u4 u5)⊤ isin E | minus 10u1 minus 10u2 + 3u3 minus 2u4 + 4u5 gt 0 and

minus 7u1 minus 6u2 + u3 minus u4 + 3u5 = 0 and

minus 3u1 minus 3u2 + u3 minus u4 + u5 = 0⋃

u = (u1 u2 u3 u4 u5)⊤ isin E | minus 10u1 minus 10u2 + 3u3 minus 2u4 + 4u5 gt 0 and

minus 3u1 minus 3u2 + u3 minus u4 + u5) gt 0 and

minus 7u1 minus 6u2 + u3 minus u4 + 3u5 = 0⋃

u = (u1 u2 u3 u4 u5)⊤ isin E | 7u1 + 6u2 minus u3 + u4 minus 3u5 gt 0 and

minus 3u1 minus 3u2 + u3 minus u4 + u5 = 0

5 Discussions

This work is complementary to our previous work [19] which dealt with termination analysisIn [19] we first prove a sufficient condition for the termination of homogeneous linear programsThis statement was conjectured in the important work of [21] where the first attempt toprove this result contains non trivial mistakes As we shown in [19] the actual proof of thissufficient condition requires expertise in several independent mathematical fields Also thenecessary condition proposed in [21] does not apply as expected in practice We then wentto generalize the previous result and to the best of our knowledge we presented the firstnecessary and sufficient condition (NSC for short) for the termination of linear programsIn fact this NSC exhibits a complete decidability result for the class of linear programs on all

90

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

initial values Moreover departing from this NSC we showed the scalability of these approachesby demonstrating that one can directly extract a sound and complete computational methodrunning in polynomial time complexity to determine termination or nontermination for linearprograms On the other hand all other related and previous works mentioned in this paper donot provide any techniques capable of generating automatically the set of initial input variablevalues for which a loop does not terminate The main contributions of this paper remain ona sound and complete computational method to compute the set of input variable values forwhich the programs do not terminate The overall time complexity of our algorithm is also oforder O(n3) As can be seen the main results ie Theorems 41 and 42 provide us with adirect symbolic representation of the ANT set Even if those theorems are rigorously stated andproofs are quite technical they are really easy to apply we only need to compute the explicitterms S0

|micro| and S1|microprime| in order to directly obtain a formula representing exactly and symbolically

the ANT set In a same manner we extended this techniques to linear program not necessarilydiagonalizable and we obtained similar theoretical and practical results As their associatedproofs are more technical they would required more space to be fully expressed and we left themfor an ensuing report In other more recent work on termination static analysis for programsover the rationals or the integers with several conditional linear inequalities we also show thatthe notion ANT remains central

6 Conclusion

We presented the new notion of asymptotically non-terminant initial variable values for linearprograms Considering a linear diagonalizable program our theoretical results provided us withsound complete and fast computational methods allowing the automated generation of the setsof all asymptotically non-terminant initial variable values represented symbolically and exactlyby a semi-linear space eg conjunctions and disjunctions of linear equalities and inequalitiesAlso by taking the complementary set of the semi-linear set of ANT initial variable values weobtain a precise under-approximation of the set of terminant initial variable values for the (non-terminant) program Actually this type of method can be vastly generalized to tackle the ter-mination and non-termination problem of linear programs not necessarily diagonalizable withmore than one conditional linear inequality on rational or integer initial values for instanceWe leave this investigation for an ensuing report

References

[1] Amir M Ben-Amram and Samir Genaim On the linear ranking problem for integer linear-constraint loops In Proceedings of the 40th annual ACM SIGPLAN-SIGACT symposium onPrinciples of programming languages POPL rsquo13 pages 51ndash62 New York NY USA 2013 ACM

[2] Amir M Ben-Amram Samir Genaim and Abu Naser Masud On the termination of integer loopsIn VMCAI pages 72ndash87 2012

[3] Aaron R Bradley Zohar Manna and Henny B Sipma Linear ranking with reachability In InCAV pages 491ndash504 Springer 2005

[4] Aaron R Bradley Zohar Manna and Henny B Sipma Termination analysis of integer linearloops In In CONCUR pages 488ndash502 Springer-Verlag 2005

[5] Aaron R Bradley Zohar Manna and Henny B Sipma Termination of polynomial programsIn In VMCAIrsquo2005 Verification Model Checking and Abstract Interpretation volume 3385 ofLNCS pages 113ndash129 Springer 2005

91

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

[6] Mark Braverman Termination of integer linear programs In In Proc CAV06 LNCS 4144 pages372ndash385 Springer 2006

[7] Hong Yi Chen Shaked Flur and Supratik Mukhopadhyay Termination proofs for linear simpleloops In Proceedings of the 19th international conference on Static Analysis SASrsquo12 pages 422ndash438 Berlin Heidelberg 2012 Springer-Verlag

[8] Edmund M Clarke Orna Grumberg and Doron Peled Model Checking MIT Press CambridgeMA 2000

[9] Michael Colon and Henny Sipma Synthesis of linear ranking functions In Proceedings of the 7thInternational Conference on Tools and Algorithms for the Construction and Analysis of SystemsTACAS 2001 pages 67ndash81 London UK 2001 Springer-Verlag

[10] Michael A Colon and Henny B Sipma Practical methods for proving program termination InIn CAV2002 Computer Aided Verification volume 2404 of LNCS pages 442ndash454 Springer 2002

[11] Byron Cook Andreas Podelski and Andrey Rybalchenko Termination proofs for systems codeSIGPLAN Not 41(6)415ndash426 June 2006

[12] P Cousot and R Cousot Abstract interpretation and application to logic programs Journal ofLogic Programming 13(2ndash3)103ndash179 1992

[13] Patrick Cousot and Radhia Cousot An abstract interpretation framework for termination SIG-PLAN Not 47(1)245ndash258 January 2012

[14] Dennis Dams Rob Gerth and Orna Grumberg A heuristic for the automatic generation of rankingfunctions In Workshop on Advances in Verification pages 1ndash8 2000

[15] Zohar Manna Mathematical Theory of Computation McGraw-Hill 1974

[16] Andreas Podelski and Andrey Rybalchenko A complete method for the synthesis of linear rankingfunctions In VMCAI pages 239ndash251 2004

[17] Jean-Pierre Queille and Joseph Sifakis Specification and verification of concurrent systems incesar In Proceedings of the 5th International Symposium in Programming pages 337ndash351 LondonUK 1982 Springer-Verlag

[18] Rachid Rebiha Nadir Matringe and Arnaldo V Moura A complete approach for terminationanalysis of linear programs Technical Report IC-13-08 Institute of Computing University ofCampinas February 2013

[19] Rachid Rebiha Nadir Matringe and Arnaldo V Moura Necessary and sufficient condition fortermination of linear programs Technical Report IC-13-07 Institute of Computing University ofCampinas February 2013

[20] Henny B Sipma Tomas E Uribe and Zohar Manna Deductive model checking Form MethodsSyst Des 15(1)49ndash74 July 1999

[21] Ashish Tiwari Termination of linear programs In Rajeev Alur and Doron Peled editors ComputerAided Verification 16th International Conference CAV 2004 Boston MA USA volume 3114 ofLecture Notes in Computer Science pages 70ndash82 Springer 2004

92

Data Conversion Method between a Natural

Number and a Binary Tree for an Inductive

Proof and Its Application

Kazuko Takahashi1 Shizuo Yoshimaru1lowast

and Mizuki Goto1

1 School of Science and Technology Kwansei Gakuin Universityktakakwanseiacjp

2 School of Science and Technology Kwansei Gakuin Universityshizuoyoshimarugmailcom

3 School of Science and Technology Kwansei Gakuin Universitybub85144kwanseiacjp

Abstract

This paper presents modeling of a binary tree that represents a natural number andgives an inductive proof for its properties using theorem provers We define a function forconverting data from a natural number into a binary tree and give an inductive proof forits well-definedness We formalize this method develop a computational model based onit and apply it to an electronic cash protocol We also define the payment function onthe binary tree and go on to prove the divisibility of electronic cash using the theoremprovers IsabelleHOL and Coq respectively Furthermore we discuss the effectiveness ofthis method

1 Introduction

Theorem proving is an important technique to provide a certified system or to ensure bug-free programming Several theorem provers which may be called proof assistants have beendeveloped including ACL2 [11] PVS [19] IsabelleHOL [16] Coq [4] Agda [17] and so onThese tools help users to develop formal proofs either interactively or semi-automaticallytypically using induction as the proof strategy There are numerous applications for suchprovers There are relatively few practical applications of these tools in most fields comparedto their use in pure mathematics although there are some outstanding results in microprocessordesign [10] C compilers [14] operating system kernels [12] security protocols [1] and securecard systems [3 13] To use these provers successfully it is necessary to construct a suitablemodel and then select an appropriate proof strategy In practical applications it may be difficultto form a natural inductive model and so it may be necessary to build a data structure whichcan be difficult for these provers to handle

We have previously attempted to prove the divisibility of an electronic cash protocol [21] Inthis experience we have encountered difficulties in proving the properties regarding the functionthat converts a natural number to a binary tree The binary tree is a complete binary treewhere a Boolean value is attached to each node and the value of which is defined as a sum ofthe value of the left and right subtrees The problem can be reduced to the fact that there existsa function that cannot be defined in a primitive recursive form on an inductively defined datastructure Because a natural number has a linear structure with only one successor whereas a

lowastCurrently Nochu Information System CoLTD

93

Data Conversion Revisited Takahashi Yoshimaru and Goto

binary tree has a branching structure with two successors at each branching point the inductionschemes are different which complicates the proof

To solve this problem we introduced a bit sequence as an intermediate data structure anddefined the function from a natural number to a binary tree as a composition of two recursivefunctions via a bit sequence Specifically the first function describes the mapping from anatural number to an intermediate bit sequence and the second function is the mapping fromthe bit sequence to the binary tree We formalized this model and associated proof method andapplied it to the divisibility of an electronic cash protocol using IsabelleHOL However thisprevious work had several drawbacks First the model was complicated because of an intricatelabeling for the nodes of a tree a simpler and more natural model for this specific binary treehas subsequently been identified Second the proof was incomplete as one of the lemmas thatrelates the bit sequence to the binary tree was left as an axiom Third the effectiveness of themethod was not discussed we did not know whether this method could be applied similarlywith theorem provers other than IsabelleHOL or whether a large number of modificationswould be required In this paper we provide a simplified model give complete proofs of thedivisibility using the theorem provers IsabelleHOL and Coq and discuss the effectiveness ofthe method

The rest of this paper is organized as follows In Section 2 we describe in detail the problemsof data conversion and our solution In Sections 3 and 4 we present a formalization and aninductive proof of the divisibility of an electronic cash protocol In Section 5 we provide adiscussion and in Section 6 we present our conclusions

2 Data Conversion Formalization

21 Problem

First we illustrate the problem of converting between a natural number and a binary treewhich are data structures with different induction schemes

Let NAT and BTREE be a natural number and a binary tree respectively NAT is induc-tively defined with one successor BTREE is inductively defined in such a form that there aretwo successors ie

nat_p(0)

nat_p(n) =gt nat_p(Suc(n))

tree_p(Tip)

tree_p(lt) amp tree_p(rt) =gt tree_p(Node(_ltrt))

where Suc denotes the successor function Node is a constructor for a tree rsquo rsquo denotes ananonymous variable that corresponds to a parent node lt and rt are the left and right subtreesrespectively and T ip is a leaf node The symbols amp and =gt denote conjunction and implicationrespectively

Consider data conversion between NAT and BTREE Let f be a function that maps fromNAT to BTREE and g be a function that maps from BTREE to NAT We assume that thesefunctions are defined inductively in the following form

f NAT --gt BTREE

f(Suc(n)) = c1(f(n))

f(0) = Tip

94

Data Conversion Revisited Takahashi Yoshimaru and Goto

g BTREE --gt NAT

g(Node(_ltrt)) = c2(g(lt) g(rt))

g(Tip) = 0

where c1 is a function from BTREE to BTREE and c2 is a function from NATtimes NAT to NATConsider proving the following relationship between f and g

g(f(n)) = n

We use the following induction scheme IS on NAT to prove it

foralln( (forallnprimenprime lt n =rArr g(f(nprime)) = nprime) =rArr g(f(n)) = n ) [IS]

The proof proceeds by rewriting g(f(n)) in succession as follows

g(f(n)) = g(f(c2(n1 n2)))= g(Node( f(n1) f(n2)))= c2(g(f(n1)) g(f(n2)))= c2(n1 n2)

where c2(n1 n2) = n for a certain n1 n2 lt nThe induction scheme IS is used to proceed from the third line to the fourth line To succeed

in this proof there are two problems to be solved The first is the progression from the first lineto the second line we have to prove the equality f(c2(n1 n2)) = Node( f(n1) f(n2)) Thisproblem is how to divide a natural number into two parts suitably The second and arguablymore challenging problem is that we cannot find c1 that defines f in a recursive form naturallyConsider the function f which maps a natural number to a binary tree The forms of the datastructures f(n) and f(Suc(n)) are considerably different and the differences depend on thevalues of n For example compare the operation of adding a leaf node labeled ldquoTruerdquo to thebinary tree shown in Figure 1 In this figure (a) shows the operation of adding a node to thebinary tree that has two leaf nodes labeled ldquoTruerdquo and (b) shows the operation of adding anode to the binary tree that has three leaf nodes labeled ldquoTruerdquo These operations cannot berepresented uniformly therefore f(n) cannot be uniformly defined for all n Furthermore evenif f is defined the proof over the properties on f is not straightforward

(a)

T F F F

T T

(b)

T T T TT T T F

T

T T T

T T

T T

T

T

Figure 1 Operation on adding a ldquoTruerdquo node to a binary tree

On the other hand the definition of g is simpler because it is a conversion from a data typethat is not totally-ordered to one that is totally-ordered

22 Solution

To solve the problem shown above we introduce the bit sequence BS as an intermediate datastructure between NAT and BTREE

95

Data Conversion Revisited Takahashi Yoshimaru and Goto

221 Conversion from BS to BTREE

First we describe the conversion from BS to BTREE We choose a specific binary tree used inan electronic cash protocol This tree is a complete binary tree and a Boolean value is attachedto each node the value of which is defined as a sum of the values of its left and right subtrees

Let b0b1 bn be a sequence of Boolean values that corresponds to a natural number kThen k = bprime0 middot 2

n + bprime1 middot 2nminus1 + + bprimen middot 20 where bprimei = 10 for bi = TrueFalse (1 le i le n)

respectively We encode bprime0 middot2n as the left tree and the remainder as the right tree The function

from BS to BTREE is defined as follows

bs_to_btree() = (Tipfalse)

bs_to_btree(bbs) = (if b

then Node(true create_btree(truelength(bs)) bs_to_btree(bs) )

else Node(true bs_to_btree(bs) create_btree(falselength(bs)) )

)

where is an operator combining the head and tail of the list T ip indicates a leaf node thefunction create btree(bool nat) creates a binary tree of height nat in which all nodes are labeledwith bool and length(list) denotes the length of list 1 Intuitively when scanning the datafrom the head of BS descending by one bit corresponds to descending one subtree in BTREEThe induction scheme for the bit sequence is that if some property holds on a bit sequence bsit also holds on bbs If b = True (ie k ge 2n) then all nodes in the left subtree are labeledTrue this is referred to as a full tree However if b = False (ie k lt 2n) then none of thenodes in the right tree are labeled True this is referred to as an empty tree Thus the datatypes BS and BTREE are matched in their induction schemes

Let a bit sequence be represented as a list the elements of which are either True or FalseFigure 2 shows the conversion of the bit sequence [True False T rue] into a binary tree Inthis figure the black trees are full trees the white trees are empty trees and the dotted treesare the others

T

T T T

FTFTT

[TrueFalseTrue] [FalseTrue] [True]

Figure 2 The mapping between a bit sequence and a binary tree

Because the binary tree corresponding to [True False T rue] is not an empty tree the rootnode is labeled True Because the first bit in the sequence is True the left tree is a full treeThe tree to the right of it is the tree corresponding to the remaining bit sequence [False T rue]after the first bit has been extracted Now consider the coding of [False T rue] because the

1We can define a mirror tree in which left and right subtrees are exchanged

96

Data Conversion Revisited Takahashi Yoshimaru and Goto

first bit of the sequence is False the right tree must be an empty tree and the left tree isthe tree corresponding to the remaining bit sequence Then we consider the coding of [True]because the first bit of the bit sequence is True the left tree is a full tree and the right tree isthe binary tree corresponding to the remaining bit sequence Finally we obtain a T ip for [ ]

T

T

T

T F

T

T

T T T T T F F F

Figure 3 The binary tree for [True False T rue]

The binary tree obtained from [True False T rue] is thus as follows (Figure 3)

( True

( True ( TrueTrueTrue ) ( TrueTrueTrue ) )

( True ( TrueTrueFalse ) ( FalseFalseFalse ) )

)

The function bs to btree can give an inductive definition that provides for the division of ninto n1 and n2 corresponding to the left and right subtrees respectively in the proof processfor IS in the previous subsection

222 Conversion from NAT to BS

Next we give a definition for the conversion from NAT to BS We show two different modelsone using a general function and one using a primitive recursive function

First we define the general function naive nat to bs This is defined in an iterative formand determines the value of a a bit sequence from the least-significant bit as follows

naive_nat_to_bs(0) = [False]

naive_nat_to_bs(1) = [True]

naive_nat_to_bs(n) = (naive_nat_to_bs(div(n2))) ([mod(n2) = 1])

where is the concatenation operator for lists div(n 2) and mod(n 2) return the result ofdivision of n by 2 and its remainder respectively

Second we define the primitive recursive function nat to bs This is defined in a tail-recursive form and determines the value of a bit sequence from the most-significant bit Thedefinition is more complex than that of the iterative form

nat_to_bs(0) = [false]

nat_to_bs(Suc(n)) = calc(lg(Suc(n))Suc(n))

calc(0m) = [true]

calc(Suc(n)m) = (if 2^n lt= m) then True(calc(nm-2^(Suc(n))))

else False(calc(nm))

lg(n) = (if nlt=1 then 0

else Suc(lg (div(n2))))

97

Data Conversion Revisited Takahashi Yoshimaru and Goto

where lg is a key function that returns the place number of the bit sequence corresponding toa given argument ie the natural number m that satisfies m le log n lt m+ 1 The followingtable shows the relationship of a natural number nat a bit sequence bs and the value of lgNote that when n increases by 1 the location in the bit sequence which is equal to the heightof the tree increases logarithmically

nat bs lg

1 1 02 10 13 11 14 100 25 101 26 110 27 111 28 1000 39 1001 3

223 Conversion from NAT to BTREE

Finally nat to btree is defined as the composition of the two functions naive nat to bs andbs to btree or the composition of nat to bs and bs to btree nat to bs and bs to btree are prim-itive recursive functions whereas naive nat to bs is a recursive function

The definition of nat to bs is more suitable to an induction scheme than that ofnaive nat to bs because induction is typically applied from the head to the tail

In the next two sections we apply this formalization to the electronic cash protocol definedin [18] and prove its divisibility

3 Modeling of an Electronic Cash Protocol

31 Ideal Electronic Cash

An electronic cash (e-cash) protocol is in general a combination of cryptography techniquessuch as zero-knowledge proof and public key encryption We consider the ideal e-cash protocolproposed by Okamoto [18] In this protocol a coin of some monetary value is encoded asa binary tree and a payment function is defined over it This binary tree approach makese-cash efficient and unlinkable and is used in many divisible e-cash schemes [7 8 15 18]We formalize this protocol and prove its divisibility on a data level ie a user can spend acoin in several separate transactions by dividing its value without overspending if and only ifa payment function satisfies the payment rules This is one of the properties that an ideale-cash protocol should satisfy We define the data structure of money and define two primitiverecursive functions of money amount and pay on money The definitions are shown using Coqcode in this section

32 Definition of money

A coin is represented as a binary tree called money Each node of the tree represents a certaindenomination The root node is assigned the monetary value of the money and the values of

98

Data Conversion Revisited Takahashi Yoshimaru and Goto

all other nodes are defined as half the value of their parent nodesMoney is defined as an inductive function It is a binary tree where nodes are labeled with

Boolean values The label True means that a node is usable while False means that it is notFor a given Boolean value b and a natural number n we can create money in which all of thenodes have the label b

Inductive money Type =

| Tip bool -gt money

| Node bool -gt money -gt money -gt money

Fixpoint create_money(b bool)(n nat) money =

match n with

| 0 =gt Tip b

| S nrsquo =gt Node b (create_money b nrsquo) (create_money b nrsquo)

end

33 Creation of money from a natural number

cash is a function that createsmoney corresponding to a given natural number that is defined asa composition of bs to money and naive nat to bs (or nat to bs) bs to money can be definedin a manner similar to that of bs to btree

Definition cash(n nat) money = bs_to_money (naive_nat_to_bs n)

Note that cash is the money that satisfies a specific condition whereas type money al-lows any complete binary tree whose nodes are labeled as Boolean values For exampleNode(false T ip(true) T ip(true)) is an element of money but not a result of a function cash

34 Calculation of the amount of money

The function money amount computes the amount of money that can be used If the rootnode is labeled True the amount of the tree is the sum of that of the left tree and the righttree otherwise the amount is 0

Fixpoint money_amount(m money) nat =

match m with

| Tip true =gt 1

| Tip false =gt 0

| Node true l r =gt money_amount l + money_amount r

| Node false _ _ =gt 0

end

35 Payment

Payment rules are set in [18] as follows when we spend some amount from the coin we searchfor a node (or combination of nodes) whose value is equal to the payment value and then cancelthese nodes at the same time all of the ancestors and all of the descendants are also canceledOverspending is prevented if and only if these rules are satisfied

The function pay corresponds to payment according to the payment rules When we pay nfrom money where n is less than or equal to the amount of money then we pay all of n fromthe left tree and the right tree remains as it is if the amount of the left tree is more than n

99

Data Conversion Revisited Takahashi Yoshimaru and Goto

Otherwise we exhaust the left tree in the payment and pay the remainder from the right treeFor example money amount(pay(cash(13) 4) = 9

In the following code eq nat dec and lt dec are functions on NAT that denote rsquo=rsquo and rsquoltrsquorespectively change false is a function that changes the label of a node to False

Fixpoint pay(m money)(n nat) money =

match m with

| Tip true =gt Tip (if eq_nat_dec n 0 then true else false)

| Node true l r =gt

if lt_dec (money_amount l) n

then Node true (change_false l) (pay r (n - money_amount l))

else Node true (pay l n) r

| _ =gt m

end

4 Proof of Properties

We prove three properties on the divisibility of the e-cash protocol On proving these propertiesinductively we apply the method proposed in Section 2

In this section we only show the outline of the proof focusing on how induction is appliedThe complete Coq proof is shown in the Appendix

First the distribution property over money amount holds

money amount(Node( left right)) =money amount(left) +money amount(right) middot middot middot (1)

This can readily be proved We rewrite the left side of the given equation

41 Well-definedness of cash

The monetary value of money created by cash from a natural number is equal to that valueThis property is represented as follows

forall n (money amount (cash(n)) = n)

and is proved using the properties of the bit sequence Below we show a case in which the firstbit b of the sequence is True When it is False the proof proceeds in the same manner

money amount(cash(n))= money amount(bs to money(bbs)) middot middot middot (2)= money amount( Node(true

bs to money(bs) create money(true length(bs) ) middot middot middot (3)= money amount(bs to money(bs))+

money amount(create money(true (length(bs)))) middot middot middot (4)

Formula (2) is obtained by unfolding cash where nat to bs(n) = bbs formula (3) isobtained by unfolding bs to money and formula (4) is obtained by the distribution propertyof money amount (1)

The first term of formula (4) is transformed as follows

100

Data Conversion Revisited Takahashi Yoshimaru and Goto

money amount(bs to money(bs))= money amount(bs to money(nat to bs(nminus 2lg n))) middot middot middot (5)= money amount(cash(nminus 2lgn)) middot middot middot (6)

Formula (5) is obtained using case split tactics on n property of lg and several other tacticsFormula (6) is obtained by unfolding cash

The second term of formula (4) is transformed as follows

money-amount(create money(true length(bs)))= money amount(cash(2lgn)) (7)

Here we use the following induction scheme of NAT

if forall k k lt n money amount(cash(k)) = kthen money mount(cash(n)) = n holds

We can prove 2lg n le n and nminus 2lg n lt n If 2lg n lt n we apply this type of induction toboth formulas (6) and (7) and so formula (4) is finally transformed into the following form

money amount(cash(2lg n)) +money amount(cash(nminus 2lg n))= 2lg n + (nminus 2lg n)= n

In case 2lg n = n the proof is simpler without using induction

42 Well-definedness of pay

The amount remaining after payment is the difference between the original value and thepayment value This property is represented as follows 2

forall nforall m (money amount(pay(cash(n)m)) = nminusm)

This is derived from the following lemma

forall cforall n (money-amount(pay(c n)) = money-amount(c)minus n

which is proved as follows When we pay n from c if n does not exceed the amount of c wepay m1 from the left subtree as far as possible and pay the remainder m2 from the right treem1 and m2 are determined as follows if n lt money amount(left) then m1 = n and m2 = 0otherwise m1 = money amount(left) and m2 = n minus money amount(left) This is provedusing induction Below we show an inductive case because the proof is simple for the basecase

money amount(pay(cm1 +m2))= money amount(pay(Node( left right)m1 +m2)) middot middot middot (8)= money amount(pay(leftm1)) +money amount(pay(rightm2)) middot middot middot (9)= money amount(left)minusm1 +money amount(right) minus m2 middot middot middot (10)= (money amount(left) + money amount(right)) minus (m1 + m2)= money amount(Node( left right)) minus (m1 +m2) middot middot middot (11)= money amount(c) minus (m1 +m2)

2Note that nminusm = 0 when m gt n

101

Data Conversion Revisited Takahashi Yoshimaru and Goto

Formula (8) is obtained by expanding c Formula (9) is obtained by the distribution propertyofmoney amount and the property of payment onmoney Formula (10) is obtained by applyinginduction tomoney Formula (11) is obtained from the distribution property ofmoney amount

43 Divisibility

Given that ms is a list of values each of which corresponds to a transaction if a user paysfrom the head of this list in succession then the remainder is the correct value This propertyis represented as follows

forallnforallms( n ge listsum(ms)

=rArr money amount (foldl(pay(cash(n)ms))) = n minus listsum(ms) )

Here foldl and listsum are the functions handling a list Let ms be a list [m1 mk]foldl(pay(cms)) is rewritten in the following form

(pay( (pay(cm1) mk)

and listsum(ms) is rewritten in the following form

m1 + + mk

This theorem can be proved using the result of the proofs for the above two properties ofwell-definedness

5 Discussion

Modeling the e-cash protocol and proving the properties described in the previous sections wereperformed using the theorem provers IsabelleHOL and Coq respectively First we comparethese two provers

Both of them are interactive theorem-proving environments based on inductive theoremproving The data types and functions are defined in recursive form and the proof proceeds byconnecting suitable tactics

IsabelleHOL has a more powerful engine for automatic proof than Coq A proof may suc-ceed simply by using the lsquoautorsquo command without connecting multiple lemmas in IsabelleHOLwhereas a user must specify tactics manually in Coq However the proof procedure in Coq iseasier to understand

Both provers are based on typed logics and adopt higher-order functions In Coq type-checking is richer and proof-checking is reduced to type checking It requires the user to provethe termination of a recursive function IsabelleHOL also requires the user to prove thetermination of a recursive function but has a stronger automatic mechanism and user doesnot need to supply much input

We developed a model for an e-cash protocol and set out to prove three properties of themodel using IsabelleHOL and subsequently translated the model into Coq The translationwas basically straightforward The definition of a primitive recursive function using primrec inIsabelleHOL was translated to Fixpoint in Coq the definition of a recursive function usingfun was translated to Function the definition of a non-recursive function using definitionwas translated to Definition In addition we must prove the termination of the functionintroduced via Function

102

Data Conversion Revisited Takahashi Yoshimaru and Goto

The tactics used in the proofs of two provers were quite different Generally more tactics arerequired in Coq however the proof in Coq provides a useful basis from which to make a proofin IsabelleHOL Actually we completed the proof of the unproved lemma in IsabelleHOL byreferring to the proof in Coq From this experience it is expected that similar modeling withother provers is possible and that the existing proofs will be useful as a basis for forming proofsin those other provers All definitions and proofs in IsabelleHOL and Coq are shown in [22]

In the field of protocol verification there are a number of works on the verification ofsecurity protocols using IsabelleHOL (eg[2]) However they mainly proved security or safetyof protocols To the best of our knowledge there exists no research on a proof that focuses onthe divisibility of electronic cash protocols using a theorem-proving approach

Bijection between the set of natural numbers and rooted trees has been discussed in severalworks [5 6 9] In these works prime decomposition of the natural numbers was used toconstruct the corresponding rooted tree They used an incomplete tree in which each primenumber forms an individual branch It appears to be impossible to define this bijection in aninductive manner Attempts to provide the mechanical proof were not made and the correctnessof the methods has not been proved using theorem provers On the other hand we propose amethod for automated theorem proving using a complete binary tree

The data conversion method described here is applicable to conversion from an inductivelydefined data structure with one successor to one with n successors by introducing a list inwhich each element takes n values as an intermediate data structure instead of a bit sequenceFollowing this transformation the proof can proceed in a similar manner to the one shown inthis paper although the number of lemmas would increase Moreover it can be extended todata conversion from data structures with m successors to data structures with n successors bycomposing two data-conversion functions ie one from an inductively defined data structurewith m successors to that with one successor and then a second function from an inductivelydefined data structure with one successor to one with n successors

6 Conclusion

We have described a function for converting data from a natural number to a binary treeand have given an inductive proof for its well-definedness We have described a method ofintroducing a bit sequence as an intermediate data structure to provide a model for inductivelydefined data structures with different induction schemes We formalized this method developeda computational model based on it and applied it to an electronic cash protocol We succeededin proving the properties of divisibility of the protocol using the theorem provers IsabelleHOLand Coq and discussed the effectiveness of the method

In future we would like to investigate other functions andor properties on such a binarytree that is handled here and develop methods of their inductive proof

References

[1] Arsac W Bella G Chantry X and Compagna L Multi-Attacker Protocol Validation J ofAutomated Reasoning 46(3-4)353-388 (2011)

[2] Bella G Massacci B and Paulson L Verifying the SET Purchase Protocols J of AutomatedReasoning 365 37 (2006)

[3] Bella G Inductive Verification of Smart Card Protocols J of Computer Security 11(1)87-132(2003)

103

Data Conversion Revisited Takahashi Yoshimaru and Goto

[4] Bertot Y and Castran P Interactive Theorem Proving and Program Development - CoqrsquoArtThe Calculus of Inductive Constructions Springer Verlag (1998)

[5] Beyer T and Hedetniemi S M Constant Time Generation of Rooted Trees SIAM J Comput9(4)706-712 (1980)

[6] Cappello P A New Bijection between Natural Numbers and Rooted Trees 4th SIAM Conferenceon Discrete Mathematics (1988)

[7] Chan A Frankel Y and Tsiounins Y Easy Come - Easy Go Divisible Cash EUROCRYPT98pp 561-575 (1998)

[8] Canard S and Gouget A Divisible E-Cash Systems Can Be Truly Anonymous EURO-CRYPT2007 pp482-497 (2007)

[9] Gobel F On a 1-1-Correspondence between Rooted Trees and Natural Numbers J of Combina-torial Theory Series B(29)141-143 (1980)

[10] Hardin D S (ed) Design and Verification of Microprocessor Systems for High-Assurance Appli-cations Springer Verlag (2010)

[11] KaufmannM Monolios P and Moore J S Computer-Aided Reasoning An Approach KluwerAcademic Publishers (2000)

[12] Klein G et al seL4 Formal Verification of an Operating-System Kernel Commun ACM 53(6)107-115 (2010)

[13] Kurita T and Nakatsugawa Y The Application of VDM to the Industrial Development ofFirmware for a Smart Card IC Chip Int J of Software and Informatics 3(2-3)343-355 (2009)

[14] Leroy X Formal Verification of a Realistic Compiler Communications of the ACM 52(7)107-115(2009)

[15] Nakanishi T and Sugiyama Y An Efficiently Improvement on an Unlinkable Divisible ElectronicCash System IEICE Trans on Fundamentals E85-A(19)2326-2335 (2002)

[16] Nipkow T Paulson L and Wenzel M IsabelleHOL A Proof Assistant for Higher-Order LogicSpringer Verlag (2002)

[17] Norell U Dependently Typed Programming in Agda Advanced Functional Programming 2008pp230-266 (2008)

[18] Okamoto T An Efficient Divisible Electronic Cash Scheme The proceedings of Cryptorsquo95pp438-451 (1995)

[19] OwreS RushbyJM and ShankarN PVS A Prototype Verification System The proceedingsof CADE-11 pp748-752 (1992)

[20] Sprenger C Zurich E T H Basin D et al Cryptographically Sound Theorem Proving 19thIEEE Computer Security Foundations Workshop (2006)

[21] Takahashi K and Yoshimaru S Formalization of Data Conversion for Inductive Proof Tunisia-Japan Workshop on Symbolic Computation in Software Science (SCSS 2009) pp135-150 (2009)

[22] httpistksckwanseiacjp~ktakaEMONEY

104

Data Conversion Revisited Takahashi Yoshimaru and Goto

Appendix Proof for E-cash protocol in Coq (tail-recursiveversion)

Require Import Omega List Arith Div2 Bool Recdef Wf_nat

Theorem well_definedness_of_pay

forall(m money)(n nat)

n lt= money_amount m

-gt money_amount(pay m n) = money_amount m - n

Proof

intros m

induction m intros n LNM destruct b simpl in try reflexivity

destruct (eq_nat_dec n 0)

rewrite e reflexivity

assert(n = 1) by omega

rewrite H reflexivity

destruct (lt_dec (money_amount m1) n) simpl

rewrite IHm2 try omega

replace (money_amount (change_false m1)) with 0 try omega

destruct m1 simpl reflexivity

rewrite IHm1 omega

Qed

Lemma bit_sequence_distribution

forall(bs list bool)(b bool)

money_amount(bs_to_money(bs ++ (bnil))) =

2 money_amount(bs_to_money bs) + (if b then 1 else 0)

Proof

intros bs b

induction bs simpl in

destruct b reflexivity

assert(forall(bl bool)money_amount (create_money bl (length

(bs ++ b nil))) =

money_amount (create_money bl (length bs)) + money_amount

(create_money bl (length bs)))

intros clear IHbs destruct bl induction bs simpl try omega

destruct a simpl in rewrite IHbs repeat rewrite plus_0_r

repeat rewrite plus_assoc rewrite H omega

Qed

Lemma one_reminder_div2

forall(n nat)

(2 div2 n) + (if one_reminder n then 1 else 0) = n

Proof

intros n

case_eq (one_reminder n) intros induction n using lt_wf_ind

destruct n try discriminate

destruct n try reflexivity

simpl in H

simpl

replace (S (div2 n + S (div2 n + 0) + 1))

with (S (S (2 div2 n + 1)))

105

Data Conversion Revisited Takahashi Yoshimaru and Goto

repeat f_equal

rewrite H0 try reflexivity try omega

apply H

simpl

omega

destruct n try reflexivity

destruct n try discriminate

simpl in H

simpl

replace (S (div2 n + S (div2 n + 0) + 0))

with (S (S (2 div2 n + 0)))

repeat f_equal

rewrite H0 try reflexivity try omega

apply H

simpl

omega

Qed

Theorem well_definedness_of_cash

forall(n nat)

money_amount (cash n) = n

Proof

intros n

induction n using lt_wf_ind

destruct n try (simpl reflexivity)

destruct n try (simpl reflexivity)

unfold cash rewrite bit_sequence_equation

case_eq (one_reminder (S (S n))) intros

rewrite bit_sequence_distribution unfold cash in H rewrite H

try (apply lt_div2 apply lt_0_Sn)

pose (one_reminder_div2 (S (S n)))

rewrite H0 in e apply e

Qed

Definition listsum(ns list nat) nat = fold_right plus 0 ns

Definition payment_amount(m money)(ns list nat) nat =

money_amount (fold_left pay ns m)

Theorem Divisibility

forall(n nat)(ns list nat)

listsum ns lt= n -gt

payment_amount (cash n) ns = n - listsum ns

Proof

intros n ns LSM

induction ns using rev_ind simpl in

rewrite lt- minus_n_O

apply well_definedness_of_cash

unfold payment_amount in

unfold listsum in

rewrite fold_left_app

rewrite fold_right_app in simpl in

rewrite plus_0_r in

106

Data Conversion Revisited Takahashi Yoshimaru and Goto

assert(fold_right plus 0 ns + x lt= n)

generalize n LSM

clear IHns LSM n

induction ns intros simpl in

omega

assert(fold_right plus x ns lt= n - a) by omega

apply IHns in H omega

rewrite well_definedness_of_pay rewrite IHns simpl in try omega

replace (fold_right plus x ns) with ((fold_right plus 0 ns) + x)

omega

clear IHns H LSM

induction ns simpl

reflexivity

rewrite lt- IHns info omega

Qed

107

Computer Algebra Investigation of Known

Primitive Triangle-Free Strongly Regular

Graphs

Mikhail Klin and Matan Ziv-Av

Ben-Gurion University of the Negevklincsbguacil

matansvgaliborg

Abstract

With the aid of computer algebra systems COCO and GAP with its packages we areinvestigating all seven known primitive triangle-free strongly regular graphs on 5 10 1650 56 77 and 100 vertices These graphs are rank 3 graphs having a rich automorphismgroup The embeddings of each graph from this family to other ones are described the au-tomorphic equitable partitions are classified all equitable partitions in the graphs on up to50 vertices are enumerated Basing on the reported computer aided results and using tech-niques of coherent configurations a few new models of these graphs are suggested whichare relying on knowledge of just a small part of symmetries of a graph in consideration

1 Introduction

This paper appears on the edge between computer algebra systems and algebraic graph theory(briefly AGT) and is mainly devoted to the computer aided investigation of the known primitivetriangle free strongly regular graphs

In fact there are 7 such graphs those on 5 10 16 50 56 77 and 100 vertices The largestone denoted by NL2(10) is the universal graph for this family in the sense that all seven graphsare induced subgraphs of NL2(10) We denote by F the family of those 7 graphs

The history of the discovery of the graphs from F and in particular of NL2(10) is quitestriking Indeed the graph NL2(10) was discovered twice once in 1956 by Dale Mesner andsecond time independently in 1968 by D G Higman and C C Sims The details of thishistory are considered in [15] see also a very brief summary in Section 4

The graphs on 5 10 and 50 vertices form a very significant subfamily consisting of theknown Moore graphs One more possible member of this series (see eg [16]) would have 3250vertices its existence is an open problem of a great significance Moore graphs and their naturalgeneralizations are objects of much interest in extremal graph theory they serve as the bestexamples of optimal network topologies Discovery of a new primitive triangle free stronglyregular graph would be a high level sensation in modern mathematics

This text is oriented towards an interdisciplinary audience though its kernel is strictlyrelated to a concrete kind of application of computer algebra in AGT

Section 2 provides in compact form the necessary background about strongly regular graphssee [11] [5] for more details while in section 3 we briefly introduce the tools of computer algebraused in AGT The seven graphs from the family F are presented in section 4

Our first main result is introduced in Section 5 full description of embeddings of (primitiveand imprimitive) triangle free strongly regular graphs into the graphs in F

108

Triangle-free strongly regular graphs Klin Ziv-Av

The next topic of our investigation is related to equitable partitions with a special emphasison automorphic equitable partitions see definitions in Section 6 The search strategy is de-scribed in Section 7 though much more details may be found in [28] We report the completeenumeration of automorphic equitable partitions and partial results for the general case

Sections 8ndash10 reflect our efforts to understand a few of the computer aided results and topresent them in a computer free form (completely or at least relatively)

In Section 8 we deal with the graph NL2(10) and describe it in a sense locally that isvia so-called metric equitable partitions obtained from the embeddings of a quadrangle anda graph K33 without one edge (Atkinson configuration) with 4 and 8 cells respectively Thespectrum of the second partition contains all of the eigenvalues of NL2(10) (the case of fullspectrum) Some modifications of the famous Robertson model (see [21]) appear in Section 9while in Section 10 we present a handful of models for some other graphs in F

It is worthy to mention that for generations of mathematicians the graphs in F appear asa source of ongoing aesthetic admiration see especially the home page of Andries Brouwer [6]We believe that some of our models shed a new light on those graphs

Last but not least is that as a rule the models we suggest rely on a relatively small subgroupof the group Aut(Γ) for Γ isin F In this way we provide promising patterns for those researcherswho wish in future to face a challenge to try to construct new primitive triangle free stronglyregular graphs cf Section 11

2 Strongly regular graphs a brief survey

An undirected graph Γ is called a strongly regular graph (SRG) with parameters (v k λ micro) ifit is a regular graph of order v and valency k and every pair of adjacent vertices has exactly λcommon neighbors while every pair of non-adjacent vertices has exactly micro common neighborsSometimes we use an extended set of parameters (v k l λ micro) where l is the number of non-neighbors of a vertex that is l = v minus k minus 1

If A = A(Γ) is the adjacency matrix of an undirected graph Γ then Γ is strongly regular ifand only if A2 = kI + λA+ micro(J minus I minus A) This implies that (I A J minus I minus A) is the standardbasis of a rank 3 homogeneous coherent algebra In other words (∆ΓΓ) are the basic graphsof a rank 3 symmetric association scheme (here Γ is the complement of Γ while ∆ contains allthe loops) The adjacency matrix of a strongly regular graph has exactly 3 distinct eigenvaluesFor a strongly regular graph we denote by

bull r gt s the two eigenvalues of A(Γ) different from k r is always positive while s is alwaysnegative

bull f g the multiplicity of the eigenvalues r s respectively

A formula for f and g is given by g f = 12

[(v minus 1)plusmn 2k+(vminus1)(λminusmicro)radic

(λminusmicro)2+4(kminusmicro)

]

A quadruple of parameters (v k λ micro) for which f and g as given by the preceding formulasare positive integers is called a feasible set of parameters See [6] for a list of feasible parametersets with some information about known graphs for some of the sets

A strongly regular graph Γ is called primitive if both Γ and its complement Γ are connectedThis is equivalent to primitivity of the related association scheme (∆ΓΓ)

109

Triangle-free strongly regular graphs Klin Ziv-Av

3 Computer algebra tools in AGT

During the last two decades the significance of the use of computer algebra systems in AGTincreased drastically Such systems are exploited in the search for new combinatorial objectsthe enumeration of objects with prescribed parameters and the understanding of algebraic andstructural properties of a given combinatorial object Γ (such as the automorphism group Aut(Γ)its action and orbits on the ingredients of Γ enumeration of substructures of Γ embeddings ofΓ into larger structures etc)

An ideal case is when the computer aided understanding of an object Γ is followed by furthertheoretical generalizations The foremost goal of this paper is to share with the reader manynew interesting properties of the graphs in the family F in order to promote the search for newprimitive tfSRGs

Below are the main tools we use

bull COCO is a set of programs for dealing with coherent configurations including construc-tion enumeration of subschemes and calculation of automorphism groups

Developed in 1990-2 Moscow USSR mainly by Faradzev and Klin [8] [9]

bull WL-stabilization ndash Weisfeiler-Leman stabilization is an efficient algorithm for calcu-lating coherent closure of a given matrix (see [25] [3]) Two implementations of theWL-stabilization are available (see [2])

bull GAP an acronym for ldquoGroups Algorithms and Programmingrdquo is a system for com-putation in discrete abstract algebra [10] [22] It supports easy addition of extensions(packages in gap nomenclature) that are written in the GAP programming languagewhich can add new features to the GAP system

One such package GRAPE [23] is designed for construction and analysis of finite graphsGRAPE itself is dependent on an external program nauty [18] in order to calculate theautomorphism group of a graph Another package is DESIGN used for construction andexamination of block designs

bull COCO v2 ndash The COCO v2 initiative aims to re-implement the algorithms in COCOWL-stabilization and DISCRETA as a GAP package In addition the new package shouldessentially extend abilities of current version basing on new theoretical results obtainedsince the original COCO package was written

We refer to [14] for a more detailed discussion of the ways in which computer algebra systemsare used in AGT for the purpose of experimentation and further theoretical generalizations

4 The seven known primitive triangle-free strongly regu-

lar graphs

A graph Γ is called triangle free if it admits no triangles that is cliques of size 3 If Γ is also astrongly regular graph then it is called a triangle free strongly regular graph (tfSRG for short)A graph is triangle free if any two neighbors have no common neighbors therefore a tfSRG isan SRG with λ = 0

The 7 known primitive tfSRGs with orders from 5 to 100 vertices are

1 Pentagon with parameters (5 2 0 1) Its automorphism group is D5 of order 10

110

Triangle-free strongly regular graphs Klin Ziv-Av

0

1

2 3

4

25

26

27 28

29

10

11

12 13

14

Figure 1 Hoffman-Singleton graph Robertson model

2 Petersen graph with parameters (10 3 0 1) Its automorphism group is isomorphic to S5

of order 120 A simple model has as vertices 2-subsets of a set of size 5 with two verticesadjacent if the subsets are disjoint

3 Clebsch graph with parameters (16 5 0 2) Usually denoted by 5 Its automorphismgroup is isomorphic to (S5 ≀S2)

pos of order 1920 A simple model is 4-dimensional cube Q4

together with long diagonals or Cayley graph CAY (E24 0001 0010 0100 1000 1111)

4 Hoffman-Singleton graph (HoSi) with parameters (50 7 0 1) Its automorphism group isisomorphic to PΣU(3 52) of order 252000 ([4]) The simplest model is Robertson model([21]) 5 pentagons marked P0 P4 and 5 pentagrams marked Q0 Q4 with vertexi of Pj joined to vertex i+ jk (mod 5) of Qk

5 Gewirtz (or Sims-Gewirtz) graph with parameters (56 10 0 2) Its automorphism groupof order 80640 is a non split extension of PSL3(4) by E22 A simple model is as theinduced subgraph of NL2(10) on the common non-neighbors of two adjacent vertices

6 Mesner graph with parameters (77 16 0 4) The automorphism group is of order 887040and is isomorphic to the stabilizer of a point in the automorphism group of NL2(10) Onesimple model is induced subgraph of NL2(10) on non-neighbors of a vertex

7 NL2(10) with parameters (100 22 0 6) also known as the Higman-Sims graph Its auto-morphism group contains Higman-Sims sporadic simple group as a subgroup of index 2We refer to [15] for a detailed presentation of the original construction of this graph byDale Mesner as it appeared on [19] [20]

Recall that the graph NL2(10) on 100 vertices was constructed twice by Dale Mesner inhis Thesis in 1956 [19] and later on by Higman and Sims in 1968 when they discovered anew sporadic simple group Moreover in 1964 Mesner proved its uniqueness We denote thisgraph by NL2(10) following the parametrization for a family of putative graphs introduced byMesner in [20] In [15] the history of this discovery as well as of related events is discussed withmany details A new wave of interest in tfSRGs stimulated by [15] was especially productivefor us It became clear that this is the time to arrange a serious comprehensive investigation ofdiverse structural properties of the graphs in the family F The goal is to attract the attentionof researchers to such an information in order to provide new ideas how efforts for the searchof new tfSRGs should be arranged We also wish to share with the reader some surprising newfeatures of the graphs in the family F observed with the aid of a computer

111

Triangle-free strongly regular graphs Klin Ziv-Av

5 Embeddings of tfSRGs into known primitive tfSRGs

Usually in graph theory a graph ∆ = (V prime Eprime) is called a subgraph of a graph Γ = (VE) if

V prime sube V and Eprime sube E Of special interest are induced subgraphs in this case Eprime = E capV prime

2

whereX2

is the set of all 2-subsets of X

Proposition 1 A subgraph ∆ of diameter 2 of a graph Γ with no triangles is an inducedsubgraph

Proof Assume that ∆ is not induced then there exists an edge uw isin E uw 6isin Eprime withuw isin V prime Since the diameter of ∆ is 2 there exist a v which is adjacent in ∆ (and thereforein Γ) to u w thus u v w is a triangle in Γ which is a contradiction

The enumeration of all tfSRGs inside of known tfSRGs was the first serious computationalchallenge in this project The results of its complete solution are discussed below

A non-empty imprimitive tfSRG is either a complete bipartite graph (Kllsim= 2 Kl) or

a graph s K2 consisting of s edges with no common vertices Note that K22 is simply aquadrangle

Lemma 2 Graph NL2(10) does not contain subgraph K33

Proof Originally we obtained this result with the aid of a computer In fact easy proof followsfrom the non-edge decomposition of Γ = NL2(10) (see eg [15]) without any assumptions aboutits uniqueness Indeed let ∆ be a subgraph of Γ which is isomorphic to K33 Assume thattwo bipartite parts of ∆ consist of subsets a b c d e f of vertices Consider now non-edgedecomposition of Γ with respect to a b then c belongs to the cell of size 60 while d e fbelong to the cell of size 6 thus c has just g = 2 neighbors in the latter cell a contradictionwith the valency of c equal to 3 in ∆

As a corollary we obtain that every known primitive tfSRG does not contain K33 andmoreover does not contain Kll when l ge 3

Another simple theoretical result (see eg [28]) claims that the number of quadrangles in an

SRG with parameters (v k l λ micro) is equal tovk2 (

λ

2)+vl2 (

micro

2)2 When λ = 0 this reduces to vlmicro(microminus1)

8 Similar formula may be obtained for the number of 2K2 The numbers of imprimitive tfSRGsinside of graphs in F are given in Table 1 in the supplement while the number of orbits of suchembeddings (with respect to Aut(Γ) for Γ isin F) are given in Table 2

Note that there is no induced subgraph of NL2(10) isomorphic to 12 K2 so both tablesin Supplement A end with s = 11 for s K2

Similar computer results are presented in Tables 3 and 4 (Supplement A) for the embeddingsof a graph from the family F into a larger graph in F

Here the final picture is less sophisticated There are just two cases where for pair of graphsXY isin F there exist more than one orbit of embeddings (up to action of Aut(Y )) of X intoY Namely in these terms there are 9 embeddings of Petersen graph into Mesner graph and 5embeddings into NL2(10) Computer free understanding of these embeddings remains a quiteinteresting task for future investigations of the links between the graphs in the family F

In all other cases there exists (up to isomorphism) at most one embedding for consideredpair (XY ) For most pairs there is a reasonably clear explanation in literature such as twoHoSi inside NL2(10) see eg [12] as well as Robertson model of HoSi [21] which explainspositions in it for both pentagon and Petersen graph

Beside this there are two more embeddings which are not immediately evident

112

Triangle-free strongly regular graphs Klin Ziv-Av

The first pair is the embedding of the Petersen graph into Gewirtz graph In fact inthis embedding the Petersen graph appears as a subgraph of the second constituent of theGewirtz graph which in turn is a graph ∆ of valency 8 on 45 vertices It turns out thatAut(∆) sim= Aut(S6) This graph ∆ generates a non-Schurian association scheme with threeclasses see eg [24] [13] example W38 The graph ∆ may be also described as the distance2 graph of the distance transitive graph of diameter 4 and valency 4 on 45 vertices akageneralized octagon GO(2 1) aka line graph of Tuttersquos 8-cage (see [5] for more details) Inthis context the task of explanation of the embedding of Petersen graph into ∆ seems to be anice exercise in AGT though out of the framework of this presentation

The second exceptional pair is the embedding of the Clebsch graph 5 into NL2(10) Thispair is of a definite independent interest and thus is considered separately in Section 10

Finally we mention that the classification of cocliques in graphs from F may be regardedas a degenerate case of subject in this section Indeed empty graph is a particular case of animprimitive tfSRG We however disregard this problem referring to information presented onthe home page of Andries Brouwer [6]

6 Equitable partitions

Let Γ = (VE) be a graph A partition τ of the vertex set V τ = V1 Vs is calledequitable partition (briefly EP) if for i j isin 1 s the numbers |Γ(v) cap Vj | are equal for allv isin Vi Here Γ(v) = u isin V |u v isin E Usually an EP τ is accompanied by intersectiondiagram which represents a kind of quotient graph Γτ on which all intersection numbers aredepicted Many such diagrams appear in [5] The quotient graph Γτ is in fact a multigraphIts (collapsed) adjacency matrix B consists of all intersection numbers

Obviously entries of B are non-negative integers and for a regular graph Γ of valency k thesum of each row in B is k

If H is a subgroup of Aut(Γ) then the set of orbits of H is an EP of Γ Such an EP is calledautomorphic (briefly AEP)

Proposition 3 ([11]) Let Γ be a graph A = A(Γ) the adjacency matrix of Γ If a partitionτ is EP of Γ with matrix B then the characteristic polynomial of B divides the characteristicpolynomial of A

In fact there are more necessary conditions for a prescribed matrix B to be the adjacencymatrix of a suitable EP of Γ which are formulated in terms of spectral graph theory see eg[7] They create a solid background for a clever search of potential EPs in a given graph Γ

7 Search for equitable partitions

In this project we distinguished two alternative problems for the complete search of EPs ingraphs of F

First problem is to enumerate all automorphic EPs Here we strongly rely on the level ofgroup theoretical ldquointellectrdquo of GAP Indeed for groups of relatively small order (say up to afew thousands) GAP allows to establish efficiently the structure of a considered group as wellas the lattice of its subgroups

However for four graphs in F the group G = Aut(Γ) has larger order thus with the growingof |G| extra theoretical input is required For example in case of G = Aut(NL2(10)) we wereusing information from the website of the Atlas of Finite Group Representations ([26]) about

113

Triangle-free strongly regular graphs Klin Ziv-Av

the maximal subgroups of G (this information goes back to [17]) This knowledge together withad hoc tricks inside of GAP made it possible to describe all subgroups of G up to equivalencyclasses with respect to EPs The fact that all groups G = Aut(Γ) Γ isin F are subgroups ofAut(NL2(10)) was also quite beneficial

Finally we successfully enumerated all automorphic EPs for all Γ isin FThe second problem is much more sophisticated to enumerate all EPs for all graphs in FFor the smallest three graphs in F the results were achieved via simple brute force see

corresponding tables in Supplement BFor HoSi we used a few complementary strategies in the search for all EPs First we attacked

partitions with ldquolargerdquo number of cells say s gt 5 Here we introduced extra parameter thesize of the smallest cell which varies from 1 to 9 Each such case was considered separately

On the second stage we step by step enumerated cases 2 le s le 5 by enumerating possiblecollapsed adjacency matrices for each case and for any such matrix enumerating all EPs

The description of our computer activities together with detailed discussion of the resultsis presented in [28] An extra advantage of the enumeration in HoSi is that it serves as a kindof a pleasant interaction of a human and a computer Indeed in spite of the fact that the mainpart of computation was fulfilled by GAP a human can follow search explain its logic and stepby step to comprehend all ongoing results

We admit however that the extra advantage of HoSi is that here parameter micro takes itssmallest possible value of 1 (for a primitive SRG) As soon as micro gt 1 and v is growing theproblem is becoming essentially more difficult

This is why already for the Gewirtz graph with v = 56 we only succeeded in enumeration ofall EPs for which the stabilizer has order at least 2 There are 688 such EPs The enumerationof the rigid EPs cannot be completed by a computer in a reasonable time

The full enumeration of all EPs for the largest two graphs in F (on 77 and 100 vertices) atthis stage looks intractable Only modest particular cases may be proceeded efficiently

We refer to Supplement B for Tables 5 6 and 7 which summarize our activities for bothconsidered problems see [28] for more information

As was mentioned in the introduction one of the main goals of this project is to detect anumber of ldquonicerdquo EPs which may serve as a training model for future search of new primitivetfSRGs At this stage this kind of job only partially relies on the support from computer finallya humanrsquos insight still turns out to be very significant Below we report about interestinginterpretations created by us for a handful of detected EPs

8 Quadrangle and Atkinson EPs of NL2(10)

Recall that Γ = NL2(10) has100middot77middot6middot5

8 = 28875 quadrangles This is a simple result obtainedon a combinatorial level without any knowledge of structure of Γ

Provided that Γ and G = Aut(Γ) are known we easily obtain (with the use of a computer)that all quadrangles in Γ form one orbit under G and stabilizer H of a quadrangle in G hasorder 3072 is isomorphic as abstract group to (Z4 times Z2)(Z4 times Z2)) Z2) Z2) Z3) Z2) Z2

and has in action on V (Γ) four orbits of lengths 4 8 24 and 64Thus we may consider an automorphic EP of size s = 4 There is sense to try again

combinatorial arguments in order to determine all invariants of this EP without any priorknowledge of Γ and its group Fortunately this turns out to be possible

Proposition 4 Let τ be a metric decomposition with respect to a prescribed quadrangle Qinside of Γ Then τ is EP s = 4 sizes of cells are 4 8 24 64 and (with respect to this

114

Triangle-free strongly regular graphs Klin Ziv-Av

ordering of cells) B =

2 4 0 162 0 12 80 4 2 161 1 6 14

See proof in [28]In principle next stage should be to describe a model of NL2(10) in terms of the group

H of order 3072 or one of its subgroups which is transitive on all cells of the quadrangle EPNevertheless in this text we are avoiding this task Instead of we prefer to split the quadrangleEP to one with larger number of cells and to proceed with that new one

A note [1] was published before the announcement of CFSG The author considered 13parameter sets for tfSRGs which may be also rank 3 graphs with the number v of verticeswhere 100 lt v le 1000 and proved that such graphs can not be constructed with the aid ofknown 2-transitive permutation groups Part of exposed details is related to consideration of aconfiguration A (graph K33 minus one edge) in putative graph

We got impression that [1] is overseen through a generation of mathematicians and it mightbe helpful to analyze existence of A (we call it Atkinson configuration) in known tfSRGs

It turns out that A appears only in graphs on 77 and 100 vertices Here we analyze itsposition in Γ = NL2(10)

Let us fix at A a quadrangle for example with the vertices a b c f Then two extra ver-tices have two neighbors in the selected quadrangle namely ends of two non-edges respectively

Now we embed A into the considered above quadrangle decomposition splitting in it cell ofsize 8 into two cells of size 2 (exactly our d e) and the remainder This immediately impliessplit of the cell of size 64 into two cells of sizes 16 and 48 The cell of size 24 is forced to besplit into subcells of sizes 12 6 6 depending on the number of neighbors in d e being 1 2and 0 respectively

A more careful analysis (see [28]) shows that we are still getting an EP

Proposition 5 A metrical decomposition τ(A) of a tfSRG with the parameters of NL2(10)with respect to configuration A is EP with s = 8 and cells of sizes 4 2 16 48 6 12 6 6 Ithas collapsed matrix B as follows with Spec(B) = 22 25 (minus8)2

B =

2 1 4 12 3 0 0 02 0 8 0 0 6 6 01 1 2 12 0 3 0 31 0 4 10 1 3 2 12 0 0 8 0 6 2 40 1 4 12 3 2 0 00 2 0 16 2 0 0 20 0 8 8 4 0 2 0

Originally the proof was obtained with the aid of com-puter analysis of Γ = NL2(10) Later on an outline of asimilar proof as for quadrangle configuration was againobtained without prior knowledge of Γ

Further consideration of τ(A) was fulfilled inside ofknown graph Γ and its group Aut(Γ) It turns out thatH = Aut(τ(A)) sim= D4timesS4 is a group of order 192 H hasexactly 8 orbits on the set V (Γ) thus A is an automorphicEP

Describing further stabilizers of H on each of the 8orbits we elaborated the following ad hoc model of Γ

We start from the auxiliary graph ∆ depicted in Figure 2We identify elements of each orbit in τ(A) with suitable sets of structures described with

the aid of ∆ In fact each set of structures appears as orbit of action of the group H Thus itis enough to describe a representative of each orbit

For example the elements in the cell of size 16 are the vertices of ∆ while the elements ofthe cell of size 4 are the four columns of ∆ The most tricky to find was a representation of the7th cell of size 6

115

Triangle-free strongly regular graphs Klin Ziv-Av

12 13 14 15

8 9 10 11

4 5 6 7

0 1 2 3

Figure 2 Auxiliary graph ∆

We think that this piecewise model of Γ appearing from areasonably small solvable group of order 192 may serve as anoptimistic message for those researchers who are hunting for newtfSRGs see also comments in Section 11

9 Some modifications of Robertson

model

The Robertson model of the Hoffman-Singleton graph (see Figure1) partitions the vertices into five pentagons and five pentagramsand describes a simple arithmetic rule for the edges connectingpentagons and pentagrams (see Section 4) Let pij (qij) be vertexj of pentagon (pentagram) i

Since NL2(10) has an EP to two cells of size 50 where theinduced graph on each cell is isomorphic to HoSi this model can be extended to a model ofNL2(10)

In both cases we get an EP with a collapsed adjacency matrix that has a transitive au-tomorphism group (a permutation g isin Sn is an automorphism of a matrix M isin F

ntimesn if thepermutation matrix Mg commutes with M) We are therefore interested in equitable partitionswith this property

In the list of equitable partitions of HoSi we find another such partition with 10 cells of sizefive The collapsed adjacency matrix of this partition isM The spectrum ofM is 7 24 (minus3)5so it has the full spectrum of HoSi

M =

0 2 2 0 0 0 0 1 1 12 0 1 0 1 2 0 0 1 02 1 0 2 0 0 1 0 0 10 0 2 0 1 1 2 0 0 10 1 0 1 0 2 0 1 0 20 2 0 1 2 0 1 0 1 00 0 1 2 0 1 0 1 2 01 0 0 0 1 0 1 0 2 21 1 0 0 0 1 2 2 0 01 0 1 1 2 0 0 2 0 0

The cells of this partition can be de-scribed in the Robertson model of HoSi foreach i isin [1 5] we construct two cellsp11+i p21+i p32+i p44+i p52+iq11+i q21+i q35+i q43+i q55+i

If we consider this matrix M as the adjacencymatrix of a color graph then the basic graph for thecolor 1 is the Petersen graph while the basic graphfor the color 2 is a cycle of length 10 For compar-ison acting similarly with the Robertson partitionwe get a graph K55

The stabilizer of the (ordered) partition inAut(HoSi) is isomorphic to the dihedral group D5

of order 10 as is the automorphism group of M

The coherent closure of the partition (more specifically of the graph with its vertices coloredaccording to the partition) is a Schurian coherent configuration of rank 300 with the stabilizerof the partition as its automorphism group

This EP of HoSi can be extended to an EP of NL2(10) of 20 independent sets of size 5 Inthis case the matrix has spectrum 22 213 (minus8)6 so this EP has full spectrum as well

The automorphism group of this matrix has order 240 and is isomorphic to Z2 times S5 whilethe stabilizer of the ordered partition is again D5 of order 10

The coherent closure of the partition is a Schurian coherent configuration of rank 1200 withthe stabilizer of the partition as its automorphism group

116

Triangle-free strongly regular graphs Klin Ziv-Av

7 7 7

7 7 7

7 74 4

2 2 2

2 2 2

Figure 3 AEP of Gewirtz graph by a semiregular subgroup of order 7

10 A few more models

The calculated data both about embeddings of tfSRGs inside tfSRGs and about EPs can beused to present new models and constructions for tfSRGs Here we offer a few examples withoutgoing into a lot of details

Example 1 (Two Wagner graphs in Clebsch graph) Wagner graph also known as Mobiusladder of order 8 denoted by M8 is a cubic graph on 8 vertices A simple model for it is aCay(Z8 1minus1 4) The spectrum is 3 12minus1 and Aut(M8) = D8

In one of the three EPs of 5 into two cells of size 8 the induced subgraph on each cell isthe Wagner graph The stabilizer of ordered partition inside Aut(5) is D8

Example 2 (Non-automorphic EP of HoSi) We can construct an EP of HoSi into two cellsby taking one of the cells to be the 20 vertices of two Petersen graphs (any two pentagons andtwo pentagrams in Robertson model) The stabilizer of this partition is D10 of order 20 so itis not automorphic

Example 3 (Inside Gewirtz graph six 7-cycles) There is one automorphic partition of Gewirtzgraph into 8 cells of size 7 The induced graph on 6 of the cells is a cycle of length 7 while theinduced graph on the other two cells has no edges

From the intersection diagram (Figure 3) we see that this partition can be merged to an

equitable partition with 2 cells of sizes 42 and 14 with adjacency matrix

(8 26 4

)

The induced graph on the cell of size 42 of valency 8 is a coherent graph Its coherent closureis a rank 6 imprimitive non-Schurian association scheme This graph is not a rational graphwith spectrum 8 222 (minus1)7 (1 +

radic2)6 (1minus

radic2)6

The induced graph on the cell of size 14 is a bipartite graph with two parts of size 7 It isthe co-Heawood graph that is the bipartite complement to the Heawood graph the Levi graph ofFano plane This is by necessity true since a regular bipartite graph of valency 4 and order 14in which every vertex belongs to exactly one quadrangle is the co-Heawood graph

A Brouwer ([6]) notes that this co-Heawood graph is a subgraph of the Gewirtz graph

Example 4 (Gewirtz graph inside of Mesner graph through the group Z7) We start witha semiregular subgroup Z7 of order 7 this time inside of the automorphism group of Mesnergraph We get an AEP with 11 cells of size 7 the collapsed matrix N of order 11 is presentedin [28] It turns out that Aut(N) sim= S2 ≀ S3 (the wreath product) is a group of order 72 withorbits of sizes 6 2 13 There are three non-equivalent possibilities to merge from this AEP a

117

Triangle-free strongly regular graphs Klin Ziv-Av

non-automorphic EP with 3 cells of sizes 14 21 42 and a collapsed matrix

4 6 6

4 0 12

2 6 8

which

has full spectrumEach of the cases provides also an EP for the Gewirtz graph with two cells of sizes 14 and

42 Thus as a by product we obtain other (cf Example 3) embeddings of the co-Heawoodgraph into the Gewirtz graph This example demonstrates ldquoirregularitiesrdquo which may causeinteresting EPs unpredictable from the first sight

Example 5 (Clebsch graph inside NL2(10)) Recall that up to the automorphism group ofΓ = NL2(10) there is one embedding of 5 into Γ The equitable partition resulting from thisembedding allows us to describe another model for NL2(10)

We start from a group H2 = Z4 times S4 of order 96 with orbits of lengths 16 16 48 128 The collapsed adjacency matrix of the corresponding automorphic equitable partition is Bprimeprime(shown below) Clearly the induced graph on the first cell of the partition is isomorphic to 5

In principle one may try as in previous sections to reconstruct the corresponding matrix Bfrom scratch not relying on knowledge of the graph Γ and its group A promising starting pointwould be justification of existence of a coclique of size 8 and its adjacency with the induced 5

We however prefer to exploit at this stage another possibility Namely it turns out thatthe stabilizers of A and 5 inside of Γ have maximal possible intersection K = Z4timesS3 of order24 K defines an AEP with 11 cells of sizes 2 4 4 6 6 6 12 12 12 12 24 and matrix Bprime

Bprime =

0 2 2 0 0 6 0 6 0 6 01 2 1 3 0 0 3 3 3 0 61 1 2 0 3 0 3 0 3 3 60 2 0 0 4 2 2 0 2 6 40 0 2 4 0 2 2 6 2 0 42 0 0 2 2 0 4 0 4 0 80 1 1 1 1 2 4 3 2 3 41 1 0 0 3 0 3 2 3 3 60 1 1 1 1 2 2 3 4 3 41 0 1 3 0 0 3 3 3 2 60 1 1 1 1 2 2 3 2 3 6

Bprimeprime =

5 4 9 3 14 2 12 0 43 4 11 3 14 0 12 2 42 8 6 6 0

It is easy to recognize how Bprime is split from the matrix B of the metric EP of the configurationA Then we merge the Bprime into Bprimeprime

The cell of size 48 is a merging of the last 3 cells the cell of size 8 is merging of cell of sizes2 and 6 (5th cell) while the cell of size 12 is a merging of two remaining cells of size 6 Eachcell of size 16 is a merging of cells of sizes 4 and 12

Example 6 (Reconstruction of NL2(10) from a subgroup of order 2) Using information inthe atlas [26] (or direct calculation using GAP) we see that G = Aut(NL2(10)) containsone conjugacy class of involutions with no fixed points From such an involution i we getan AEP into 50 cells of size 2 We investigated the quotient graph Γ of this AEP and itscollapsed adjacency matrix denoted by B The structure of Γ may be recovered by consideringthe centralizer CG(i) However we prefer to rely on information of combinatorial nature The

graph Γ has a natural EP into cells of sizes 20 and 30 (representing edges and non-edges inNL2(10))

The induced (color) graph on 20 vertices is the graph K1010 from which a 1-factor is removedThe induced graph on 30 vertices is the incidence graph of generalized quadrangle of order

2 GQ(2)

118

Triangle-free strongly regular graphs Klin Ziv-Av

This equitable partition corresponds to an equitable partition of Γ = NL2(10) into two cellsof sizes 40 and 60

11 Concluding comments

The presentation in this extended abstract is a tip of iceberg Much more concrete informationmay be found in [28] while [27] subject of ongoing polishing and development will reflect alldetected computer data about the graphs from family F We see also more potential to returnagain to construction of further models for graphs in F in particular relying on non-automorphicEPs The new attempts to achieve at least in part enumeration of all EPs of restricted size ofcells for graphs on 77 and 100 vertices are also on agenda The paper [16] as well as a numberof private communications of M Macaj to author MK create a background to attack in nearestfuture the problem of existence of new tfSRGs with relatively small parameters The parameterset on 162 vertices seems to be first interesting and realistic target

It should be mentioned that the results in [16] as well as in numerous private communica-tions of M Macaj to the author MK show that a putative new primitive triangle free stronglyregular graph Γ with prescribed parameters will have a relatively small automorphism groupAut(Γ) very concrete restrictions on the cycle structure of elements in Aut(Γ) are typicallyavailable Transformation of those restrictions to the language of equitable partitions may beregarded as a reasonable starting platform for attempts to construct a new tfSRG

Note however that many experts in AGT do not believe at all that a new tfSRG existsNeedless to say that this question creates a great challenge for the modern scientific community

Acknowledgments

We thank Andy Woldar for ongoing collaboration in this project We acknowledge Sven Re-ichard and Christian Pech for sharing with us their draft versions of COCO II Ongoing com-munication with Martin Macaj is very helpful and stimulative We also are pleased to thankPeter Cameron and Jozef Siran for interest expressed to the topic of our research

References

[1] M D Atkinson On rank 3 groups having λ = 0 Canad J Math 29(4)845ndash847 1977

[2] L Babel S Baumann and M Luedecke Stabcol An efficient implementation of the weisfeiler-leman algorithm Technical Report TUM-M9611 Technical University Munich 1996

[3] L Babel I V Chuvaeva M Klin and D V Pasechnik Algebraic combinatorics in mathematicalchemistry methods and algorithms ii program implementation of the weisfeiler-leman algorithmTechnical Report TUM-M9701 Fakultat fur Mathematik TU Munc 1997 httpwww-litmatumdeveroeffhtml96068019html

[4] C T Benson and N E Losey On a graph of Hoffman and Singleton J Combinatorial TheorySer B 1167ndash79 1971

[5] A E Brouwer A M Cohen and A Neumaier Distance-regular graphs volume 18 of Ergeb-nisse der Mathematik und ihrer Grenzgebiete (3) [Results in Mathematics and Related Areas (3)]Springer-Verlag Berlin 1989

[6] AE Brouwer httpwwwwintuenl~aebgraphs

119

Triangle-free strongly regular graphs Klin Ziv-Av

[7] Dragos Cvetkovic Peter Rowlinson and Slobodan Simic An introduction to the theory of graphspectra volume 75 of London Mathematical Society Student Texts Cambridge University PressCambridge 2010

[8] I A Faradzev and M H Klin Computer package for computations with coherent configurationsIn Proc ISSAC pages 219ndash223 Bonn 1991 ACM Press

[9] I A Faradzev M H Klin and M E Muzichuk Cellular rings and groups of automorphisms ofgraphs In Investigations in algebraic theory of combinatorial objects volume 84 of Math Appl(Soviet Ser) pages 1ndash152 Kluwer Acad Publ Dordrecht 1994

[10] The GAP Group GAP ndash Groups Algorithms and Programming Version 4412 2008

[11] Chris Godsil and Gordon Royle Algebraic graph theory volume 207 of Graduate Texts in Mathe-matics Springer-Verlag New York 2001

[12] Paul R Hafner On the graphs of Hoffman-Singleton and Higman-Sims Electron J Combin11(1)Research Paper 77 33 pp (electronic) 2004

[13] M Klin C Pech and P-H Zieschang Flag algebras of block designs i initial notions steiner2-designs and generalized quadrangles November 1998

[14] Mikhail Klin Christian Pech Sven Reichard Andrew Woldar and Matan Ziv-Av Examples ofcomputer experimentation in algebraic combinatorics Ars Math Contemp 3(2)237ndash258 2010

[15] Mikhail H Klin and Andrew J Woldar Dale Mesner Higman amp Sims and the strongly regulargraph with parameters (100 22 0 6) Bull Inst Combin Appl 6313ndash35 2011

[16] Martin Macaj and Jozef Siran Search for properties of the missing Moore graph Linear AlgebraAppl 432(9)2381ndash2398 2010

[17] Spyros S Magliveras The subgroup structure of the Higman-Sims simple group Bull AmerMath Soc 77535ndash539 1971

[18] B D McKay nauty userrsquos guide (version 15) 1990

[19] Dale Marsh Mesner An investigation of certain combinatorial properties of partially balancedincomplete block experimental designs and association schemes with a detailed study of designs oflatin square and related types ProQuest LLC Ann Arbor MI 1956 Thesis (PhD)ndashMichiganState University

[20] Dale Marsh Mesner Negative latin square designs Mimeo notes 410 Institute of Statistics UNCNC 1964

[21] George Neil Robertson Graphs minimal under girth valency and connectivity constraints Pro-Quest LLC Ann Arbor MI 1969 Thesis (PhD)ndashUniversity of Waterloo (Canada)

[22] Martin Schonert et al GAP ndash Groups Algorithms and Programming ndash version 3 release 4 patch-level 4 Lehrstuhl D fur Mathematik Rheinisch Westfalische Technische Hochschule AachenGermany 1997

[23] Leonard H Soicher GRAPE a system for computing with graphs and groups In Groups andcomputation (New Brunswick NJ 1991) volume 11 of DIMACS Ser Discrete Math TheoretComput Sci pages 287ndash291 Amer Math Soc Providence RI 1993

[24] Edwin R van Dam Three-class association schemes J Algebraic Combin 10(1)69ndash107 1999

[25] B Weisfeiler On construction and identification of graphs Number 558 in Lecture Notes in MathSpringer Berlin 1976

[26] Robert Wilson Peter Walsh Jonathan Tripp Ibrahim Suleiman Richard Parker Simon NortonSimon Nickerson Steve Linton John Bray and Rachel Abbott Atlas of finite group representa-tions - version 3 httpbrauermathsqmulacukAtlasv3

[27] M Ziv-Av Protocols with computer data related to the investigation of known primitive trangle-free strongly regular graphs httpwwwmathbguacil~zivavmath

[28] M Ziv-Av Results of computer algebra calculations for triangle free strongly regular graphshttpwwwmathbguacil~zivavmatheqpartpdf

120

Triangle-free strongly regular graphs Klin Ziv-Av

A Data about embeddings of tfSRGs inside tfSRGs

Quadrangle edge 2 edges 3 4 5 6Pentagon 0 5 0 0 0 0 0Petersen 0 15 15 5 0 0 0Clebsch 40 40 60 40 10 0 0HoSi 0 175 7875 128625 845250 2170350 1817550

Gewirtz 630 280 15120 245280 1370880 2603664 1643040Mesner 6930 616 55440 1330560 10589040 28961856 24641232NL2(10) 28875 1100 154000 5544000 67452000 301593600 477338400

7 edges 8 9 10 11HoSi 40150 15750 3500 350 0

Gewirtz 104160 7560 1400 112 0Mesner 3664320 166320 30800 2464 0NL2(10) 258192000 14322000 924000 154000 11200

Table 1 Number of imprimitive tfSRGs inside tfSRGs

Quadrangle edge 2 edges 3 4 5 6Pentagon 0 1 0 0 0 0 0Petersen 0 1 1 1 0 0 0Clebsch 1 1 1 1 1 0 0HoSi 0 1 1 4 10 21 15

Gewirtz 1 1 2 9 30 48 36Mesner 1 1 1 7 26 56 50NL2(10) 1 1 1 2 7 14 17

7 edges 8 9 10 11HoSi 8 1 1 1 0

Gewirtz 5 2 2 1 0Mesner 14 2 2 1 0NL2(10) 14 3 2 2 1

Table 2 Number of orbits of imprimitive tfSRGs inside tfSRGs

Pentagon Petersen Clebsch HoSi Gewirtz Mesner NL2(10)Pentagon 1 12 192 1260 8064 88704 443520Petersen 1 16 525 13440 1921920 35481600Clebsch 1 0 0 0 924000HoSi 1 0 0 704

Gewirtz 1 22 1030Mesner 1 100NL2(10) 1

Table 3 Number of primitive tfSRGs inside tfSRGs

121

Triangle-free strongly regular graphs Klin Ziv-Av

Pentagon Petersen Clebsch HoSi Gewirtz Mesner NL2(10)Pentagon 1 1 1 1 1 1 1Petersen 1 1 1 1 9 5Clebsch 1 0 0 0 1HoSi 1 0 0 1

Gewirtz 1 1 1Mesner 1 1NL2(10) 1

Table 4 Number of orbits of primitive tfSRGs inside tfSRGs

B Data about equitable partitions of primitive tfSRGs

Pentagon Petersen Clebsch HoSi Gewirtz Mesner NL2(10)EP 3 11 46 163Aut 3 11 38 89 154 236 607

Table 5 Number of orbits of equitable partitions and of automorphic equitable partitions forknown tfSRGs

Size 1 3 5 TotalEP 1 1 1 3Aut 1 1 1 3

Size 1 2 3 4 5 6 7 10 TotalEP 1 2 2 2 1 1 1 1 11Aut 1 2 2 2 1 1 1 1 11

Size 1 2 3 4 5 6 7 8 9 10 12 16 TotalEP 1 4 6 12 5 7 3 4 1 1 1 1 46Aut 1 4 5 10 3 5 2 4 1 1 1 1 38

Size 1 2 3 4 5 6 7 8 9 10 11EP 1 6 8 16 18 20 19 18 11 11 8Aut 1 4 5 7 6 9 9 11 4 9 4Size 12 13 14 15 16 18 20 28 30 50 TotalEP 7 7 2 2 1 2 3 1 1 1 163Aut 4 4 2 1 1 2 3 1 1 1 89

Table 6 Numbers of EPs and automorphic EPs by size of partition for four small graphs

122

Triangle-free strongly regular graphs Klin Ziv-Av

Size 1 2 3 4 5 6 7 8 9 10 11 12 13Aut 1 5 9 12 12 14 15 16 14 11 7 7 6Size 14 16 17 18 19 20 23 28 31 32 35 56 TotalAut 5 3 3 2 2 4 1 1 1 1 1 1 154

Size 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15Aut 1 3 5 8 11 10 20 14 19 12 18 12 16 9 14Size 16 17 18 19 20 21 23 25 29 33 41 45 49 77 TotalAut 5 12 5 9 1 8 4 8 6 2 1 1 1 1 236

Size 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15Aut 1 6 15 21 28 29 31 42 34 35 37 49 30 31 27Size 16 17 18 19 20 21 22 23 24 25 26 27 28 29Aut 26 18 18 13 26 14 11 7 9 6 6 5 2 1Size 30 31 32 33 34 35 39 40 45 50 53 60 65 100 TotalAut 7 1 3 2 2 3 1 4 1 1 1 1 1 1 607

Table 7 Numbers of automorphic EPs by size of partition for larger graphs

123

Usage of Invariants for Symbolic Verification of

Requirements

Short Paper

Alexander Letichevsky1 Alexander Godlevsky1 Anton Guba1 Alexander

Kolchin1 Oleksandr Letychevskyi1 Vladimir Peschanenko2

1 VM Glushkov Institute of Cybernetics Kiev Ukraineletcyfranet godlissorgua antongubaukrnet kolchin avyahoocom litissorgua

2 Kherson State University Kherson Ukrainevladimiriusgmailcom

The main goal of the paper is finding of pre- and post-invariants for transitions betweensymbolic states in the system that must be verified and use them for verification purposesSystems are specified by basic protocols [1] This specification defines a transition system withtransitions s rarr s

prime where s and sprime are symbolic states b is a basic protocol The main problem

of verification is a reachability problem for given properties expressed in specification logiclanguage

We present double approximation method of verification based on computing invariants Themethod is implemented as an iterative algorithm which solves in parallel reachability problemand computes lower and upper approximations of invariants for basic protocols

Currently there are a lot of significant works devoted to computing invariants which areconsidered for loops in programs Loops are marked explicitly - syntactic constructions likewhile and others When we deal with requirement specifications we do not deal with explicitmarked loops moreover basic protocols provide non-deterministic order Existing methodsusually ignore the conditions of the loops Invariants formulae which is obtained as a resultinclude unreachable states and therefore could be used in verification only in the following wayif a property does not intersect with the invariant formula then it is unreachable if intersectsthen conclusion cannot be done Therefore the problem of modification of existing methodsor to develop a new algorithm that could be applied in practice of requirements verification isactual

Research of problems of automatic program invariants generation for a variety of data al-gebras was performed starting from 70-th years in Institute of Cybernetics of NAS of UkraineTheir main results are presented in [2] Double approximation method is the dynamic iterativemethod of invariants generation and it is based on these results and adapted for requirementsverification The method also can be applied to program verification if a program is consideredas a special case of basic protocol specification The method has been implemented in VRS(Verification of Requirement Specifications) system [3] and IMS (Insertion Modeling System)system [4]

References

[1] A Letichevsky J Kapitonova V Volkov A Letichevsky Jr S Baranov V Kotlyarov T WeigertSystem Specification with Basic Protocols Cybernetics and System Analyses vol 4 2005 p 3-21

[2] Godlevsky AB Kapitonova YV Krivoy SL Letichevsky AA Iterative methods of programanalysis Cybernetics vol 2 1989 9-19

[3] Verification for Requirement Specification (VRS) httpissorguaISSVRStoolhtm lastviewed May 2013

[4] APS and IMS Systems httpapsystemorgua last viewed May 2013

124

Lebesgue Constants and Optimal Node Systems

via Symbolic Computations

Short Paper

Robert Vajda

University of Szeged Szeged Hungaryvajdarmathu-szegedhu

Abstract

Polynomial interpolation is a classical method to approximate continuous functionsby polynomials To measure the correctness of the approximation Lebesgue constantsare introduced For a given node system X(n+1) = x1 lt lt xn+1 (xj isin [a b])the Lebesgue function λn(x) is the sum of the modulus of the Lagrange basis polynomialsbuilt on X(n+1) The Lebesgue constant Λn assigned to the function λn(x) is its maximumover [a b] The Lebesgue constant bounds the interpolation error ie the interpolationpolynomial is at most (1 + Λn) times worse then the best approximation The minimumof the Λnrsquos for fixed n and interval [a b] is called the optimal Lebesgue constant Λlowast

n Forspecific interpolation node systems such as the equidistant system numerical results forthe Lebesgue constants Λn and their asymptotic behavior are known [3 7] However togive explicit symbolic expression for the minimal Lebesgue constant Λlowast

n is computationallydifficult In this work motivated by Rack [5 6] we are interested for expressing the minimalLebesgue constants symbolically on [minus1 1] and we are also looking for the characterizationof the those node systems which realize the minimal Lebesgue constants We exploited theequioscillation property of the Lebesgue function [4] and used quantifier elimination andGroebner Basis as tools [1 2] Most of the computation is done in Mathematica [8]

Acknowledgement The research of the author was partially supported by the HSRF(OTKA) grant number K83219

References

[1] D S Arnon - G E Collins - S McCallum Cylindrical Algebraic Decomposition I The BasicAlgorithm In Caviness-Johnson (eds) Quantifier Elimination and Cylindrical Algebraic Decom-position 136-151 Springer 1998

[2] B Buchberger Ein Algorithmus zum Auffinden der Basiselemente des Restklassenringes nach einemnulldimensionalen Polynomideal (An algorithm for finding the basis elements in the residue classring modulo a zero dimensional polynomial ideal) PhD Thesis Innsbruck 1965

[3] J S Hesthaven From electrostatics to almost optimal nodal sets for polynomial interpolation in asimplex SIAM J Numer Anal Vol 35 No 2 655-676 1998

[4] T A Kilgore A characterization of the Lagrange interpolating projection with minimal Tchebycheffnorm J Approx Theory 24 (1978) no 4 273-288

[5] H-J Rack An example of optimal nodes for interpolation International Journal of MathematicalEducation in Science and Technology 15 (3) 355-357 1984

[6] H-J Rack An example of optimal nodes for interpolation revisited Advances in Applied Mathe-matics and Approximation Theory Springer Proceedings in Mathematics amp Statistics Volume 41117-120 2013

[7] S J Simon Lebesgue constants in polynomial interpolation Annales Mathematicae et Informaticae33 109-123 2006

[8] Wolfram Research Inc Mathematica Version 90 Champaign Illinois 2012

125

Author Index

Alpuente Marıa 4

Ballis Demis 4

Buchberger Bruno 1

Comini Marco 19 31

Frechina Francisco 4

Ghourabi Fadoua 50

Godlevsky Alexander 124

Goto Mizuki 93

Guba Anton 124

Ida Tetsuo 50

Kakutani Yoshihiko 64

Kato Go 64

Kawano Yasuhito 64

Klin Mikhail 108

Kolchin Alexander 124

Kubota Takahiro 64

Letichevsky Alexander 124

Letychevskyi Oleksandr 124

Li Wei 2

Matringe Nadir 81

Moura Arnaldo 81

Neumann Severin 70

Ouaknine Joel 3

Peschanenko Vladimir 124

Rebiha Rachid 81

Sakurada Hideki 64

Sapina Julia 4

Takahashi Kazuko 50 93

Torella Luca 19 31

Vajda Robert 125

Yoshimaru Shizuo 93

Ziv-Av Matan 108

Keyword Index

algebraic number 125

automated verification 64

BB84 64

bottom-up semantics 31

computational model 93

computational origami 50

computer algebra 108

debugging 4

Distributed 70

elecronic cash protocol 93

equitable partitions 108

F4 70

formal methods 64

geometrical constraint solving 50

Groebner basis 125

Grobner Basis 70

induction scheme 93

invariants 124

knot fold 50

Lebesgue constant 125

Linear Algebra 81

maude 4

MPI 70

Parallel 70

polynomial interpolation 125

process calculi 64

program animation 4

property-oriented specifications 19

quantifier elimination 125

quantum cryptography 64

requirements specification 124

resultant 125

rewriting logic 4

semantics-based inference methods 19

slicing 4

Static Analysis 81

stepping 4

strongly regular graphs 108

symbolic verification 124

term rewriting 31

Term Rewriting Systems 19 31

Termination Analysis 81

theorem proving 50

theorem proving methods 93

  • Introduction
  • Preliminaries
  • Rewriting Modulo Equational Theories
  • Exploring the Computation Tree
    • Expanding a Program State
    • Computing a Fragment of the Computation Tree
      • Particularizing the Exploration
        • Interactive Stepper
        • Forward Trace Slicer
          • Implementation
          • Conclusions
          • Introduction
            • Notations
              • Many notions of equivalence
              • Deriving specifications from TRSs
                • An effective instance of the presented method
                  • Conclusions and future work
                  • Introduction
                  • Preliminaries
                  • Modeling the small-step rewriting behavior
                    • The semantic domain
                      • Linearizing Narrowing
                        • Operational denotations of TRSs
                          • Evaluation Function
                          • Properties of the TRS operational denotation
                            • Fixpoint denotations of TRSs
                              • Properties of the TRS fixpoint denotation
                                  • Conclusions
                                  • Technical Proofs
                                  • Introduction
                                  • Notations
                                  • Origami Geometrical Construction
                                    • Huzitas Fold Operations
                                    • Extensions
                                      • Knot Fold
                                        • Geometrical Properties
                                        • Geometrical Constraint Solving Approach
                                          • Regular Heptagon by the Knot Fold
                                            • Geometrical Constraints
                                            • Construction by Eos
                                            • Algebraic Interpretation
                                              • Proof
                                                • Theorem to Prove
                                                • Proof by Eos
                                                • Proof Results
                                                  • Conclusion
                                                    • Acknowledgments
                                                      • Introduction
                                                      • The Verifier
                                                      • Application to Shor and Preskills Security Proof
                                                      • Conclusions
                                                      • Introduction
                                                      • Notations
                                                      • Preliminaries
                                                      • Matrix Distribution
                                                      • Simplifying the F4 Algorithm
                                                      • Benchmarks
                                                      • Conclusion
                                                      • Introduction
                                                      • Linear Algebra and Linear Loop Programs
                                                      • Asymptotically Non-terminant Variable Values
                                                      • Automated generation of ANT loci
                                                        • The regular case
                                                        • The general case handling linear diagonalizable programs
                                                          • Discussions
                                                          • Conclusion
                                                          • Introduction
                                                          • Data Conversion Formalization
                                                            • Problem
                                                            • Solution
                                                              • Conversion from BS to BTREE
                                                              • Conversion from NAT to BS
                                                              • Conversion from NAT to BTREE
                                                                  • Modeling of an Electronic Cash Protocol
                                                                    • Ideal Electronic Cash
                                                                    • Definition of money
                                                                    • Creation of money from a natural number
                                                                    • Calculation of the amount of money
                                                                    • Payment
                                                                      • Proof of Properties
                                                                        • Well-definedness of cash
                                                                        • Well-definedness of pay
                                                                        • Divisibility
                                                                          • Discussion
                                                                          • Conclusion
                                                                          • Introduction
                                                                          • Strongly regular graphs a brief survey
                                                                          • Computer algebra tools in AGT
                                                                          • The seven known primitive triangle-free strongly regular graphs
                                                                          • Embeddings of tfSRGs into known primitive tfSRGs
                                                                          • Equitable partitions
                                                                          • Search for equitable partitions
                                                                          • Quadrangle and Atkinson EPs of NL2(10)
                                                                          • Some modifications of Robertson model
                                                                          • A few more models
                                                                          • Concluding comments
                                                                          • Data about embeddings of tfSRGs inside tfSRGs
                                                                          • Data about equitable partitions of primitive tfSRGs
Page 4: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,

Symposium Organization

Symposium Chair

Temur Kutsia Research Institute for Symbolic Computa-

tion - RISC Austria

Program Chair

Laura Kovacs Chalmers University of Technology Sweden

Program Committee

Marıa Alpuente Technical University of Valencia Spain

Serge Autexier DFKI Germany

Nikolaj Bjorner Microsoft Research USA

Adel Bouhoula Ecole superieure des communications de Tu-

nis Tunisia

Iliano Cervesato Carnegie Mellon University - Qatar Cam-

pus Qatar

Horatiu Cirstea Loria France

Jurgen Giesl RWTH Aachen Germany

Tetsuo Ida Tsukuba University Japan

Paul Jackson School of Informatics University of Edin-

burgh UK

Tudor Jebelean Research Institute for Symbolic Computa-

tion - RISC Austria

Cezary Kaliszyk University of Innsbruck Austria

Fairouz Kamareddine Heriot-Watt University UK

Laura Kovacs Chalmers University of Technology Sweden

Temur Kutsia Research Institute for Symbolic Computa-

tion - RISC Austria

Stephan Merz INRIA-LORIA Nancy France

Ali Mili New Jersey Institute of Technology USA

Yasuhiko Minamide University of Tsukuba Japan

Pierre-Etienne Moreau INRIA-LORIA Nancy France

Andre Platzer Carnegie Mellon University USA

Stefan Ratschan Czech Academy of Sciences The Czech Re-

public

Rachid Rebiha University of Lugano Switzerland and IC

Unicamp Brazil

Enric Rodrıguez Car-

bonell

Technical University of Catalonia Spain

Sorin Stratulat Universite Paul Verlaine France

Thomas Sturm Max Planck Institute for Informatics Ger-

many

Additional Reviewers

Cabarcas Daniel

Eder Christian

Gay Simon

Ghorbal Khalil

Ghourabi Fadoua

Kredel Heinz

Martins Joao G

Vigneron Laurent

Table of Contents

Invited Papers

Mathematics of 21st Century A Personal View 1

Bruno Buchberger

A Semantic Framework for Program Debugging 2

Wei Li

Decision Problems for Linear Recurrence Sequences 3

Joel Ouaknine

Regular Papers

Parametric Exploration of Rewriting Logic Computations 4

Marıa Alpuente Demis Ballis Francisco Frechina and Julia

Sapina

Automatic Inference of Term Equivalence in Term Rewriting

Systems 19

Marco Comini and Luca Torella

A Condensed Goal-Independent Fixpoint Semantics Modeling

the Small-Step Behavior of Rewriting 31

Marco Comini and Luca Torella

Logical and Algebraic Views of a Knot Fold of a Regular

Heptagon 50

Fadoua Ghourabi Tetsuo Ida and Kazuko Takahashi

Automated Verification of Equivalence on Quantum

Cryptographic Protocols 64

Takahiro Kubota Yoshihiko Kakutani Go Kato Yasuhito

Kawano and Hideki Sakurada

A modified parallel F4 algorithm for shared and distributed

memory architectures 70

Severin Neumann

Generating Asymptotically Non-terminant Initial Variable

Values for Linear Diagonalizable Programs 81

Rachid Rebiha Nadir Matringe and Arnaldo Moura

Data Conversion Method between a Natural Number and a

Binay Tree for an Inductive Proof and Its Application 93

Kazuko Takahashi Shizuo Yoshimaru and Mizuki Goto

Computer algebra investigation of known primitive

triangle-free strongly regular graphs 108

Matan Ziv-Av and Mikhail Klin

Short Papers

Usage of Invariants for Symbolic Verification of Requirements 124

Alexander Letichevsky Alexander Godlevsky Anton Guba

Alexander Kolchin Oleksandr Letychevskyi and Vladimir

Peschanenko

Lebesgue Constants and Optimal Node Systems via Symbolic

Computations 125

Robert Vajda

Mathematics of 21st Century

A Personal View

Bruno Buchberger

Research Institute for Symbolic Computation - RISC

Johannes Kepler University Linz Austria

BrunoBuchbergerriscuni-linzacat

Extended Abstract

Mathematics of 19th century and before was rich in content intuition strong ideas motivationfrom natural sciences and had a coherent view of all fields of mathematics (geometry algebraanalysis number theory )

Mathematics of 20th century added three important aspects mathematical logic as themathematical meta-theory of mathematics formalism and abstractness and reduction to firstprinciples (ldquoBourbakismrdquo) and the notion of computing (both as an exact mathematicalnotion and as the foundation of the revolutionary device rdquoprogrammable computerrdquo) In factthe three aspects have a lot to do with each other and are fundamentally interrelated Howeverin practice the three aspects were (and still are) pursued by three different communities Thedeep insights of logicians on the nature of mathematics are hardly used in ever-day practiceof ldquoworking mathematiciansrdquo ldquopure mathematiciansrdquo are often proud that they do not touchthe computer except for writing e-mails typing in LaTeX and using web search and computerscientists often think that what they are doing does not need mathematics or even is oppositeto mathematics

In my view as indicated by trends in late 20th century in 21st century mathematics willevolve as - or return to be - a unified body of mathematical logic abstract structural math-ematics and computer mathematics with no boundaries between the three aspects ldquoWorkingmathematiciansrdquo will have to master the three aspects equally well and integrate them in theirdaily work More specifically working in mathematics will proceed on the ldquoobject levelrdquo ofdeveloping new mathematical content (abstract knowledge and computational methods) andat the same time on the ldquometa-levelrdquo of developing automated reasoning methods for support-ing research on the object level This ldquomassage of the mathematical brainrdquo by jumping backand forth between the object and the meta-level will guide mathematics onto a new level ofsophistication

Symbolic computation is just a way of expressing this general view of mathematics of the21st century and it also should be clear that software science is just another way of expressingthe algorithmic aspect of this view

In the talk we will exemplify the spirit of this new type of mathematics by a report onthe Theorema system being developed in the speakerrsquos research group Theorema is both alogic and a software frame for doing mathematics in the way sketched above On the objectlevel Theorema allows to prove and program within the same logical frame and on the meta-level it allows to formulate reasoning techniques that help proving and programming on theobject level In particular we will show how this type of doing mathematics allows to mimicthe invention process behind the speakerrsquos theory of Grobner bases which provides a generalmethod for dealing with multivariate nonlinear polynomial systems

1

A Semantic Framework for Program Debugging

Wei Li

State Key Laboratory of Software Development Environment

School of Computer Science and Engineering

Beihang University China

liweinlsdebuaaeducn

Abstract

This work aims to build a semantic framework for automated debugging A debugging pro-

cess consists of tracing locating and fixing processes consecutively The first two processes

are accomplished by a tracing procedure and a locating procedure respectively The tracing

procedure reproduces the execution of a failed test case with well-designed data structures and

saves necessary information for locating bugs The locating procedure will use the informa-

tion obtained from the tracing procedure to locate ill-designed statements and to generate a

fix-equation the solution of which is a function that will be used to fix the bugs A structural

operational semantics is given to define the functions of the tracing and locating procedure

Both procedures are proved to terminate and produces one fix-equation The main task of

fixing process is to solve the fix-equation It turns out that for a given failed test case there

exist three different types of solutions 1 the bug is solvable there exists a solution of the

fix-equation and the program can be repaired 2 There exists a non-linear error in the pro-

gram the fix-equation generated at each round of the locating procedure is solvable but a new

bug will arise when the old bug is being fixed 3 There exists a logical design error and the

fix-equation is not solvable

2

Decision Problems for Linear Recurrence

Sequences

Joel Ouaknine

Department of Computer Science

Oxford University United Kingdom

JoelOuakninecsoxacuk

Abstract

Linear recurrence sequences (LRS) such as the Fibonacci numbers permeate vast areas ofmathematics and computer science In this talk we consider three natural decision problemsfor LRS namely the Skolem Problem (does a given LRS have a zero) the Positivity Problem

(are all terms of a given LRS positive) and the Ultimate Positivity Problem (are all but finitelymany terms of a given LRS positive) Such problems (and assorted variants) have applicationsin a wide array of scientific areas such as theoretical biology (analysis of L-systems pop-ulation dynamics) economics (stability of supply-and-demand equilibria in cyclical marketsmultiplier-accelerator models) software verification (termination of linear programs) proba-bilistic model checking (reachability and approximation in Markov chains stochastic logics)quantum computing (threshold problems for quantum automata) discrete linear dynamicalsystems (reachability and invariance problems) as well as combinatorics statistical physicsterm rewriting formal languages cellular automata generating functions etc

We shall see that these problems have deep and fascinating connections to rich mathematicalconcepts and conjectures particularly in the fields of analytic and algebraic number theorydiophantine geometry and approximation real algebraic geometry mathematical logic andcomplexity theory

3

Parametric Exploration of

Rewriting Logic Computations lowast

M Alpuente1 D Ballis2 F Frechina1 and J Sapina1

1 DSIC-ELP Universitat Politecnica de ValenciaCamino de Vera sn Apdo 22012 46071 Valencia Spain

alpuenteffrechinajsapinadsicupves2 DIMI Universita degli Studi di Udine

Via delle Scienze 206 33100 Udine Italy demisballisuniudit

Abstract

This paper presents a parameterized technique for the inspection of Rewriting Logiccomputations that allows the non-deterministic execution of a given rewrite theory to befollowed up in different ways Starting from a selected state in the computation tree theexploration is driven by a user-defined inspection criterion that specifies the explorationmode By selecting different inspection criteria one can automatically derive useful debug-ging facilities such as program steppers and more sophisticated dynamic trace slicers thatfacilitate the detection of control and data dependencies across the computation tree Ourmethodology which is implemented in the Anima graphical tool allows users to capture theimpact of a given criterion validate input data and detect improper program behaviors

1 Introduction

Program animation or stepping refers to the very common debugging technique of executingcode one step at a time allowing the user to inspect the program state and related databefore and after the execution step This allows the user to evaluate the effects of a givenstatement or instruction in isolation and thereby gain insight into the program behavior (ormisbehavior) Nearly all modern IDEs debuggers and testing tools currently support this modeof execution optionally where animation is achieved either by forcing execution breakpointscode instrumentation or instruction simulation

Rewriting Logic (RWL) is a very general logical and semantic framework which is particu-larly suitable for formalizing highly concurrent complex systems (eg biological systems [7] andWeb systems [2 6]) RWL is efficiently implemented in the high-performance system Maude [9]Roughly speaking a rewriting logic theory seamlessly combines a term rewriting system (TRS)together with an equational theory that may include equations and axioms (ie algebraic lawssuch as commutativity associativity and unity) so that rewrite steps are performed modulo theequations and axioms

In recent years debugging and optimization techniques based on RWL have received growingattention [1 13 16 17] but to the best of our knowledge no practical animation tool forRWLMaude has been formally developed To debug Maude programs Maude has a basictracing facility that allows the user to advance through the program execution letting himherselect the statements to be traced except for the application of algebraic axioms that are not

lowastThis work has been partially supported by the EU (FEDER) and the Spanish MEC project ref TIN2010-21062-C02-02 and by Generalitat Valenciana ref PROMETEO2011052 This work was carried out during thetenure of D Ballisrsquo ERCIM lsquoAlain Bensoussanrdquo Postdoctoral Fellowship The research leading to these resultshas received funding from the European Union Seventh Framework Programme (FP72007-2013) under grantagreement n 246016 F Frechina was supported by FPU-ME grant AP2010-5681

4

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

under user control and are never recorded as execution steps in the trace All rewrite steps thatare obtained by applying the equations or rules for the selected function symbols are shown inthe output trace so that the only way to simplify the displayed view of the trace is by manuallyfixing the traceable equations or rules Thus the trace is typically huge and incomplete andwhen the user detects an erroneous intermediate result it is difficult to determine where theincorrect inference started Moreover this trace is either directly displayed or written to afile (in both cases in plain text format) thus only being amenable for manual inspection bythe user This is in contrast with the enriched traces described below which are complete (allexecution steps are recorded by default) and can be sliced automatically so that they can bedramatically simplified in order to facilitate a specific analysis Also the trace can be directlydisplayed or delivered in its meta-level representation which is very useful for further automatedmanipulation

Contributions This paper presents the first parametric (forward) exploration technique forRWL computations Our technique is based on a generic animation algorithm that can be tunedto work with different modalities including incremental stepping and automated forward slicingThe algorithm is fully general and can be applied for debugging as well as for optimizing anyRWL-based tool that manipulates RWL computations Our formulation takes into account theprecise way in which Maude mechanizes the rewriting process and revisits all those rewrite stepsin an instrumented fine-grained way where each small step corresponds to the application ofan equation equational axiom or rule This allows us to explain the input execution trace withregard to the set of symbols of interest (input symbols) by tracing them along the executiontrace so that in the case of the forward slicing modality all data that are not descendants ofthe observed symbols are simply discarded

Related Work Program animators have existed since the early years of programmingAlthough several steppers have been implemented in the functional programming community(see [10] for references) none of these systems applies to the animation and forward slicing ofMaude computations An algebraic stepper for Scheme is defined and formally proved in [10]which is included in the DrScheme programming environment The stepper reduces Schemeprograms to values (according to the reduction semantics of Scheme) and is useful for explainingthe semantics of linguistic facilities and for studying the behavior of small programs It explainsa programrsquos execution as a sequence of reduction steps based on the ordinary laws of algebra forthe functional core of the language and more general algebraic laws for the rest of the languageIn order to discover all of the steps that occur during the program evaluation the stepperrewrites (or rdquoinstrumentsrdquo) the code The inserted code uses a mechanism called ldquocontinuationmarksrdquo to store information about the programrsquos execution as it is running and makes calls tothe stepper before after and during the evaluation of each program expression Continuationmarks allow the stepper to reuse the underlying Scheme implementation without having to re-implement the evaluator The stepperrsquos implementation technique also applies to both ML andHaskell since it supports states continuations multiple threads of control and lazy evaluation[10]

In [4 5] an incremental backward trace slicer was presented that generates a trace slice ofan execution trace T by tracing back a set of symbols of interest along (an instrumented versionof) T while data that are not required to produce the target symbols are simply discarded Thiscan be very helpful in debugging since any information that is not strictly needed to delivera critical part of the result is discarded which helps answer the question of what programcomponents might affect a lsquoselected computationrdquo However for the dual problem of ldquowhatprogram components might be affected by a selected computationrdquo a kind of forward expansionis needed which has been overlooked to date

5

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

Plan of the paper Section 2 recalls some fundamental notions of RWL and Section 3summarizes the rewriting modulo equational theories defined in Maude Section 4 formulatesthe exploration as a parameterized procedure that is completely controlled by the user whileSection 5 formalizes three different inspection techniques that are obtained as an instance ofthe generic scheme Finally Section 6 reports on a prototypical implementation of the proposedtechniques and Section 7 concludes

2 Preliminaries

Let us recall some important notions that are relevant to this work We assume some basicknowledge of term rewriting [18] and Rewriting Logic [14] Some familiarity with the Maudelanguage [9] is also required

We consider an order-sorted signature Σ with a finite poset of sorts (Slt) that models theusual subsort relation [9] We assume an S-sorted family V = VssisinS of disjoint variable setsτ(ΣV)s and τ(Σ)s are the sets of terms and ground terms of sort s respectively We writeτ(ΣV) and τ(Σ) for the corresponding term algebras The set of variables that occur in a termt is denoted by Var(t) In order to simplify the presentation we often disregard sorts when noconfusion can arise

A position w in a term t is represented by a sequence of natural numbers that addressesa subterm of t (Λ denotes the empty sequence ie the root position) By notation w1w2we denote the concatenation of positions (sequences) w1 and w2 Positions are ordered by theprefix ordering that is given the positions w1 and w2 w1 le w2 if there exists a position u suchthat w1u = w2

Given a term t we let Pos(t) denote the set of positions of t By t|w we denote the subtermof t at position w and t[s]w specifies the result of replacing the subterm t|w by the term s

A substitution σ equiv x1t1 x2t2 is a mapping from the set of variables V to the set ofterms τ(ΣV) which is equal to the identity almost everywhere except over a set of variablesx1 xn The domain of σ is the set Dom(σ) = x isin V | xσ 6= x By id we denote theidentity substitution The application of a substitution σ to a term t denoted tσ is defined byinduction on the structure of terms

tσ =

xσ if t = x x isin V

f(t1σ tnσ) if t = f(t1 tn) n ge 0

For any substitution σ and set of variables V σ |V denotes the substitution obtained from σby restricting its domain to V (ie σ |V (x) = xσ if x isin V otherwise σ |V (x) = x) Given twoterms s and t a substitution σ is a matcher of t in s if sσ = t The term t is an instance ofthe term s iff there exists a matcher σ of t in s By matchs(t) we denote the function thatreturns a matcher of t in s if such a matcher exists

A (labelled) equation is an expression of the form [l] λ = ρ where λ ρ isin τ(ΣV) V ar(ρ) subeV ar(λ) and l is a label ie a name that identifies the equation A (labelled) rewrite rule isan expression of the form [l] λ rarr ρ where λ ρ isin τ(ΣV) V ar(ρ) sube V ar(λ) and l is a labelWhen no confusion can arise rule and equation labels are often omitted The term λ (resp ρ)is called left-hand side (resp right-hand side) of the rule λrarr ρ (resp equation λ = ρ)

6

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

3 Rewriting Modulo Equational Theories

An order-sorted equational theory is a pair E = (Σ∆cupB) where Σ is an order-sorted signature∆ is a collection of (oriented) equations and B is a collection of equational axioms (ie algebraiclaws such as associativity commutativity and unity) that can be associated with any binaryoperator of Σ The equational theory E induces a congruence relation on the term algebraτ(ΣV) which is denoted by =E A rewrite theory is a triple R = (Σ∆ cup BR) where(Σ∆ cupB) is an order-sorted equational theory and R is a set of rewrite rules

Example 31The following rewrite theory encoded in Maude specifies a close variant of the fault-tolerantclient-server communication protocol of [15]

mod CLIENT-SERVER-TRANSF is inc INT + QID sorts Content State Msg Cli Serv Addressee

Sender Data CliName ServName Question Answer subsort Msg Cli Serv lt State subsort Addressee Sender CliName ServName lt Qid subsort Question Answer Data lt Nat

ops Srv Srv-A Srv-B Cli Cli-A Cli-B -gt Qid op null -gt State op _amp_ State State -gt State [assoc comm id null] op _lt-_ Addressee Content -gt Msg op __ Sender Data -gt Content op [____] CliName ServName Question Answer -gt Cli op na -gt Answer op [_] ServName -gt Serv [ctor] op f ServName CliName Data -gt Data

vars C S Addr Qid vars Q D A Nat var CNT [Content]

eq [succ] f(S C Q) = s(Q)

rl [req] [C S Q na] =gt[C S Q na] amp S lt- C Q

rl [reply] S lt- C Q amp [S] =gt[S] amp C lt- S f(S C Q)

rl [rec] C lt- S D amp [C S Q A] =gt[C S Q A]

rl [dupl] (Addr lt- CNT) =gt(Addr lt- CNT) amp (Addr lt- CNT)

rl [loss] (Addr lt- CNT) =gt null endm

The specification models an environment where several clients and servers coexist Eachserver can serve many clients while for the sake of simplicity we assume that each clientcommunicates with a single server

The names of clients and servers belong to the sort Qid Clients are represented as 4-tuplesof the form [C S Q D] where C is the clientrsquos name S is the name of the server it wants tocommunicate with Q is a natural number that identifies a client request and D is either a naturalnumber that represents the server response or the constant value na (not available) when theresponse has not been yet received Servers are stateless and are represented as structures [S]with S being the serverrsquos name All messages are represented as pairs of the form Addr lt- CNTwhere Addr is the addresseersquos name and CNT stands for the message contents Such contentsare pairs AddrN with Addr being the senderrsquos name and N being a number that representseither a request or a response

The server S uses a function f (only known to the server itself) that given a question Q

from client C the call f(S C Q) computes the answer s(Q) where s(Q) is the successor of Q Thisfunction is specified by means of the equation succ

Program states are formalized as a soup (multiset) of clients servers and messages whereasthe system behavior is formalized through five rewrite rules that model a faulty communicationenvironment in which messages can arrive out of order can be duplicated and can be lostSpecifically the rule req allows a client C to send a message with request Q to the server SThe rule reply lets the server S consume the client request Q and send a response messagethat is computed by means of the function f The rule rec specifies the client reception of aserver response D that should be stored in the client data structure Indeed the right-handside [C S Q A] of the rule includes an intentional barely perceptible bug that does not let theclient structure be correctly updated with the incoming response D The correct right-hand sideshould be [C S Q D] Finally the rules dupl and loss model the faulty environment and have

7

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

the obvious meaning messages can either be duplicated or lost

Given a rewrite theory (Σ ER) with E = ∆ cup B the rewriting modulo E relation (insymbols rarrRE) can be defined by lifting the usual rewrite relation on terms [12] to the E-congruence classes [t]E on the term algebra τ(ΣV) that are induced by =E [8] that is [t]Eis the class of all terms that are equal to t modulo E Unfortunately rarrRE is in generalundecidable since a rewrite step t rarrRE tprime involves searching through the possibly infiniteequivalence classes [t]E and [tprime]E

The exploration technique formalized in this work is formulated by considering the preciseway in which Maude proves the rewrite steps (see Section 52 in [9]) Actually the Maudeinterpreter implements rewriting modulo E by means of two much simpler relations namelyrarr∆B and rarrRB These allow rewrite rules and equations to be intermixed in the rewritingprocess by simply using an algorithm of matching modulo B We define rarrRcup∆B as rarrRB

cup rarr∆B Roughly speaking the relation rarr∆B uses the equations of ∆ (oriented from leftto right) as simplification rules thus for any term t by repeatedly applying the equations assimplification rules we eventually reach a normalized term tdarr∆ to which no further equationscan be applied The term t darr∆ is called a canonical form of t wrt ∆ On the other handthe relation rarrRB implements rewriting with the rules of R which might be non-terminatingand non-confluent whereas ∆ is required to be terminating and Church-Rosser modulo B inorder to guarantee the existence and unicity (modulo B) of a canonical form wrt ∆ for anyterm [9]

Formally rarrRB and rarr∆B are defined as follows given a rewrite rule r = (λ rarr ρ) isin R(resp an equation e = (λ = ρ) isin ∆) a substitution σ a term t and a position w of t

trσwrarrRB tprime (resp t

eσwrarr∆B tprime) iff λσ =B t|w and tprime = t[ρσ]w When no confusion can arise we

simply write trarrRB tprime (resp trarr∆Btprime) instead of t

rσwrarrRB tprime (resp t

eσwrarr∆B tprime)

Under appropriate conditions on the rewrite theory a rewrite step modulo E on a term t canbe implemented without loss of completeness by applying the following rewrite strategy [11](i) reduce t wrt rarr∆B until the canonical form t darr∆ is reached (ii) rewrite t darr∆ wrt rarrRB

A computation C in the rewrite theory (Σ∆ cupBR) is a rewrite sequence

s0 rarrlowast∆B s0darr∆ rarrRB s1 rarrlowast

∆B s1darr∆

that interleaves rarr∆B rewrite steps and rarrRB rewrite steps following the strategy mentionedabove Terms that appear in computations are also called (program) states

A computation tree TR(s) for a term s and a rewrite theory R is a tree-like representationof all the possible computations in R that originate from the initial state s More preciselyTR(s) is a labelled tree whose root node label identifies the initial state s and whose edges arelabelled with rewrite steps of the form t rarrRcup∆B tprime so that any node in TR(s) represents aprogram state of a computation stemming from s

Example 32

Consider the rewrite theory of Example 31 together with the initial state [Srv-A] amp [Cli-A

Srv-A7na] amp [Cli-BSrv-A17na] In this case the computation tree consists of severalinfinite computations that start from the considered initial state and model interactions betweenclients Cli-A and Cli-B and server Srv-A The computed tree is depicted in the following picturewhere for the sake of simplicity we only display the equations and rules that have been appliedat each rewrite step while other information such as the computed substitution and the rewrite

8

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

position are omitted in the depicted tree

Query Go

Go

Go

Go

Go

Go

GoGoBack

Back

Back

Back

Back

Back

BackBack Anima

[Srv-A] amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]s0

req[Srv-A] amp (Srv-A lt- Cli-A7) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s1 req[Srv-A] amp (Srv-A lt- Cli-B17) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s2

reply[Srv-A] amp (Cli-A lt- Srv-Af(Serv-ACli-A7)) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s3 reqdupl[Srv-A] amp (Srv-A lt- Cli-A7) amp (Srv-A lt- Cli-A7) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s4 req[Srv-A] amp (Srv-A lt- Cli-A7) amp (Srv-A lt- Cli-B17) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s5 loss[Srv-A] amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s6

succ[Srv-A] amp (Cli-A lt- Srv-A8) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s7

Options

Given a computation C it is always possible to expand C in an instrumented computationCinst in which each application of the matching modulo B algorithm is mimicked by the explicitapplication of a suitable equational axiom which is also oriented as a rewrite rule [3]

Also typically hidden inside the B-matching algorithms some flatunflat transformationsallow terms that contain operators that obey associative-commutative axioms to be rewrittenThese transformations allow terms to be reordered and correctly parenthesized in order toenable subsequent rewrite steps Basically this is achieved by producing a single auxiliaryrepresentative of their AC congruence class [3] For example consider a binary AC operatorf together with the standard lexicographic ordering over symbols Given the B-equivalencef(b f(f(b a) c)) =B f(f(b c) f(a b)) we can represent it by using the ldquointernal sequencerdquo

of transformations f(b f(f(b a) c))flatminusrarr lowast

Bf(a b b c)unflatminusrarr lowast

Bf(f(b c) f(a b)) where the firstsubsequence corresponds to a flattening transformation sequence that obtains the AC canonicalform while the second one corresponds to the inverse unflattening transformation This wayany given instrumented computation consists of a sequence of (standard) rewrites using theequations (rarr∆) rewrite rules (rarrR) equational axioms and flatunflat transformations (rarrB)By abuse of notation since equations and axioms are both interpreted as rewrite rules in ourformulation we often abuse the notation λrarr ρ to denote rules as well as (oriented) equationsand axioms Given an instrumented computation Cinst by |Cinst| we denote its length mdashthat isthe number of rewrite steps that occur in Cinst We use the functions head(Cinst) and tail(Cinst)to respectively select the first rewrite step in Cinst and the instrumented computation yieldedby removing the first rewrite step from Cinst In the sequel we also assume the existence of afunction instrument(C) which takes a computation C and delivers its instrumented counterpart

Example 33Consider the rewrite theory of Example 31 together with the following computation

C = [Cli Srv 7 na] amp [Srv] amp Cli lt- Srv f(Srv Cli 7) rarr∆B

[Cli Srv 7 na]amp [Srv] amp Cli lt- Srv 8 rarrRB

[Cli Srv 7 7] amp [Srv]

The corresponding instrumented computation Cinst which is produced by instrument(C) isgiven by 1) suitably parenthesizing states by means of flatteningunflattening transformations

9

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

when needed and 2) making commutative ldquostepsrdquo explicit by using the (oriented) equationalaxiom (X amp Y rarr Y amp X) in B that models the commutativity property of the (juxtaposition)operator amp Note these transformations are needed to enable the application of the rule rec

(of R) to the seventh state

Cinst = [Cli Srv 7 na] amp [Srv] amp Cli lt- Srv f(Srv Cli 7)succminusrarr∆

[Cli Srv 7 na] amp [Srv] amp Cli lt- Srv 8unflatminusrarrB

[Cli Srv 7 na] amp ([Srv] amp Cli lt- Srv 8)commminusrarrB

[Cli Srv 7 na] amp (Cli lt- Srv 8 amp [Srv])flatminusrarrB

[Cli Srv 7 na] amp Cli lt- Srv 8 amp [Srv]unflatminusrarrB

([Cli Srv 7 na] amp Cli lt- Srv 8) amp [Srv]commminusrarrB

(Cli lt- Srv 8 amp [Cli Srv 7 na]) amp [Srv]recminusrarrR

[Cli Srv 7 7] amp [Srv]

4 Exploring the Computation Tree

Computation trees are typically large and complex objects to deal with because of the highly-concurrent nondeterministic nature of rewrite theories Also their complete generation andinspection are generally not feasible since some of their branches may be infinite as they encodenonterminating computations

However one may still be interested in analysing a fragment of a given computation tree fordebugging or program comprehension purposes This section presents an exploration techniquethat allows the user to incrementally generate and inspect a portion T bull

R(sbull) of a computationtree TR(s) by expanding (fragments of) its program states into their descendants starting fromthe root node The exploration is an interactive procedure that is completely controlled by theuser who is free to choose the program state fragments to be expanded

41 Expanding a Program State

A state fragment of a state s is a term sbull that hides part of the information in s that is theirrelevant data in s are simply replaced by special bull-variables of appropriate sort denoted bybulli with i = 0 1 2 Given a state fragment sbull a meaningful position p of sbull is a positionp isin Pos(sbull) such that sbull|p 6= bulli for all i = 0 1 By MPos(sbull) we denote the set thatcontains all the meaningful positions of sbull Symbols that occur at meaningful positions of astate fragment are called meaningful symbols By Varbull(exp) we define the set of all bull-variablesthat occur in the expression exp

Basically a state fragment records just the information the user wants to observe of a givenprogram state

The next auxiliary definition formalizes the function fragment(t P ) that allows a statefragment of t to be constructed wrt a set of positions P of t The function fragment relies onthe function freshbull whose invocation returns a (fresh) variable bulli of appropriate sort which isdistinct from any previously generated variable bullj

Definition 41 Let t isin τ(ΣV) be a state and let P be a set of positions st P sube Pos(t)Then the function fragment(t P ) is defined as follows

fragment(t P ) = recfrag(t PΛ) where

10

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

function inspect(sbull Cinstr I)1 if |Cinstr | = 1 then2 return I(sbull Cinstr )3 elseif |Cinstr | gt 14 if I(sbull head(Cinstr ))= nil then5 return inspect(I(sbull head(Cinstr ))

tail(Cinstr ) I)6 else7 return nil8 end9 endendf

function expand(sbull sR I)1 Ebull

R = empty

2 for each srσwrarrRcup∆B t

with w isin MPos(sbull)

3 Cinst = instrument(srσwrarrRcup∆B t)

4 tbull = inspect(sbull Cinst I)

5 if tbull 6= nil then EbullR = Ebull

R cup sbullrrarr tbull

6 end7 return Ebull

R

endf

Figure 1 The inspect function Figure 2 The expand function

recfrag(t P p) =

f(recfrag(t1 P p1) recfrag(tn P pn))

if t=f(t1 tn) and p isin P

t if t isin V and p isin P

freshbull otherwise

and P = u | u le p and p isin P is the prefix closure of P

Roughly speaking fragment(t P ) yields a state fragment of t wrt a set of positions P thatincludes all symbols of t that occur within the paths from the root to any position in P whileeach maximal subterm t|p with p 6isin P is replaced by means of a freshly generated bull-variable

Example 42Let t = d(f(g(a h(b)) c) a) be a state and let P = 11 12 be a set of positions of t Byapplying Definition 41 we get the state fragment tbull = fragment(t P ) = d(f(g(bull1 bull2) c) bull3)and the set of meaningful positions MPos(tbull) = Λ 1 11 12

An inspection criterion is a function I(sbull srσwrarrK t) that given a rewrite step s

rσwrarrK t with

K isin ∆ RB and a state fragment sbull of s computes a state fragment tbull of the state t Roughlyspeaking an inspection criterion controls the information content conveyed by term fragmentsresulting from the execution of standard rewrite steps Hence distinct implementations of the

inspection criteria I(sbull srσwrarrK t) may produce distinct fragments sbull

rrarr tbull of the considered

rewrite step We assume that the special value nil is returned by the inspection criterionwhenever no fragment tbull can be delivered Several examples of inspection criteria are shown inSection 5

The function inspect of Figure 1 allows an inspection criterion I to be sequentially appliedalong an instrumented computation Cinstr in order to generate the fragment of the last stateof the computation Specifically given an instrumented computation s0 rarrK s1 rarrK rarr snn gt 0 the computation is traversed and the inspection criterion I is recursively applied oneach rewrite step si rarrK si+1 wrt the input fragment sbulli to generate the next fragment sbulli+1

The expansion of a single program state is specified by the function expand(sbull sR I) ofFigure 2 which takes as input a state s and its fragment sbull to be expanded wrt a rewritetheory R and an inspection criterion I Basically expand unfolds the state fragment sbull wrt

all the possible rewrite steps srσwrarrRcup∆B t that occur at the meaningful positions of sbull and

stores the corresponding fragments of sbullrrarr tbull in the set Ebull Note that to compute the state

11

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

fragment tbull for a rewrite step srσwrarrRcup∆B t and a state fragment sbull expand first generates the

instrumented computation Cinst of the considered step and then applies the inspection criterionI over C by using the inspect function

42 Computing a Fragment of the Computation Tree

The construction of a fragment T bullR(sbull0) of a computation tree TR(s0) is specified by the function

explore given in Figure 3 Essentially explore formalizes an interactive procedure that startsfrom a tree fragment (built using the auxiliary function createTree) which only consists of theroot node sbull0 and repeatedly uses the function expand to compute rewrite step fragments thatcorrespond to the visited tree edges wrt a given inspection criterion The tree T bull

R(sbull0) is builtby choosing at each loop iteration of the algorithm the tree node that represents the statefragment to be expanded by means of the auxiliary function pickLeaf (T bull

R(sbull0)) which allowsthe user to freely select a node sbull from the frontier of the current tree T bull

R(sbull0) Then T bullR(sbull0)

is augmented by calling addChildren(T bullR(sbull0) s

bull expand(sbull sR I)) This function call adds allthe edges sbull rarr tbull which are obtained by expanding sbull to the tree T bull

R(sbull0)The special value EoE (End of Exploration) is used to terminate the inspection process

when the function pickLeaf (T bullR(sbull0)) is equal to EoE no state to be expanded is selected and

the exploration terminates delivering the computed fragment T bullR(sbull0)

function explore(sbull0 s0R I)1 T bull

R(sbull0) = createTree(sbull0)2 while(sbull = pickLeaf (T bull

R(sbull0)) 6= EoE) do3 T bull

R(sbull0) = addChildren(T bullR(sbull0) s

bull expand(sbull sR I))4 od5 return T bull

R(sbull0)endf

Figure 3 The explore function

5 Particularizing the Exploration

The methodology given in Section 4 provides a generic scheme for the exploration of com-putation trees wrt a given inspection criterion I that must be provided by the user Inthis section we show three implementations of the criterion I that produce three distinct ex-ploration strategies In the first case the considered criterion allows an interactive programstepper to be derived in which rewriting logic computations of interest can be animated Inthe second case we implement a partial stepper that allows computations with partial inputsto be animated Finally in the last example the chosen inspection criterion implements anautomated forward slicing technique that allows relevant control and data information to beextracted from computation trees

51 Interactive Stepper

Given a computation tree TR(s0) for an initial state s0 and a rewrite theory R the stepwiseinspection of the computation tree can be directly implemented by instantiating the explorationscheme of Section 4 with the inspection criterion

Istep(sbull s

rσwrarr K t) = t

12

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

that always returns the reduced state t of the rewrite step srσwrarr K t with K isin ∆ RB

This way by starting the exploration from a state fragment that corresponds to the wholeinitial state s0 (ie sbull0 = s0) the call explore(s0R Istep) generates a fragment T bull

R(sbull0) of thecomputation tree TR(s0) whose topology depends on the program states that the user decidesto expand during the exploration process

Example 51Consider the rewrite theoryR in Example 31 and the computation tree in Example 32 Assumethe user starts the exploration by calling explore(s0R Istep) which allows the first level of thecomputation tree to be unfolded by expanding the initial state s0 wrt the inspection criterion

Istep This generates the tree TbullR(s0) containing the edges s0

reqrarr s1 s0

reqrarr s2 Now if the user

carries on with the exploration of program state s1 and then quits s1 will be expanded and thetree T bull

R(s0) will be augmented accordingly Specifically the resulting T bullR(s0) will include the

following edges s0reqrarr s1 s0

reqrarr s2 s1

succrarr s3 s1

reqrarr s4 s1

duplrarr s4 s1

reqrarr s5 s1

lossrarr s6

It is worth noting that all the program state fragments produced by the program stepperdefined above are ldquoconcreterdquo (ie state fragments that do not include bull-variables) Howeversometimes it may be useful to work with partial information and hence with state fragmentsthat abstract ldquoconcreterdquo program states by using bull-variables This approach may help to focususerrsquos attention on the parts of the program states that the user wants to observe disregardingunwanted information and useless rewrite steps

Example 52Consider the following two rewrite rules [r1] f(x b) rarr g(x) and [r2] f(a y) rarr h(y) togetherwith the initial state f(a b) Then the computation tree in this case is finite and only contains

the tree edges f(a b)r1xaΛ

rarr g(a) and f(a b)r2ybΛ

rarr h(b) Now consider the state fragmentf(bull1 b) where only the second input argument is relevant If we decided to expand the initialstate fragment f(bull1 b) we would get the tree fragment represented by the single rewrite step

f(bull1 b)r1rarr g(bull1) since the partial input encoded into f(bull1 b) cannot be rewritten via r2

In light of Example 52 and our previous considerations we define the following inspectioncriterion

Ipstep(sbull s

rσwrarr K t) = if sbull

rσbullwrarr K tbull then return tbull else return nil

Roughly speaking given a rewrite step micro srσwrarr K t with K isin ∆ RB the criterion

Ipstep returns a state fragment tbull of the reduced state t whenever sbull can be rewritten to tbull

using the very same rule r and position w that occur in microThe particularization of the exploration scheme with the criterion Ipstep allows an interac-

tive partial stepper to be derived in which the user can work with state information of interestthereby producing more compact and focused representations of the visited fragments of thecomputation trees

52 Forward Trace Slicer

Forward trace slicing is a program analysis technique that allows computations to be simplifiedwrt a selected fragment of their initial state More precisely given a computation C withinitial state s0 and a state fragment sbull0 of s0 forward slicing yields a simplified view Cbull of Cin which each state s of the original computation is replaced by a state fragment sbull that only

13

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

function Islice(sbull s

λrarrρσwrarr t)

1 if w isin MPos(sbull) then2 θ = xfreshbull | x isin V ar(λ)3 λbull = fragment(λMPos(Varbull(sbull|w)) cap Pos(λ))

4 ψλ = 〈|θmatchλbull(sbull|w)|〉

5 tbull = sbull[ρψλ]w6 else7 tbull = nil8 fi9 return tbull

endf

Figure 4 Inspection criterion that models forward slicing of a rewrite step

records the information that depends on the meaningful symbols of sbull0 while unrelated dataare simply pruned away

In the following we define an inspection criterion Islice that implements the forward slicingof a single rewrite step The considered criterion takes two parameters as input namely a

rewrite step micro = (srσwrarr K t) (with r = λ rarr ρ and K isin ∆ RB) and a state fragment

sbull of a state s It delivers the state fragment tbull which includes only those data that arerelated to the meaningful symbols of sbull Intuitively the state fragment tbull is obtained fromsbull by ldquorewritingrdquo sbull at position w with the rule r and a suitable substitution that abstractsunwanted information of the computed substitution with bull-variables A rigorous formalizationof the inspection criterion Islice is provided by the algorithm in Figure 4

Note that by adopting the inspection criterion Islice the exploration scheme of Section 4automatically turns into an interactive forward trace slicer that expands program states usingthe slicing methodology encoded into the inspection criterion Islice In other words given acomputation tree TR(s0) and a user-defined state fragment sbull0 of the initial state s0 any branchsbull0 rarr sbull1 rarr sbulln in the tree T bull

R(sbull0) which is computed by the explore function is the slicedcounterpart of a computation s0 rarrRcup∆B s1 rarrRcup∆B sn (wrt the state fragment sbull0) thatappears in the computation tree TR(s0)

Roughly speaking the inspection criterion Islice works as follows When the rewrite stepmicro occurs at a position w that is not a meaningful position of sbull (in symbols w 6isin MPos(sbull))trivially micro does not contribute to producing the meaningful symbols of tbull This amounts tosaying that no relevant information descends from the state fragment sbull and hence the functionreturns the nil value

On the other hand when w isin MPos(sbull) the computation of tbull involves a more in-depthanalysis of the rewrite step which is based on a refinement process that allows the descendantsof sbull in tbull to be computed The following definition is auxiliary

Definition 53 (substitution update) Let σ1 and σ2 be two substitutions The update ofσ1 wrt σ2 is defined by the operator 〈| |〉 as follows

〈|σ1 σ2|〉 = σ|Dom(σ1) where

xσ =

xσ2 if x isin Dom(σ1) capDom(σ2)xσ1 otherwise

The operator 〈|σ1 σ2|〉 updates (overrides) a substitution σ1 with a substitution σ2 where bothσ1 and σ2 may contain bull-variables The main idea behind 〈| |〉 is that for the slicing of the

14

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

rewrite step micro all variables in the applied rewrite rule r are naıvely assumed to be initiallybound to irrelevant data bull and the bindings are incrementally updated as we apply the rule r

More specifically we initially define the substitution θ = xfreshbull | x isin V ar(ρ) thatbinds each variable in λ rarr ρ to a fresh bull-variable This corresponds to assuming that all theinformation in micro which is introduced by the substitution σ can be marked as irrelevant Thenθ is refined as follows

We first compute the state fragment λbull = fragment(λMPos(Varbull(sbull|w))capPos(λ)) that onlyrecords the meaningful symbols of the left-hand side λ of the rule r wrt the set of meaningfulpositions of sbull|w Then by matching λbull with sbull|w we generate a matcher matchλbull(sbull|w) thatextracts the meaningful symbols from sbull|w Such a matcher is then used to compute ψλ which

is an update of θ wrt matchλbull(sbull|w) containing the meaningful information to be trackedFinally the state fragment tbull is computed from sbull by replacing its subterm at position w withthe instance ρψλ of the right-hand side of the applied rule r This way we can transfer all therelevant information marked in sbull into the fragment of the resulting state tbull

Example 54Consider the computation tree of Example 32 whose initial state is

s0 = [Srv-A] amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

Let sbull0 = bull amp [Cli-Abull7 bull ] amp bull be a state fragment1 of s0 where only request 7 of ClientCli-A is considered of interest By sequentially expanding the nodes sbull0 s

bull1 s

bull3 and s

bull5 wrt

the inspection criterion Islice we get the following fragment of the given computation tree

Query Go

Go

Go

Go

Go

Go

GoGoBack

Back

Back

Back

Back

Back

BackBack AnimaOptions

bull amp [Cli-Abull7bull] amp bullsbull0

reqbull amp (bull lt- Cli-A7) amp [Cli-Abull7na] amp bullsbull1

reqduplbull amp (bull lt- Cli-A7) amp (bull lt- Cli-A7) amp [Cli-Abull7na] amp bull

sbull2 reply[bull] amp (Cli-A lt- bullf(bullCli-A7)) amp [Cli-Abull7na] amp bull

sbull3 lossbull amp [Cli-Abull7na] amp bullsbull4

succ[bull] amp (Cli-A lt- bull8) amp [Cli-Abull7na] amp bullsbull5

req[bull] amp (bull lt- Cli-A7) amp(Cli-A lt- bull8) amp [Cli-Abull7na] amp bull

sbull6 dupl[bull] amp (Cli-A lt- bull8) amp(Cli-A lt- bull8) amp [Cli-Abull7na] amp bull

sbull7 loss[bull] amp [Cli-Abull7na] amp bullsbull8 rec

[bull] amp [Cli-Abull77] amp bullsbull9

Note that the slicing process automatically computes a tree fragment that represents apartial view of the protocol interactions from client Cli-Arsquos perspective Actually irrelevantinformation is hidden and rules applied on irrelevant positions are directly ignored whichallows a simplified fragment to be obtained favoring its inspection for debugging and analysispurposes In fact if we observe the highlighted computation in the tree we can easily detectthe wrong behaviour of the rule rec Specifically by inspecting the state fragment sbull9 = ([bull]amp [Climinus A bull 7 7] amp bull) which is generated by an application of the rule rec we immediatelyrealize that the response 8 produced in the parent state sbull5 has not been stored in sbull9 whichclearly indicates a buggy implementation of the considered rule

1Throughout the example we omit indices from the considered bull-variables to keep notation lighter andimprove readability So any variable bulli i = 0 1 is simply denoted by bull

15

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

Finally it is worth noting that the forward trace slicer implemented via the criterion Islicediffers from the partial stepper given at the end of Section 51 Given a state fragment sbull and

a rewrite steprσwrarrK t Islice always yields a fragment tbull when the rewrite occurs at a meaningful

position By contrast the inspection criterion Ipstep encoded in the partial stepper may fail toprovide a computed fragment tbull when sbull does not rewrite to tbull

Example 55

Consider the same rewrite rules and initial state f(bull1 b) of Example 52 By expanding f(bull1 b)wrt the inspection criterion Islice we get the computation tree fragment with tree edgesf(bull1 b)

r1rarr g(bull1) and f(bull1 b)r2rarr h(b) whereas the partial stepper only computes the tree edge

f(bull1 b)r1rarr g(bull1) as shown in Example 52

6 Implementation

The exploration methodology developed in this paper has been implemented in the Anima

tool which is publicly available at httpsafe-toolsdsicupvesanima The underlyingrewriting machinery of Anima is written in Maude and consists of about 150 Maude functiondefinitions (approximately 1600 lines of source code)

Anima also comes with an intuitive Web user inter-

Database

Anima Client

JAX-RS API

Initial State Rewriting LogicSpecification Animation

Anima Web Service

Anima Core

Figure 5 Anima architecture

face based on AJAX technology which allows usersto graphically display and animate computation treefragments The core exploration engine is specified asa RESTful Web service by means of the Jersey JAX-RS API

The architecture of Anima is depicted in Figure 5and consists of five main components Anima ClientJAX-RS API AnimaWeb Service Database and An-ima Core The Anima Client is purely implementedin HTML5 and JSP It represents the front-end layerof our tool and provides an intuitive versatile Webuser interface which interacts with the Anima Web Service to invoke the capabilities of theAnima Core and save partial results in the Database component

A screenshot that shows the Anima tool at work on the case study that is described inExample 54 is given in Figure 6

These are the main features provided by Anima

1 Inspection strategies The tool implements the three inspection strategies described inSection 5 As shown in Figure 6 the user can select a strategy by using the selectorprovided in the option pane

2 ExpandingFolding program states The user can expand or fold states by right-clicking onthem with the mouse and by selecting the ExpandFold Node options from the contextualmenu For instance in Figure 6 a state fragment on the frontier of the computed treehas been selected and is ready to be expanded through the Expand Node option

3 Selecting meaningful symbols State fragments can be specified by highlighting the statesymbols of interest either directly on the tree or in the detailed information window

16

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

GoGoGoGoGoBackBackBackBackBack Anima

Options

View

Rule Labels

State Labels

Zoom 100

- +

Interactive StepperInteractive StepperInteractive StepperInteractive StepperInteractive Stepper

Simple Advanced

ON OFF

ON Transition information from state to sbull1 sbull2

Rule

rl [reply] S lt- C Q amp [S] =gt [S] amp C lt- S f(S C Q)

amp [Cli-Abull7na]

bull amp [Cli-Abull7bull] amp bull

sbull0

req

bull amp (bull lt- Cli-A7) amp [Cli-Abull7na] amp bull

sbull1

reqdupl

bull amp (bull lt- Cli-A7) amp (bull

lt- Cli-A7) amp [Cli-Abull

7na] amp bull

sbull2 reply

[bull] amp (Cli-A lt- bullf(bullCl

i-A7))

amp bull

sbull3 loss

bull amp [Cli-Abull7na] amp bull

sbull4

Expand node

Fold node

Show full information

Show transition information

Expand view

Collapse view

Figure 6 Anima at work

4 Search mechanism The search facility implements a pattern language that allows stateinformation of interest to be searched on huge states and complex computation trees Theuser only has to provide a filtering pattern (the query) that specifies the set of symbols thatheshe wants to search for and then all the states matching the query are automaticallyhighlighted in the computation tree

5 Transition information Anima facilitates the inspection of a selected rewrite step s rarr tthat occurs in the computation tree by underlining its redex in s and the reduced subtermin t Some additional transition information is also displayed in the transition informa-tion window (eg the ruleequation applied the rewrite position and the computedsubstitution of the considered rewrite step) by right-clicking on the corresponding option

7 Conclusions

The analysis of execution traces plays a fundamental role in many program analysis approachessuch as runtime verification monitoring testing and specification mining We have presenteda parametrized exploration technique that can be applied to the inspection of rewriting logiccomputations and that can work in different ways Three instances of the parameterized ex-ploration scheme (an incremental stepper an incremental partial stepper and a forward traceslicer) have been formalized and implemented in the Anima tool which is a novel program an-imator for RWL The tool is useful for Maude programmers in two ways First it concretelydemonstrates the semantics of the language allowing the evaluation rules to be observed inaction Secondly it can be used as a debugging tool allowing the users to step forward andbackward while slicing the trace in order to validate input data or locate programming mis-takes

17

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

References

[1] M Alpuente D Ballis M Baggi and M Falaschi A FoldUnfold Transformation Frameworkfor Rewrite Theories extended to CCT In Proc 2010 ACM SIGPLAN Workshop on PartialEvaluation and Program Manipulation PEPM 2010 pages 43ndash52 ACM 2010

[2] M Alpuente D Ballis J Espert and D Romero Model-checking Web Applications with Web-TLR In Proc of 8th Intrsquol Symposium on Automated Technology for Verification and Analysis(ATVA 2010) volume 6252 of LNCS pages 341ndash346 Springer-Verlag 2010

[3] M Alpuente D Ballis J Espert and D Romero Backward Trace Slicing for Rewriting LogicTheories In Proc CADE 2011 volume 6803 of LNCSLNAI pages 34ndash48 Springer-Verlag 2011

[4] M Alpuente D Ballis F Frechina and D Romero Backward Trace Slicing for ConditionalRewrite Theories In Proc LPAR-18 volume 7180 of LNCS pages 62ndash76 Springer-Verlag 2012

[5] M Alpuente D Ballis F Frechina and J Sapina Slicing-Based Trace Analysis of RewritingLogic Specifications with iJulienne In Matthias Felleisen and Philippa Gardner editors Procof 22nd European Symposium on Programming ESOP 2013 volume 7792 of Lecture Notes inComputer Science pages 121ndash124 Springer 2013

[6] M Alpuente D Ballis and D Romero Specification and Verification of Web Applications inRewriting Logic In Formal Methods Second World Congress FM 2009 volume 5850 of LNCSpages 790ndash805 Springer-Verlag 2009

[7] M Baggi D Ballis and M Falaschi Quantitative Pathway Logic for Computational Biology InProc of 7th Intrsquol Conference on Computational Methods in Systems Biology (CMSB rsquo09) volume5688 of LNCS pages 68ndash82 Springer-Verlag 2009

[8] R Bruni and J Meseguer Semantic Foundations for Generalized Rewrite Theories TheoreticalComputer Science 360(1ndash3)386ndash414 2006

[9] M Clavel F Duran S Eker P Lincoln N Martı-Oliet J Meseguer and C Talcott MaudeManual (Version 26) Technical report SRI Intrsquol Computer Science Laboratory 2011 Availableat httpmaudecsuiucedumaude2-manual

[10] J Clements M Flatt and M Felleisen Modeling an Algebraic Stepper In Proc 10th EuropeanSymposium on Programming volume 2028 of LNCS pages 320ndash334 Springer-Verlag 2001

[11] F Duran and J Meseguer A Maude Coherence Checker Tool for Conditional Order-SortedRewrite Theories In Proc of 8th International Workshop on Rewriting Logic and Its Applications(WRLArsquo10) number 6381 in LNCS pages 86ndash103 Springer-Verlag 2010

[12] JW Klop Term Rewriting Systems In S Abramsky D Gabbay and T Maibaum editorsHandbook of Logic in Computer Science volume I pages 1ndash112 Oxford University Press 1992

[13] N Martı-Oliet and J Meseguer Rewriting Logic Roadmap and Bibliography Theoretical Com-puter Science 285(2)121ndash154 2002

[14] J Meseguer Conditional Rewriting Logic as a Unified Model of Concurrency Theoretical Com-puter Science 96(1)73ndash155 1992

[15] J Meseguer The Temporal Logic of Rewriting A Gentle Introduction In Concurrency Graphsand Models Essays Dedicated to Ugo Montanari on the Occasion of his 65th Birthday volume5065 pages 354ndash382 Berlin Heidelberg 2008 Springer-Verlag

[16] A Riesco A Verdejo R Caballero and N Martı-Oliet Declarative Debugging of RewritingLogic Specifications In Recent Trends in Algebraic Development Techniques 19th Intrsquol WorkshopWADT 2008 volume 5486 of LNCS pages 308ndash325 Springer-Verlag 2009

[17] A Riesco A Verdejo and N Martı-Oliet Declarative Debugging of Missing Answers for MaudeIn 21st Intrsquol Conference on Rewriting Techniques and Applications RTA 2010 volume 6 of LIPIcspages 277ndash294 Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik 2010

[18] TeReSe editor Term Rewriting Systems Cambridge University Press Cambridge UK 2003

18

Automatic Inference of Term Equivalence in

Term Rewriting Systems

Marco Comini1 and Luca Torella2

1 DIMI University of Udine Italymarcocominiuniudit

2 DIISM University of Siena Italylucatorellaunisiit

Abstract

In this paper we propose a method to automatically infer algebraic property-orientedspecifications from Term Rewriting Systems Namely having three semantics with suitableproperties given the source code of a TRS we infer a specification which consists of a setof most general equations relating terms that rewrite for all possible instantiations to thesame set of constructor terms

The semantic-based inference method that we propose can cope with non-constructor-based TRSs and considers non-ground terms Particular emphasis is put on avoiding thegeneration of ldquoredundantrdquo equations that can be a logical consequence of other ones

1 Introduction

In the last years there has been a growing interest in the research on automatic inference ofhigh-level specifications from an executable or the source code of a system This is probablydue to the fact that the size of software systems is growing over time and certainly one cangreatly benefit from the use of automatic tools There are several proposals like [1 7 6] whichhave proven to be very helpful

Specifications have been classified by their characteristics [8] It is common to distin-guish between property-oriented specifications and model-oriented or functional specificationsProperty-oriented specifications are of higher description level than other kinds of specificationsthey consist of an indirect definition of the systemrsquos behavior by stating a set of propertiesusually in the form of axioms that the system must satisfy [11 10] In other words a specifi-cation does not represent the functionality of the program (the output of the system) but itsproperties in terms of relations among the operations that can be invoked in the program (ieidentifies different calls that have the same behavior when executed) This kind of specifica-tions is particularly well suited for program understanding the user can realize non-evidentinformation about the behavior of a given function by observing its relation to other functionsMoreover the inferred properties can manifest potential symptoms of program errors which canbe used as input for (formal) validation and verification purposes

We can identify two mainstream approaches to perform the inference of specifications glass-box and black-box The glass-box approach [1] assumes that the source code of the programis available In this context the goal of inferring a specification is mainly applied to documentthe code or to understand it Therefore the specification must be more succinct and compre-hensible than the source code itself The inferred specification can also be used to automatethe testing process of the program or to verify that a given property holds [1] The black-boxapproach [7 6] works only by running the executable This means that the only informationused during the inference process is the input-output behavior of the program In this setting

19

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

the inferred specification is often used to discover the functionality of the system (or services ina network) [6] Although black-box approaches work without any restriction on the consideredlanguage ndash which is rarely the case in a glass-box approach ndash in general they cannot guaranteethe correctness of the results (whereas indeed semantics-based glass-box approaches can)

For this work we developed a (glass-box) semantic-based algebraic specification synthesismethod for the Term Rewriting Systems formalism that is completely automatic ie needsonly the source TRS to run Moreover the outcomes are very intuitive since specifications aresets of equations of the form e1 = e2 where e1 e2 are generic TRS expressions so the userdoes not need any kind of extra knowledge to interpret the results The underpinnings of ourproposal are radically different from other works for functional programming since the presenceof non-confluence or non-constructor-based TRSs poses several additional problems

11 Notations

We assume that the reader is familiar with the basic notions of term rewriting For a thoroughdiscussion of these topics see [9] In the paper we use the following notations V denotes a(fixed) countably infinite set of variables and T (ΣV) denotes the terms built over signatureΣ and variables V T (Σempty) are ground terms Substitutions over T (Σempty) are called groundsubstitutions Σ is partitioned in D the defined symbols and C the constructor symbols

T (CV) are constructor terms Substitutions over T (CV) are said constructor substitutionsC[t1 tn] denotes the replacement of t1 tn in context C A TRS R is a set of rules l rarr r

where l = f(t1 tn) l r isin T (ΣV) var(r) sube var(l) and f isin D t1 tn are the argumentpatterns of l rarr r and need not necessarily be in T (CV) unlike in functional programmingwhere only constructor-based TRSs are considered (with ti isin T (CV))

2 Many notions of equivalence

In the functional programming paradigm an equation e1 = e2 is typically interpreted as aproperty that holds for any well-typed constructor ground instance of the variables occurringin the equation Namely for all bindings of variables with well-typed (constructor ground)terms ϑ the constructor term computed for the calls e1ϑ and e2ϑ is the same In functionalprogramming we can consider only constructor instances because by having constructor-basedconfluent TRSs the set of values for non-constructor instances is the same as for constructorones

Differently from the functional programming case the TRS formalism admits variables ininitial terms and defined symbols in the patterns of the rules moreover rules are evaluatednon-deterministically and can rewrite to many constructor terms Thus an equation can beinterpreted in many different ways We will discuss the key points of the problem by means ofa (very simple) illustrative example

Example 21 Consider the following (non constructor based) TRS R where we provide a prettystandard definition of the arithmetic operations + - and (modulo)

0 + x -gt x x - 0 -gt x x s(y) -gt (x - s(y)) s(y)

s(x) + y -gt s(x+y) s(x) - s(y) -gt x - y (0 - s(x)) s(y) -gt y - x

Note that since the TRS formalism is untyped a term like 0 + a is admissible and is evaluatedto constructor term a

20

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

For this TRS one could expect to have in its property-oriented specification equations like

(x + y) + z = x + (y + z) (21)

x - (y + z) = (x - y) - z (22)

(x - y) - z = (x - z) - y (23)

0 + x = x (24)

x + 0 = x (25)

x + y = y + x (26)

These equations of the form e1 = e2 can be read as the (observable) outcomes of e1 are thesame of e2 The first essential thing is to formalize the meaning of ldquoobservable outcomesrdquo ofthe evaluation of an expression e (which contains variables) In the TRS formalism we haveseveral possible combinations First it is technically possible to literally interpret variables ine and decide to observe either the set of normal forms of e or the set of constructor terms ofe However as can be quickly verified only (24) is valid in either of these forms Indeedconsider for example terms x - (y + z) and (x - y) - z For both terms no rule can beapplied hence they are both (non constructor) normal forms and thus (22) is not literally validClearly this is quite a radical choice An interesting alternative would be to request that forany possible interpretation of variables with any term the expressions rewrite to the same setof constructor terms Formally by defining the rewriting behavior of a term t as

BJtRK ∶= ϑ sdot s∣ tϑETHrarrR

lowast s s isin T (CV) ϑ∶V rarr T (ΣV) dom(ϑ) sube var(t) (27)

we can interpret e1 = e2 as e1 =RB e2 ∶lArrrArr BJe1RK = BJe2RK In the following we call thisequivalence rewriting behavior equivalence Actually eqs (21) to (24) are valid wrt =RB

Note that if we would have chosen to use normal forms instead of constructor terms in (27)(ie s rarr instead of s isin T (CV)) then we would still have the same situation described beforewhere only (24) holds

The other equations (eqs (25) and (26)) are not valid in this sense For instance BJx + 0K =xt sdot si(0)∣tETHrarrlowast si(0) 1 while BJxK = xt sdot v∣tETHrarr

R

lowast v v isin T (CV) (and then ε sdot x isin BJxK ∖

BJx + 0K) These equations are not valid essentially because we have variables which cannotbe instantiated but if we consider ground constructor instancies which ldquotriggerrdquo in either terman evaluation to constructor terms then we actually obtain the same constructor terms Forexample for t1 = x and t2 = x + 0 for all ϑi = xsi(0) we have BJt1ϑiK = BJt2ϑiK = ε sdot si(0)∣Thus (25) holds in this sense

Decidedly also this notion of equivalence is interesting for the user We can formalize it ast1 =G t2 ∶lArrrArr forallϑ ground constructor BJt1ϑK cupBJt2ϑK sube ε sdot t∣t isin T (CV)rArr BJt1ϑK = BJt2ϑK Wewill call it ground constructor equivalence Note that =G is the only possible notion in the purefunctional paradigm where we can just have evaluations of ground terms and where we haveonly confluent constructor-based TRSs In this case the latter definition boils down to twoexpressions are equivalent if all its ground constructor instances rewrite to the same constructorterm This fact allows one to have an intuition of the reason why the problem of specificationsynthesis is definitively more complex in the full TRS paradigm

Since we do not consider only constructor-based TRSs there is another very relevant differ-ence wrt the pure functional case For instance let us consider the TRS Q obtained by addingthe rule g((x - y) - z) -gt x - (y + z) to TRS R of Example 21 Let t1 = x - (y + z)

1Here by si(0) we mean i repeated applications of s to 0 including the degenerate case for i = 0

21

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

and t2 = (x-y)-z We have BJt1QK = BJt2QK = x0 y0 z0 sdot 0xs(0) y0 z0 sdot s(0)xs(0) ys(0) z0 sdot 0xs(0) y0 zs(0) sdot 0 ∣ While the term g(t2) has this same be-havior BJg(t1)QK = empty

In general in the case of the TRS formalism terms embedded within a context do notnecessarily manifest the same behavior Thus it is also interesting to additionally ask to theequivalence notion =RB that the behaviors must be the same also when the two terms areembedded within any context Namely e1 =C e2 ∶lArrrArr forall contextC BJC[e1]RK = BJC[e2]RKWe call this equivalence contextual equivalence We can see that =C is (obviously) strongerthan =RB which is in turn stronger than =G Actually they are strictly stronger Indeed onlyeqs (21) and (24) are valid wrt =C (while eqs (22) and (23) are not)

We believe that all these notions are interesting for the user thus we formalize our notionof (algebraic) specification as follows

Definition 22 A specification S is a set of (sequences of) equations of the form t1 =K t2 =K =K tn with K isin CRB G and t1 t2 tn isin T (ΣV)

Thus for TRS Q we would get the following (partial) specification

(x + y) + z =C x + (y + z) 0 + x =C x

x - (y + z) =RB (x - y) - z (x - y) - z =RB (x - z) - y

x + y =G y + x x + 0 =G x

(x + y) z =G ((x z) + (y z)) z (x + y) y =G x y

(x - y) z =G (((x + z) z) - (y z)) z

In the following we present a first proposal of a semantics-based method that infers such spec-ifications for TRSs and tackles the presented issues (and discuss about its limitations) It isan adaptation for the TRS paradigm of ideas from [2] for the Functional Logic paradigm Thisadaptation is not straightforward since the Functional Logic paradigm is quite similar to theFunctional paradigm but considerably different from the TRS paradigm Moreover this worksignificantly extends the inference process by tackling equations like f(x y) = f(y x) which arereally important

3 Deriving specifications from TRSs

The methodology we are about to present is parametric wrt three semantics evaluation func-tions which need to enjoy some properties Namely

ERBJt RK gives the rewriting behavior (RB) semantics of term t with (definitions from) TRSR This semantics has to be fully abstract wrt rewriting behavior equivalence Namelywe require that ERBJt1 RK = ERBJt2 RK lArrrArr t1 =RB t2

EC Jt RK gives the contextual (C) semantics of the term t with the TRS R This semantics hasto be fully abstract wrt contextual equivalence Namely EC Jt1 RK = EC Jt2 RK lArrrArrt1 =C t2

EGJt RK gives the ground (G) semantics of the term t with the TRS R This semanticshas to be fully abstract wrt ground constructor equivalence Namely EGJt1 RK =EGJt2 RK lArrrArr t1 =G t2

22

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

The idea underlying the process of inferring specifications is that of computing the semanticsof various terms and then identify all terms which have the same semantics However not allequivalences are as important as others given the fact that many equivalences are simplelogical consequences of others For example if ti =C si then for all constructor contexts CC[t1 tn] =C C[s1 sn] thus the latter derived equivalences are uninteresting and shouldbe omitted Indeed it would be desirable to synthesize the minimal set of equations from whichby deduction all valid equalities can be derived This is certainly a complex issue in testingapproaches With a semantics-based approach it is fairly natural to produce just the relevantequations The (high level) idea is to proceed bottom-up by starting from the evaluation ofsimpler terms and then newer terms are constructed (and evaluated) by using only semanticallydifferent arguments Thus by construction only non-redundant equations are produced

There is also another source of redundancy due to the inclusion of relations =K For examplesince =C is the finer relation t =C s implies t =RB s and t =G s To avoid the generation of coarserredundant equations a simple solution is that of starting with =C equivalences and once theseare all settled to proceed only with the evaluation of the =RB equivalences of non =C equivalentterms Thereafter we can evaluate the =G equivalences of non =RB equivalent terms

Clearly the full computation of a programsrsquo semantics is not feasible in general For themoment for the sake of comprehension we prefer to present the conceptual framework leavingout of the picture the issues related to decidability We will show a possible decidable instanceof the method in Section 31

Let us describe in more detail the specification inference process The input of the processconsists of a TRS to be analyzed and two additional parameters a relevant API Σr and amaximum term size max size The relevant API allows the user to choose the operations inthe program that will be present in the inferred specification whereas the maximum term sizelimits the size of the terms in the specification As a consequence these two parameters tunethe granularity of the specification both making the process terminating and allowing the userto keep the specification concise and easy to understand

The output consists of a set of equations represented by equivalence classes of terms (withdistinct variables) Note that inferred equations may differ for the same program dependingon the considered API and on the maximum term size Similarly to other property-orientedapproaches the computed specification is complete up to terms of size max size ie it includesall the properties (relations) that hold between the operations in the relevant API and that areexpressible by terms of size less or equal than max size

Terms are classified by their semantics into a data structure which we call classificationconsisting (conceptually) of a set of equivalence classes (ec) formed by

bull sem(ec) the semantics of (all) the terms in that classbull rep(ec) the representative term of the class (rep(ec) isin terms(ec))bull terms(ec) the set of terms belonging to that equivalence classbull epoch(ec) an integer to record the moment of introduction of that equivalence class

The representative term is the term which is used in the construction of nested expressionswhen the equivalence class is considered To output smaller equations it is better to choose thesmallest term in the class (wrt the function size) but any element of terms(ec) can be used

The inference process consists of successive phases one for each kind of equality (in orderof discriminating power ie C RB G) as depicted in Figure 1

Computation of the initial classification (epochs 0 and 1) The first phase of the algo-rithm is the computation of the initial classification that is needed to compute the classificationwrt =C We initially create a classification which contains

23

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

Inference Process

Computation of the initial classification

Generation of =C -classification

Generation of =RB -classification

Generation of =G -classification

Generation of =C -equations

Generation of =RB -equations

Generation of =G -equations

Specification

TRS

Program

API

max size

Figure 1 A general view of the inference process

bull one class for a free (logical) variable ⟨EC JxK x x 0⟩bull the classes for any constructor symbol ie for all cn

2 isin C and x1 xn distinct variables

⟨EC JtK t t 0⟩ where t = c(x1 xn)

Then for all symbols fn of the relevant API Σr and distinct variables x1 xn we add

to classification the term t = f(x1 xn) with semantics s = EC Jt RK and epoch m = 1This operation denoted addEC (t sm) is the most delicate part of the method If we wouldnot consider the generation of ldquopermutedrdquo equations like f(x y) = f(y x) then the wholeactivity would just boil down to look for the presence of s in some equivalence class and thenupdating the classification accordingly (like in [2]) Handling of permutations cannot be done bynaıvely adding all (different) permutations of s In this way we would generate many redundantequations Consider for instance the TRS Q

f(abc) -gt 0

f(bac) -gt 0

f(acb) -gt 0

f(bca) -gt 0

f(cab) -gt 0

f(cba) -gt 0

From the minimal set f(x y z) =C f(y x z) =C f(x z y) we can generate all other valid per-mutations like f(x y z) =C f(y z x) =C f(z x y) Thus in this case we should only generatepermutated equations where we just swap two variables However for the TRS R

f(abc) -gt 0 f(bca) -gt 0 f(cab) -gt 0

f(x y z) neC f(y x z) neC f(x z y) but f(x y z) =C f(y z x) Moreover f(x y z) =C f(z x y)can be deduced by this Thus in this case we should only generate permutated equations witha rotation of three variables since all other rotations of three variables are just a consequence

Thus not all permutations have to be considered while adding a semantics to a classificationand it is not necessary to look for all permutations within the semantics already present in theclassification To generate only a minimal set of necessary permutated equations we need toconsider for each k variables a set Πn

k of generators of the permutations of n variables whichdo not move n minus k variables (note that Πn

1 = id ) Then for a term t = f(x1 xn) westart sequentially for i from 1 to n and look if for some π isin Πn

i we have an equivalence classec in the current classification whose semantics coincides with sπ (ie ec = ⟨sπ tprime T mprime⟩) Ifit is found then the term tπminus1 is added to the set of terms in ec (ie ec is transformed inecprime = ⟨sπ tprime T cup tπminus1 mprime⟩) and we stop Otherwise we iterate with next i If all fails a newequivalence class ⟨s t T m⟩ has to be created but we have to determine the right term set

2Following the standard notation fn denotes a function f of arity n

24

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

T (to possibly generate equations like f(x y) = f(y x)) We initially start with T = t andj = n and sequentially for i from 2 to j we check if for some π isin Πj

i we have s = sπ If wefind it we add tπ to T and decrement j by i minus 1 (i variables are now used in a valid equationand thus from this moment on i minus 1 variables have no longer to be considered) Otherwise wecontinue with next i The final T is used for the new equivalence class

For example for t = f(x y z) in TRS Q we start with variables x y z and T = t Nowconsider for instance π = (xy) isin Π3

2 Since EC JtK = EC JtπK then T = f(x y z) f(y x z)and then we drop x and remain with variables y z Now we have only πprime = (y z) isin Π2

2 andsince EC JtK = EC JtπprimeK then T = f(x y z) f(y x z) f(x z y) we drop y and (thus) finishInstead for t = f(x y z) in TRS R we start with variables x y z and T = t Now considerfor instance π1 = (xy) isin Π3

2 Since EC JtK ne EC Jtπ1K then we consider π2 = (y z) isin Π3

2 and sinceEC JtK ne EC Jtπ2K we increase i Now we have only π3 = (xy z) isin Π3

3 and since EC JtK = EC Jtπ3Kthen T = f(x y z) f(y z x) we drop x y and (thus) finish

Generation of =C classification (epochs 2 and above) The second phase of the algo-rithm is the (iterative) computation of the successive epochs until we complete the constructionof the classification of terms wrt =C At each iteration (with epoch k) for all symbols fnof the relevant API Σr we select from the current classification all possible combinations of nequivalence classes ec1 ecn such that at least one eci was newly produced in the previousiteration (ie whose epoch is k minus 1) We build the term t = f(rep(ec1) rep(ecn)) whichby construction has surely not been considered yet Then if size(t) le max size we computethe semantics s = EC Jt RK and update the current classification by adding to classification theterm t and its semantics s (addEC (t s k)) as described before

If we have produced new equivalence classes then we continue to iterate This phase eventu-ally terminates because at each iteration we consider by construction terms which are differentfrom those already existing in the classification and whose size is strictly greater than the sizeof its subterms (but the size is bounded by max size)

The following example illustrates how the iterative process works

Example 31 Let us use the program R of Example 21 and choose as relevant API the func-tions + - and In the first step the terms

t11 = x + y t12 = x - y t13 = x y

are built Since (all permutations of) the semantics of all these terms are different and differentfrom the other semantics already in the initial classification three new classes are added to theinitial classification

During the second iteration the following two terms (among others) are built

bull the term t21 = (xrsquo + yrsquo) + y is built as the instantiation of x in t11 with (a renamedapart variant of) t11 and

bull the term t22 = x + (xrsquo + yrsquo) as the instantiation of y in t11 with t11

The semantics of these two terms is the same s but it is different from the semantics of theexisting equivalence classes Thus during this iteration (at least) the new equivalence classecprime ∶= ⟨s t21 t21 t22 n⟩ is computed Hereafter only the representative of the class will beused for constructing new terms Since we have chosen t21 instead of t22 as the representativeterms like (x + (xrsquo + yrsquo)) z will never be built

Thanks to the closedness wrt context of the semantics this strategy for generating terms issafe In other words when we avoid to build a term it is because it is not able to produce a

25

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

behavior different from the behaviors already included by the existing terms thus we are notlosing completeness

Generation of the =C specification Since by construction we have avoided much redun-dancy thanks to the strategy used to generate the equivalence classes we now have only to takeeach equivalence class with more than one term and generate equations for these terms

Generation of =RB equations The third phase of the algorithm works on the former clas-sification by first transforming each equivalence class ec by replacing the C-semantics sem(ec)with ERBJrep(ec) RK and terms(ec) with the (singleton) set rep(ec) After the transforma-tion some of the previous equivalence classes which had different semantic constructor termsmay now have the same RB -semantics and then we merge them making the union of the termsets terms(ec)

Thanks to the fact that before merging all equivalence classes were made of just singletonterm sets we cannot generate (again) equations t1 =RB t2 when an equation t1 =C t2 had beenalready issued Let us clarify this phase by an example

Example 32 Assume we have a classification consisting of three equivalence classes with C-semantics s1 s2 and s3 and representative terms t11 t22 and t31

ec1 = ⟨s1 t11t11 t12 t13⟩ ec2 = ⟨s2 t22t21 t22⟩ ec3 = ⟨s3 t31t31⟩

We generate equations t11 =C t12 =C t13 and t21 =C t22Now assume that ERBJt11K = w0 and ERBJt22K = ERBJt31K = w1 Then (since t12 t13 and

t21 are removed) we obtain the new classification

ec4 = ⟨w0 t11 t11 n⟩ ec5 = ⟨w1 t22 t22 t31 n⟩

Hence the only new equation is t22 =RB t31 Indeed equation t11 =RB t12 is uninterestingsince we already know t11 =C t12 and equation t21 =RB t31 is redundant (because t21 =C t22 andt22 =RB t31)

The resulting (coarser) classification is then used to produce the =RB equations as donebefore by generating equations for all non-singletons term sets

Generation of the =G equations In the last phase we transform again the classificationby replacing the RB -semantics with the G-semantics (and terms(ec) with the set rep(ec))Then we merge eventual equivalence classes with the same semantics and finally we generate=G equations for non singleton term sets

Theorem 33 (Correctness) For all equations e1 = e2 generated in the second third andforth phase we have that e1 =C e2 e1 =RB e2 and e1 =G e2 respectively

Proof By construction of equivalence classes in the second phase an equation t1 = t2 isgenerated if and only if the semantics EC Jt1 RK = EC Jt2 RK Then since EC Jt1 RK =EC Jt2 RK lArrrArr t1 =C t2 the first part of thesis follows immediately Then by the succes-sive trasformation and reclassification in the third phase we issue an equation t1 = t2 if andonly if ERBJt1 RK = ERBJt2 RK Then since ERBJt1 RK = ERBJt2 RK lArrrArr t1 =RB t2 we havethe second part of thesis The proof of the third part of thesis since EGJt1 RK = EGJt2 RK lArrrArrt1 =G t2 is analogous

26

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

Example 34 Let us recall (again) the programR of Example 21 The terms x + y and y + xbefore the transformation belong to two different equivalence classes (since their rewritingbehavior is different) Anyway after the transformation the two classes are merged since theirG-semantics is the same namely x0 y0 sdot 0xs(0) y0 sdot s(0)x0 ys(0) sdot s(0) ∣

We now present some examples to show how our proposal deals with non-contructor basedor non-confluent TRS plus some to show that we can infer several non-trivial equations

Example 35 Consider the definition for the boolean data type with constructor terms trueand false and boolean operations and or not and imp

and(true x) -gt x

and(false x) -gt false

or(true x) -gt true

or(false x) -gt x

not(true) -gt false

not(false) -gt true

imp(false x) -gt true

imp(true x) -gt x

This is a pretty standard ldquoshort-cutrdquo definition of boolean connectives With our method weget the following equations

not(or(xy)) =C and(not(x)not(y)) imp(xy) =C or(not(x)y)

not(and(xy)) =C or(not(x)not(y)) not(not(x)) =G x

and(xand(yz)) =C and(and(xy)z) and(xy) =G and(yx)

Example 36 Let us consider the following non-constructor based TRS implementing someoperations over the naturals in Peano notation

x - 0 -gt x

s(x) - s(y) -gt x - y

g(x) -gt chk(x - s(x))

chk(0) -gt 0

chk(s(x)) -gt s(x)

chk(0 - s(x)) -gt err

The definition of - is a standard definition of the minus operation over naturals The chk

function simply returns the natural passed as argument or returns err if the argument is anot defined subtraction It is easy to see that the TRS is not constructor-based because ofthe presence of the - in the pattern of a rule The artificial function g which checks if thesubtraction of a number by its successor is a natural number is doomed to return err Withour classification we actually derive equation g(x) =C err

Example 37 Let us consider the following (artificial) non-orthogonal TRS

coin -gt 0

coin -gt 1

d(x) -gt g(xx)

g(01) -gt true

t(x) -gt k(xxx)

k(101) -gt true

The coin function can return both 0 and 1 The functions d and t call an auxiliary functionduplicating and triplicating (respectively) the variable received as argument Functions f andg require a specific combination of 0 and 1 to return the constructor term true Notice thatto reach the constructor term true from d and t respectively it is necessary to use a nondeterministic function able to rewrite to both 0 and 1 Some of the inferred equations for thisTRS are t(x) =C d(x) and t(coin) =C g(coincoin) =C k(coincoincoin) =C d(coin)

27

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

Example 38 Let us consider the following TRS that computes the double of numbers inPeano notation

double (0) -gt 0

double(s(x)) -gt s(s(double(x)))

dbl(x) -gt plus(xx)

plus(0y) -gt y

plus(s(x)y) -gt s(plus(xy))

Some of the inferred equations for the TRS are

dbl(dbl(double(x))) =G dbl(double(dbl(x))) (31)

double(x) =G dbl(x) (32)

dbl(dbl(x)) =G dbl(double(x))=Gdouble(dbl(x)) =G double(double(x)) (33)

plus(double(x)y) =G plus(dbl(x)y) (34)

We can observe that all equations hold with the =G relation and not with the =RB relationThis is due to the fact that the two functions dbl and dbl even if at a first sight could seemto evaluate the same constructor terms can behave differently For instance if we add to theTRS the two rules coin -gt 0 and coin -gt s(0) we can notice that the terms double(coin)and dbl(coin) return different constructor terms This is due to the non determinism ofthe coin function that exploits the right non-linearity of function dbl While double(coin)

evaluates to 0 and s(s(0)) the term dbl(coin) can be reduced even to s(0) (by dbl(coin)

rarr plus(coincoin) rarr2 plus(0s(0)) rarr s(0))This characteristic of the program is not easy to realize by just looking at the code

Example 39 Let us consider the following TRS defining two functions over an extension ofthe Peano notation able to handle negative integers

abs(-(x)) -gt abs(x)

abs(s(x)) -gt s(x)

abs(0) -gt 0

f(-(-(x))) -gt f(x)

f(0) -gt 0

f(s(x)) -gt s(x)

f(-(s(x))) -gt 0

Function abs is a standard definition of the absolute value function f returns its input if it isa positive number and 0 if it is not Some of the inferred equations are f(f(x)) =C abs(f(x))

and f(abs(x)) =C abs(abs(x))

Example 310 Let us consider the following program which implements a two-sided queue in a(non-trivial) efficient way The queue is implemented as two lists where the first list correspondsto the first part of the queue and the second list is the second part of the queue reversed Theinl function adds the new element to the head of the first list whereas the inr function addsthe new element to the head of the second list (the last element of the queue) The outl (outr)function drops one element from the left (right) list unless the list is empty in which case itreverses the other list and then swaps the two lists before removal

new -gt Q(Nil Nil)

inl(xQ(xs ys)) -gt Q((xxs)ys)

inr(xQ(xs ys)) -gt Q(xs (xys))

outl(Q(Nil ys)) -gt

Q(tail(rev(ys))Nil)

outl(Q((xxs)ys)) -gt Q(xsys)

outr(Q(xs Nil)) -gt

Q(Nil tail(rev(xs)))

outr(Q(xs (yys))) -gt Q(xsys)

null(Q((xxs)ys)) -gt False

null(Q(Nil (xxs))) -gt False

null(Q(Nil Nil)) -gt True

28

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

tail ((xxs)) -gt xs

rev(xs) -gt rv rsquo(xs Nil)

rv rsquo(Nil ys) -gt ys

rv rsquo((xxs)ys) -gt rv rsquo(xs (xys))

With our method (amongst others) we derive

null(new) =C True (35)

new =C outl(inl(xnew)) =C outr(inr(xnew)) (36)

outl(inl(xq)) =C outr(inr(xq)) (37)

inr(xinl(yq)) =C inl(yinr(xq)) (38)

inl(xoutl(inl(yq))) =C outr(inl(xinr(yq))) (39)

null(inl(xnew)) =C null(inr(xnew)) =C False (310)

We can see different kinds of non-trivial equations eqs (36) and (37) state that adding andremoving one element produces always the same result independently from the side in which weadd and remove it Equations (38) and (39) show a sort of restricted commutativity betweenfunctions

31 An effective instance of the presented method

In a semantics-based approach one of the main problems to be tackled is effectiveness Thesemantics of a program is in general infinite and thus some approximation has to be used inorder to have a terminating method To experiment on the validity of our proposal we startedby using a novel (condensed) fixpoint semantics which we have developed for left-linear TRSsthat is fully abstract wrt =C

3 Such semantics is defined as the fixpoint of an immediateconsequences operator P JRK We have opted for this semantics because it has some propertieswhich are very important from a pragmatical point of view

bull it is condensed meaning that denotations are the smallest possible (between all thosesemantics which induce the same program equivalence) This is a very relevant (if notessential) feature to develop a semantic-based tool which has to compute the semantics

bull The semantics ERB can be obtained directly by transforming the EC semantics concretelyjust by loosing internal structure Therefore no (costly) computation of ERB is needed

We have implemented the basic functionality of the proposed methodology in a prototype writ-ten in Haskell TRSynth available at httpsafe-toolsdsicupvestrsynth (for a detaileddescription see [4]) The implementation of =G equality is still ongoing work because we arelacking of a suitable implementation of the G-semantics

To achieve termination the prototype computes a fixed number k of steps of P JRK Thenit proceeds with the classification as described in Section 3 Clearly in presence of terms withinfinite solutions with such a rough approximation we may loose both correctness (by mis-takenly equating terms which become semantically different after k iterates) and completeness(by mistakenly not equating terms which will become semantically equivalent) Neverthelessthe results are encouraging For instance TRSynth detects all =C and =RB which we showed inexamples (except of Example 38 because of a bug in the computation of the semantics)

3The writing of articles related to the formal definition of this semantics is in progress [3]

29

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

4 Conclusions and future work

This paper discusses about the issues that arise for the automatic inference of high-levelproperty-oriented (algebraic) specifications because of non-confluent or non-constructor basedTRS Then a first proposal which overcomes these issues is presented

Our method computes a concise specification of program properties from the source code ofa TRS We hope to have convinced the reader (with all examples) that we reached our maingoal that is to get a concise and clear specification (that is useful for the programmer in orderto discover unseen properties or detect possible errors)

We have developed a prototype that implements the basic functionality of the approach Weare aware that many other attempts to guarantee termination could be used in other instanciesof the presented method Certainly given our know-how in the future we will experiment withabstractions obtained by abstract interpretation [5] (our novel semantics itself has been obtainedas an abstract interpretation) Actually we already have an ongoing work to implement thedepth(k) abstract version of our semantics In the depth(k) abstraction terms (occurring in thenodes of the semantic trees) are ldquocutrdquo at depth k by replacing them with cut variables distinctfrom program variables Hence for a given signature Σ the universe of abstract semantic treesis finite (although it increases exponentially wrt k) Therefore the finite convergence of thecomputation of the abstract semantics is guaranteed

References

[1] G Ammons R Bodık and J R Larus Mining specifications In 29th ACM SIGPLAN-SIGACTsymposium on Principles of programming languages (POPLrsquo02) pages 4ndash16 New York NY USA2002 Acm

[2] G Bacci M Comini M A Feliu and A Villanueva Automatic Synthesis of Specifications forFirst Order Curry Programs In Proceedings of the 14th symposium on Principles and practice ofdeclarative programming pages 25ndash34 New York NY USA 2012 ACM

[3] M Comini and L Torella A Condensed Goal-Independent Fixpoint Semantics Modeling theSmall-Step Behavior of Rewriting Technical Report DIMI-UD012013RR Dipartimento diMatematica e Informatica Universita di Udine 2013

[4] M Comini and L Torella TRSynth a Tool for Automatic Inference of Term Equivalence inLeft-linear Term Rewriting Systems In E Albert and S-C Mu editors PEPM rsquo13 Proceedingsof the ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation pages 67ndash70Acm 2013

[5] P Cousot and R Cousot Abstract Interpretation A Unified Lattice Model for Static Analysisof Programs by Construction or Approximation of Fixpoints In Proceedings of the 4th ACMSIGACT-SIGPLAN symposium on Principles of programming languages Los Angeles CaliforniaJanuary 17ndash19 pages 238ndash252 New York NY USA 1977 ACM Press

[6] C Ghezzi A Mocci and M Monga Synthesizing intensional behavior models by graph trans-formation In 31st International Conference on Software Engineering (ICSErsquo09) pages 430ndash4402009

[7] J Henkel C Reichenbach and A Diwan Discovering Documentation for Java Container ClassesIEEE Transactions on Software Engineering 33(8)526ndash542 2007

[8] A A Khwaja and J E Urban A property based specification formalism classification TheJournal of Systems and Software 832344ndash2362 2010

[9] TeReSe editor Term Rewriting Systems Cambridge University Press Cambridge UK 2003

[10] H van Vliet Software EngineeringndashPrinciples and Practice John Wiley 1993

[11] J M Wing A specifierrsquos introduction to formal methods Computer 23(9)10ndash24 1990

30

A Condensed Goal-Independent Fixpoint

Semantics Modeling the Small-Step Behavior of

Rewriting

Marco Comini1 and Luca Torella2

1 DIMI University of Udine Italy mdash marcocominiuniudit

2 DIISM University of Siena Italy mdash lucatorellaunisiit

Abstract

In this paper we present a novel condensed narrowing-like semantics that contains theminimal information which is needed to describe compositionally all possible rewritings ofa term rewriting system We provide its goal-dependent top-down definition and moreimportantly an equivalent goal-independent bottom-up fixpoint characterization

We prove soundness and completeness wrt the small-step behavior of rewriting forthe full class of term rewriting systems

1 Introduction

Nowadays the formalism of Term Rewriting Systems (TRSs) is used besides for functionalprogramming also for many other applications (like specification of communication protocolsto mention one) There has been a lot of research on the development of tools for the formalverification and (in general) automatic treatmentmanipulation of TRSs Within the proposalsthere are semantics-based approaches which can guarantee correctness by construction How-ever they cannot employ directly the construction of the semantics since in general it is infiniteThus some kind of approximation has to be used

Given the potentiality of application of the TRS formalism we have turned our attentiontoward the development of semantics-based TRS manipulation tools with the intention to useAbstract Interpretation theory as fundament to devise semantics approximations correct byconstruction However as also noted by [9] defining a suitable (concrete) semantics is usuallythe first crucial step in adapting the general methodology of Abstract Interpretation to thesemantic framework of the programming language at hand When a concrete semantics isused to define via abstract interpretation abstract (approximate) semantics to be employedto develop semantics-based manipulation tools it is particularly relevant if it is condensedand defined compositionally In the literature a semantics is said to be condensing when thesemantics of an instance of an expression (term goal call) can be obtained with a semanticoperation directly from the semantics of the (un-instantiated) expression In such a situationonly the semantics for most general expressions can be maintained in denotations We saythat a semantics is condensed when the denotations themselves do not contain redundancy iewhen it is not possible to semantically derive the components of a denotation from the othercomponents Indeed the abstract semantics operations which are obtained from a condensedconcrete semantics involve the use of the join operation (of the abstract domain) at each iterationin parallel onto all components of rules instead of using several subsequent applications for allcomponents This has a twofold benefit On one side it speeds up convergence of the abstractfixpoint computation On the other side it considerably improves precision

In [2] we developed an automatic debugging methodology for the TRS formalism based onabstract interpretation of the big-step rewriting semantics that is most commonly considered

31

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

in functional programming ie the set of constructor termsnormal forms However theresulting tool was inefficient The main reason for this inefficiency is because the chosen concretesemantics is not condensing and thus because of its accidental high redundancy it causes thealgorithms to use and produce much redundant information at each stage In contrast thesame methodology gave good results in [5] because it was applied to a condensed semantics

The constructor termsnormal forms semantics is not condensed because it contains allpossible rewritings but there are many possible rewritings which can be obtained by someother ones since rewriting is closed under substitution (stability) and replacement (t ETHrarr

R

lowast s

implies C[t]p ETHrarrR

lowast C[s]p) Thus in [1] we tried to directly devise a semantics fully abstract

wrt the big-step rewriting semantics with the specific objective to avoid all redundancy whilestill characterizing the rewritings of any term In particular we searched a semantics which

bull has a compositional goal-independent definitionbull is the fixpoint of a bottom-up constructionbull is as condensed as possible

Unfortunately (in [1]) we just partially achieved this goal since the semantics is defined only forsome classes of TRSs In the meantime for a (quite) different language in [4 3] we obtainedmdashfor the full languagemdasha semantics with the mentioned characteristics by following a differentapproach

1 Define a denotation fully abstract wrt the small-step behavior of evaluation of expres-sions which enjoys the mentioned properties

2 Obtain by abstraction of this small-step semantics a denotation (which enjoys the men-tioned properties) correct wrt the big-step behavior

This approach has the additional advantage that the small-step semantics can be reused alsoto develop other semantics more concrete than the big-step one (for instance semantics whichcan model functional dependencies that are suitable to develop pre-post verification methods)

Unfortunately in the case of the TRS formalism we do not have a suitable small-step se-mantics to start with For Curry we defined the small-step semantics by collecting just themost general traces of the small-step operational semantics which correspond (in our case) tothe rewriting derivations of the terms f(x1 xn) The problem is that we cannot obtainjust from the traces of all f(x1 xn) the rewriting derivations of all (nested) terms withoutusing again (directly or indirectly) the rewriting mechanism In fact usually f(x1 xn) isimmediately a normal form because we cannot instantiate variables however there are manyinstances which can trigger the rules Narrowing [7] can seem a possible solution to this prob-lem but we have an issue related to the interference of non-confluence (ie non-determinism)with non-linearity as shown by this example

Example 11Let us consider the following TRS R

coin rarr Tail Head ne Tail rarr True diff (x)rarr x ne xcoin rarrHead Tail ne Head rarr True

We have rewriting derivations diff (x) ETHrarr x ne x ↛ diff (Head) ETHrarr Head ne Head ↛ diff (Tail) ETHrarrTail ne Tail ↛ while diff (coin)ETHrarrlowast True Moreover we have the narrowing derivation diff (x) ε

x ne x 32

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

Narrowing can instantiate variables (according to rules) but a variable is instantiated with thesame term in all of its occurrences (it would make little sense to do differently for a top-downresolution mechanism) However Example 11 shows that it is not possible to retrieve thatdiff (coin) ETHrarrlowast True from all possible narrowing derivations of diff (x) since the only narrowingderivation (of diff (x)) does not reach True

In this paper we define a variation of narrowing (linearizing narrowing) which admits dif-ferent instances of variables with multiple occurrences With linearizing narrowing we definea denotation fully abstract wrt the small-step behavior of rewriting which enjoys the men-tioned properties for generic TRSs without restrictions The outline to achieve this is thefollowing

bull We gather all linearizing narrowing derivations into trees (Definition 310)bull We show that all possible rewritings can be reconstructed from linearizing narrowing trees(Theorem 314)

bull We define top-down condensed denotations OJRK by collecting just the linearizing nar-rowing trees of most general terms (f(ETHrarrxn)) and we prove that with a suitable semanticevaluation function E we can reconstruct any linearizing narrowing tree starting from

OJRK (Theorem 323)bull By using E we define a (bottom-up) immediate consequence operator whose least fixpointF JRK is equal to OJRK (Theorem 330) Thus from F JRK we can reconstruct all possiblerewritings of R and we have full abstraction wrt the rewriting behavior (Corollary 331)

Note that the proofs of all results are in the appendix

2 Preliminaries

We assume that the reader is familiar with the basic notions of term rewriting For a thoroughdiscussion of these topics see [10] In the paper we use the following notions and notations

We writeETHrarron for the list of syntactic objects o1 on Given a monotonic function F ∶ Lrarr Lover lattice L whose bottom is and lub is ⊔ by F uarrk we denote function λxF k(x) and byF uarrω function λx⊔F k(x)∣k isin N By lfp(F ) we denote the least fixed point of F (and recallthat for a continuos F lfp(F ) = F uarrω)Terms and Substitutions

Σ denotes a signature and V denotes a (fixed) countably infinite set of variables T (ΣV)denotes the terms built over signature Σ and variables V Σ is partitioned in D the definedsymbols (also called operations) and C the constructor symbols (also called data constructors)

T (CV) are called constructor terms The set of variables occurring in a term t is denoted byvar(t) while the sequence (in order) of variables occurring in a term t is denoted by ETHrarrvar(t) Aterm is linear if it does not contain multiple occurrences of any variable LT (ΣV) denotes theset of linear terms

t∣p denotes the subterm of t at position p and t[s]p denotes the result of replacing thesubterm t∣p by the term s

Given a substitution ϑ = x1t1 xntn we denote by dom(σ) and range(σ) the domainset x1 xn and the range set ⋃n

i=1 var(ti) respectively The identity substitution is denotedby ε By tσ we denote the application of σ to t σV denotes the restriction of substitution σto set V sube V σϑ denotes the composition of ϑ and σ ie the substitution st x(σϑ) = (xσ)ϑfor any x isin V Given two substitutions ϑ1 and ϑ2 and two terms t1 and t2 we say that ϑ1

33

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

(respectively t1) is more general than ϑ2 (respectively t2) denoted ϑ1 ⪯ ϑ2 (respectively t1 ⪯ t2)if and only if there exists a substitution σ st ϑ1σ = ϑ2 (respectively t1σ = t2) We denote by≃ the induced equivalence ie ϑ ≃ σ if and only if there exists a renaming ρ st ϑρ = σ (andσρminus1 = ϑ) With σ uarr σprime we indicate the lub (wrt ⪯) of σ and σprime

A substitution ϑ is an unifier for terms t and s if tϑ = sϑ t and s unifyare unifiable whenthere exists a unifier A unifier σ for t and s is a most general unifier denoted as σ =mgu(t s)when σ ⪯ ϑ for any unifier ϑ of t and s

Rewriting

A term rewriting system (TRS for short) R is a set of rules l rarr r where l r isin T (ΣV) var(r) subevar(l) l = f(t1 tn) and f isin D t1 tn are the argument patterns of l rarr r and neednot necessarily be in T (CV) unlike in functional programming where only constructor-basedTRSs are considered (ie with ti isin T (CV)) We denote by RΣ the set of all TRSs defined onsignature Σ

Given TRS R a rewrite step tpETHrarrR

tprime is defined if there are a position p in t l rarr r isin R and

a substitution η with dom(η) sube var(l) such that t∣p = lη and tprime = t[rη]p As usual we omit towrite position p when it is not relevant and omit R when is clear from the context Moreoverwe use ETHrarrlowast to denote the transitive and reflexive closure of the rewriting relation ETHrarr

A term t is called a normal form denoted by t↛ if there is no term s such that tETHrarrlowast sA substitution x1t1 xntn is R-normalized (wrt a TRS R) if all ti are normal forms

(which trivially includes the case when ti isin T (CV))Full Narrowing

In the paper with s≪X we denote a renamed apart variant s of an element belonging to a setof syntactic objects X ie a renaming of variable names of some x isin X that does not containvariables that appear in the context of the definition where s ≪ X is used (this is also calledldquousing fresh variables names in srdquo)

The combination of variable instantiation and rewriting is called narrowing [7] Formally a

(full) narrowing step tσp

Rtprime is defined if there is a position p in t l rarr r ≪R and σ =mgu(t∣p l)

such that t∣p notin V and tprime = (t[r]p)σ In such a case we have that tσpETHrarrR

tprime Again we omit to

write position p when it is not relevant and omit R when is clear from the contextt denotes that there is no term s such that t s

3 Modeling the small-step rewriting behavior

In this section we introduce the concrete semantics which is suitable to model the small-steprewriting behavior In order to formally state such relationship we first need to formally definethe concept of small-step rewriting behavior

Definition 31 (Rewriting behavior) Given t0 isin T (ΣV) and R isin RΣ the small-step rewrit-ing behavior of t0 in R is

BssJt0 in RK ∶= t0 ETHrarrR

t1 ETHrarrR⋯ETHrarrR

tnminus1 ETHrarrR

tn∣forallti isin T (ΣV) (31)

and the small-step rewriting behavior of R is BssJRK ∶= ⋃tisinT (ΣV)BssJt in RK

34

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

This notion of observable behavior induces the definition of TRS equivalence

forallR1 R2 isin RΣR1 asympss R2 ∶lArrrArr BssJR1 K = BssJR2 K (32)

Thanks to the following property we can restrain the check of Bss equivalence of two TRSs tolinear terms Moreover in the sequel we will also restrict our attention only to denotations forlinear terms

Proposition 32 Let R1 R2 isin RΣ Then R1 asympss R2 lArrrArr R1 is a variant of R2 lArrrArr forallt isinLT (ΣV) BssJt in R1 K = BssJt in R2 K

31 The semantic domain

We now define a notion of ldquohypothetical rewritingrdquo which resembles full narrowing [7] butit ldquodecouplesrdquo multiple occurrences of variables This way we maintain the potentiality tochoose different evolutions of the rewritings of redexes once variables are instantiated with nonconstructor terms

The semantic domain of our semantics will be made of trees with all possible derivations ofthis variation of narrowing

311 Linearizing Narrowing

Definition 33 (Term Linearization) Let t isin T (ΣV) r isin LT (ΣV) and σ∶ V rarr V We saythat (r σ) is a linearization of t denoted (r σ) = lin(t) if rσ = t and var(t) sube var(r) Thesubstitution σ will be called delinearizator

If a term is linear then lin(t) = (t ε) while for non-linear terms we can have different possibilities(for instance lin(f(xx)) = (f(x y)yx) = (f(z x)zx) = ) However the followingconstructions which involve linearization are actually independent upon the particular choiceof linearization in the sense that all possible different results are variants (analogously to whathappens for the choice of different mgursquos)

It may be useful to note that a delinearizer σ has one binding for each (further) multipleoccurrence of a variable

Definition 34 (Linearizing Narrowing Derivation) Let t s isin LT (ΣV) and R isin RΣ There

exists a linearizing narrowing step tθp

OcircrArrσR

s if there exist a position p of t l rarr r ≪ R

θprime =mgu(t∣p l) and σ∶ V rarr V such that

t∣p notin V (s σ) = lin(t[rθprime]p) θ = θprimevar(t)We omit to write position p when it is not relevant and omit R when is clear from the context

A sequence t0θ1

OcircrArrσ1

t1 θn

OcircrArrσn

tn is called linearizing narrowing derivation With t0θ

OcircrArrσ

lowast tn we

denote the existence of a linearizing narrowing derivation such that θ = θ1⋯θn and σ = σ1⋯σnNote that in linearizing narrowing derivations we do not apply mgu θ to all reduct (t[r]p)θ asnarrowing does This would not make any difference since terms are kept linear by constructionand thus θ cannot alter the context outside positions being reduced

Linearizing narrowing is correct wrt rewriting (as narrowing is) as proven by the followingtheorem which is the analogous of Theorem 38 of [8] (Theorem 1 of [7]) where we use linearizing

35

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

narrowing instead of narrowing Actually linearizing narrowing is more general than narrowingin the sense that when we have a narrowing derivation then we will surely have a linearizingnarrowing derivation which possibly compute more general instances (in case there are non-linear terms)

Theorem 35 Let R isin RΣ s0 isin LT (ΣV) t0 isin T (ΣV) η0 an R-normalized substitution suchthat t0 = s0η0 and V sub V such that var(s0) cup dom(η0) sube V If t0 ETHrarrlowast tn then there exist a termsn isin LT (ΣV) and substitutions ηn θ σ such that

s0θ

OcircrArrσ

lowast sn tn = snσηn (θηn)V = η0V ηn is R-normalized

where s0θ

OcircrArrσ

lowast sn and t0 ETHrarrlowast tn employ the same rewrite rules at the same positions

Note that while it is always possible to transform rewrite derivations into linearizing narrowingderivations (in the sense of Theorem 35) the opposite does not hold in general as we will showin Example 37 As anticipated we gather all linearizing narrowing derivations (of the sameterm t) into a tree

Definition 36 (Linearizing Narrowing Trees) Let t isin LT (ΣV) A linearizing narrowingtree T for t is a (not necessarily finite) labelled tree which is rooted in t and where

1 paths are linearizing narrowing derivations2 sibling subtrees have the same root terms if and only if their incoming arcs have different

substitutions

We denote with LNTΣ (or simply LNT when clear from the context) the set of all thelinearizing narrowing trees (over Σ) Moreover for any t isin LT (ΣV) we denote with LNTt theset of all linearizing narrowing trees for t

Point 2 ensures that all sibling steps in a linearizing tree are pairwise distinct and thus that wecannot have two different paths of the tree with the same terms and labels

Example 37Consider TRS R of Example 11 The linearizing narrowing tree starting from term diff (x) is

diff (x) x ne x1True

xHead x1Tailε

TruexTa

il x1Head

εε

x1x

This linearizing narrowing derivation diff (x) xHeadx1Tail

OcircOcircOcircOcircOcircOcircrArrx1x

lowast True can be read as if there is a

term t that can rewrite both to Head and Tail then diff (t) rewrites to True Indeed diff (coin)does rewrite to True (a possible rewriting derivation is diff (coin) ETHrarr coin ne coin ETHrarr Head necoin ETHrarr Head ne Tail ETHrarr True)

In this case is not possible to transform these linearizing narrowing derivations into rewritederivations (since diff (x)ETHrarr x ne x↛ as well as diff (t)ETHrarr t ne t↛ for all t isin T (CV))

This example also shows that linearizing narrowing can have longer derivations wrt (stan-dard) narrowing since diff (x) ε

x ne x

36

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

Definition 38 (Variance on LNT) Let t isin LT (ΣV) and T1 T2 isin LNTt We say that T1 andT2 are local variants if there exists a renaming ρ such that T1ρ = T2Two linearizing narrowing trees are local variants if and only if they have the same root t andtheir steps are equal up to renaming of variables which do not occur in t

Note Since the actual choices of local variable names is completely irrelevant from now onwith an abuse of notation by LNT we will actually indicate its quotient wrt localvariance Moreover all linearizing narrowing trees presented in the sequel will actuallybe an arbitrary representative of an equivalence class

Definition 39 (Order on LNT) Let denote with paths(T ) the set of all the paths of T start-ing from the root

Given T1 T2 isin LNT we define T1 ⊑ T2 if and only if paths(T1) sube paths(T2)Given a set T sube LNTt the least upper bound ⊔T is the tree whose paths are ⋃T isinT paths(T )

Dually for the greatest lower bound ⊓It is worth noticing that for any t isin LT (ΣV) LNTt is a complete lattice

By Point 2 of Definition 36 paths is injective thus it establishes an order preserving iso-

morphism (LNTt ⊑) minusminusminusminusminusminusminusminusminusrarrETHrarrlarrlarrETHminusminusminusminusminusminusminusminusminuspaths

prfxtree (paths(LNTt) sube) where the adjoint of paths prfxtree builds

a tree from a set of paths (by merging all common prefixes) So we have two isomorphic rep-resentations of linearizing narrowing trees and in the sequel we can simply write d isin T ford isin paths(T ) The set representation is very convenient for technical definitions while forexamples the tree representation is better suited

Definition 310 (Linearizing Narrowing Tree of a term) Let t isin LT (ΣV) and R isin RΣA linearizing narrowing tree NJt in RK for term t in TRS R is

NJt in RK ∶= d isin LNTt∣d uses rules from RIntuitively NJt in RK denotes the linearizing narrowing behavior of linear term t in TRS Rmodulo local variance (ie local variables are up to renaming)

Example 311Given the following TRS R

m(H (x))rarr d(xK(x)) d(C (x)K (E(y)))rarr f(xx y y)f (A x y F)rarr B(y y) f (E(x) y AA)rarrK(E(y))

The linearizing narrowing tree NJm(x) in RK is

m(x) d(x1K(x2)) f(x3 x4 y y1)B(y y2)

x3Ay1Fy2y

K(E(x4))x3E(x5)

yAy1A

ε

x1C(x3)x2E(y)

x4x3 y1y

xH(x1)

x2x1

Linearizing narrowing trees ldquocapturerdquo the behavioral TRS equivalence asympss since the TRSequivalence induced by N coincides with asympss

Theorem 312 Let R1 R2 isin RΣ Then R1 asympss R2 if and only if for every t isin LT (ΣV)NJt in R1 K =NJt in R2 K

37

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

Even more from linearizing narrowing trees we can completely reconstruct the small-steprewriting behavior To formally prove this we need to introduce the following operation to buildrewriting derivations from linearizing narrowing derivations

Definition 313 Let R isin RΣ and d = s0 θ1OcircrArrσ1

s1θ2OcircrArrσ2

θnOcircrArrσn

sn be a linearizing narrowing deriva-

tion The linear narrowing to rewriting operator is defined as

lfloordrfloor ∶= t0 ETHrarr t1 ETHrarr tk ∣ ξ is an R-normalized substitution 0 le k le nη = θ1 uarr σ1 uarr uarr θk uarr σk forall0 le i le k ti = siηξ (33)

We abuse notation and lift lfloorsdotrfloor also to sets as lfloorSrfloor ∶= ⋃disinSlfloordrfloorIntuitively this operation takes a prefix d of a linear narrowing derivation and if it can simulta-neously satisfy all its computed answers and delinearizators with substitution η then it buildsa rewriting sequence by applying ηξ to all terms of d for any R-normalized substitution ξ

Theorem 314 Let R isin RΣ and t isin LT (ΣV) Then BssJt in RK = lfloorNJt in RKrfloorHence NJt inRK is indeed a condensed representation of BssJt inRK Now the next step for theconstruction of a semantics with the desired characteristics is to achieve compositionality Todo so we should look for a denotation for most general terms f (ETHrarrxn) (of a TRS R) which couldbe used to retrieve with suitable semantic operations NJt in RK for any t isin LT (ΣV)32 Operational denotations of TRSs

The operational denotation of a TRS can be defined as an interpretation giving meaning to thedefined symbols over linearizing narrowing trees ldquomodulo variancerdquo Essentially we define thesemantics of each function in D over formal parameters (whose names are actually irrelevant)

Definition 315 (Interpretations) Let MGTD ∶= f (ETHrarrxn) ∣ fn isin D ETHrarrxn are distinct variablesTwo functions I J ∶MGTD rarr LNTΣ are (global) variants denoted by I cong J if for each

π isinMGTD there exists a renaming ρ such that (I(π))ρ = J(πρ)An interpretation is a function I ∶MGTD rarr LNTΣ modulo variance2 such that for every

π isinMGTD I(π) is a linearizing narrowing tree for πThe semantic domain IΣ (or simply I when clear from the context) is the set of all inter-

pretations ordered by the pointwise extension of ⊑The partial order on I formalizes the evolution of the computation process (I ⊑) is a completelattice and its least upper bound and greatest lower bound are the pointwise extension of ⊔and ⊓ respectively In the sequel we abuse the notations for LNT for I as well The bottomelement of I is I ∶= λππ (for each π isin MGTD) In the sequel we abuse the notations forLNT for I as well

It is important to note that MGTD (modulo variance) has the same cardinality of D (andis then finite) and thus each interpretation is a finite collection (of possibly infinite elements)Hence we will often explicitly write interpretations by cases like

I ∶=⎧⎪⎪⎪⎪⎨⎪⎪⎪⎪⎩

π1 ↦ T1

πn ↦ Tn

for

I(π1) ∶= T1⋮

I(πn) ∶= Tn2ie a family of elements of LNTΣ indexed by MGTD modulo variance

38

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

In the following any I isin I is implicitly considered as an arbitrary function MGT rarr LNT

obtained by choosing an arbitrary representative of the elements of I in the equivalence classgenerated by cong Actually in the sequel all the operators that we use on I are also independentof the choice of the representative Therefore we can define any operator on I in terms of itscounterpart defined on functions MGT rarr LNT

Moreover we also implicitly assume that the application of an interpretation I to a specificπ isin MGT denoted by I(π) is the application I(π) of any representative I of I which is

defined exactly on π For example if I = (λf (x y) f(x y) xc(z)

OcircOcircOcircrArrε

c(y z))congthen I(f(u v)) =

f(u v) uc(z)

OcircOcircOcircrArrε

c(v z)While defined symbols have to be interpreted according to TRS rules constructor symbols

are meant to be interpreted as themselves In order to treat them as a generic case of functionapplication we assume that any interpretation I is also implicitly extended on constructors asI(c(ETHrarrxn)) ∶= c(ETHrarrxn) In the sequel we will use ϕ when we refer to a generic (either constructoror defined) symbol whence f for defined symbols and c for constructor ones

Definition 316 (Operational denotation of TRSs) Let R isin RΣ Then the operationaldenotation of R is

OJRK ∶= (λf (ETHrarrxn) NJf(ETHrarrxn) in RK)cong

(34)

Intuitively O collects the linearizing narrowing tree of each f (ETHrarrxn) in R abstracting from theparticular choice of the variable names ETHrarrxn

Example 317The operational denotation of TRS R of Example 11 is

OJRK =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

coin ↦ coin

Tail

Head

εεεε

x ne y ↦ x ne yTrue

True

xTail yH

ead

εxHead yTailε

diff (x)↦ diff (x) x ne x1True

True

ε

x1x

xHead x1T

ail

εxTail x

1Headε

The (small-step) rewriting behavior of any term t can be ldquoreconstructedrdquo from OJRK bymeans of the following evaluation function E 321 Evaluation Function

When we have the interpretation with the linearizing narrowing tree of f (ETHrarrxn) we can easily

reconstruct the rewriting behavior of any f (ETHrarrtn) for (renamed apart)

ETHrarrtn isin LT (CV) by sim-

ply replacing the most general bindings along a derivation with constructor terms ti (clearly

39

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

pruning branches with inconsistent instances) However with non-constructor nested termsthings gets more involved In practice we have an interleaving of parts of all sub-derivationscorresponding to the evaluation of arguments leaded by the derivation of f (ETHrarrxn) Intuitively thebasic building block of our proposal is the definition of a semantics embedding operation thatmimics parameter passing Namely taken two linearizing narrowing trees T1 T2 and a variablex of (the root of) T1 the tree-embedding operation T1[xT2] transforms T1 by modifying itssteps accordingly to steps of T2 which provides specific actual parameter values to x in placeswhere x in T1 was originally ldquofreelyrdquo instantiated

In order to define T1[xT2] we need to introduce an auxiliary (technical) relation whichworks on single derivations Note that in the sequel to shorten definitions when we adornlinearizing narrowing derivations or trees with a term s like ds or Ts we mean that the headof ds or the root of Ts is term s

Definition 318 Let π isin LT (ΣV) dg be a linearizing narrowing derivation with head g andTb isin LNTb Then dgπTb ⊢ d is the least relation that satisfies the rules

dtπTs ⊢ tmicromicro = larrETHETHmgu(s π) (35a)

dtπTsprime ⊢ d

dtπTs ⊢ tmicroθq

OcircrArrσ

dmicro = larrETHETHmgu(s π) s

θp

OcircrArrσ

Tsprime isin Ts existq s∣p = tmicro∣q (35b)

dt0 π0Ts0 ⊢ dt1 dtn πnTsn ⊢ dtn+1

(t θp

OcircrArrσ

dt0)πTs0 ⊢ tmicro θprimep

OcircrArrσprimeprime

dtn+1

micro = larrETHETHmgu(s0 π)θprime = larrETHETHmgu(tmicro tθ)var(tmicro) x1y1 xnyn = proj (var(πθ) σ)Ts1 Tsn ≪ Ts0

π0 = πθ foralli isin 1 n πi = π0yixiforallj isin 0 n ETHrarrvj =ETHrarrvar(sj)

σprimeprime = (σ cup

n

⋃i=1

ETHrarrvi ETHrarrv0)var(tn+1)

(35c)

where

bull proj (Vσ) = xy isin σ ∣ y isin V bulllarrETHETHmgu(t s) is an mgu θ of t and s such that forallx isin var(t) xθ isin V

Broadly speaking the role of π in a statement dtπTs ⊢ d is that of the ldquoparameter patternrdquoresponsible to constrain ldquofreelyrdquo instantiated formal parameters in dt to the actual parametersvalues which are actually ldquocomingrdquo from Ts More specifically Rules 35 govern the inlaying ofthe steps of a linearizing narrowing tree Ts into a derivation dt In particular

bull The axiom 35a stops any further possible inlayingbull The rule 35b considers the case when we want to proceed with an inner linearizingnarrowing step employing a step coming from Ts In this case t plays the role of contextand the inner step is done accordingly to the one chosen from Ts Note that is it possibleto do the step only if exists q such that s∣p = tmicro∣q Namely the defined symbol over whichthe step is done needs to be ldquovisiblerdquo in tmicro

bull The rule 35c considers the case when we want to do an outermost step First the stephas to be compatible with the way we instantiated t so far namely exists mgu(tmicro tθ)Then we choose from σ only the delinearizers that depend on the variable from whichwe started the embedding Each of these delinearizer comes from the linearization of amultiple occurrence of a same variable z Thus for each rename zprime of z we sequentiallyembed into zprime a (possibly different) sub-derivation coming from a renamed apart variant of

40

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

Ts Note that if we would not have multiple occurrences of z (ie proj (var(πθ) σ) = empty)the rule would simply be

dt0 π0Ts0 ⊢ dt1(t θpOcircrArr

σ

dt0)πTs0 ⊢ tmicro θprimepOcircrArrσ

dt1

micro = larrETHETHmgu(s0 π) θprime = larrETHETHmgu(tmicro tθ)var(tmicro)

π0 = πθ

Note that in Rules 35 we use a selected form of mgu (ie larrETHETHmgu which does not rename variablesin the left argument) in order to avoid to change variable names along the way

Example 319Consider OJRK of Example 317 Let Tcoin ∶= OJRK(coin) and d0 ∶= diff (x) ε

OcircOcircrArrx1x

d1 isinOJRK(diff (x)) where d1 = x ne x1 xHeadx1Tail

OcircOcircOcircOcircOcircOcircOcircrArrε

True

Let us build a proof tree to find a derivation d such that d0xTcoin ⊢ d We have to startwith an application of rule (35c) which (in this case) has two premises since the delinearizatorx1x in the first step of d0 has one binding The first subtree which embeds the Head branchof Tcoin into x is

(35a)TrueHead Head ⊢ True

(35c)d1xHead ⊢ Head ne x1 x1Tail

OcircOcircOcircrArrε

True(35b)

d1xTcoin ⊢ coin ne x1 ε

OcircrArrε

Head ne x1 x1Tail

OcircOcircOcircrArrε

True

acutesup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1cedilsup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1parad3

(PT)

Now we can build the full proof tree (by building the second subtree which starting from d3can finish to embed the Tail branch of Tcoin into x1)

(PT)

(35a)TrueTail Tail ⊢ True

(35c)d2 x1Tail ⊢ Head ne Tail ε

OcircrArrε

True(35b)

d2 x1Tcoin ⊢ Head ne coin ε

OcircrArrε

Head ne Tail ε

OcircrArrε

True(35c)

d3 x1Tcoin ⊢ coin ne coin ε

OcircrArrε

Head ne coin ε

OcircrArrε

Head ne Tail ε

OcircrArrε

True(35c)

d xTcoin ⊢ diff (coin) ε

OcircrArrε

coin ne coin ε

OcircrArrε

Head ne coin ε

OcircrArrε

Head ne Tail ε

OcircrArrε

True

We have analogous proof tree for d xTcoin ⊢ diff (coin) ε

OcircrArrε

coin ne coin ε

OcircrArrε

Tail ne coin ε

OcircrArrε

Tail neHead

ε

OcircrArrε

True In total we have ten possible proof trees four of whom that have derivations

which reach True

Tree-embedding is simply defined by collecting all contributes of dxT ⊢ dprime

Definition 320 (Tree-embedding) Let Tg isin LNTg and Tb isin LNTg such that

1 Tg and Tb do not share any local variable2 x is a variable which does not occur in Tb

Then the tree-embedding operation Tg[xTb] is defined as Tg[xTb] ∶= d∣dg isin Tg dgxTb ⊢ d41

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

The evaluation function is obtained by repeated application of tree-embedding

Definition 321 (Evaluation Function) Let t isin LT (ΣV) and I isin I The evaluation of twrt I denoted E JtKI is defined by induction on the structure of t as follows

E JxKI ∶= x (36a)

E Jϕ(ETHrarrtn)KI ∶= I(ϕ(ETHrarrxn))[x1 E Jt1KI ] [xn E JtnKI ] ETHrarrxn renamed apart distinct (36b)

Example 322Consider OJRK of Example 317 The evaluation of E Jdiff (coin)KOJRK is

E Jdiff (coin)KOJRK = [ by Equation (36b) with n = 1 ]OJRK(diff (x))[x E JcoinKOJRK] = [ by Equation (36b) with n = 0 ]OJRK(diff (x))[xOJRK(coin)]

Then by completing what shown in Example 319 we have that E Jdiff (coin)KOJRK is

diff (coin)

diff (Head)Head ne Head

εεε

ε

coin ne coin

Head ne coinHead ne Head

εε

Head ne Tail Trueεεε

ε

εε

Tail ne coinTail ne Head True

εε

εε

Tail ne Tailεε

εε

coin ne HeadHead ne Head

εε

Tail ne Head Trueεεε

ε

εε

coin ne TailHead ne Tail True

εε

εε

Tail ne Tailεε

εε

εε

diff (Tail)Tail ne Tail

εε

εε

322 Properties of the TRS operational denotation

The following result states formally that from OJRK the evaluation function E can reconstructthe linearizing narrowing tree of any linear term

Theorem 323 For all R isin RΣ and t isin LT (ΣV) E JtKOJRK =NJt in RK

A straightforward consequence of Theorems 323 and 312 is

Corollary 324 For all R1 R2 isin RΣ OJR1 K = OJR2 K if and only if R1 asympss R2

Thus semantics O is fully abstract wrt asympss

33 Fixpoint denotations of TRSs

We will now define a bottom-up goal-independent denotation which is equivalent to O and thus(by Corollary 324) adequate to characterize the small-step behavior for TRSs It is definedas the fixpoint of an abstract immediate operator over interpretations P JRK This operatoris essentially given in terms of evaluation E of right hand sides of rules Namely given aninterpretation I it essentially consists in

42

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

bull building an initial linearizing narrowing step for a most general term according to rulesrsquoleft hand side

bull applying the evaluation operator E to the right hand side of the rule over I Definition 325 Let R isin RΣ P JRK∶ I rarr I is defined for all f isin D (of arity n) as

P JRKI (f(ETHrarrxn)) ∶=⊔f(ETHrarrxn) θ

OcircrArrσ

E JrprimeKI ∣ f(ETHrarrxn)θ rarr r ≪R

(rprime σ) = lin(r) (37)

Moreover we define our fixpoint semantics as F JRK ∶= lfp P JRK

F JRK is well defined since P JRK is continuous

Proposition 326 Let R isin RΣ Then P JRK is continuous

Example 327Let us consider the (artificial) TRS R ∶= g rarr f(h(a)) h(a) rarr h(b) f (h(b)) rarr a taken from[1] which is neither constructor-based nor confluent The evaluation of the right hand sidesof all rules is E Jf(h(a))KI = I(f(x))[x E Jh(a)KI ] = f(x)[xh(a)] = f(h(a)) E Jh(b)KI =h(x)[xb] = h(b) and E JaKI = a Hence

I1∶= P JRKuarr1 =

⎧⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎩

g ↦ g f(h(a))εε

h(x)↦ h(x) h(b)xa

ε

f(x)↦ f(x) axh(b)

ε

In the next iteration we have to evaluate E Jf(h(a))KI1= I

1(f(x))[x E Jh(a)KI

1] Since E Jh(a)KI

1=

I1(h(x))[x E JaKI

1] = h(a) ε

OcircrArrε

h(b) we have

P JRKuarr2 =⎧⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎩

g ↦ g f(h(a)) f(h(b)) aεε

εε

εε

h(x)↦ h(x) h(b)xa

ε

f(x)↦ f(x) axh(b)

ε

Now since P JRKuarr3 = P JRKuarr2 this is also the fixpoint F JRK

Example 328Consider TRS R of Example 11 The iterates of P JRK are

P JRKuarr1 =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

coin ↦ coin

Tail

Head

εεεε

x ne y ↦ x ne yTrue

True

xTail yH

ead

εxHead yTailε

diff (x)↦ diff (x) x ne x1ε

x1x

43

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

P JRKuarr2 =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

coin ↦ coin

Tail

Head

εεεε

x ne y ↦ x ne yTrue

True

xTail yH

ead

εxHead yTailε

diff (x)↦ diff (x) x ne x1True

True

ε

x1x

xHead x1T

ail

εxTail x

1Headε

Now since P JRKuarr3 = P JRKuarr2 this is also the fixpoint F JRK

Example 329Let us consider the TRS R ∶= zeros rarr ∶(0 zeros) take(0 x) rarr nil take(s(n) ∶(y z))) rarr∶(y take(n z)) f (n)rarr take(n zeros) The first two iterates of P JRK are

P JRKuarr1 =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

zeros ↦ zeros ∶(0 zeros)εε

take(x1 y1)↦ take(x1 y1 )

nil

x10

ε ∶(y0 take(x0 z))

x1s(x

0)y1 ∶(y

0 z)ε

f(x0)↦ f(x0) take(x0 zeros)εε

P JRKuarr2 =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

zeros ↦ zeros ∶(0 zeros) ∶(0 ∶(0 zeros))εε

εε

take(x2 y2)↦ take(x2 y2 )

nil

x20

ε ∶(y1 take(x1 z1))∶(y1nil)

εε ∶(y1 ∶(y0 take(x0 z0)))

x1s(x

0)z1 ∶(y

0 z0)

ε

x2s(x

1)y2 ∶(y

1 z1)ε

f(x1)↦ f(x1)

take(x1 zeros)

nil

x10

ε

take(x1 ∶(0 zeros))

nil

x10

ε

∶(0 take(x0 zeros))x

1s(x0)

ε

εε

εε

Note that to highlight the construction order of the various subtrees we used indices in variablesnames that respect the order of introduction and boxed the subtrees which correspond to the

44

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

previous iterate By continuing the computation of the iterates we obtain

F JRK =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

zeros ↦ zeros ∶(0 zeros) ∶(0 ∶(0 zeros))εε

εε

take(x y)↦ take(x y)

nil

x0

ε ∶(yprime take(xprime z))∶(yprimenil)

εε ∶(yprime ∶(yprimeprime take(xprimeprime zprime)))

x primes(x primeprime)z ∶(y primeprime z prime)ε

xs(x prime)y ∶(y prime z)ε

f(x)↦ f(x)

take(x zeros)

nil

x0

ε

take(x ∶(0 zeros))nil

x0

ε

take(x ∶(0 ∶(0 zeros)))εε ∶(0 take(xprime zeros))

∶(0nil)xprime 0

ε

∶(0 take(xprimeprime ∶(0 zeros)))

x primes(x primeprime)

ε

xs(x prime)ε

εε

εε

We can observe that since terms in R are linear the linearizing narrowing trees have justε as delinearizers and actually they are isomorphic to full narrowing trees

331 Properties of the TRS fixpoint denotation

The top-down goal-dependent denotation O and the bottom-up goal-independent denotationF are actually equivalent

Theorem 330 (Equivalence of denotations) Let R isin RΣ Then OJRK = F JRK

A straightforward consequence of Theorem 330 and Corollary 324 is

Corollary 331 (Correctness and full abstraction of F ) Let R1 R2 isin RΣ Then F JR1 K =F JR2 K if and only if R1 asympss R2

4 Conclusions

We have presented a condensed compositional bottom-up semantics for the full class of termrewriting systems which is fully abstract wrt the small-step behavior of rewriting

We are going to use this semantics to define by abstraction a condensed bottom-up se-mantics for the full class of term rewriting systems which is fully abstract wrt the big-stepbehavior of rewriting and thus suitable for semantic-based program manipulation tools Actu-ally we have developed a first proposal of such a semantics (by following this approach) but

45

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

restricted to the class of left-linear TRSs We already used it to develop a semantics-basedautomatic specification synthesis prototype [6] which is giving promising results

However we believe that our notion of linearized narrowing which differently from nar-rowing represents faithfully the small-step behavior of rewriting (in a compact way) could beinteresting for other applications as well

References

[1] M Alpuente M Comini S Escobar M Falaschi and J Iborra A Compact Fixpoint Semanticsfor Term Rewriting Systems Theoretical Computer Science 411(37)3348ndash3371 2010

[2] M Alpuente M Comini S Escobar M Falaschi and S Lucas Abstract Diagnosis of FunctionalPrograms In M Leuschel editor Logic Based Program Synthesis and Transformation ndash 12th

International Workshop LOPSTR 2002 Revised Selected Papers volume 2664 of Lecture Notes

in Computer Science pages 1ndash16 Berlin 2003 Springer-Verlag

[3] G Bacci An Abstract Interpretation Framework for Semantics and Diagnosis of Lazy Functional-

Logic Languages PhD thesis Dipartimento di matematica e Informatica Universita di Udine2011

[4] G Bacci and M Comini A Fully-Abstract Condensed Goal-Independent Bottom-Up FixpointModeling of the Behaviour of First Order Curry Submitted for Publication 2012

[5] M Comini G Levi M C Meo and G Vitiello Abstract Diagnosis Journal of Logic Program-

ming 39(1-3)43ndash93 1999

[6] M Comini and L Torella TRSynth a Tool for Automatic Inference of Term Equivalence inLeft-linear Term Rewriting Systems In E Albert and S-C Mu editors PEPM rsquo13 Proceedings

of the ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation pages 67ndash70Acm 2013

[7] J-M Hullot Canonical Forms and Unification In Proceedings of the 5th International Conference

on Automated Deduction volume 87 of Lecture Notes in Computer Science pages 318ndash334 Berlin1980 Springer-Verlag

[8] A Middeldorp and E Hamoen Completeness results for basic narrowing Applicable Algebra in

Engineering Communication and Computing 5213ndash253 1994 101007BF01190830

[9] H R Nielson and F Nielson Infinitary Control Flow Analysis a Collecting Semantics for ClosureAnalysis In Symposium on Principles of Programming Languages pages 332ndash345 1997

[10] TeReSe editor Term Rewriting Systems Cambridge University Press Cambridge UK 2003

A Technical Proofs

Proof of Proposition 32

Point 1 Implication lArrOcirc is straightforward We prove OcircrArr by reduction to absurd Supposethat R1 asympss R2 and R1 is not a variant of R2 Then there is at least one rule which isdifferent in R1 wrt R2 (or vice versa) Thus by Equation (31) we can have rewritingsteps which employ that rule in BssJR1 K which cannot be in BssJR2 K which is absurd

Point 2 Similarly to previous point but restricting to initial linear terms

In the sequel we use the following results

46

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

Proposition A1 ([8]) Suppose we have substitutions θ ρ ρprime and sets A B of variables suchthat (B minus dom(θ)) cup range(θ) sube A If ρA = ρprimeA then (θρ)A = (θρprime)AProposition A2 ([8]) Let R be a TRS and suppose we have substitutions θ ρ ρprime and setsA B of variables such that the following conditions are satisfied

ρA R-normalized θρprimeA = ρA B sube (A minus dom(θ)) cup range(θA)Then ρprimeB is also R-normalized

Proof of Theorem 35 We prove the thesis by induction on the length of the rewriting derivationfrom t0 to tn The case of length zero is straightforward

Suppose t0 ETHrarr t1 ETHrarr ETHrarr tn is a rewriting derivation of length n gt 0 We may assumewithout loss of generality that var(l) cap V = empty We have (s0η0)∣p = s0∣pη0 = τ l for somesubstitution τ with dom(τ) sube var(l) Let micro ∶= τ cup η0 We have s0∣pmicro = s0∣pη0 = lτ = lmicro so s0∣pand l are unifiable Let θprime

1∶= mgu(s0∣p l) and θ1 ∶= θprime1var(s0∣p) Clearly dom(θ1) cup range(θ1) sube

var(s0∣p) cup var(l) Moreover there exists a substitution ψ such that

θ1ψ = micro (1)

Now let (s1 σ1) ∶= lin(s0[rθprime1]p) By Definition 34

s0θ1p

OcircOcircrArrσ1 lrarrr

s1 (2)

Let V1 ∶= (V minus dom(θ1)) cup range(θ1) cup dom(σ1) andη1 ∶= (σ1ψ)V1

(3)

Clearly dom(η1) sube V1 We have var(s1) = dom(σ1)cup var(s0[rθ1]p) sube dom(σ1)cup var(s0[lθ1]p) =dom(σ1) cup var(s0θ1) sube V1 Therefore var(s1) cup dom(θ1) sube V1 By (1) and (3) we have s1σ1η1 =s1σ1ψ = s0[rθ1]pψ = s0[r]pθ1ψ = s0[r]pmicro = s0micro[rmicro]p Since V cap dom(τ) = empty we have

microV = η0V (4)

Likewise microvar(r) = η0var(r) Hence s0micro[rmicro]p = s0η0[rτ]p = t0[rτ]p = t1 Thust1 = s1σ1η1 (5)

Next we have to verify that (θ1η1)V = η0V By (3) and by Proposition A1 we have that(θ1η1)V = (θ1σ1ψ)V By (1) and (4) (θ1η1)V = (θ1σ1ψ)V Since dom(σ1) notin V we havethat (θ1σ1ψ)V = (θ1ψ)V = microV = η0V Thus

(θ1η1)V = η0V (6)

Now we show that η1 is R-normalized Since dom(η1) sube V1 it suffices to show that η1V1isR-normalized Let B ∶= (V minusdom(θ1))cuprange(θ1V ) Proposition A2 yields the normalization

of η1B Recall that range(θ1) sube var(s0∣p) cup var(l) Let x isin range(θ1) since θ1 is idempotentclearly x notin dom(θ1) If x isin var(s0∣p) sube V then x isin V minus dom(θ1) sube B If x isin var(l) thenx isin var(lθ1) = var(s0∣pθ1) thus x isin range(θ1V ) sube B Thus range(θ1) sube B and then V1 =B cup dom(σ1) By this and (3) since η1B is R-normalized η1V1

is R-normalized as well

47

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

By inductive hypothesis we have a term sn and substitutions θprime σprime and ηn such that

s1θprimeOcircrArrσprime

lowast sn (7)

tn = snσprimeηn (8)

(θprimeηn)V1= η1V1

(9)

ηn is R-normalized (10)

Moreover s1θprimeOcircOcircrArr

σprimeR

lowast sn and t1 ETHrarrR

lowast tn apply the same rewrite rules at the same positions

Let θ ∶= θ1θprime and σ = σ1σprime By (2) and (7) we obtain s0θ

OcircrArrσ

lowast sn By construction this

narrowing derivation makes use of the same rewriting rules at the same positions as the rewritingderivation t0 ETHrarr

R

lowast tn It remains to show that (θηn)V = η0V By (9) and Proposition A1

(θ1θprimeηn)V = (θ1η1)V Therefore by (6) (θηn)V = (θ1η1)V = η0V Proof of Theorem 312 We prove OcircrArr by reduction to absurd Suppose that R1 asympss R2 andexistt isin LT (ΣV) NJt in R1 K neNJt in R2 K This means that there is at least one derivation whichbelongs to NJt in R1 K and not to NJt in R2 K (or vice versa) Hence there is at least a rulewhich is not in common to the two programs Thus R1 asympss R2 which is absurd

We prove lArrOcirc by reduction to absurd Suppose that forallt isin LT (ΣV) NJt inR1 K =NJt inR2 Kand R1 asympss R2 Then there is at least one rule which is different in R1 wrt R2 Thus byEquation (31) and Theorem 35 NJt in R1 K neNJt in R2 K which is absurd

Proof of Theorem 314 We prove the two inclusions separately Inclusion supe is immediate byDefinition 313

Inclusion sube is proved by reduction to absurd Assume that there exists a derivation t0 ETHrarrR

lowast tn

such that it does not belong to lfloorNJt0 inRKrfloor Then by Theorem 35 taken η0 = ε there exists arelaxed narrowing derivation of the form s0

θ1

OcircrArrσ1

θn

OcircrArrσn

sn Note that for each i isin 1n θi andσi are just renaming ηi = ε and ti = siσi σ0 Let η ∶= η0 = ε It is easy to see that there existsηprime such that ηprime = θ1 uarr σ1 uarr uarr θn uarr σn By Definition 313 there exists a rewriting derivationtprime0ETHrarrR

lowast tprimen where tprimei = siηprime for each i isin 1n Moreover dom(σk) isin var(si) for each k isin i+ 1nand θi = (σj)dom(θi) or θi = (σj)dom(θi) for some j Hence siη

prime = siσi σ0 Thus tprimei = ti foreach i isin 1n which is absurd

Lemma A3 Let R a TRS x isin V and t s isin T (ΣV) such that they do not share variables andx isin t x isin s Then NJt in RK[xNJs in RK] =NJtxs in RK

Proof It is sufficient to prove that given dt isin NJt in RK and Ts = NJs in RK if dtxTs ⊢ dthen d isin NJtxs in RK To this aim we will prove a stronger result let π isin T (CV) letTs = NJs in RK and for any dt isin NJt in RK such that dtπTs ⊢ d then d isin NJtη in RK whereη =larrETHETHmgu(s π) We proceed by structural induction on the proof tree

rule 35a) straightforward

rule 35b) By inductive hypothesis dtπTsprime ⊢ dtmicro lArrrArr dtmicro isinNJtmicro inRK If it exists dtmicro then

tmicro∣p = s∣p Moreover existmicroprime such that microprime = larrETHETHmgu(sprime π) and tmicroprime∣p = sprime∣p Thus tmicroθp

OcircrArrσ

dtmicro isinNJtmicro in RK

48

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

rule 35c) By inductive hypothesis we have that dt0 π0Ts0 ⊢ dt1 lArrrArr dt1 isin NJtmicro0 inRK dtn πnTsn ⊢ dtn+1 lArrrArr dtn+1 isin NJtmicron in RK where micro0 = larrETHETHmgu(s0 π0) micron =larrETHETHmgu(sn πn) We know that exists a linearizing narrowing step t

θp

OcircrArrσ

t0 where θ2 =mgu(t∣p l) θ = θ2var(t) (s σ) = lin(rθ2) tmicro = t[s]p We need to prove that it exists the

linearizing narrowing step tmicroθprimep

OcircrArrσprimeprime

tn+1 Since it exists mgu(t∣p l) and mgu(tmicro tθ) thenit exists θ3 such that θ3 = mgu((tmicro)∣p l) Now let θprime ∶= θ3var(tmicro) and (sprime σprime) = lin(rθ3)then tmicro[sprime]p = t Let us observe that t1 = t0micro0 t2 = t0micro0micro1 tn+1 = t0micro0 micron wheremicro0 =larrETHETHmgu(s0 π0) micron =larrETHETHmgu(sn πn) Let microlowast = micro0 micron then tn+1 = t0microlowast = tmicrolowast[smicrolowast]p =tmicro[smicrolowast]p = t

Proof of Theorem 323 We proceed by structural induction on term t

t = x Immediate by Equation (36a)

t = ϕ(ETHrarrtn)

E Jϕ(ETHrarrtn)KOJRK =[ by Equation (36b) ]

= OJRK(ϕ(ETHrarrxn))[x1 E Jt1KOJRK] [xn E JtnKOJRK] =[ by inductive hypothesis ]

=NJϕ(ETHrarrxn) in RK[x1NJt1 in RK] [xnNJtn in RK] =[ by Lemma A3 ]

=NJϕ(ETHrarrtn) in RK

Proof of Proposition 326 It is straightforward to prove that P JP K is monotone and finitarythus it is continuous

Proof of Theorem 330 We prove the two inclusions separately

⊑) Let indicate with Ok all derivations of OJRK with length le k by induction we prove thatforallk Ok ⊑ P JRKuarrk

k = 0) immediate

k gt 0) foralld isin Ok we have that d = f(x) θΛ

OcircrArrσ

dprime such that (by Theorem 323) dprimet isin E JtKOkminus1

Thus by monotonicity of E we have that dprimet isin E JtKP JRKuarrkminus1 By the definition of P d isin P JP KP JRKuarrkminus1 = P JRKuarrk

Thus by Proposition 326 OJRK = ⊔kge0Ok ⊑ ⊔kge0P JRKuarrk = F JRK

⊒) We need to prove that f(ETHrarrxn) θΛ

OcircrArrσ

E JrprimeKOJRK ⊑NJf(ETHrarrxn) inRK By Theorem 323 E JrprimeKOJRK

is a linearizing narrowing tree Since θ = mgu(f(ETHrarrxn l))ETHrarrxnand (σ rprime) = lin(r) we can

conclude that f(ETHrarrxn) θΛ

OcircrArrσ

E JrprimeKOJRK ⊑NJf(ETHrarrxn) in RK

49

Logical and Algebraic Views of a Knot Fold of a

Regular Heptagon

Fadoua Ghourabi1 Tetsuo Ida2 and Kazuko Takahashi1

1 Kwansei Gakuin University Japanghourabikwanseiacjp ktkakwanseiacjp

2 University of Tsukuba Japanidai-eosorg

Abstract

Making a knot on a rectangular origami or more generally on a tape of a finite lengthgives rise to a regular polygon We present an automated algebraic proof that makingtwo knots leads to a regular heptagon Knot fold is regarded as a double fold operationcoupled with Huzitarsquos fold operations We specify the construction by describing thegeometrical constraints on the fold lines to be used for the construction of a knot Thealgebraic interpretation of the logical formulas allows us to solve the problem of howto find the fold operations ie to find concrete fold lines The logical and algebraicframework incorporated in a system called Eos (e-origami system) is used to simulate theknot construction as well as to prove the correctness of the construction based on algebraicproof methods

1 Introduction

From the early history of mathematics the correspondence between geometry and algebra hasbeen recognized and has been the subject of constant study In some sense ancient geometrywas a mother of algebra In particular solving algebraic equations has been related to therealm of Euclidean geometry Early mathematicians notably Khawarizmi and Khayyam gavegeometrical meanings to the solutions of equations Khayyamrsquos insight was that solutions ofcertain cubic equations are points of intersections of conic sections [1] Seven centuries laterafter freeing algebra from geometrical thinking Wantzel proved that solving cubic solutionsis impossible by Euclidean tools ie compass and straightedge [2] Further tools have beeninvented and used to perform constructions that are impossible by Euclidean tools

Paper folding ie origami allows solving cubic equations and hence geometrical construc-tions such as trisection of an arbitrary angle or a regular heptagon are realizable Given anorigami paper what we can do by hand is to construct creases and points The creases areconstructed by folding the paper along the lines which we call fold lines The points are con-structed by the intersection of lines Huzita presented a set of fold operations (known also asHuzitarsquos axioms in literature) with which he showed how to obtain fold lines [3] Huzitarsquos foldoperations are simple to perform by hand but powerful enough to solve cubic equations [4]

The geometrical construction of a regular heptagon has a unique history in that it belongsto the famous classical impossible problems by Euclidean tools Using paper folding the con-struction was shown to be possible In this paper we show another method of constructing aregular heptagon based on an extension of Huzitarsquos fold operations by introducing knottingThe constructions of regular n-gons (in particular of regular pentagon and heptagon) by makingknots have not been rigorously specified and the observation that their constructions purportto problems of solving geometrical constraints is missing

50

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

We investigate the geometrical constraints of the knot fold towards constructions of regu-lar polygons and proofs of the correctness of these constructions The knot fold operation isspecified by an existentially quantified formula of the first-order predicate logic The formulais then translated into a set of algebraic equalities and disequalities which then are solved byspecialized solvers based on Grobner basis theory andor CAD (Cylindrical Algebraic Decom-position) We have developed a computational origami system called Eos [5] using computeralgebra system Mathematica In brief it is an e-origami system which allows us to do virtualorigami It has capabilities of constructing and visualizing origami geometrical objects alge-braically analyzing origami folds and proving the correctness of origami constructions Eos

supports Huzitarsquos fold operations and has been extended to include multi-fold operations Weuse Eos to assist us with our mathematical study of the knot fold

The rest of the paper is organized as follows In Sect 2 we give the notations that we useIn Sect 3 we present Huzitarsquos fold operations and their extensions In Sect 4 we explain thegeometrical properties of the knot fold The construction of regular heptagon by Eos is shownin Sect 5 and its formal and algebraic proof is discussed in Sect 6 In Sect 7 we summarizeour results and point out a direction of further research

2 Notations

In this paper we restrict the use of geometrical objects to points segments and lines Pointsare denoted by a single capital letter of the Latin alphabet eg A B C D X Y etc Linesare denoted by m n t u and v Let X and Y be two points then XY denotes the line passingthrough points X and Y For brevity we often write XY to refer to the line passing through Xand Y We use the same notation to denote the segment between points X and Y Althoughthe meaning of the notation XY should be clear from the context we precede the notation XYwith either the word ldquosegmentrdquo or the word ldquolinerdquo to emphasize which objects we are working

with We also useminusminusrarrXY to denote a vector from point X to point Y The distance between two

points X and Y is denoted by |XY |Since we use Cartesian coordinate system in this paper a line is represented by a linear

equation ax+ by+ c = 0 in variables x and y The sets of all points and lines are denoted by Πand L respectively Abusing the set notation we use X isin m to mean that point X is incidentto line m and X1 Xp sub m to mean that all the points X1 Xp are incident to m

When an origami is folded along a line m some of the points are moved to superpose withtheir reflections across m We denote by Xm the reflection of point X across line m

A simple knot is denoted by K Ki denotes the ith knot The notation K = 〈mn t〉 meansthat the knot K is defined by 3 fold lines (to be explained in Sect 4)m n and t and furthermoreK is obtained by folding along the lines following the order of their appearance in 〈mn t〉

3 Origami Geometrical Construction

31 Huzitarsquos Fold Operations

By O we denote an origami An origami O is supposed to represent a square sheet of paperwith four points on the corners and four edges that is subject to folding1 We call A B Cand D the points on the corner Some intersections of lines may not fit on the square paper

1We could take O to be any convex polygon that can be constructed from a square sheet of paper Howeverthis could be an unnecessary generalization in our study

51

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

As we want to work with these points we consider O to be a sufficiently large (bounded) 2Dplane so that all the points and lines of interest are on O Huzita observed that the degreeof freedom of paper fold by fold lines can be made finite by specifying how certain points andlines are superposed Then he gave the following operations (O1) sim (O6) which serve as basicoperations in the geometrical construction of origamis Operation (O7) was added later byJustin [6] We call collectively (O1) sim (O7) Huzitarsquos fold operations

(O1) Given two distinct points P and Q fold O along the unique line that passes through Pand Q

(O2) Given two distinct points P and Q fold O along the unique line to superpose P and Q

(O3) Given two distinct lines m and n fold O along a line to superpose m and n

(O4) Given a line m and a point P fold O along the unique line passing through P to superposem onto itself

(O5) Given a line m a point P not on m and a point Q fold O along a line passing throughQ to superpose P and m

(O6) Given two lines m and n a point P not on m and a point Q not on n where m and n aredistinct or P and Q are distinct fold O along a line to superpose P and m and Q and n

(O7) Given two linesm and n and a point P not onm fold O along the unique line to superposeP and m and n onto itself

We note that the above statements are slightly different from the original ones To formalizethe above statements with the view to rigorous geometrical construction we restate Huzitarsquosoperations by carefully adding and removing side conditions of degeneracy and incidence [7]In essence treating origamis with a program requires rigorous specification of these operations

Huzitarsquos fold operations determine fold lines by specifying superpositions of constructedpoints and lines In Eos these specifications are formulas in a language of many-sorted first-order predicate logic By the algebraic interpretation of the formulas we derive polynomialequalities The problem of finding fold line(s) is therefore reduced to solving constraints ex-pressed in multi-variate polynomials of degree 3 over the field of origami constructible numbers[8 5]

32 Extensions

The contribution of Huzitarsquos fold operations is powerful enough to perform relevant geometri-cal constructions by way of solving algebraic equations of degree up to 3 Examples of suchconstructions are trisecting an arbitrary angle constructing a regular heptagon etc Somestudies have explored possible extensions of Huzitarsquos fold operations in an attempt to increasethe power of paper folding ie to solve higher degree equations

Alperin and Lang proposed multi-fold method where the origami is folded along more thanone fold line simultaneously [9] The idea is to find fold lines that are mutually dependentThe multi-fold construction allows solving higher degree equations We presented a construc-tion method of angle trisection using 2-fold operation [5] and angle quintisection using 4-foldoperation [10] Although the p-fold method generates an arbitrarily high degree polynomialaccurately folding an origami by p lines simultaneously would be difficult to do by hand evenfor p = 2

52

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

Folding polygonal knots has been traditionally used in Japan For example folding a broadsash for a kimono by a pentagon is a common practice of daily life However it is unknownwhen the knot fold was first mathematically studied The earliest contributions of which weare aware are those of Cundy and Rollett [11] Brunton [12] and Sakaguchi [13] Cundy andRollett showed models of knots that make some regular polygons Brunton elaborated themathematical study of the knot fold and showed that the number of necessary knots dependson the number of the edges of the polygon

4 Knot Fold

In order to determine the geometrical constraints of knot fold we first analyze key geometricalproperties of a knot

41 Geometrical Properties

(a) (b) (c)

Figure 1 Knot-fold of regular pentagon FEIHG

Let us examine the operation of knotting in Fig 1 We make one simple knot by tyingtogether the two ends of the origami tape in Fig 1(a) Note that we use a rectangular shapeof an origami When the height of the tape ie |AD| and |BC| is infinitesimal and both endsof the paper are connected the tape becomes a curve ie an object of study in knot theoryThe knot with 3 crossings is the most basic one in knot theory When we bring the height backto the original without distorting the tape except for folds we obtain the polygonal knot Awell fastened and well flattened knot becomes a polygonal shape as depicted in Fig 1(c) Theobtained polygonal shape exhibits a regular pentagonal form As it is inferred from the knottheory making the knot in Fig 1(c) requires 3 folds along the lines m n and t that extend theedges FE GH and IEn respectively2 The knot K = 〈mn t〉 is the one in Fig 1(c)

When the knot is entirely unfolded we obtain the tape with the creases and the generatedpoints as shown in Fig 2 We note the following geometrical properties The vertices E H andI are lined up on the edge CD whereas vertices F and G are incident to the edge AB The foldalong m passes through F and superposes point H and line AB Point E is the intersectionof m and CD Similarly the fold line n passes through G and the fold along n superposespoint E and line AB Point H is the intersection of n and CD Note that fold lines m and nare mutually defined The fold is a 2-fold operation where m and n are defined simultaneouslyLine t can be determined by applying operation (O5) of Huzitarsquos fold operation set Namely

2Recall that En is the reflection point of E across line n as defined in Sect 2

53

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

Figure 2 Unknotted tape

line t passes through I and superposes G and CD Note that the parameters of (O5) points IG and line CD are considered with respect to the configuration before the fold Refer to Fig 2The origami after the the 2-fold (ie along m and n) is shown in Fig 1(b) The purposes ofthe fold along t is first to construct the vertex I and second to fasten and lock the knot

A purely geometrical proof that the knot fold creates a regular polygon is sketched in [14]In the following we present a formal and automated algebraic proof that uses properties of theoperation of folding such as preservation of some of distances parallelism etc

42 Geometrical Constraint Solving Approach

The question now becomes how to determine the fold lines m n and t such that the knot isa regular pentagon The proof that the knot fold gives rise to regular pentagons shows thateach of the fold line makes angles 2α = 2π

5 with the edges [14] where α = ∡GEH = ∡EHF In origami geometry construction of angles using Huzitarsquos fold operations is not trivial Theproblem of constructing angles is boiled down to a sequence of fold steps which makes theconstruction tedious where the number of intermediate points and lines is prone to increaseFurthermore not all angles are constructible by Huzitarsquos fold operations The construction ofa regular 11-gon whose interior angles are equal to 9π

11 is shown to be impossible by Huzitarsquosfold operations [15] Hence we carefully choose a specification of the knot fold that couldbe extended towards the construction of regular n-gons where n ge 7 We are led to avoidconstruction of angles in order to solve the knot fold construction problem We consider theknot fold construction as a geometrical constraint solving problem without use of angles

Example Regular pentagon

Our method of constructing a regular pentagon by the knot fold uses a multi-fold togetherwith Huzitarsquos fold operations We consider the example in Fig 1 where we make a knotK = 〈mn t〉 We try to define the geometrical properties of K in a systematic way so thatwe can generalize it to the knot fold of regular n-gons where n ge 7 We observe the followinggeometrical properties on m n t E F G H and I

bull Points E and F are incident to mbull Points G and H are incident to nbull Points E H and I are incident to CDbull Points F and G are incident to ABbull The fold line m superposes H and AB ie Hm isin ABbull The fold line n superposes E and AB ie En isin ABbull The fold line t passes through I and superposes G and CD ie I isin t and Gt isin CDbull The distances |EF | |FG| and |GH| are equal

54

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

The above properties are described by the following first order logical formula φK

φK equiv existmn t isin L existEFGH I isin Π

EF sub m and GH sub n and EH I sub CD and FG sub ABand

Hm isin AB and En isin AB and I isin t andGt isin CD and |EF | = |FG| = |GH|

(1)

We used Eos to construct the regular pentagon in Fig 1 It is possible to determine t indepen-dently from m and n We consider the formula (2) that defines the 2-fold operation to solvelines m and n first

φprimeK equiv existmn isin L existEFGH isin Π

EF sub m and GH sub n and EH sub CD and FG sub ABand

Hm isin AB and En isin AB and |EF | = |FG| = |GH|

(2)

The fold line t is obtained by applying operation (O5) Namely line t passes through pointI and superposes point H and line AB

We can prove automatically that the generated shape is a regular pentagon based on Grobnerbases theory We will omit the proof of the correctness of the pentagon knot construction Inthe next sections we will discuss the construction and the proof of a regular heptagon by theknot fold in details

5 Regular Heptagon by the Knot Fold

Brunton studied the construction of regular n-gons where n ge 3 [12] He showed that the

number of necessary knots is Φ(n)2 minus 1 in order to construct a regular n-gon where Φ(n) is

Eulerrsquos totient function Hence to construct a regular heptagon we perform 2 knots K1 andK2 We explained in Sect 4 that a knot can be decomposed into 3-fold operations along threefold lines In the case of regular heptagon we need 5 fold lines m n t u and v whereK1 = 〈mn t〉 and K2 = 〈v um〉 Let EKJIHGF be the constructed regular heptagonFigure 3 exhibits the vertices of the regular heptagon after unfolding K1 and K2 The foldlines are extensions of edges of EKJIHGF as follows Lines m n and t are the extension ofsegment EF IJ and GFn respectively Lines v and u are extensions of segments KEu andHIm respectively Figure 4 shows a sketch of a regular heptagon with the lines m n t u andv

51 Geometrical Constraints

Figure 3 Unfolded regular heptagon EKJIHGF

Lines m and n of the knot K1 = 〈mn t〉 are defined by the following properties on m n tE F I J G and H

55

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

tn

mu

vE

F

G

H

I

J

K

Figure 4 Sketch of a regular heptagon EKJIHGF and lines m n t u and v

bull Points E and F are incident to mbull Points I and J are incident to nbull Points E and J are incident to CDbull Points F I G and H are incident to ABbull The fold line m superposes I and CD ie Im isin CDbull The fold line n superposes F and CD ie Fn isin CDbull The distances |EF | |IJ | |FGn| |IHm| and |GnHm| are equal3

We write formula φK1in a similar fashion to the formula (1)

φK1equiv existmn t isin L existEF I JGH isin Π

EF sub m and I J sub n and F IGH sub AB and E J sub CDand

Im isin CD and Fn isin CD andG isin t and J t isin ABand

|EF | = |IJ | = |FGn| = |IHm| = |GnHm|

(3)

Similarly to our discussion in Sect 42 line t can be constructed independently from lines mand n We therefore can separate the construction t and use φprime

K1in (4) to solve for m and n

first

φprimeK1

equiv existmn existEF I JGH isin Π

EF sub m and I J sub n and F IGH sub AB and E J sub CDand

Im isin CD and Fn isin CDand

|EF | = |IJ | = |FGn| = |IHm| = |GnHm|

(4)

Knot K2 = 〈v um〉 is defined by the following properties on v u m K X H Y Z and F bull Points K and X are on vbull Points H and Y are on ubull Points K and Y are on CDbull Points Z H F and X are on ABbull The fold line v superposes H and CD ie Hv isin CD

3Refering to Fig 3 distances |GFn| and |FGn| are equal due to the fact that reflection across line n preservesthe distances Similarly distances |HIm| and |IHm| are equal

56

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

bull The fold line u superposes X and CD ie Xu isin CDbull The fold line m passes through F and superposes Y and AB ie Y m isin ABbull The distances |KX| |HY | |XFu| |HZv| and |FuZv| are equal

φK2equiv existv um isin L existKXH Y Z F isin Π

KX sub v and HY sub u and KY sub CD and XHZ F sub ABand

Hv isin CD andXu isin CD and F isin m and Y m isin ABand

|KX| = |HY | = |XFu| = |HZv| = |FuZv|

(5)

However referring to Fig 3 points X Y and Z are equal to points Eu Im and ((((Gn)m)u)v)From formula φprime

K1 E I and G are obtained It is possible to determine the fold lines that

make K2 in an easier way than solving constraints in formula (5) as we explain in the nextsub-section

52 Construction by Eos

We first assume that the initial origami is a rectangle ABCD We work with the Cartesiancoordinate system and the coordinates of points A B C and D are (0 0) (wd 0) (wd ht)and (0 ht) respectively The width wd and the height ht can be taken arbitrary Of coursewd is sufficiently larger than ht so that the knot construction is feasible For concreteness ofour presentation using Eos we set wd = 900 and ht = 60 Furthermore let E be an arbitrarybut fixed point on segment CD Let the coordinates of E be (400 ht) for simplicity and clarityof the construction Our objective is to construct a regular heptagon EKJIHGF by the knotfold Recall that the construction requires a 2-fold operation prior to Huzitarsquos fold operations(see Sect 41) The first folding step is the crucial one ie the 2-fold operation

In Eos Huzitarsquos fold operations can be performed using function HO The extension to themulti-fold is natural as HO is implemented with the generality that allows the specification oflogical formulas describing the multi-fold Multi-fold is realized by the call of the followingMathematica function

HO [ H Constraint rarr φ ]

H is a list of points on the origami which determine the faces to be moved φ is a formula in thefirst-order predicate logic The formula φ specifies the constraints that the geometrical objectsconcerned have to satisfy In our example the geometrical constraints that specify the 2-foldoperation are expressed by formula φprime

K1in (4) We write φprime

K1in the language of Eos and call

HO as follows

HO[C A Constraint rarr existmmLineexistnnLineexistff PointexistiiPointexistjjPointexistggPointexisthhPoint

(E f sub m and i j sub n and f i g h sub AB and j isin CDand

im isin CD and fn isin CDand

SqDistance[E f ] == SqDistance[i j] == SqDistance[f gn] ==

SqDistance[i hm] == SqDistance[gn hm])]

(6)

The term SqDistance[XY ] is the square of the distance between X and Y (ie |XY |2)Notations like ldquoexistmmLinerdquo ldquoE f sub mrdquo ldquoimrdquo ldquoim isin CDrdquo are Eos extension of Mathematicasyntax

The evaluation of (6) generates 24 distinct cases of possible configurations of points F GH I and J and lines m and n We deduce that the algebraic interpretation of the constraintsas defined by φprime

K1 is a well constrained system of equations since we obtained finite number of

solutions However not all of the 24 cases are relevant to our construction problem They may

57

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

(a) Case 1 (b) Case 2

(c) Case 3 (d) Case 4

(e) Case 5 (f) Case 6

Figure 5 6 possible cases for lines m and n

correspond to degenerate cases that lead to failure of the proof by Grobner bases In order toeliminate the degenerate cases and also to get a reasonable number of cases we further narrowthe search space of the configuration of points and lines For that we add the following extraconstraints

E isin nandj isin mandSqDistance[E i] == SqDistance[j f ] == SqDistance[E h] == SqDistance[j g]

The sub-formula E isin n and j isin m eliminates the degenerate cases where E and j are equalSub-formula SqDistance[E i] == SqDistance[j f ] == SqDistance[E h] == SqDistance[j g]specifies further conditions on points E F G H I and J We evaluate the following HO call

HO[C A Constraint rarr existmmLineexistnnLineexistff PointexistiiPointexistjjPointexistggPointexisthhPoint

(E f sub m and i j sub n and f i g h sub AB and j isin CDand

im isin CD and fn isin CD and

SqDistance[E f ] == SqDistance[i j] == SqDistance[f gn] ==

SqDistance[i hm] == SqDistance[gn hm]and

E isin n and j isin m and SqDistance[E i] == SqDistance[j f ] == SqDistance[E h] == SqDistance[j g])

MarkPointAt rarr F I J G H]

(7)

Consequently we obtain 6 cases as shown in Fig 5 Two of them namely those in Fig 5(a) andin Fig 5(f) lead to the construction of a regular heptagon Eos allows the user to interactivelychoose the suitable case to proceed with the construction Keyword MarkPointAt tells the Eoshow to label the existentially quantified points f i j g and h The outcome of folding in thecase 6 is shown in Fig 6

Next we apply two operations (O1) to fold along the line FGn and IHm in Fig 6 by callingHO with suitable arguments The lines FGn and IHm are the fold lines t and u respectivelyThe results are shown in Fig 7(a) and 7(b) Finally given the origami of Fig 7(b) we constructthe remaining vertex K We apply operation (O6) to obtain v which brings H and G onto ICand HB respectively Point K is the intersection of IC and line v We obtain the heptagonEKJIHGF in Fig 7(c)

58

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

Figure 6 Step 1 Folds along lines m and n

53 Algebraic Interpretation

This algebraic interpretation is used to ldquoevaluaterdquo the function calls of HO as well as the auto-mated proof of the correctness of the construction We take HO in (7) as an example To obtaingeometrical objects m n F G H I and J the formula in (7) is transformed into a set ofalgebraic equalities Further details of the algebraic interpretation are explained in [8] and [5]

Let the coordinates of A B D and E be (0 0) (900 0) (0 60) and (400 60) respectivelyFor an atomic formula φ let [[φ]] denote the set of polynomial relations that are the algebraicmeaning of φ An atomic formula is interpreted as a set of polynomial relations (equalities orinequalities) and a term is given as a rational function The set of (non-simplified) polynomialequalities (8) ndash (14) is the algebraic interpretation of formula in (7)

400a5+ 60b6+ c7 == 0 c7+ a5x11+ b6y12 == 0 c10+ a8x13+ b9y14 == 0

c10+ a8x15+ b9y16 == 0minus900y12 == 0minus900y14 == 0

minus900y20 == 0minus900y18 == 0minus54000 + 900y16 == 0 (8)

minus54000 +900

(

minus2b6(c7+ a5x13) + a52y14minus b62y14)

a52 + b62== 0 (9)

minus54000 +900

(

minus2b9(c10+ a8x11) + a82y12minus b92y12)

a82 + b92== 0 (10)

(400minus x11)2 + (60minus y12)2 == (x13minus x15)2 + (y14minus y16)2 ==(

y12minusminus2b9(c10+ a8x17) + a82y18minus b92y18

a82 + b92

)2

+

(

x11minusminusa82x17+ b92x17minus 2a8(c10+ b9y18)

a82 + b92

)2

==

(

y14minusminus2b6(c7+ a5x19) + a52y20minus b62y20

a52 + b62

)2

+

(

x13minusminusa52x19+ b62x19minus 2a5(c7+ b6y20)

a52 + b62

)2

==

(

minus2b9(c10+ a8x17) + a82y18minus b92y18

a82 + b92minus

minus2b6(c7+ a5x19) + a52y20minus b62y20

a52 + b62

)2

+

(

minusa82x17+ b92x17minus 2a8(c10+ b9y18)

a82 + b92minus

minusa52x19+ b62x19minus 2a5(c7+ b6y20)

a52 + b62

)2

(11)

59

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

400a8+ 60b9+ c10 6= 0 c7+ a5x15+ b6y16 6= 0 (12)

(minus400 + x13)2 + (minus60 + y14)2 ==

(x11minus x15)2 + (y12minus y16)2 == (minus400 + x19)2 + (minus60 + y20)2 ==

(x15minus x17)2 + (y16minus y18)2 (13)

(minus1 + b9)b9 == 0 (minus1 + a8)(minus1 + b9) == 0 1 + a82 6= 0 (minus1 + b6)b6 == 0

(minus1 + a5)(minus1 + b6) == 0 1 + a52 6= 0 (14)

A line a x + b y + c = 0 is represented by (a b c) together with the constraint (minus1 + b)b =0 and (minus1 + a)(minus1 + b) = 0 and a2 + 1 6= 0 Lines m and n are represented by (a5 b6 c7) and(a8 b9 c10) respectively Hence we have the equalities and disequalities in (14)

The equalities in (8) are the algebraic interpretation of the sub-formula E f sub mandi j subnand f i g h sub AB and j isin CD The first equation 400a5+ 60b6+ c7 == 0 means that point Eat (400 60) is incident to m defined by the equation a5x+ b6y + c7 = 0 Similarly the rest ofthe equations in (8) are interpretations of f at (x11 y12) is on m i at (x13 y14) is on n j at(x15 y16) is on n f is on AB i is on AB h at (x19 y20) is on AB g at (x17 y18) is on ABand j is on CD respectively

The reflection of point i at (x13 y14) across line m is the point im whose coordinates are

(minusa52x13 + b62x13minus 2a5(c7 + b6y14)

a52 + b62minus2b6(c7 + a5x13) + a52y14minus b62y14

a52 + b62)

Equation (9) states that im is incident to CD represented by (0 1 -60) Similarly equation(10) is the algebraic interpretation of fn isin CD Eos transforms rational form p

q== 0 to

p == 0 Note that in (9)ndash(11) q comes from coefficient of lines and q 6= 0 is deduced from (14)The disequalities of (12) states that the coordinates of point E and j do not satisfy the

equation of lines n and m respectively Eos changes the disequalities into equalities by addingslack variables introduced by Rabinowitch trick

Now we examine the equalities (11) and (13) [[SqDistance[E f ]==SqDistance[i j]]] givesrise to the first equality in (11) namely (400minusx11)2+(60minusy12)2 == (x13minusx15)2+(y14minusy16)2where E at (400 60) f at (x11 y12) i at (x13 y14) and j at (x15 y16) The rest of theequalities in (11) and equalities in (13) are obtained in the same way

By solving the above set of polynomial equalities for the coefficients of m and n and coor-dinates of f i j g and h we obtain the 6 cases in Fig 5

6 Proof

61 Theorem to Prove

We prove the following theorem

Theorem 61 Given the origami in Fig 7(c) we have(a) |EF | = |FG| = |GH| = |HI| = |IJ | = |JK| = |KE| and(b) ∡EOF = ∡FOG = ∡GOH = ∡HOI = ∡IOJ = ∡JOK = ∡KOE = 2π

7 where O is thecenter of EKJIHGF

Let θ = ∡EOF and α = eiθ VectorminusminusrarrFG is the rotation of

minusminusrarrEF through θ around center O

To prove the theorem 61 we show that the rotations ofminusminusrarrEF through angles 2θ 3θ 4θ 5θ and

60

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

(a) (b) (c)

Figure 7 Construction of (a) the edge GF (step 2) (b) the edge IH (step 3) and (c) vertex Kand final heptagon EKJIHG (step 4)

6θ givesminusminusrarrGH

minusrarrHI

minusrarrIJ

minusminusrarrJK and

minusminusrarrKE respectively and furthermore that θ = 2π

7 We show thatafter the construction the following holds

forallα isin C (αminusminusrarrEF minus

minusminusrarrFG = 0 rArr

α2minusminusrarrEF minusminusminusrarrGH = 0 and α3minusminusrarrEF minus

minusrarrHI = 0 and α4minusminusrarrEF minus

minusrarrIJ = 0and

α5minusminusrarrEF minusminusminusrarrJK = 0 and α6minusminusrarrEF minus

minusminusrarrKE = 0 and α7 minus 1 = 0)

(15)

Let P be the geometrical constraints accumulated during the construction Let C equiv forallα isinC (C1 rArr C2 and C3 and C4 and C5 and C6 and C7) be the formula (15) P and C form the premise andconclusion of the proposition (16) that we want to prove

P rArr forallα isin C (C1 rArr C2 and C3 and C4 and C5 and C6 and C7) (16)

Formula (16) is semantically equivalent to the conjunctions of the formulas (17)ndash(22)

P rArr forallα isin C (C1 rArr C2) (17)

P rArr forallα isin C (C1 rArr C3) (18)

P rArr forallα isin C (C1 rArr C4) (19)

P rArr forallα isin C (C1 rArr C5) (20)

P rArr forallα isin C (C1 rArr C6) (21)

P rArr forallα isin C (C1 rArr C7) (22)

62 Proof by Eos

We show how the validity of (17) is proved and the rest is achieved in a similar way We addthe conclusion forallα isin C C1 rArr C2 by calling Eos function Goal as follows

Goal[forallααisinComplexes(VectorToComplex[αminusminusrarrEF minus

minusminusrarrFG]==0 rArr

(VectorToComplex[α2minusminusrarrEF minusminusminusrarrGH]==0))]

(23)

Expressions C1 equiv αminusminusrarrEF minus

minusminusrarrFG = 0 and C2 equiv α2minusminusrarrEF minus

minusminusrarrGH = 0 written in the language of

Eos are VectorToComplex[αminusminusrarrEF minus

minusminusrarrFG] and VectorToComplex[α2minusminusrarrEF minus

minusminusrarrGH]==0 respectively

61

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

Function Goal adds the negation of the conclusion to the premise By calling Goal we obtainP and not(forallα isin C (C1 rArr C2)) In order to translate P and not(forallα isin C (C1 rArr C2)) into algebraic formwe fix the coordinate system to be Cartesian with points A B C D and E as follows

map = DefMapping[A Point[0-wd]B Point[wd0]

C Point[wd ht] D Point[0 ht] E Point[0 ht] ]amp(24)

Without loss of generality we set the size of the initial origami to be 2wdtimesht where the widthwd is taken to be arbitrary and the height ht is equal to 1 The point E is fixed at location(0 ht) Finally we check whether the reduced Grobner basis of the algebraic interpretation ofP and not(forallα isin C (C1 rArr C2)) is 1 by calling function Prove

Prove[ldquoKnot Heptagonrdquo Mapping rarr map GroebnerBasis rarr

CoefficientDomain rarr RationalFunctions

MonomialOrder rarr DegreeReverseLexicographic]

(25)

The above call of function Prove tells Eos to compute Grobner basis of the polynomial set[[P and not(forallα isin C (C1 rArr C2))]] Let V be the set of variables in [[P and not(forallα isin C (C1 rArr C2))]] TheGrobner basis computation is carried out in the domain of polynomials whose variables are inV wd and whose coefficients are in functions of Q(wd) Eos computes Grobner basis andgenerates a proof document (whose title is given by the first argument of the call of Prove) [16]

63 Proof Results

The proofs of (17)ndash(22) are successful The CPU time used for Grobner basis computation onMac OS X (Intel Core i7 8G 24GHz) machine varies from 69236984 seconds (for proving (17))to 1994889588 seconds (for proving (20))

7 Conclusion

We presented the construction of a regular heptagon using the knot fold Our method consistsin applying 2-fold operation coupled with Huzitarsquos fold operations The fold lines that makethe knot fold are determined by solving geometrical constraints We further showed the proofof the correctness of the construction of a regular heptagon based on Grobner bases

Note that using Huzitarsquos fold operations (O1) sim (O7) a regular heptagon is constructibleWith Eos we need 9 Huzitarsquos fold operations and more than 10 auxiliary operations such asunfolding and marking supporting points Further investigation of the geometrical constraintsby the knot fold is required to construct regular 11-gon which is impossible by Huzitarsquos foldoperations

Another issue that should be investigated in the future research is the rigidity of the knotfold We need to define the notion of rigidity in mathematical terms in this knot fold as wellas in more general origami that may involve 3D constructions

71 Acknowledgments

We thank Stephen Watt of Western Ontario University for drawing our attention to the knotfold This work is supported by JSPS KAKENHI Grant No 25330007 The first author of thispaper is supported by a postdoctoral fellowship at Kwansei Gakuin University

62

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

References

[1] D S Kasir The Algebra of Omar Khayyam (English translation of Khayyamrsquos original workAl-Jabr Wrsquoal Muqabalah) Teachers College Press 1931

[2] P L Wantzel Recherches sur les moyens de connaıtre si un probleme de geometrie peut se resoudreavec la regle et le compas Journal de Mathematiques Pures et Appliquees pages 366ndash372 1837

[3] H Huzita Axiomatic Development of Origami Geometry In Proceedings of the First InternationalMeeting of Origami Science and Technology pages 143ndash158 1989

[4] R C Alperin A Mathematical Theory of Origami Constructions and Numbers New York Journalof Mathematics 6119ndash133 2000

[5] T Ida A Kasem F Ghourabi and H Takahashi Morleyrsquos Theorem Revisited Origami Con-struction and Automated Proof Journal of Symbolic Computation 46(5)571 ndash 583 2011

[6] J Justin Resolution par le pliage de lrsquoequation du troisieme degre et applications geometriques InProceedings of the First International Meeting of Origami Science and Technology pages 251ndash2611989

[7] F Ghourabi A Kasem and C Kaliszyk Algebraic Analysis of Huzitarsquos Origami Operations andtheir Extensions In Automated Deduction in Geometry LNAILNCS Springer 2013 (to appear)

[8] F Ghourabi T Ida H Takahashi M Marin and A Kasem Logical and Algebraic View ofHuzitarsquos Origami Axioms with Applications to Computational Origami In Proceedings of the22nd ACM Symposium on Applied Computing (SACrsquo07) pages 767ndash772 Seoul Korea 2007

[9] R C Alperin and R J Lang One- Two and Multi-fold Origami Axioms In Origami4 Pro-ceedings of the Fourth International Meeting of Origami Science Mathematics and Education(4OSME) pages 371ndash393 2009

[10] F Ghourabi T Ida and H Takahashi Computational Origami of Angle Quintisection InProceedings of the Workshop in Symbolic Computation in Software Science (SCSS2008) RISCTechnical Report Series 08-08 pages 57ndash68 2008

[11] H M Cundy and A P Rollett Mathematical Models Oxford University Press 1961

[12] J K Brunton Polygonal Knots The Mathematical Gazette 45(354)299ndash301 1961

[13] K Sakaguchi On Polygons Made by Knotting Slips of Paper Technical Report of ResearchInstitute of Education Nara University of Education 1855ndash58 1982

[14] J Maekawa Introduction of the study of knot tape In Origami5 Proceedings of the FourthInternational Meeting of Origami Science Mathematics and Education (5OSME) pages 395ndash403 2011

[15] D A Cox Galois Theory Wiley-Interscience 2004

[16] F Ghourabi T Ida and A Kasem Proof Documents for Automated Origami Theorem ProvingIn Automated Deduction in Geometry volume 6877 of LNCS pages 78ndash97 Springer 2011

63

Automated Verification of Equivalence on

Quantum Cryptographic Protocols

Takahiro Kubota1 Yoshihiko Kakutani1 Go Kato2

Yasuhito Kawano2 and Hideki Sakurada2

1 The University of Tokyo Tokyo Japantakahirok11 30kakutaniissu-tokyoacjp

2 NTT Communication Science Laboratories Kanagawa Japankatogokawanoyasuhitosakuradahidekilabnttcojp

Abstract

It is recognized that security verification of cryptographic protocols tends to be difficultand in fact some flaws on protocol designs or security proofs were found after they had beenpresented The use of formal methods is a way to deal with such complexity Especiallyprocess calculi are suitable to describe parallel systems Bisimilarity which denotes thattwo processes behave indistinguishably from the outside is a key notion in process calculiHowever by-hand verification of bisimilarity is often tedious when the processes have manylong branches in their transitions We developed a software tool to automatically verifybisimulation relation in a quantum process calculus qCCS and applied it to Shor andPreskillrsquos security proof of BB84 The tool succeeds to verify the equivalence of BB84 andan EDP-based protocol which are discussed in their proof

1 Introduction

Security proofs of cryptographic protocols tend to be complex and difficult to verify Thisfact has been recognized in the classical cryptography and there is a line of researches to dealwith the complexity of verification [1 2] Since by-hand proofs are prone to human error andtime consumption efforts have been put into automating security proofs and verification in theclassical cryptography Security proofs are also complex in the quantum cryptography where wemust also consider attacks using entanglements The first security proof of BB84 quantum keydistribution (QKD) protocol by Mayers [3] is about 50 pages long After that paper researchershave been seeking simpler proofs [4 5] Since QKD is one of the closest application to practicein the quantum information field it is important to examine QKD systemsrsquo security formallyand make it machine-checkable

There are several formal frameworks for quantum protocols Feng et al developed a processcalculus qCCS [6] In this calculus a protocol is formalized as a configuration A configurationis a pair of a process and a quantum state corresponding to quantum variables Weak openbisimulation relation on qCCS configurations is defined Weakly open bisimilar configurationshave the same transitions up to internal ones and reveal the identical quantum states to theoutsider (adversary) in each step The relation is proven to be closed by parallel composition ofprocesses A use case of a process calculus for formal verification is to prove weak bisimilarityof implementation and specification described as configurations qCCS has been applied toquantum teleportation superdense coding and BB84 protocols

To extend application of formal methods to security proofs we applied qCCS to Shor andPreskillrsquos security proof of BB84 [4] in the previous paper [7] In Shor and Preskillrsquos securityproof security of BB84 is proven to be equivalent to that of another protocol based on anentanglement distillation protocol (EDP) and then the latter is proven to be secure We

64

Automated Verification of Equivalence on Quantum Cryptographic Protocols Kubota et al

formalized BB84 and the EDP-based protocol as configurations and proved their bisimilarityby hand However by-hand verification of bisimilarity is often tedious when configurationshave many long branches in their transitions In this paper we present a software tool to verifybisimilarity of given two qCCS configurations There are two main contributions of our work

First we implemented a software tool that formally verifies bisimilarity of qCCS configu-rations without recursive structures A protocol possibly takes security parameters for variouspurposes As for BB84 it takes two parameters one determines the length of qubits whichAlice sends to Bob in the first quantum communication and the other is for tolerated error-ratein the eavesdropping detection step Such parameters are passed to the verifier as symbols andare interpreted appropriately In our verifierrsquos framework quantum states and operations aredescribed as symbols Since attacks from the adversary are also treated as symbols our verifiercan deal with unspecified attacks To examine the behavioural equivalence adversaryrsquos viewsdenoted by partial traces must be checked to be equal in each step of a protocol The verifierautomatically checks the equality using user-defined equations

Second we applied our verifier to Shor and Preskillrsquos security proof of BB84 [4] The verifiertakes as input two configurations denoting BB84 and the EDP-based protocol and equationsabout the properties of error-correcting codes and measurement of the halves of EPR pairsThe verifier succeeds to verify the bisimilarity of the configurations of the two protocols

The package of the verifier is available from httphagiissu-tokyoacjp~tkqccs

verifiertargz It includes a user manual and and example scripts in the folders doc andscriptsRelated Work The authors of qCCS presented the notion of symbolic bisimulation for quan-tum processes [8] A purpose is to verify bisimilarity algorithmically They proved the strong(internal actions should be simulated) symbolic bisimilarity is equivalent to the strong openbisimilarity and actually presented an algorithm to verify symbolic ground (outsiders do notperform quantum operations adaptively) bisimilarity Since our purpose is to apply a pro-cess calculus to security proofs where adversarial interference must be taken into account weimplemented a tool that verifies weak open bisimilarity on the basis of the original qCCS [6]

2 The Verifier

Formal Framework The verifier employs a sublanguage of qCCS where the syntax of recur-sion and the use of classical data are restricted The framework is still expressive because ourtarget protocols do not need recursion and classical probability distributions can be representedas quantum states denoted by diagonal operators The syntax of the processes in the verifier isas follows

P = discard(q) | cqP | cqP | meas b then P saem | op[q]P | P ||P | PL

Intuitively discard(q)means termination of a process keeping a sequence of quantum variablesq secret cqP sends a quantum variable q to a channel c and then executes P cqP receivesquantum data to a variable q from a channel c and then executes P meas b then P saem

measures a quantum bit b and executes P if the outcome is 0 or terminates if the outcome is1 op[q]P performs a superoperator op to quantum variables q and then executes P P ||P prime

executes P and P prime in parallel PL where L is a set of channels executes P keeping channelsin L private Let qv(P ) be the set of quantum variables that occur in a process P cqP meas b then P saem op[q]P and P ||P prime are defined only if q isin qv(P ) b isin qv(P ) q sub qv(P )and qv(P ) cap qv(P prime) = empty respectively In our verifier each quantum variable is defined with its

65

Automated Verification of Equivalence on Quantum Cryptographic Protocols Kubota et al

qubit-length that is indicated by a natural number symbol declared beforehand The adoptionof natural number symbols is important to treat security parameters in the verifier Quantumstates are represented as character strings called environments The syntax of the environmentsis given as follows

ρ = X[q] | op[q](ρ) | ρ ρ | proji[b](ρ) | Tr[q](ρ)

Let qv(ρ) be the set of quantum variables that occur in an environment ρ X[q] meansthat quantum variables q are in a quantum state X op[q](ρ) is a quantum state after theapplication of operation op to quantum variables q in an environment ρ ρ ρprime represents thetensor product of ρ and ρprime but ρ ρprime and ρprime ρ are identified in the verifier ρ ρprime is definedonly if qv(ρ) cap qv(ρprime) = empty proji[b](ρ) means the reduced density operator |i〉〈i|bρ|i〉〈i|b withi isin 0 1 Tr[q](ρ) means the partial trace of ρ by q We call a pair 〈P ρ〉 of a process Pand an environment ρ a configuration only if qv(P ) sub qv(ρ) because quantum states of qubitsoccurring in P must be defined in ρ For example an agent that sends the halves of n EPR pairsto the outside is formalized as a configuration 〈cqdiscard(r) EPR[qr]ANY[s]〉 where thequantum variables q r are of the qubit length n and the quantum variable s is defined with anarbitrary qubit-length EPR[qr] is interpreted to (|00〉〈00|+ |00〉〈11|+ |11〉〈00|+ |11〉〈11|)otimesn

qr

and ANY[s] is arbitrarily for adversaryrsquos density operatorsA labelled transition system based on the original one [6] is implemented in the verifier

Transitions are interpreted as interactions between configurations and the adversary For exam-

ple the configuration above performs a transition 〈cqdiscard(r) EPR[qr]ANY[s]〉cqminusminusrarr

〈discard(r) EPR[qr]ANY[s]〉 where the adversary can recognize that the quantum vari-able q is sent through the channel c Transitions caused by internal actions such as quantumoperations internal communications and conditional branches are labelled τ The label τ intu-itively means that the action is invisible from the outside The transition rules of conditionalbranch are 〈meas b then P saem ρ〉

τminusrarr 〈P proj0[b](ρ)〉 and 〈meas b then P saem ρ〉

τminusrarr

〈discard(qv(P )) proj1[b](ρ)〉 These may decrease the trace of the density operator de-noting a quantum state Since the trace indicates the probability to reach to a configurationwe can restore the probability from configurations to conditional branches We identify thebranches that are evoked by an identical quantum variable Eventually probability is absorbedin quantum states and excluded from the transition system

The transition system of the original qCCS is probabilistic which is caused by the mea-surement construction M [qx] in the syntax [6] It measures an observable M of a quantumvariable q and stores the result in a classical variable x There are two ways to formalize quan-tum measurement since one can be also formalized as a superoperator Because only M [qx]evokes a probabilistic branch processes with different formalization of measurement are notbisimilar in general We proposed a criteria how to select the way in our previous work [7] weshould use M [qx] if a process behaves differently according to the measurement For examplethe case where a process performs different labeled transitions is typical Otherwise we shouldformalize measurement by a superoperator In our verifierrsquos framework M [qx] cannot be writ-ten independently Instead the syntax meas b then P saem is the composition of M [qx] andthe conditional branch in the original qCCS This restriction and the conditions on quantumvariables prevent the situation where two configurations with the different ways of formalizationof measurement are not bisimilarProcedure to Check Bisimulation Weak bisimulation relation [6] is defined on qCCS con-figurations Roughly speaking weakly bisimilar configurations (1) perform identical labelledtransitions up to τ transitions and (2) reveal identical density operators whatever operations theadversary performs to her quantum variables The adversaryrsquos view is denoted by the partial

66

Automated Verification of Equivalence on Quantum Cryptographic Protocols Kubota et al

trace Tr[q](ρ) when the global quantum state is ρ and q are the quantum variables that arenot revealed to the adversary The verifier takes as input two configurations and user-definedequations on environments and returns true or false It is designed to be sound with respectto the original qCCS that is two configurations are bisimilar if the verifier returns true withthem and some valid equations This is because

Reqs = (CD) |The verifier returns true given CD and eqs

is a bisimulation relation for all valid equations eqs Precisely Reqs is converted accordinglybecause meas b then P saem is decomposed to M [bx] and a conditional branch which performsa two-step transition in the branch with x = 0 The recursive procedure to verify bisimilarityis as follows Since the transitions of the processes written in our sublanguage are finite theprocedure always terminates

1 The procedure takes as input two configurations 〈P0 ρ0〉 〈Q0 σ0〉 and user-defined equa-tions on environments

2 If P0 and Q0 can perform any τ -transitions of superoperator applications they are allperformed at this point Let 〈P ρ〉 and 〈Q σ〉 be the obtained configurations

3 Whether qv(P ) = qv(Q) is checked If it does not hold the procedure returns false

4 Whether Tr[qv(P )](ρ) = Tr[qv(Q)](σ) is checked with user-defined equations Theprocedure to check the equality of quantum states are described in the next subsectionIf it does not hold the procedure returns false

5 A new superoperator symbol E[qv(ρ)minus qv(P )] that stands for an adversarial operationis generated

6 For each 〈P prime ρprime〉 such that 〈P E[qv(ρ) minus qv(P )](ρ)〉αminusrarr 〈P prime ρprime〉 the procedure checks

whether there exists 〈Qprime σprime〉 such that 〈Q E[qv(σ) minus qv(Q)](σ)〉τlowastminusrarr

αminusrarr

τlowastminusrarr 〈Qprime σprime〉 and

the procedure returns true with the input 〈P prime ρprime〉 and 〈Qprime σprime〉 If there exists it goes tothe next step 7 Otherwise it returns false

7 For each 〈Qprime σprime〉 such that 〈Q E[qv(σ) minus qv(Q)](σ)〉αminusrarr 〈Qprime σprime〉 the procedure checks

whether there exists 〈P prime ρprime〉 such that 〈P E[qv(ρ) minus qv(P )](ρ)〉τlowastminusrarr

αminusrarr

τlowastminusrarr 〈P prime ρprime〉 and

the procedure returns true with the input 〈Qprime σprime〉 and 〈P prime ρprime〉 If there exists it returnstrue Otherwise it returns false

The step 2 prominently reduces the search space Indeed 〈op1[q]P ||op

2[r]Q ρ〉 and

〈P ||QF rop2

(E qop1

(ρ))〉 are bisimilar and F rop2

(E qop1

(ρ)) = E qop1

(F rop2

(ρ)) holds because q cap r = emptyholds Therefore superoperators that can originally cause τ transitions are disposedEquality Test of Quantum States To test the equality of given two environments the verifierchecks whether they are transformed to the same form There are two kinds of transformationstrace out and application of user-defined rules

Partial trace is significant to test the equality of quantum states For example two differentquantum states op1[q](X[q]Y[r]Z[s]) and op2[r](U[q]V[r]Z[s]) have the same par-tial trace Z[s] under Tr[qr] for arbitrary interpretation of the superoperators op1 op2 andthe quantum states X Y Z U V The verifier eliminates symbols of superoperators and quantumstates according to the partial trace rules below

Tr[q](E[r](ρ)) = Tr[q](ρ) if r sub q (1) Tr[q](ρ) = Tr[r](Tr[s](ρ)) if q = r cup s (2)

Tr[q](E[r](ρ)) = E[r](Tr[q](ρ)) if q cap r = empty (3) Tr[q](ρ lowast ρq lowast σ) = ρ lowast σ (4)

67

Automated Verification of Equivalence on Quantum Cryptographic Protocols Kubota et al

If r sub q holds Tr[q](E[r](ρ)) is rewritten to Tr[q](ρ) eliminating E[r] by the rule (1)otherwise by the rules (2) and (3) the trace-out symbol with quantum variables that are disjointto targets of superoperator goes inside of itrsquos application After eliminating superoperatorsquantum states are traced out by the rule (4)

If an objective quantum state has a part that matches to the left-hand side of a user-defined equation the part is rewritten to the right-hand side To apply a user-definedequation the verifier automatically solves commutativity of superoperators or partial tracesthat are applied to disjoint sets of quantum variables For example if the objectivequantum state is Tr[q](hadamard[s] (EPR[qr]X[s])) and a user defines an equationTr[q](EPR[qr])=Tr[q](PROB [qr]) (E1) the application goes as follows

Tr[q](hadamard[s](EPR[qr]X[s])) = hadamards[s](Tr[q](EPR[qr]X[s])) (by 5)

= hadamard[s](Tr[q](PROB[qr]X[s])) (by E1)

Since the trace-out rules may have become applicable after applications of user-defined rulesthe trace-out procedure is applied again In each opportunity to test the equality of quantumstates each user-defined equation is applied only once This guarantees whatever rules a userdefines the equality test terminates

3 Application to Shor and Preskillrsquos Security Proof

The two protocols BB84 and the EDP-based protocol [4] are formalized as qCCS configurationson the basis of our previous work [7] Readers can find the script scriptsshor-preskillscrin the package The interpretations of the symbols of the quantum states and the superoperatorsthat are used in the formalization are also included as docshor-preskill symbolspdfOn Channels As in general QKD protocols three kinds of channels are used public quantumchannels private classical channels and public no-interpolate classical channels Since thesyntax has channel restriction PL formalization of private channels is straightforward Publicno-interpolate classical channels are realized by copying the data If a quantum variable q wherea classical value is assigned is sent through a public no-interpolate channel c this is formalizedas copy[qQ]cqdQ c where Q is a new quantum variable a superoperatorcopy copies the value of q to Q and d is a new non-restricted channel q will securely sentthrough the restricted channel c and an adversary obtains the same value accessing Q througha public channel d Note that the value of q can be copied because it is classicalEquations for the Proof We defined 10 equations in the verifier Equations are interpretedto those on density operators and proven correct For example the equation below tells theverifier that the halves of EPR pairs are indistinguishable from the uniform distribution Thisis used to check that the adversaryrsquos views are identical in the EDP-based protocol and BB84before Alice in the EDP-based protocol measures her halves of the check qubits

equation E7

Tr[q1_A](EPR[q1_Aq2_A]) = Tr[q1_A](PROB[q1_Aq2_A])

end

The user-defined rule above is interpreted to an equation trq1 A(|00〉〈00|+ |00〉〈11|+ |11〉〈00|+

|11〉〈11|)otimesnq1 Aq2 A = trq1 A(|00〉〈00|+ |11〉〈11|)otimesn

q1 Aq2 A The other rules are related to CSS codespartial traces and measurement of quantum states We obtained them by formalizing theequality of quantum states that are discussed in the original proof [4]

It is actually natural to express quantum states as symbols with some equations in inputs Incryptographic protocols the dimension of quantum states and superoperators cannot be fixed

68

Automated Verification of Equivalence on Quantum Cryptographic Protocols Kubota et al

as a certain number as they depend on security parameters In addition qubits going throughpublic channels are potentially interpolated by the adversary Since arbitrary computationby the adversary must be considered it should be described as an unspecified superoperatorTherefore quantum states are difficult to be expressed as concrete matrices which can benumerically analyzed Although quantum states are treated symbolically automatic calculationof partial traces is still possible focusing on occurrence of quantum variables in environmentsExperiment Result We ran the verifier with the input of shor-preskillscr We used anote PC with Intel Core i5 CPU M 460 253GHz and 1GB memory The transition tree ofthe EDP-based protocol has 621 nodes and 165 paths and that of BB84 has 588 nodes and 165paths The verifier checked the bisimilarity of the two protocols in 1598 seconds The recursiveprocedure was called 951 times

4 Conclusions

We presented a software tool to check bisimulation of qCCS configurations and applied it to asecurity proof of BB84 [4] In security proofs equivalence on protocols is often discussed Itcan be described as bisimulation relation but it is nearly impossible to check by hand if statetransitions of processes have many long branches In addition the equality of an adversaryrsquosview between two protocols has to be checked in each step An adversaryrsquos view is calculatedfrom a global quantum states which is possibly denoted by a huge matrix The verifier doesexhausting parts of proofs of behavioral equivalence namely it checks the correspondence ofall state transitions up to invisible ones and an adversaryrsquos view up to equations On the otherhand a user only have to examine the correctness of formalization of protocols and validityof equations that he defines It could be difficult to find all appropriate equations for a proofimmediately The verifier is also able to show environments andor processes when the checkprocedure returns false With the information a user can modify equations to inputFuture WorkWe plan to define probabilistic bisimilarity which denotes that configurations be-have indistinguishably up to some probability This will be helpful to prove ldquoindistinguishabilityup to negligible probabilityrdquo of protocols It is quite common argument in the cryptography

References

[1] S Halevi A plausible approach to computer-aided cryptographic proofs Cryptology ePrint ArchiveReport 2005181 2005

[2] B Blanchet A D Jaggard A Scedrov and J-K Tsay Computationally sound mechanized proofsfor basic and public-key kerberos In Proceedings of the 2008 ACM symposium on Informationcomputer and communications security pages 87ndash99 2008

[3] D Mayers Unconditional security in quantum cryptography J ACM 48351ndash406 May 2001

[4] P W Shor and J Preskill Simple proof of security of the bb84 quantum key distribution protocolPhys Rev Lett 85(2)441ndash444 Jul 2000

[5] H-K Lo and H F Chau Unconditional security of quantum key distribution over arbitrarily longdistances Phys Rev Lett 283(5410)2050ndash2056 Mar 1999

[6] Y Deng and Y Feng Open bisimulation for quantum processes In Theoretical Computer Sciencevolume 7604 of LNCS pages 119ndash133 2012

[7] T Kubota Y Kakutani G Kato Y Kawano and H Sakurada Application of a process calculusto security proofs of quantum protocols In Proceedings of WORLDCOMPFCS2012 Jul 2012

[8] Y Feng Y Deng and M Ying Symbolic bisimulation for quantum processes arXiv preprintarXiv12023484 2012

69

A Modified Parallel F4 Algorithm for Shared

and Distributed Memory Architectures

Severin Neumann

Fakultat fur Mathematik und InformatikUniversitat Passau D-94030 Passau Germany

neumansfimuni-passaude

Abstract

In applications of symbolic computation an often required but complex procedure is findingGrobner bases for polynomial ideals Hence it is obvious to realize parallel algorithms tocompute them There are already flavours of the F4 algorithm like [4] and [13] using thespecial structure of the occurring matrices to speed up the reductions on parallel architec-tures with shared memory In this paper we start from these and present modificationsallowing efficient computations of Grobner bases on systems with distributed memory Toachieve this we concentrate on the following objectives decreasing the memory consump-tion and avoiding communication overhead We remove not required steps of the reductionsplit the columns of the matrix in blocks for distribution and review the effectiveness of theSIMPLIFY function Finally we evaluate benchmarks with up to 256 distributed threads ofan implementation being available at httpsgithubcomsvrnmparallelGBC

1 Introduction

Parallelization is one of the most used methods to improve the performance of existing softwareBut it should be introduced systematically One chooses the most time-consuming segments ofa program and tries to improve these first In applications of symbolic computation an oftenrequired but complex procedure is finding Grobner bases for polynomial ideals Therefore itis obvious to realize parallel versions of algorithms to compute them Although it is possibleto use Buchbergerrsquos algorithm [14] we favour Faugerersquos algorithm F4 [3] since the reduction isdone due to matrix transformation which is known for being well parallelizable

There are already parallel flavours of F4 like [4] and [13] using the special structure ofthe occurring matrices to speed up the reduction Both approaches have been developed formulticore and multiprocessor systems with shared memory For these systems the number ofparallel processing units is limited and currently there are not many platforms serving morethan 64 processors Compared with that clusters of several suchlike computers can have antheoretical unlimited number of processors This advantage comes with the downside of dis-tributed memory realizing algorithms requires to consider that data has to be transfered Bythat memory duplication and communication overhead are introduced

In the following we start from the mentioned developments for shared memory systemsand present modifications which will finally allow efficient computation of Grobner bases alsofor systems with distributed memory To achieve this we have concentrated on the followingobjectives reducing the memory consumption and avoiding communication overhead Weremove needless steps of the reduction split the columns of the matrix in blocks for distributionand review the effectiveness of the SIMPLIFY function

At the end we will evaluate benchmarks of an implementation using eight distributed nodeshaving 32 processor cores each The source code is available at httpsgithubcomsvrnmparallelGBC

70

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

2 Notations

In the following we will use the notation of [11] Hence K denotes a field and K[x1 xn] thepolynomial ring over K in n indeterminantes Tn is defined as the set of all terms xα1

1 middot middotxαnn

σ is a term ordering on this set For a polynomial f isin K[x1 xn] with f =summ

i=1 ci middot tiwhere ci isin K and ti isin T

n for all i we call the set Supp(f) = t1 tm support of f Thenthe leading term of f is defined as LTσ(f) = tk = maxσ(Supp(f)) and the leading coefficientis LCσ(f) = ck

Let F = f1 fs isin K[x1 xn] 0 be a set of polynomials Then I = 〈F〉 is theideal generated by F The elements of the set B = (i j) | 1 le i lt j lt s are called criticalpairs For each critical pair exists an S-polynomial Sij = 1

LCσ(fi)middot tij middot fi minus

1LCσ(fj)

middot tji middot fj

with tij =lcm(LTσ(fi)LTσ(fj))

LTσ(fi)and tji =

lcm(LTσ(fj)LTσ(fi))LTσ(fj)

The set F is a σ-Grobner basis of I if for all critical pairs the S-polynomials can be reducedto zero by the elements of F with respect to σ

If not stated otherwise we will use the degree reverse lexicographic termordering (DegRevLex)and the finite field with 32003 elements (F32003) for examples and benchmarks

3 Preliminaries

The F4 algorithm was introduced by Faugere in 1999 [3] By using the special structure ofthe matrix and column-based parallelism Faugere and Lachartre introduced a parallelizationimproving the performance remarkable [4] We have presented another modification [13] for F4speeding up the computation by row-based parallelization

In the following we give a quick summary about Grobner bases computation and the men-tioned developments For a given set of polynomials F = f1 fs isin K[x1 xn] 0generating an ideal I = 〈F〉 a σ-Grobner basis G = g1 gt isin K[x1 xn] can be com-puted using the F4 algorithm by the following four steps

1 Create and update the set of critical pairs B using Gebauerrsquos and Mollerrsquos UPDATE func-tion [6] This function guarantees that the leading terms tij middot fi = tji middot fj of the minuendand subtrahend of the S-polynomial is unique among the critical pairs

2 Select a subset of all critical pairs for reduction using the normal or the sugar cubestrategy [7] At this point the details are not relevant For our benchmarks we chose thesugar cube strategy Although we have to mention that our implementation supports thenormal strategy and for some of the polynomial systems we used as example this strategymight perform better

3 Symbolic preprocess the selected pairs to obtain a coefficient matrix representing theS-polynomials The matrix is additionally filled with rows representing reduction polyno-mials for each term which can be reduced using elements of the partial computed Grobnerbasis G The SIMPLIFY method can be applied to reuse results of previous reductions

4 Reduce the generated matrix until row-echelon form This is equivalent to top-reducingthe S-polynomials All non-zero rows of this matrix having leading terms which are notdivisible by any element of G are inserted into G As long as new elements are found thealgorithm continues with step 1

The most time-consuming step is the reduction of the coefficient matrix The mentioned par-allelizations of Lachartre and Faugere as well as our own approach concentrate on speeding

71

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

up this step We want to show how to use these improvements also for distributed parallelarchitectures therefore we have to review them

Starting after symbolic preprocessing we obtain a coefficient matrix M which has to bereduced to a row-echelon form M has n rows and m columns with m ge n and can bedecomposed in submatrices

1 Submatrices S1 and S2 arise from the subtrahends and minuends of the S-polynomialsSince the UPDATE function guarantees that all polynomials have distinct leading terms therepresenting rows have unique pivot columns Therefore S1 and S2 are upper-triangular

2 Submatrix R represents the reduction polynomials They were computed during symbolicpreprocessing For each reducible term there is only one reduction polynomial Becauseof that R is upper-triangular

3 Finally these submatrices can be split up in pivot and non-pivot columns The pivots of Rand S1 are forming the submatrix A and the non-pivots the submatrix B The submatrixS2 is split into C containing its pivots and D containing the non-pivot columns Thisnotation was introduced in [4]

The following example demonstrates the construction of a matrix occurring during Grobnerbases computations

Example 1 Let K = K32003 P = K[x1 x2 x3] and let the polynomials g1 = x21 + x2

2g2 = x1 middot x2 + x2

2 + x2 middot x3 and g3 = x22 + x2

3 + x3 form the ideal I = 〈g1 g2 g3〉 for which aGrobner basis with respect to DegRevLex should be computed Using UPDATE we get the criticalpairs (2 3) and (1 2) They have the same sugar degree sugar(g2 g3) = 3 = sugar(g1 g2) Sowe reduce the following polynomials

f12 =(x21 + x2

2) middot x2 = x21 middot x2 + x3

2

f21 =(x1 middot x2 + x22 + x2 middot x3) middot x1 = x2

1 middot x2 + x1 middot x22 + x1 middot x2 middot x3

f23 =(x1 middot x2 + x22 + x2 middot x3) middot x2 = x1 middot x

22 + x3

2 + x22 middot x3

f32 =(x22 + x2

3 + x3) middot x1 = x1 middot x22 + x1 middot x

23 + x1 middot x3

and as set of reduction polynomials we obtain

r1 =g3 middot x2 = x32 + x2 middot x

23 + x2 middot x3

r2 =g2 middot x3 = x1 middot x2 middot x3 + x22 middot x3 + x2 middot x

23

r3 =g3 middot x3 = x22 middot x3 + x3

3 + x23

At the end we get the following matrix M

f12f23r1r2r3f21f32

1 0 1 0 0 0 0 0 0 0 00 1 1 0 1 0 0 0 0 0 00 0 1 0 0 0 1 0 0 1 00 0 0 1 1 0 1 0 0 0 00 0 0 0 1 0 0 1 0 0 11 1 0 1 0 0 0 0 0 0 00 1 0 0 0 1 0 0 1 0 0

One can easily see the mentioned structure of the matrix The upper left submatrix is A andits pivots are highlighted Below is C and the non-pivot columns are forming B and D

72

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

Using this decomposition the (full) reduction of the matrix can be computed using thefollowing algorithm

1 Primary reduction Reduce B to Aminus1 middotB

2 Secondary reduction Reduce D to D minus C middotAminus1 middotB

3 Final reduction Reduce D to its reduced row-echelon form using Gaussian elimination

4 Optional reduction Reduce B using the pivots of D

Especially the primary reduction can be efficiently parallelized since the matrix is in uppertriangular form and so all pivots are known The primary and secondary reduction can becomputed in parallel because a reduced row of B can be applied independently on rows of D

After the final reduction all non-zero rows of D are elements of the Grobner basis andcan be used to compute further critical pairs Matrix (AB) does not contain any requiredelements because by construction the pivots of A are equivalent to leading terms which arealready contained in the Grobner basis Hence the fourth step is optional and only required ifSIMPLIFY is used

There are two different approaches to achieve parallelization Column-based as suggestedby Faugere and Lachatre and row-based as suggested by us Actually these two are not mu-tually exclusive and we will use this property to advance the parallelism on architectures withdistributed memory In the following we will use the row-based approach for shared memoryparallelism but one can easily see that all modifications are also applicable to the column-basedapproach of Faugere and Lachatre

4 Matrix Distribution

In the case of the matrix reduction during Grobner basis computation we have to considerhow to distribute the coefficient matrices with least duplication and communication Like anyother parallel and distributed algorithm for transforming matrices into row echelon form wecan choose between row- and column-based distribution or a combination of both

If row-based or combined distribution is chosen the algorithm scatters rows or blocks amongthe computation nodes and these need to send rows from one to each other if they are requiredfor further reductions To reduce the communication overhead this needs to use a strategywhich decides how the matrix is distributed Since we use rows-based parallelization for theshared memory level and since the column-based distribution does play well with the specialproperties of Grobner basis computations we didnrsquot analyse the effectiveness of the row-basedor combined approach

If column-based distribution is chosen the pivot matricesA and C have to be send to all nodesand the non-pivot matrices B and D can be distributed without duplication Since all pivotsare preset for primary and secondary reduction this approach does only require communicationbefore and after all reductions are done

Furthermore the matrices are sparse and by using appropriate matrix formats the commu-nication overhead can be reduced even more We chose to store the off-diagonal elements of Aand C in a coordinate list ie there is one list storing tuples of row column and value Thisformat allows reordering in parallel executable sets to improve the row-based parallelization aspresented in [13] For B and D a modified list of lists format is used storing pairs of row indexand value for each column This allows to distribute columns independently As suggested in[8 Chapter 6] the columns are distributed round-robin to optimize load balancing Afterwards

73

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

each node can use row-based parallelism on the local shared memory The following shows thedistribution of the matrix constructed in example 1

Example 2 Using two parallel nodes the matrix M of the previous example is decomposedinto one coordinate list and two lists of lists Afterwards the pivots are sent to both nodes andthe two sets of non pivot columns are distributed among the nodes Finally the two nodes areholding the following data

Node 1 Node 2

(A C)(411) (431) (201)(211) (351)(051)(151)(161)

(B D)5 (61)7 (41)9 (43)

(A C)(411) (431) (201)(211) (351)(051)(151)(161)

(B D)6 (21) (31)8 (61) -10 (41) -

Table 1 shows that the final reduction can be computed on a single node because thesubmatrix D consumes only a tiny fraction of the whole matrix One can easily check thatthis is true in general the submatrices S1 and S2 have s rows each and the submatrix R hasr rows There are p pivot columns and n non-pivot columns Hence the coefficient matrix has2 middots+r rows and p+n columns After primary and secondary reduction the final reduction onlyrequires the submatrix D which has s remaining rows and n columns Therefore all reducedcolumns can be gathered on one node which executes the Gaussian elimination on D

Polynomial System Sugar degree primary matrix final matrix ratio ()Gametwo 7 [10] 17 7731 x 5818 2671x2182 13Cyclic 8 [1] 14 3819 x 4244 612x1283 48Cyclic 9 16 70251 x 75040 4014x10605 08

Katsura 12 [9] 9 12141 x 11490 2064x2155 32Katsura 13 9 26063 x 23531 4962x4346 35Eco 12 [12] 9 12547 x 10937 2394x1269 22Eco 13 10 25707 x 24686 2883x2310 10F966 [5] 9 60274 x 63503 4823x9058 11

Table 1 Ratio of primary matrix and final matrix during reduction for selected problems

The optional reduction is an obstacle for the effectiveness of the algorithm since it requiresthat the reduced matrix D has to be distributed again to be applied on B Because of that weexamine if the optional reduction is useful at all Even more we put to test if the SIMPLIFY

method and distributed computation play well together

5 Simplifying the F4 Algorithm

Removing the optional reduction may scale down the required communication overhead andthe reduction time Even more if SIMPLIFY isnrsquot used during symbolic preprocessing the

74

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

distributed matrix has not to be gathered completely since the columns of the reduced matrixB are not required after primary and secondary reduction

Algorithm 1 SIMPLIFY

Input t isin Tn a term f isin K[x1 xn] a polynomial F isin (Fk)k=1dminus1) where Fk is

finite subset of K[x1 xn]Output a non evaluated product ie an element of Tn timesK[x1 xn]foreach u isin list of divisors of t do1

if existj(1 le j lt d) such that (u middot f) isin Fj then2

Fj is the row echelon form of Fj wrt σ 3

there exists a (unique) p isin Fj

+such that LTσ(p) = LTσ(u middot f) 4

if u 6= t then return SIMPLIFY( tu pF) else return (1 p)5

end6

end7

The SIMPLIFY method does not guarantee that a reduction is improved by reusing previousresults Actually SIMPLIFY proves it effectiveness mostly by application Hence we requirea best possible implementation of the method Algorithm 1 is a repetition of the originalSIMPLIFY [3] It leaves some details open and there are some possibilities for optimization

bull Searching through all divisors of t is time consuming regarding the fact that only somedivisors of u will satisfy the condition (u f) isin Fj for j isin (1 le j lt d)

bull To check if there exists a j with (u f) in Fj it is important how Fj is stored A naiveimplementation will require to loop over all rows of Fj until the condition is satisfied

bull This algorithm does not check if there is another jprime 6= j satisfying the condition andprovides a better replacement

To address these issues we propose the following modifications

bull All rows of F1 Fdminus1 are stored in a two-dimensional map The first key is a polynomialf and the second is a term u This allows to update (u f) if a better replacement is foundBy that only one value per pair is stored This will decrease the required memory

bull The first map should provide a fast random access to the value of key f and the secondmap should have an ordering to allow a decreasing iteration of the possible terms In thisway the search space for possible replacements is reduced to the multiples of f only

bull The value of a map element is the reduced form of f middot u

We call this data structure SimplifyDB We can provide an improved version of SIMPLIFY asshown by algorithm 2 Additionally we have to introduce a function to update the SimplifyDB

Therefore after reduction we execute algorithm 3 for each row of Fj

+ The insertion step allows

us to compare candidates for the SimplifyDB In our implementation for two candidates thebetter is the one which has less elements in its support This is equivalent to the first weightedlength function wlen(p) = Supp(p) in [2] At this point we didnrsquot try any other suggestedweighted length function

SIMPLIFY can be improved even more During symbolic preprocessing it is called twiceonce for the selected critical pair (m f) with m isin T

n and f isin G and once to create reduction

75

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

Algorithm 2 SIMPLIFY with SimplifyDB

Input t isin Tn a term f isin K[x1 xn] a polynomial SimplifyDB

Output a non evaluated product ie an element of Tn timesK[x1 xn]foreach u le t isin SimplifyDB[f ] do1

if u divides t then2

p = SimplifyDB[f ][u] 3

if u 6= t then return SIMPLIFY( tu p SimplifyDB) else return (1p) 4

end5

end6

Algorithm 3 Insertion into SimplifyDB

Input t isin Tn a term f p isin K[x1 xn] polynomials SimplifyDB

Output SimplifyDBif existu isin SimplifyDB[f ] t = u then1

Replace SimplifyDB[f ][u] with p if it is better 2

else3

SimplifyDB[f ][t] = p 4

end5

polynomials mprime middot f with mprime isin Tn and f prime isin G As one can easily see the second input parameter

is always an element of G So it stands to reason to restrict SIMPLIFY

SIMPLIFY(t i) where i is the index of gi isin G

Still there is the recursive call of SIMPLIFY taking a polynomial p as parameter which mightnot be an element of G Recall that p was found in the SimplifyDB using f and a term u = t

z

with z isin Tn With the knowledge that f = gi isin G we can write p = f middotuminus r = gi middotuminus r where

r isin K[x1 xn] is the sum of all reductions applied on f during a previous reduction stepThe recursive call is looking for another polynomial pprime which simplifies z middot p = z middot (gi middot u minus r)If such a polynomial pprime exists we can write pprime = z middot (gi middot u minus r) minus rprime = z middot u middot gi minus (z middot r minus rprime)Hence if the SimplifyDB stores pprime at index (gi z middot u) instead of (p z) the recursion is obsoleteand SIMPLIFY can be replaced with algorithm 4 being recursion free

Algorithm 4 New SIMPLIFY algorithm

Input t isin Tn a term i is the index of gi isin G SimplifyDB

Output a non evaluated product ie an element of Tn timesK[x1 xn]foreach u le t isin SimplifyDB[f ] do1

if u divides t then return ( tu SimplifyDB[f ][u]) 2

end3

Before benchmarking different variants of the distributed versions of the algorithm a firstlook at timings using only shared memory will thin out the number of combinations Forthe following computations we used a system with 48 AMD Opteron

TM

6172 cores having64 gigabyte of main memory The implementation of the parallelization for the shared memoryis presented in [13] and in its latest version it is realized using Intel Rcopy Threading Building Blocks(TBB) and Open Multi-Processing (OpenMP) for parallelization

76

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

Table 2 shows that the optional reduction is mostly useless and can be left out duringGrobner basis computation Table 3 shows that our new recursion-free SIMPLIFY is also inpractice faster and even more memory efficient

Finally SIMPLIFY is improving performance by increasing memory usage and so for solvinglarger polynomial systems it might be possible to find a solution within the bounds of availablememory by disabling SIMPLIFY Consequently we will compare computations with and withoutthe improved SIMPLIFY for the distributed parallel implementation in the following section

Polynomial systems without optional reduction with optional reductionmax matrix size runtime max matrix size runtime

Gametwo 7 7808 x 5895 2846 7731 x 5818 2985Cyclic 8 3841 x 4295 1118 3819 x 4244 1215Cyclic 9 70292 x 75080 6067 70251 x 75040 6283

Katsura 12 12142 x 11491 3449 12141 x 11490 3666Katsura 13 26063 x 23531 1522 26063 x 23531 1692Eco 12 12575 x 11349 2522 12547 x 10937 2836Eco 13 25707 x 24686 9176 25707 x 24686 1037F966 60898 x 63942 9832 60274 x 63503 1185

Table 2 Comparison of computations with and without optional reduction The new SIMPLIFY

algorithm was used in both cases

Polynomial with new SIMPLIFY with original SIMPLIFY without SIMPLIFYsystems runtime (s) memory runtime memory runtime memory

Gametwo 7 2846 459MB 2882 721MB 2997 262MBCyclic 8 1118 262MB 1443 393MB 1228 131MBCyclic 9 6067 156GB 6492 240GB 5429 210GB

Katsura 12 3449 655MB 3928 157GB 4374 328MBKatsura 13 1522 256GB 1872 727GB 2071 917MBEco 12 2522 328MB 3875 138GB 5087 262MBEco 13 9176 114GB 1364 577GB 2182 852MBF966 9832 256GB 2182 113GB 2125 125GB

Table 3 Comparison of original and new SIMPLIFY

6 Benchmarks

For the following benchmarks of our distributed implementation we used a cluster of up toeight systems having 16 Intel Rcopy Xeon Rcopy E5-2670 cores with hyperthreading and 64GB of RAMallowing us using up to 256 parallel threads For data distribution we use the Message PassingInterface (MPI) and the BoostMPI wrapper

Table 4 compares once again runtimes for computations with and without SIMPLIFY usingone two or four nodes For all polynomial input systems the computation time goes up andthe distribution has no positive effect However we accomplished to speed-up the reductiontime This is not an inconsistency The overall runtime goes up due to the communication

77

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

overhead and the possibility to improve the performance is limited to decreasing the reductiontime Hence the problem is the small size of the given polynomial systems Figure 1 illustratesthis issue for Cyclic 9

Table 5 adds further and more difficult examples Especially for Katsura 15 and Cyclic 10the distributed parallelization takes effect providing a speed-up of 23 and 27 for the overallcomputation time and 57 and 50 for the reduction using four respectively eight nodes Exclud-ing the Eco 14 system the computation is most effective without SIMPLIFY and in particularfor Cyclic 10 computations were not even possible with it due to memory overflows

Eco 14 is an counterexample because it is not possible to decrease the computation timeusing a distributed system This is caused by the effectiveness of SIMPLIFY for the probleminstance

The crashed computations for Katsura 15 and for Cyclic 10 without SIMPLIFY with twonodes are caused by a not yet solved overflow in the MPI implementation if more than 512 MBhave to be transfered in one operation This does not happen with four or eight nodes becausethe matrix size for each node decreases by factor two respectively four

At the end no distributed computation with SIMPLIFY is faster and hence it should beremoved in further developments of distributed parallel algorithms for Grobner bases compu-tations

Polynomial systems with SIMPLIFY without SIMPLIFY nodes 1 2 4 1 2 4

Gametwo 7 2985 3455 5603 2848 3853 2888(5549) (6709) (6010) (6630) (4607) (3427)

Cyclic 8 7798 1112 9520 7497 1406 2078(1327) (1707) (1953) (1332) (1473) (1168)

Cyclic 9 5060 5182 4947 3306 3617 4276(2222) (1952) (1388) (1499) (1224) (7373)

Katsura 12 4200 4636 5523 2859 3997 6685(6083) (8220) (7762) (6699) (4535) (3362)

Katsura 13 1874 1900 1864 1396 1588 1760(4046) (4661) (3682) (5003) (3107) (1815)

Eco 12 2135 2940 4149 2498 4108 8802(2564) (3760) (3953) (6458) (3664) (3097)

Eco 13 9178 1065 1209 1114 1575 2126(1210) (1632) (1462) (3865) (2310) (1467)

F966 9188 1062 1321 9360 1392 1851(2086) (2629) (2391) (3859) (2632) (1870)

Table 4 Distributed computation (and reduction) times for 12 or 4 nodes

78

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

1woS 2woS 4woS 1wS 2wS 4wS

0

100

200

300

400

500

600

Overhead

Reduction

Prepare

Update

Figure 1 Computation time in detail for Cyclic 9 with and without SIMPLIFY

Poly sys with SIMPLIFY without SIMPLIFY nodes 1 2 4 8 1 2 4 8

Katsura 14 9575 8310 7489 7448 7756 6599 6754 991(3139) (2634) (2012) 1691 (3984) (2244) (1351) (86)

Katsura 15 5719 crashed 3440 3252 5615 3857 3252 3372(2571) (-) 1272 1008 (3781) (1960) (1094) (666)

Cyclic 10 crashed crashed crashed crashed 30400 crashed 13270 11280(-) (-) (-) (-) (25240) (-) (7862) (5010)

Eco 14 5098 5194 5526 626 8005 7870 9967 1660(1106) (1177) (9802) (8938) (4113) (2240) (1277) (7824)

Table 5 Distributed computation (and reduction) times for larger input systems

7 Conclusion

We have shown that the parallelization of the F4 algorithm can be expanded form a sharedmemory system to a cluster of distributed nodes providing a multiple of the computation powerof a single system This was primarily achieved by using column-based parallelism removingthe optional reduction and the SIMPLIFY function It allowed us to solve larger input systemslike Katsura 15 or Cyclic 10 almost three times faster using four or respectively eight distributednodes Some work is still required to optimize the speed-up and the communication of the nodeshas to be improved to make solving of even larger problem instances possible

79

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

References

[1] Goran Bjorck and Uffe Haagerup All cyclic p-roots of index 3 found by symmetry-preservingcalculations 2008

[2] Michael Brickenstein Slimgb Grobner bases with slim polynomials Revista Matematica Com-

plutense 23(2)453ndash466 2010

[3] Jean-Charles Faugere A new efficient algorithm for computing Grobner bases (F4) Journal of

Pure and Applied Algebra 139(1ndash3)61ndash88 June 1999

[4] Jean-Charles Faugere and Sylvain Lachartre Parallel Gaussian Elimination for Grobner basescomputations in finite fields In Proceedings of the 4th International Workshop on Parallel and

Symbolic Computation PASCO rsquo10 pages 89ndash97 New York USA July 2010 ACM

[5] Jean-Charles Faugere Moreau Francois De Saint Martin and Fabrice Rouillier Design of regularnonseparable bidimensional wavelets using Groebner basis techniques IEEE Transactions on

Signal Processing 46(4)845ndash856 1998

[6] Rudiger Gebauer and H Michael Moller On an installation of buchbergerrsquos algorithm Journal

of Symbolic Computation 6275ndash286 December 1988

[7] Alessandro Giovini Teo Mora Gianfranco Niesi Lorenzo Robbiano and Carlo Traverso rdquoOnesugar cube pleaserdquo or selection strategies in the buchberger algorithm In Proceedings of the 1991

international symposium on Symbolic and algebraic computation ISSAC rsquo91 pages 49ndash54 NewYork USA 1991 ACM

[8] Gene H Golub and Charles F Van Loan Matrix Computations Johns Hopkins Studies in theMathematical Sciences Johns Hopkins University Press 1996

[9] Shigetoshi Katsura Wataru Fukuda Sakari Inawashiro Nahomi Fujiki and Rudiger GebauerDistribution of effective field in the ising spin glass of the plusmnj model at t = 0 Cell Biochemistry

and Biophysics 11309ndash319 1987

[10] David M Kreps and Robert Wilson Sequential equilibria Econometrica 50(4)863ndash94 July 1982

[11] Martin Kreuzer and Lorenzo Robbiano Computational Commutative Algebra 1 ComputationalCommutative Algebra Springer 2000

[12] Alexander Morgan Solving polynomial systems using continuation for engineering and scientific

problems Classics in applied mathematics SIAM 2009

[13] Severin Neumann Parallel reduction of matrices in Grobner bases computations In Vladimir PGerdt Wolfram Koepf Ernst W Mayr and Evgenii V Vorozhtsov editors Computer Algebra in

Scientific Computing volume 7442 of Lecture Notes in Computer Science pages 260ndash270 SpringerBerlin Heidelberg 2012

[14] Kurt Siegl A parallel factorization tree grobner basis algorithm In Parallel Symbolic Computation

PASCO 1994 Proceedings of the First International Symposium River Edge USA 1994 WorldScientific Publishing Co Inc

80

Generating Asymptotically Non-Terminant

Initial Variable Values for Linear Diagonalizable

Programs

Rachid Rebiha1lowast Nadir Matringe23 and Arnaldo Vieira Moura1

1 Institute of Computing UNICAMP University of Campinas SP Brasilrachidicunicampbr

2 Universit de Poitiers Laboratoire Mathmatiques et Applications France3 Institue de Mathematiques de Jussieu Universite Paris 7-Denis Diderot France

Abstract

We present the key notion of asymptotically non-terminant initial variable values fornon-terminant loop programs We show that those specific values are directly associated toinital variable values for which the corresponding loop program does not terminate Con-sidering linear diagonalizable programs we describe powerful computational methods thatgenerate automatically and symbolically a semi-linear space represented by a linear systemof equalities and inequalities Each element of this space provides us with asymptoticallynon-terminant initial variable values Our approach is based on linear algebraic methodsWe obtain specific conditions using certain basis and matrix encodings related to the loopconditions and instructions

1 Introduction

Research on formal methods for program verification [12 15 8 17] aims at discovering math-ematical techniques and developing their associated algorithms to establish the correctness ofsoftware hardware concurrent systems embedded systems or hybrid systems Static programanalysis [12 15] is used to check that a software is free of defects such as buffer overflows orsegmentation faults which are safety properties or termination and non-termination which areliveness properties Proving termination of while loop programs is necessary for the verificationof liveness properties that any well behaved and engineered system or any safety critical em-bedded system must guarantee We could list here many verification approaches that are onlypractical depending on the facility with which termination can be automatically determinedVerification of temporal properties of infinite state systems [20] is another example

Recent work on automated termination analysis of imperative loop programs has focusedon a partial decision procedure based on the discovery and synthesis of ranking functions Suchfunctions map the loop variable to a well-defined domain where their value decreases furtherat each iteration of the loop [9 10] Several interesting approaches based on the generationof linear ranking functions have been proposed [3 4] for loop programs where the guards andthe instructions can be expressed in a logic supporting linear arithmetic For the generation ofsuch functions there are effective heuristics [14 10] and in some cases there are also completemethods for the synthesis of linear ranking functions [16] On the other hand it is easy togenerate a simple linear terminant loop program that does not have a linear ranking functionAnd in this case such complete synthesis methods [16] fail to provide a conclusion about thetermination or the non termination of such a program

lowastSupported by FAPESP grant 201108947-1 and FAPESP grant BEPE 201304734-9

81

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

In this work we address the non-termination problem for linear while loop programs Inother words we consider the class of loop programs where the loop condition is a conjunc-tion of linear inequalities and the assignments to each of the variables in the loop instructionblock are affine or linear forms In matrix notation linear loop programs will be representedin a general form as while (Bx gt b) x = Ax + c (ie A and B are matrices b and c arevectors of real numbers and that x is a vector of variables) Without loss of generality theterminationnon-termination analysis for such a class of linear programs could be reduced tothe problem of terminationnon-termination for homogeneous linear programs [6 21] Thosebeing programs where linear assignments consist of homogeneous expressions and where thelinear loop condition consists of at most one inequality Concerning effective program trans-formations and simplification techniques non-termination analysis for programs presented in amore complex form can often be reduced to an analysis of a program expressed in this basicaffine form Despite tremendous progress over the years [6 5 7 13 11 2 1] the problem offinding a practical sound and complete methods for determining or analyzing non termina-tion remains very challenging for this class of programs and for all initial variable values Westarted our investigation from our preliminary technical reports [19 18] where we introduced atermination analysis in which algorithms ran in polynomial time complexity Here consideringa non terminating loop we introduce new static analysis methods that compute automaticallyand in polynomial time complexity the set of initial input variable values for which the programdoes not terminate and also a set of initial inputs values for which the program does terminateThis justifies the innovation of our contributions ie none of the other mentioned related workis capable of generating such critical information over non-terminating loops We summarizeour contributions as follows

bull To the best of our knowledge we introduce a new key notion for non-termination and ter-mination analysis for loop programs we identify the important concept of asymptoticallynon-terminant initial variable values ANT for short Any asymptotically non-terminantinitial variable values can be directly related to an initial variable value for which theconsidered program does not terminate

bull Our theoretical contributions provide us with efficient computational methods running inpolynomial time complexity and allowing the exact computation of the set of all asymp-totically non-terminant initial variable values for a given loop program

bull We generate automatically a set of linear equalities and inequalities describing a semi-linear space that represents symbolically the set of all asymptotically non-terminant initialvariable values The set of ANT values contains the set of non-terminant initial variablevalues On the other hand the complementary set of ANT values is a precise under-approximation of the set of terminant inputs for the same program

Example 11 (Motivating Example) Consider the following program depicted below on theleft We show a part of the output of our algorithm below on the right

(i) Pseudo code

while(2x+3y-zgt0)

x= y + z

y= -(12)x+(32)y -(12)z

z=(32)x -(32)y+(12)z

(ii) Output of our prototype

Locus of ANT

[[4u[1]+u[2]+u[3]gt0]

AND[u[1]+4u[2]+4u[3]gt0]

AND[-u[1]+u[2]-u[3]=0]]

OR[[-u[1]+u[2]-u[3]gt0]]

82

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

The semi-linear ANT = u = (u1 u2 u3)⊤ isin E | 4u1 + u2 + u3 gt 0 and u1 + 4u2 + 4u3 gt

0 andminusu1 + u2 minus u3 = 0 cup u = (u1 u2 u3)⊤ isin E | minus u1 + u2 minus u3 gt 0 represents symbolically

all asymptotically initial variable values that are directly associated to initial variable valuesfor which the program does not terminate On the other hand the complementary of this setco-ANT = u = (u1 u2 u3)

⊤ isin E | 4u1 + u2 + u3 le 0 or u1 + 4u2 + 4u3 le 0 orminusu1 + u2 minus u3 6=0 cap u = (u1 u2 u3)

⊤ isin E | minus u1 + u2 minus u3 le 0 is a precise under-approximation of the setof all initial variable values on which the program terminates

The rest of this article is organized as follows Section 2 can be seen as a preliminarysection where we introduce some key notions and results from linear algebra which will be usedto build our computational methods In this section we also present our computational modelfor programs and some further notations Section 3 introduces the new notion of asymptoticallynon-terminant initial variable values Section 4 provides the main theoretical contributionsof this work This section also presents our computational methods that generate a symbolicrepresentation of the asymptotically non-terminant variable values for linear programs Weprovide a complete dicussion in Section 5 Finally Section 6 states our conclusions

2 Linear Algebra and Linear Loop Programs

Here we present key linear algebraic notions and results which are central in the theoretical andalgorithmic development of our methods We denote by M(mnK) the set of mtimes n matriceswith entries in K and simply M(nK) when m = n The Kernel of A also called its nullspacedenoted by Ker(A) is Ker(A) = v isin K

n | A middot v = 0Km In fact when we deal with squarematrices these Kernels are Eigenspaces Let A be a ntimes n square matrix with entries in K Anonzero vector x isin K is an eigenvector for A associated with the eigenvalue λ isin K if A middotx = λxie (A minus λIn) middot x = 0 where In is the n times n identity matrix The nullspace of (A minus λIn) iscalled the eigenspace of A associated with eigenvalue λ Let n be a positive integer we willdenote R

n by E and its canonical basis by Bc = (e1 en) Let A be a square matrix inM(nR) Let us introduce the notation Spec(A) for the set of eigenvalues of A in R and wewill write Spec(A)lowast for the set Spec(A)minus 0 For λ isin Spec(A) we will denote by Eλ(A) thecorresponding eigenspace Throughout the paper we write dλ for the dimension of Eλ(A) Wewill say that A is diagonalizable if E = oplusλisinSpec(A)Eλ(A) Let A be a diagonalizable matrixFor each eigenspace Eλ(A) we will take a basis Bλ = (eλ1 eλdλ

) and we define

B = cupλisinSpec(A)Bλ

as a basis for E

Definition 21 Let x belong to E We denote by xλ its component in Eλ(A) If x admits the

decompositionsum

λisinSpec(A)(sumdλ

i=1 xλieλi) in B we have xλ =sumdλ

i=1 xλieλi

We denote by P the transformation matrix corresponding to B whose columns are the vectorsof B decomposed in Bc Letting di denote the integer dλi

for the ease of notation we recallthe following lemma

Lemma 21 We have Pminus1AP = diag(λ1Id1 λtIdt) We denote by D the matrix Pminus1AP

As we will obtain our results using the decomposition of x in B we recall how one obtains itfrom the decomposition of x in Bc

83

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

Lemma 22 Let x isin E If x =sumn

i=1 xiei = (x1 xn)⊤ isin Bc and x decomposes as

sumtj=1(

sumdj

i=1 xλj ieλj i) in B the coefficients xλj i are those of the column vector Pminus1x in Bc

Throughout the paper we write lt gt for the canonical scalar product on E which is given by lt

x y gt=sumn

i=1 xiyi and recall as it is standard in static program analysis that a primed symbolxprime refers to the next state value of x after a transition is taken Next we present transitionsystems as representations of imperative programs and automata as their computational models

Definition 22 A transition system is given by 〈x L T l0Θ〉 where x = (x1 xn) is a setof variables L is a set of locations and l0 isin L is the initial location A state is given by aninterpretation of the variables in x A transition τ isin T is given by a tuple 〈lpre lpost qτ ρτ 〉where lpre and lpost designate the pre- and post- locations of τ respectively and the transitionrelation ρτ is a first-order assertion over x cup xprime The transition guard qτ is a conjunction ofinequalities over x Θ is the initial condition given as a first-order assertion over x Thetransition system is said to be linear when ρτ is an affine form

We will use the following matrix notations to represent loop programs and their associatedtransitions systems

Definition 23 Let P be a loop program represented by the transition system 〈x =(x1 xn) l0 T = 〈l l qτ ρτ 〉 l0Θ〉 We say that P is a linear loop program if the followingconditions hold

bull Transition guards are conjunctions of linear inequalities We represent the loop conditionin matrix form as V x gt b where V isin M(mnR) and b isin R

m By V x gt b we mean thateach coordinate of vector V x is greater than the corresponding coordinate of vector b

bull Transition relations are affine or linear forms We represent the linear assignments inmatrix form as x = Ax+ c where A isin M(nR) and c isin R

n

The linear loop program P = P (A V b c) will be represented in its most general form aswhile (V x gt b) x = Ax+ c

In this work we use the following linear loop program classifications

Definition 24 We identify the following three types of linear loop programs from the morespecific to the more general form

bull Homogeneous We denote by PH the set of programs where all linear assignments consistof homogeneous expressions and where the linear loop condition consists of at most oneinequality If P is in PH then P will be written in matrix form as while (lt v x gtgt

0) x = Ax where v is a (ntimes 1)-vector corresponding to the loop condition and whereA isin M(nR) is related to the list of assignments in the loop We say that P has ahomogeneous form and it will also be denoted as P (A v)

bull Generalized Condition We denote by PG the set of linear loop programs where the loopcondition is generalized to a conjunction of multiple linear homogeneous inequalities

bull Affine Form We denote by P A the set of loop programs where the inequalities and theassignments are generalized to affine expressions If P is in P A it will be written aswhile (V x gt b) x = Ax+ c for A and V in M(nR) b isin R

m and c isin Rn

84

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

Without lost of generality the static analysis for the class of linear programs P A could bereduced to the problem of terminationnon-termination for homogeneous linear programs inPH In this work we consider programs in PH The generalization to programs in P A canalready be done and it will be reported elsewhere

3 Asymptotically Non-terminant Variable Values

In this section we present the new notion of asymptotically non-terminant variable values Itwill prove to be central in analysis of termination in general Let A be a matrix in M(nR)and v be a vector in E Consider the program P (A v) while (lt v x gtgt 0) x = Ax whichtakes values in E We first give the definition of the termination of such a program

Definition 31 The program P (A v) is said to be terminating on x isin E if and only iflt vAk(x) gt is not positive for some k ge 0

In other words Definition 31 states that if the program P (A v) performs k ge 0 loopiterations from initial variables xin E we obtain x = Ak(x) Thus if lt vAk(x) gtle 0the loop condition is violated and so P (a v) terminates Next we introduce the followingimportant notion

Definition 32 We say that x isin E is an asymptotically non terminating value for P (A v) ifthere exists kx ge 0 such that P (A v) is non terminating on Akx(v) We will write that x isANT for P (A v) or simply x is ANT We will also write that P (A v) is ANT on x

Note that if P (A v) is non terminating on Akx(x) then lt vAk(x) gt is gt 0 for k ge kxThe following result follows directly from the previous definition

Corollary 31 An element x isin E is ANT if and only if lt vAk(x) gt is positive for k largeenough

If the set of ANT points is not empty we say that the program P (A v) is ANT We willalso write NT for non terminant For the programs we study here the following lemma alreadyshows the importance of such a set

Lemma 31 The program P (A v) is NT if and only if it is ANT

Proof It is clear that NT implies ANT (ie NT sube ANT ) as a NT point of P (A v) is ofcourse ANT (with kx = 0) Conversely if P (A v) is ANT call x an ANT point then Akx(x)is a NT point of P (A v) and so P (A v) is NT

As one can easily see the set of NT points is included in the set of ANT points But themost important property of the ANT set remains in the fact that each of its point provides uswith an associated element in NT for the corresponding program In other words each elementx in the ANT set even if it does not necessarily belong to the NT set refers directly to initialvariable values yx = Ak[x](x) for which the program does not terminate ie yx is an NT pointWe can say that there exists a number of loop iterations k[x] departing from the initial variable

values x such that Ak[x](x) correspond to initial variable values for which P (A v) does notterminate But it does not necessarily implies that x is also an NT point for P (A v) In factprogram P (A v) could terminate on the initial variable values x by performing a number of

85

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

loop iterations strictly smaller than k[x] On the other hand the complementary set co-ANT

provides us with a quite precise under approximation of the set of all initial variable values forwhich the program terminates

The set of ANT points of a program is also important to the understanding of the terminationof a program with more than one conditional linear inequality as well as for termination overthe rationals for example This will be reported elsewhere

4 Automated generation of ANT loci

In this section we show how we generate automatically and exactly the ANT Locus ie the setof all ANT points for linear diagonalizable programs over the reals We represent symbolicallythe computed ANT Locus by a semi-linear space defined by linear equalities and inequalitiesConsider the program P (A v) while (lt v x gtgt 0) x = Ax The study of ANT setsdepends on the spectrum of A Recall the introductory discussion and Definition 21 at Section2

Proposition 41 For x in E and k ge 1 the scalar product lt vAk(x) gt is equal to

sum

λisinSpec(A)

λk lt v xλ gt=sum

λisinSpec(A)lowast

λk lt v xλ gt

Proof It is a direct consequence of the equality Ak(xλ) = λkxλ

41 The regular case

We first analyze the situation where A is what we call regular

Definition 41 We say that A is regular if Spec(A) cap[

minus Spec(A)]

is an empty set ie ifλ belongs to Spec(A) then minusλ does not belong to Spec(A)

In this case we make the following observation

Proposition 42 Let micro be the nonzero eigenvalue of largest absolute value if it exists such thatlt v xmicro gt is nonzero For k large the quantity lt vAk(x) gt is equivalent to microk lt v xmicro gt

Proof Indeed we can write lt vAk(x) gt as

microk lt v xmicro gt +sum

λ|λ|lt|micro|

λk lt v xλ gt= microk(lt v xmicro gt +sum

λ|λ|lt|micro|

λk

microklt v xλ gt)

and λk

microk approaches zero when k goes to infinity

We then define the following sets

Definition 42 For micro a positive eigenvalue of A we define Smicro as follows

Smicro = x isin Elt v xmicro gtgt 0 lt v xλ gt= 0 for |λ| gt |micro|

86

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

In order to obtain Smicro for all positive eigenvalues micro of A one needs to calculate lt v xmicro gtand lt v xλ gt for all eigenvalues λ such that |λ| gt |micro| For all eigenvalues λ involved inthe computation of Smicro one also needs to evaluate the coefficients cλi =lt v eλi gt for all

eigenvectors eλi isin B and 1 le i le dλ Thus we have lt v xλ gt=sumdλ

i=1 cλixλi Now we onlyneed to compute the coefficient xλi which are those of the column vector Pminus1x in Bc whereP is the transformation matrix corresponding to B See Lemma 22

We ca now state the following theorem allowing the exact computation of the ANT Locusfor the regular case

Theorem 41 The program P (A v) is ANT on x if and only if x belongs to

microgt0isinSpec(A)

Smicro

Proof Let x belong to E If all lt v xλ gt are zero for λ isin Spec(A) then lt vAk(x) gt= 0and x is not ANT Otherwise let micro be the eigenvalue of largest absolute value such thatlt v xmicro gt is nonzero Then according to Proposition 42 the sign of lt vAk(x) gt is the signof microk lt v xmicro gt for k large If micro is negative this sign will be alternatively positive and negativedepending on the parity of k and x is not ANT If micro is positive this sign will be the sign oflt v xmicro gt hence x will be ANT if and only if lt v xmicro gt is positive This proves the result

Example 41 (Running example) Consider the program P (A v) depicted as follows

(i) Pseudo code

while(x+y-2zgt0)

x= x-4y-4z

y= 8x-11y-8z

z= -8x+8y+5z

(ii) Associated matrices

A =

1 minus4 minus48 minus11 minus8minus8 8 5

and v =

11minus2

Step 1 Diagonalization of the matrix A

P =

1 1 12 1 0minus2 0 1

D =

1 0 00 minus3 00 0 minus3

and Pminus1 =

1 minus1 minus1minus2 3 22 minus2 minus1

Using our notations the obtained eigenvectors (ie the column vectors of P ) are denoted asfollows e11 = (1 2minus2)⊤ eminus31 = (1 1 0)⊤ eminus32 = (1 0 1)⊤

Step 2 We compute Smicro for all positive micro isin Spec(A)lowast

bull We compute first the coefficients cλic11 =lt v e11 gt=lt (1 1minus2)⊤ (1 2minus2)⊤ gt= 7

cminus31 =lt v eminus31 gt=lt (1 1minus2)⊤ (1 1 0)⊤ gt= 2

cminus32 =lt v eminus31 gt=lt (1 1minus2)⊤ (1 0 1)⊤ gt= minus1

bull We compute the coefficient xλi which are those of the column vector Pminus1 middotu in Bc whereu = (u1 u2 u3) is the vector encoding the initial variable values

Pminus1

u1

u2

u3

=

u1 minus u2 minus u3)minus2u1 + 3u2 + 2u3)2u1 minus 2u2 minus u3)

=

x11

xminus31

xminus32

We can now proceed to the generation of the linear constraints defining a semi-linear space

87

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

describing symbolically and exactly Smicrolt v x1 gt= c11x11 = 7(u1 minus u2 minus u3)lt v xminus3 gt= cminus31xminus31 + cminus32xminus32 = minus6u1 + 8u2 + 5u3)Hence we have S1 = u = (u1 u2 u3)

⊤ isin E | (u1minusu2minusu3 gt 0)and(minus6u1+8u2+5u3 = 0)

Step 3 We apply Theorem 41 to generate the ANT Locus It reduces to the semi-linear spaceS1 = u = (u1 u2 u3)

⊤ isin E | (u1 minus u2 minus u3 gt 0) and (minus6u1 + 8u2 + 5u3 = 0)

42 The general case handling linear diagonalizable programs

For the general case in the asymptotic expansion of lt vAk(x) gt one can have compensationsbetween λk lt v xλ gt and (minusλ)k lt v xλ gt as these terms can be zero when k is even forinstance and of a well determined sign when k is odd We thus need to take care of this issueTo this end we introduce the following notation

Definition 43 If λ does not belong to Spec(A) for any x isin E we write xλ = 0

We have the following propositions which give the asymptotic behavior of lt vAk(x) gt

Proposition 43 Let micro be the nonzero eigenvalue of largest absolute value if it exists suchthat lt v x|micro| + xminus|micro| gt is nonzero For k large the quantity lt vA2k(x) gt is equivalent to

|micro|2k(lt v x|micro| + xminus|micro| gt)

Proof Indeed we can write lt vA2k(x) gt as

micro2k(lt v x|micro| gt + lt v xminus|micro| gt) +sum

|λ||λ|lt|micro|

λ2k(lt v x|λ| gt + lt v xminus|λ| gt)

= micro2k(lt v x|micro| gt + lt v xminus|micro| gt) +sum

|λ||λ|lt|micro|

λ2k

micro2k(lt v x|λ| gt + lt v xminus|λ| gt))

and λk

microk approaches to zero when k goes to infinity

Proposition 44 Let micro be the nonzero eigenvalue of largest absolute value if it exists suchthat lt v x|micro| minus xminus|micro| gt is nonzero For k large the quantity lt vA2k+1(x) gt is equivalent to

|micro|2k+1(lt v x|micro| minus xminus|micro| gt)

Proof The proof is similar to the proof of Proposition 43

As in the previous Section we introduce the following relevant sets

Definition 44 For |micro| in |Spec(A)lowast| we define the sets S0|micro| and S1

|micro| as follows

S0|micro| = x isin Elt v x|micro| + xminus|micro| gtgt 0 lt v x|λ| + xminus|λ| gt= 0 for |λ| gt |micro| and

S1|micro| = x isin Elt v x|micro| minus xminus|micro| gtgt 0 lt v x|λ| minus xminus|λ| gt= 0 for |λ| gt |micro|

In order to compute the sets S0|micro| and S1

|micro| we obtain the coefficients cλi =lt v eλi gt for alleigenvalues λ If the λ appearing as index in the coefficient cλi is not an eigenvalue then we fix

cλi = 0 and dλ = 0 (see Definition 43) Thus we have lt v x|λ| + xminus|λ| gt=sumd|λ|

i=1 c|λ|ix|λ|i +sumdminus|λ|

i=1 cminus|λ|ixminus|λ|i and lt v x|λ| minus xminus|λ| gt=sumd|λ|

i=1 c|λ|ix|λ|i minussumdminus|λ|

i=1 cminus|λ|ixminus|λ|iWe finally obtain the following main theorem

88

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

Theorem 42 The program P (A v) is ANT on x if and only if x belongs to the set

(|micro||microprime|)isin|Spec(A)lowast|times|Spec(A)lowast|

S0|micro| cap S1

|microprime|

Proof It is obvious that x is ANT if and only if lt vA2k(x) gt and lt vA2k+1(x) gt are bothpositive for k large Now reasoning as in the proof of Theorem 41 but using Propositions 43and 44 instead of Proposition 42 we obtain that lt vA2k(x) gt is positive for k large if andonly if x belongs to S0

|micro| for some micro isin |Spec(A)lowast| and that lt vA2k+1(x) gt is positive for k

large if and only if x belongs to S1|microprime| for some microprime isin |Spec(A)lowast| The result follows

The following two examples illustrate how Theorem 42 applies to different cases

Example 42 (Running example) Consider the program P (A v) depicted as follows

(i) Pseudo code

while(2x+3y-zgt0)

x=15x+18y-8z+6s-5t

y=5x+3y+z-t-3s

z=-4y+5z-4s-2t

s=-43x-46y+17z-14s+15t

t=26x+30y-12z+8s-10t

(ii) Associated matrices

A =

15 18 minus8 6 minus55 3 1 minus1 minus30 minus4 5 minus4 minus2

minus43 minus46 17 minus14 1526 30 minus12 8 minus10

v =

11231

Step 1 Diagonalization of the matrix A

P =

2 1 minus1 1 1minus1 0 2 0 minus1minus2 0 2 minus1 minus2minus4 minus1 0 minus2 minus12 2 1 2 1

D =

minus3 0 0 0 00 minus1 0 0 00 0 0 0 00 0 0 1 00 0 0 0 2

and Pminus1 =

minus3 minus3 1 minus1 1minus1 minus2 1 0 1minus5 minus4 1 minus1 210 10 minus3 2 minus4minus7 minus6 1 minus1 3

We obtain the following eigenvectors written using our notation e01 = (minus1 2 2 0 1)⊤e11 = (1 0minus1minus2 2)⊤ e21 = (1minus1minus2minus1 1)⊤ eminus11 = (1 0 0minus1 2)⊤ and eminus31 =(2minus1minus2minus4 2)⊤

Step 2 Computing Smicro for all positive micro isin Spec(A)lowast

bull Our algorithm first computes the coefficients cλi We obtain c01 = 6 c11 = minus5c21 = minus6 cminus11 = 0 and cminus31 = minus13

bull Then our algorithm computes the coefficients of the decomposition of the initial vari-able values in B They are those of the column vector Pminus1 middot u in Bc where u =(u1 u2 u3 u4 u5)

⊤ is the vector encoding the initial variable values

Pminus1

u1

u2

u3

u4

u5

=

minus3u1 minus 3u2 + u3 minus u4 + u5

minusu1 minus 2u2 + u3 + u5

minus5u1 minus 4u2 + u3 minus u4 + 2u5

10u1 + 10u2 minus 3u3 + 2u4 minus 4u5

minus7u1 minus 6u2 + u3 minus u4 + 3u5

=

xminus31

xminus11

x01

x11

x21

Now the algorithm obtains all the non-zero terms appearing in the definition of S0|λ| and S1

|λ|

lt v x|1| + xminus|1| gt= c11x11 = minus5(10u1 + 10u2 minus 3u3 + 2u4 minus 4u5)lt v x|2| + xminus|2| gt= c21x21 = minus6(minus7u1 minus 6u2 + u3 minus u4 + 3u5)

89

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

lt v x|minus3| + xminus|minus3| gt= cminus31xminus31 = minus13(minus3u1 minus 3u2 + u3 minus u4 + u5)lt v x|minus3| minus xminus|minus3| gt= minuscminus31xminus31 = 13(minus3u1 minus 3u2 + u3 minus u4 + u5)

All the sets S0|λ| and S1

|λ| can now be computed exactly

S0

|1| = u isin E | 5(10u1 + 10u2 minus 3u3 + 2u4 minus 4u5) gt 0 and minus6(minus7u1 minus 6u2 + u3 minus u4 + 3u5) = 0 and

minus 13(minus3u1 minus 3u2 + u3 minus u4 + u5) = 0

S1

|1| = u isin E|5(10u1 + 10u2 minus 3u3 + 2u4 minus 4u5) gt 0 and minus6(minus7u1 minus 6u2 + u3 minus u4 + 3u5) = 0 and

13(minus3u1 minus 3u2 + u3 minus u4 + u5) = 0

S0

|2| = u isin E| minus 6(minus7u1 minus 6u2 + u3 minus u4 + 3u5) gt 0 and minus13(minus3u1 minus 3u2 + u3 minus u4 + u5) = 0

S0

|2| = u isin E| minus 6(minus7u1 minus 6u2 + u3 minus u4 + 3u5) gt 0 and minus13(minus3u1 minus 3u2 + u3 minus u4 + u5) = 0

S1

|2| = u isin E| minus 6(minus7u1 minus 6u2 + u3 minus u4 + 3u5) gt 0 and 13(minus3u1 minus 3u2 + u3 minus u4 + u5) = 0

S0

|minus3| = u isin E| minus 13(minus3u1 minus 3u2 + u3 minus u4 + u5) gt 0

S1

|minus3| = u isin E| 13(minus3u1 minus 3u2 + u3 minus u4 + u5) gt 0

Step 3 We apply Theorem 42 to generate the ANT LocusThe algorithm computes the following intersections S0

1 capS11 S

01 capS1

2 S01 capS1

3 S02 capS1

1 S02 capS1

2 S02 cap S1

3 S03 cap S1

1 S03 cap S1

2 and S03 cap S1

1 In fact the previous computational step already allows our algorithm to perform implicit sim-plifications For instance it appears that S0

|1| = S1|1| S

0|1| = S1

|1| = S0|minus1| = S1

|minus1| S0|2| = S1

|2|

and that S0|minus3| cap S1

|minus3| is the empty set According to Theorem 42 the ANT locus reduces tothe following semi-linear space

u = (u1 u2 u3 u4 u5)⊤ isin E | minus 10u1 minus 10u2 + 3u3 minus 2u4 + 4u5 gt 0 and

minus 7u1 minus 6u2 + u3 minus u4 + 3u5 = 0 and

minus 3u1 minus 3u2 + u3 minus u4 + u5 = 0⋃

u = (u1 u2 u3 u4 u5)⊤ isin E | minus 10u1 minus 10u2 + 3u3 minus 2u4 + 4u5 gt 0 and

minus 3u1 minus 3u2 + u3 minus u4 + u5) gt 0 and

minus 7u1 minus 6u2 + u3 minus u4 + 3u5 = 0⋃

u = (u1 u2 u3 u4 u5)⊤ isin E | 7u1 + 6u2 minus u3 + u4 minus 3u5 gt 0 and

minus 3u1 minus 3u2 + u3 minus u4 + u5 = 0

5 Discussions

This work is complementary to our previous work [19] which dealt with termination analysisIn [19] we first prove a sufficient condition for the termination of homogeneous linear programsThis statement was conjectured in the important work of [21] where the first attempt toprove this result contains non trivial mistakes As we shown in [19] the actual proof of thissufficient condition requires expertise in several independent mathematical fields Also thenecessary condition proposed in [21] does not apply as expected in practice We then wentto generalize the previous result and to the best of our knowledge we presented the firstnecessary and sufficient condition (NSC for short) for the termination of linear programsIn fact this NSC exhibits a complete decidability result for the class of linear programs on all

90

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

initial values Moreover departing from this NSC we showed the scalability of these approachesby demonstrating that one can directly extract a sound and complete computational methodrunning in polynomial time complexity to determine termination or nontermination for linearprograms On the other hand all other related and previous works mentioned in this paper donot provide any techniques capable of generating automatically the set of initial input variablevalues for which a loop does not terminate The main contributions of this paper remain ona sound and complete computational method to compute the set of input variable values forwhich the programs do not terminate The overall time complexity of our algorithm is also oforder O(n3) As can be seen the main results ie Theorems 41 and 42 provide us with adirect symbolic representation of the ANT set Even if those theorems are rigorously stated andproofs are quite technical they are really easy to apply we only need to compute the explicitterms S0

|micro| and S1|microprime| in order to directly obtain a formula representing exactly and symbolically

the ANT set In a same manner we extended this techniques to linear program not necessarilydiagonalizable and we obtained similar theoretical and practical results As their associatedproofs are more technical they would required more space to be fully expressed and we left themfor an ensuing report In other more recent work on termination static analysis for programsover the rationals or the integers with several conditional linear inequalities we also show thatthe notion ANT remains central

6 Conclusion

We presented the new notion of asymptotically non-terminant initial variable values for linearprograms Considering a linear diagonalizable program our theoretical results provided us withsound complete and fast computational methods allowing the automated generation of the setsof all asymptotically non-terminant initial variable values represented symbolically and exactlyby a semi-linear space eg conjunctions and disjunctions of linear equalities and inequalitiesAlso by taking the complementary set of the semi-linear set of ANT initial variable values weobtain a precise under-approximation of the set of terminant initial variable values for the (non-terminant) program Actually this type of method can be vastly generalized to tackle the ter-mination and non-termination problem of linear programs not necessarily diagonalizable withmore than one conditional linear inequality on rational or integer initial values for instanceWe leave this investigation for an ensuing report

References

[1] Amir M Ben-Amram and Samir Genaim On the linear ranking problem for integer linear-constraint loops In Proceedings of the 40th annual ACM SIGPLAN-SIGACT symposium onPrinciples of programming languages POPL rsquo13 pages 51ndash62 New York NY USA 2013 ACM

[2] Amir M Ben-Amram Samir Genaim and Abu Naser Masud On the termination of integer loopsIn VMCAI pages 72ndash87 2012

[3] Aaron R Bradley Zohar Manna and Henny B Sipma Linear ranking with reachability In InCAV pages 491ndash504 Springer 2005

[4] Aaron R Bradley Zohar Manna and Henny B Sipma Termination analysis of integer linearloops In In CONCUR pages 488ndash502 Springer-Verlag 2005

[5] Aaron R Bradley Zohar Manna and Henny B Sipma Termination of polynomial programsIn In VMCAIrsquo2005 Verification Model Checking and Abstract Interpretation volume 3385 ofLNCS pages 113ndash129 Springer 2005

91

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

[6] Mark Braverman Termination of integer linear programs In In Proc CAV06 LNCS 4144 pages372ndash385 Springer 2006

[7] Hong Yi Chen Shaked Flur and Supratik Mukhopadhyay Termination proofs for linear simpleloops In Proceedings of the 19th international conference on Static Analysis SASrsquo12 pages 422ndash438 Berlin Heidelberg 2012 Springer-Verlag

[8] Edmund M Clarke Orna Grumberg and Doron Peled Model Checking MIT Press CambridgeMA 2000

[9] Michael Colon and Henny Sipma Synthesis of linear ranking functions In Proceedings of the 7thInternational Conference on Tools and Algorithms for the Construction and Analysis of SystemsTACAS 2001 pages 67ndash81 London UK 2001 Springer-Verlag

[10] Michael A Colon and Henny B Sipma Practical methods for proving program termination InIn CAV2002 Computer Aided Verification volume 2404 of LNCS pages 442ndash454 Springer 2002

[11] Byron Cook Andreas Podelski and Andrey Rybalchenko Termination proofs for systems codeSIGPLAN Not 41(6)415ndash426 June 2006

[12] P Cousot and R Cousot Abstract interpretation and application to logic programs Journal ofLogic Programming 13(2ndash3)103ndash179 1992

[13] Patrick Cousot and Radhia Cousot An abstract interpretation framework for termination SIG-PLAN Not 47(1)245ndash258 January 2012

[14] Dennis Dams Rob Gerth and Orna Grumberg A heuristic for the automatic generation of rankingfunctions In Workshop on Advances in Verification pages 1ndash8 2000

[15] Zohar Manna Mathematical Theory of Computation McGraw-Hill 1974

[16] Andreas Podelski and Andrey Rybalchenko A complete method for the synthesis of linear rankingfunctions In VMCAI pages 239ndash251 2004

[17] Jean-Pierre Queille and Joseph Sifakis Specification and verification of concurrent systems incesar In Proceedings of the 5th International Symposium in Programming pages 337ndash351 LondonUK 1982 Springer-Verlag

[18] Rachid Rebiha Nadir Matringe and Arnaldo V Moura A complete approach for terminationanalysis of linear programs Technical Report IC-13-08 Institute of Computing University ofCampinas February 2013

[19] Rachid Rebiha Nadir Matringe and Arnaldo V Moura Necessary and sufficient condition fortermination of linear programs Technical Report IC-13-07 Institute of Computing University ofCampinas February 2013

[20] Henny B Sipma Tomas E Uribe and Zohar Manna Deductive model checking Form MethodsSyst Des 15(1)49ndash74 July 1999

[21] Ashish Tiwari Termination of linear programs In Rajeev Alur and Doron Peled editors ComputerAided Verification 16th International Conference CAV 2004 Boston MA USA volume 3114 ofLecture Notes in Computer Science pages 70ndash82 Springer 2004

92

Data Conversion Method between a Natural

Number and a Binary Tree for an Inductive

Proof and Its Application

Kazuko Takahashi1 Shizuo Yoshimaru1lowast

and Mizuki Goto1

1 School of Science and Technology Kwansei Gakuin Universityktakakwanseiacjp

2 School of Science and Technology Kwansei Gakuin Universityshizuoyoshimarugmailcom

3 School of Science and Technology Kwansei Gakuin Universitybub85144kwanseiacjp

Abstract

This paper presents modeling of a binary tree that represents a natural number andgives an inductive proof for its properties using theorem provers We define a function forconverting data from a natural number into a binary tree and give an inductive proof forits well-definedness We formalize this method develop a computational model based onit and apply it to an electronic cash protocol We also define the payment function onthe binary tree and go on to prove the divisibility of electronic cash using the theoremprovers IsabelleHOL and Coq respectively Furthermore we discuss the effectiveness ofthis method

1 Introduction

Theorem proving is an important technique to provide a certified system or to ensure bug-free programming Several theorem provers which may be called proof assistants have beendeveloped including ACL2 [11] PVS [19] IsabelleHOL [16] Coq [4] Agda [17] and so onThese tools help users to develop formal proofs either interactively or semi-automaticallytypically using induction as the proof strategy There are numerous applications for suchprovers There are relatively few practical applications of these tools in most fields comparedto their use in pure mathematics although there are some outstanding results in microprocessordesign [10] C compilers [14] operating system kernels [12] security protocols [1] and securecard systems [3 13] To use these provers successfully it is necessary to construct a suitablemodel and then select an appropriate proof strategy In practical applications it may be difficultto form a natural inductive model and so it may be necessary to build a data structure whichcan be difficult for these provers to handle

We have previously attempted to prove the divisibility of an electronic cash protocol [21] Inthis experience we have encountered difficulties in proving the properties regarding the functionthat converts a natural number to a binary tree The binary tree is a complete binary treewhere a Boolean value is attached to each node and the value of which is defined as a sum ofthe value of the left and right subtrees The problem can be reduced to the fact that there existsa function that cannot be defined in a primitive recursive form on an inductively defined datastructure Because a natural number has a linear structure with only one successor whereas a

lowastCurrently Nochu Information System CoLTD

93

Data Conversion Revisited Takahashi Yoshimaru and Goto

binary tree has a branching structure with two successors at each branching point the inductionschemes are different which complicates the proof

To solve this problem we introduced a bit sequence as an intermediate data structure anddefined the function from a natural number to a binary tree as a composition of two recursivefunctions via a bit sequence Specifically the first function describes the mapping from anatural number to an intermediate bit sequence and the second function is the mapping fromthe bit sequence to the binary tree We formalized this model and associated proof method andapplied it to the divisibility of an electronic cash protocol using IsabelleHOL However thisprevious work had several drawbacks First the model was complicated because of an intricatelabeling for the nodes of a tree a simpler and more natural model for this specific binary treehas subsequently been identified Second the proof was incomplete as one of the lemmas thatrelates the bit sequence to the binary tree was left as an axiom Third the effectiveness of themethod was not discussed we did not know whether this method could be applied similarlywith theorem provers other than IsabelleHOL or whether a large number of modificationswould be required In this paper we provide a simplified model give complete proofs of thedivisibility using the theorem provers IsabelleHOL and Coq and discuss the effectiveness ofthe method

The rest of this paper is organized as follows In Section 2 we describe in detail the problemsof data conversion and our solution In Sections 3 and 4 we present a formalization and aninductive proof of the divisibility of an electronic cash protocol In Section 5 we provide adiscussion and in Section 6 we present our conclusions

2 Data Conversion Formalization

21 Problem

First we illustrate the problem of converting between a natural number and a binary treewhich are data structures with different induction schemes

Let NAT and BTREE be a natural number and a binary tree respectively NAT is induc-tively defined with one successor BTREE is inductively defined in such a form that there aretwo successors ie

nat_p(0)

nat_p(n) =gt nat_p(Suc(n))

tree_p(Tip)

tree_p(lt) amp tree_p(rt) =gt tree_p(Node(_ltrt))

where Suc denotes the successor function Node is a constructor for a tree rsquo rsquo denotes ananonymous variable that corresponds to a parent node lt and rt are the left and right subtreesrespectively and T ip is a leaf node The symbols amp and =gt denote conjunction and implicationrespectively

Consider data conversion between NAT and BTREE Let f be a function that maps fromNAT to BTREE and g be a function that maps from BTREE to NAT We assume that thesefunctions are defined inductively in the following form

f NAT --gt BTREE

f(Suc(n)) = c1(f(n))

f(0) = Tip

94

Data Conversion Revisited Takahashi Yoshimaru and Goto

g BTREE --gt NAT

g(Node(_ltrt)) = c2(g(lt) g(rt))

g(Tip) = 0

where c1 is a function from BTREE to BTREE and c2 is a function from NATtimes NAT to NATConsider proving the following relationship between f and g

g(f(n)) = n

We use the following induction scheme IS on NAT to prove it

foralln( (forallnprimenprime lt n =rArr g(f(nprime)) = nprime) =rArr g(f(n)) = n ) [IS]

The proof proceeds by rewriting g(f(n)) in succession as follows

g(f(n)) = g(f(c2(n1 n2)))= g(Node( f(n1) f(n2)))= c2(g(f(n1)) g(f(n2)))= c2(n1 n2)

where c2(n1 n2) = n for a certain n1 n2 lt nThe induction scheme IS is used to proceed from the third line to the fourth line To succeed

in this proof there are two problems to be solved The first is the progression from the first lineto the second line we have to prove the equality f(c2(n1 n2)) = Node( f(n1) f(n2)) Thisproblem is how to divide a natural number into two parts suitably The second and arguablymore challenging problem is that we cannot find c1 that defines f in a recursive form naturallyConsider the function f which maps a natural number to a binary tree The forms of the datastructures f(n) and f(Suc(n)) are considerably different and the differences depend on thevalues of n For example compare the operation of adding a leaf node labeled ldquoTruerdquo to thebinary tree shown in Figure 1 In this figure (a) shows the operation of adding a node to thebinary tree that has two leaf nodes labeled ldquoTruerdquo and (b) shows the operation of adding anode to the binary tree that has three leaf nodes labeled ldquoTruerdquo These operations cannot berepresented uniformly therefore f(n) cannot be uniformly defined for all n Furthermore evenif f is defined the proof over the properties on f is not straightforward

(a)

T F F F

T T

(b)

T T T TT T T F

T

T T T

T T

T T

T

T

Figure 1 Operation on adding a ldquoTruerdquo node to a binary tree

On the other hand the definition of g is simpler because it is a conversion from a data typethat is not totally-ordered to one that is totally-ordered

22 Solution

To solve the problem shown above we introduce the bit sequence BS as an intermediate datastructure between NAT and BTREE

95

Data Conversion Revisited Takahashi Yoshimaru and Goto

221 Conversion from BS to BTREE

First we describe the conversion from BS to BTREE We choose a specific binary tree used inan electronic cash protocol This tree is a complete binary tree and a Boolean value is attachedto each node the value of which is defined as a sum of the values of its left and right subtrees

Let b0b1 bn be a sequence of Boolean values that corresponds to a natural number kThen k = bprime0 middot 2

n + bprime1 middot 2nminus1 + + bprimen middot 20 where bprimei = 10 for bi = TrueFalse (1 le i le n)

respectively We encode bprime0 middot2n as the left tree and the remainder as the right tree The function

from BS to BTREE is defined as follows

bs_to_btree() = (Tipfalse)

bs_to_btree(bbs) = (if b

then Node(true create_btree(truelength(bs)) bs_to_btree(bs) )

else Node(true bs_to_btree(bs) create_btree(falselength(bs)) )

)

where is an operator combining the head and tail of the list T ip indicates a leaf node thefunction create btree(bool nat) creates a binary tree of height nat in which all nodes are labeledwith bool and length(list) denotes the length of list 1 Intuitively when scanning the datafrom the head of BS descending by one bit corresponds to descending one subtree in BTREEThe induction scheme for the bit sequence is that if some property holds on a bit sequence bsit also holds on bbs If b = True (ie k ge 2n) then all nodes in the left subtree are labeledTrue this is referred to as a full tree However if b = False (ie k lt 2n) then none of thenodes in the right tree are labeled True this is referred to as an empty tree Thus the datatypes BS and BTREE are matched in their induction schemes

Let a bit sequence be represented as a list the elements of which are either True or FalseFigure 2 shows the conversion of the bit sequence [True False T rue] into a binary tree Inthis figure the black trees are full trees the white trees are empty trees and the dotted treesare the others

T

T T T

FTFTT

[TrueFalseTrue] [FalseTrue] [True]

Figure 2 The mapping between a bit sequence and a binary tree

Because the binary tree corresponding to [True False T rue] is not an empty tree the rootnode is labeled True Because the first bit in the sequence is True the left tree is a full treeThe tree to the right of it is the tree corresponding to the remaining bit sequence [False T rue]after the first bit has been extracted Now consider the coding of [False T rue] because the

1We can define a mirror tree in which left and right subtrees are exchanged

96

Data Conversion Revisited Takahashi Yoshimaru and Goto

first bit of the sequence is False the right tree must be an empty tree and the left tree isthe tree corresponding to the remaining bit sequence Then we consider the coding of [True]because the first bit of the bit sequence is True the left tree is a full tree and the right tree isthe binary tree corresponding to the remaining bit sequence Finally we obtain a T ip for [ ]

T

T

T

T F

T

T

T T T T T F F F

Figure 3 The binary tree for [True False T rue]

The binary tree obtained from [True False T rue] is thus as follows (Figure 3)

( True

( True ( TrueTrueTrue ) ( TrueTrueTrue ) )

( True ( TrueTrueFalse ) ( FalseFalseFalse ) )

)

The function bs to btree can give an inductive definition that provides for the division of ninto n1 and n2 corresponding to the left and right subtrees respectively in the proof processfor IS in the previous subsection

222 Conversion from NAT to BS

Next we give a definition for the conversion from NAT to BS We show two different modelsone using a general function and one using a primitive recursive function

First we define the general function naive nat to bs This is defined in an iterative formand determines the value of a a bit sequence from the least-significant bit as follows

naive_nat_to_bs(0) = [False]

naive_nat_to_bs(1) = [True]

naive_nat_to_bs(n) = (naive_nat_to_bs(div(n2))) ([mod(n2) = 1])

where is the concatenation operator for lists div(n 2) and mod(n 2) return the result ofdivision of n by 2 and its remainder respectively

Second we define the primitive recursive function nat to bs This is defined in a tail-recursive form and determines the value of a bit sequence from the most-significant bit Thedefinition is more complex than that of the iterative form

nat_to_bs(0) = [false]

nat_to_bs(Suc(n)) = calc(lg(Suc(n))Suc(n))

calc(0m) = [true]

calc(Suc(n)m) = (if 2^n lt= m) then True(calc(nm-2^(Suc(n))))

else False(calc(nm))

lg(n) = (if nlt=1 then 0

else Suc(lg (div(n2))))

97

Data Conversion Revisited Takahashi Yoshimaru and Goto

where lg is a key function that returns the place number of the bit sequence corresponding toa given argument ie the natural number m that satisfies m le log n lt m+ 1 The followingtable shows the relationship of a natural number nat a bit sequence bs and the value of lgNote that when n increases by 1 the location in the bit sequence which is equal to the heightof the tree increases logarithmically

nat bs lg

1 1 02 10 13 11 14 100 25 101 26 110 27 111 28 1000 39 1001 3

223 Conversion from NAT to BTREE

Finally nat to btree is defined as the composition of the two functions naive nat to bs andbs to btree or the composition of nat to bs and bs to btree nat to bs and bs to btree are prim-itive recursive functions whereas naive nat to bs is a recursive function

The definition of nat to bs is more suitable to an induction scheme than that ofnaive nat to bs because induction is typically applied from the head to the tail

In the next two sections we apply this formalization to the electronic cash protocol definedin [18] and prove its divisibility

3 Modeling of an Electronic Cash Protocol

31 Ideal Electronic Cash

An electronic cash (e-cash) protocol is in general a combination of cryptography techniquessuch as zero-knowledge proof and public key encryption We consider the ideal e-cash protocolproposed by Okamoto [18] In this protocol a coin of some monetary value is encoded asa binary tree and a payment function is defined over it This binary tree approach makese-cash efficient and unlinkable and is used in many divisible e-cash schemes [7 8 15 18]We formalize this protocol and prove its divisibility on a data level ie a user can spend acoin in several separate transactions by dividing its value without overspending if and only ifa payment function satisfies the payment rules This is one of the properties that an ideale-cash protocol should satisfy We define the data structure of money and define two primitiverecursive functions of money amount and pay on money The definitions are shown using Coqcode in this section

32 Definition of money

A coin is represented as a binary tree called money Each node of the tree represents a certaindenomination The root node is assigned the monetary value of the money and the values of

98

Data Conversion Revisited Takahashi Yoshimaru and Goto

all other nodes are defined as half the value of their parent nodesMoney is defined as an inductive function It is a binary tree where nodes are labeled with

Boolean values The label True means that a node is usable while False means that it is notFor a given Boolean value b and a natural number n we can create money in which all of thenodes have the label b

Inductive money Type =

| Tip bool -gt money

| Node bool -gt money -gt money -gt money

Fixpoint create_money(b bool)(n nat) money =

match n with

| 0 =gt Tip b

| S nrsquo =gt Node b (create_money b nrsquo) (create_money b nrsquo)

end

33 Creation of money from a natural number

cash is a function that createsmoney corresponding to a given natural number that is defined asa composition of bs to money and naive nat to bs (or nat to bs) bs to money can be definedin a manner similar to that of bs to btree

Definition cash(n nat) money = bs_to_money (naive_nat_to_bs n)

Note that cash is the money that satisfies a specific condition whereas type money al-lows any complete binary tree whose nodes are labeled as Boolean values For exampleNode(false T ip(true) T ip(true)) is an element of money but not a result of a function cash

34 Calculation of the amount of money

The function money amount computes the amount of money that can be used If the rootnode is labeled True the amount of the tree is the sum of that of the left tree and the righttree otherwise the amount is 0

Fixpoint money_amount(m money) nat =

match m with

| Tip true =gt 1

| Tip false =gt 0

| Node true l r =gt money_amount l + money_amount r

| Node false _ _ =gt 0

end

35 Payment

Payment rules are set in [18] as follows when we spend some amount from the coin we searchfor a node (or combination of nodes) whose value is equal to the payment value and then cancelthese nodes at the same time all of the ancestors and all of the descendants are also canceledOverspending is prevented if and only if these rules are satisfied

The function pay corresponds to payment according to the payment rules When we pay nfrom money where n is less than or equal to the amount of money then we pay all of n fromthe left tree and the right tree remains as it is if the amount of the left tree is more than n

99

Data Conversion Revisited Takahashi Yoshimaru and Goto

Otherwise we exhaust the left tree in the payment and pay the remainder from the right treeFor example money amount(pay(cash(13) 4) = 9

In the following code eq nat dec and lt dec are functions on NAT that denote rsquo=rsquo and rsquoltrsquorespectively change false is a function that changes the label of a node to False

Fixpoint pay(m money)(n nat) money =

match m with

| Tip true =gt Tip (if eq_nat_dec n 0 then true else false)

| Node true l r =gt

if lt_dec (money_amount l) n

then Node true (change_false l) (pay r (n - money_amount l))

else Node true (pay l n) r

| _ =gt m

end

4 Proof of Properties

We prove three properties on the divisibility of the e-cash protocol On proving these propertiesinductively we apply the method proposed in Section 2

In this section we only show the outline of the proof focusing on how induction is appliedThe complete Coq proof is shown in the Appendix

First the distribution property over money amount holds

money amount(Node( left right)) =money amount(left) +money amount(right) middot middot middot (1)

This can readily be proved We rewrite the left side of the given equation

41 Well-definedness of cash

The monetary value of money created by cash from a natural number is equal to that valueThis property is represented as follows

forall n (money amount (cash(n)) = n)

and is proved using the properties of the bit sequence Below we show a case in which the firstbit b of the sequence is True When it is False the proof proceeds in the same manner

money amount(cash(n))= money amount(bs to money(bbs)) middot middot middot (2)= money amount( Node(true

bs to money(bs) create money(true length(bs) ) middot middot middot (3)= money amount(bs to money(bs))+

money amount(create money(true (length(bs)))) middot middot middot (4)

Formula (2) is obtained by unfolding cash where nat to bs(n) = bbs formula (3) isobtained by unfolding bs to money and formula (4) is obtained by the distribution propertyof money amount (1)

The first term of formula (4) is transformed as follows

100

Data Conversion Revisited Takahashi Yoshimaru and Goto

money amount(bs to money(bs))= money amount(bs to money(nat to bs(nminus 2lg n))) middot middot middot (5)= money amount(cash(nminus 2lgn)) middot middot middot (6)

Formula (5) is obtained using case split tactics on n property of lg and several other tacticsFormula (6) is obtained by unfolding cash

The second term of formula (4) is transformed as follows

money-amount(create money(true length(bs)))= money amount(cash(2lgn)) (7)

Here we use the following induction scheme of NAT

if forall k k lt n money amount(cash(k)) = kthen money mount(cash(n)) = n holds

We can prove 2lg n le n and nminus 2lg n lt n If 2lg n lt n we apply this type of induction toboth formulas (6) and (7) and so formula (4) is finally transformed into the following form

money amount(cash(2lg n)) +money amount(cash(nminus 2lg n))= 2lg n + (nminus 2lg n)= n

In case 2lg n = n the proof is simpler without using induction

42 Well-definedness of pay

The amount remaining after payment is the difference between the original value and thepayment value This property is represented as follows 2

forall nforall m (money amount(pay(cash(n)m)) = nminusm)

This is derived from the following lemma

forall cforall n (money-amount(pay(c n)) = money-amount(c)minus n

which is proved as follows When we pay n from c if n does not exceed the amount of c wepay m1 from the left subtree as far as possible and pay the remainder m2 from the right treem1 and m2 are determined as follows if n lt money amount(left) then m1 = n and m2 = 0otherwise m1 = money amount(left) and m2 = n minus money amount(left) This is provedusing induction Below we show an inductive case because the proof is simple for the basecase

money amount(pay(cm1 +m2))= money amount(pay(Node( left right)m1 +m2)) middot middot middot (8)= money amount(pay(leftm1)) +money amount(pay(rightm2)) middot middot middot (9)= money amount(left)minusm1 +money amount(right) minus m2 middot middot middot (10)= (money amount(left) + money amount(right)) minus (m1 + m2)= money amount(Node( left right)) minus (m1 +m2) middot middot middot (11)= money amount(c) minus (m1 +m2)

2Note that nminusm = 0 when m gt n

101

Data Conversion Revisited Takahashi Yoshimaru and Goto

Formula (8) is obtained by expanding c Formula (9) is obtained by the distribution propertyofmoney amount and the property of payment onmoney Formula (10) is obtained by applyinginduction tomoney Formula (11) is obtained from the distribution property ofmoney amount

43 Divisibility

Given that ms is a list of values each of which corresponds to a transaction if a user paysfrom the head of this list in succession then the remainder is the correct value This propertyis represented as follows

forallnforallms( n ge listsum(ms)

=rArr money amount (foldl(pay(cash(n)ms))) = n minus listsum(ms) )

Here foldl and listsum are the functions handling a list Let ms be a list [m1 mk]foldl(pay(cms)) is rewritten in the following form

(pay( (pay(cm1) mk)

and listsum(ms) is rewritten in the following form

m1 + + mk

This theorem can be proved using the result of the proofs for the above two properties ofwell-definedness

5 Discussion

Modeling the e-cash protocol and proving the properties described in the previous sections wereperformed using the theorem provers IsabelleHOL and Coq respectively First we comparethese two provers

Both of them are interactive theorem-proving environments based on inductive theoremproving The data types and functions are defined in recursive form and the proof proceeds byconnecting suitable tactics

IsabelleHOL has a more powerful engine for automatic proof than Coq A proof may suc-ceed simply by using the lsquoautorsquo command without connecting multiple lemmas in IsabelleHOLwhereas a user must specify tactics manually in Coq However the proof procedure in Coq iseasier to understand

Both provers are based on typed logics and adopt higher-order functions In Coq type-checking is richer and proof-checking is reduced to type checking It requires the user to provethe termination of a recursive function IsabelleHOL also requires the user to prove thetermination of a recursive function but has a stronger automatic mechanism and user doesnot need to supply much input

We developed a model for an e-cash protocol and set out to prove three properties of themodel using IsabelleHOL and subsequently translated the model into Coq The translationwas basically straightforward The definition of a primitive recursive function using primrec inIsabelleHOL was translated to Fixpoint in Coq the definition of a recursive function usingfun was translated to Function the definition of a non-recursive function using definitionwas translated to Definition In addition we must prove the termination of the functionintroduced via Function

102

Data Conversion Revisited Takahashi Yoshimaru and Goto

The tactics used in the proofs of two provers were quite different Generally more tactics arerequired in Coq however the proof in Coq provides a useful basis from which to make a proofin IsabelleHOL Actually we completed the proof of the unproved lemma in IsabelleHOL byreferring to the proof in Coq From this experience it is expected that similar modeling withother provers is possible and that the existing proofs will be useful as a basis for forming proofsin those other provers All definitions and proofs in IsabelleHOL and Coq are shown in [22]

In the field of protocol verification there are a number of works on the verification ofsecurity protocols using IsabelleHOL (eg[2]) However they mainly proved security or safetyof protocols To the best of our knowledge there exists no research on a proof that focuses onthe divisibility of electronic cash protocols using a theorem-proving approach

Bijection between the set of natural numbers and rooted trees has been discussed in severalworks [5 6 9] In these works prime decomposition of the natural numbers was used toconstruct the corresponding rooted tree They used an incomplete tree in which each primenumber forms an individual branch It appears to be impossible to define this bijection in aninductive manner Attempts to provide the mechanical proof were not made and the correctnessof the methods has not been proved using theorem provers On the other hand we propose amethod for automated theorem proving using a complete binary tree

The data conversion method described here is applicable to conversion from an inductivelydefined data structure with one successor to one with n successors by introducing a list inwhich each element takes n values as an intermediate data structure instead of a bit sequenceFollowing this transformation the proof can proceed in a similar manner to the one shown inthis paper although the number of lemmas would increase Moreover it can be extended todata conversion from data structures with m successors to data structures with n successors bycomposing two data-conversion functions ie one from an inductively defined data structurewith m successors to that with one successor and then a second function from an inductivelydefined data structure with one successor to one with n successors

6 Conclusion

We have described a function for converting data from a natural number to a binary treeand have given an inductive proof for its well-definedness We have described a method ofintroducing a bit sequence as an intermediate data structure to provide a model for inductivelydefined data structures with different induction schemes We formalized this method developeda computational model based on it and applied it to an electronic cash protocol We succeededin proving the properties of divisibility of the protocol using the theorem provers IsabelleHOLand Coq and discussed the effectiveness of the method

In future we would like to investigate other functions andor properties on such a binarytree that is handled here and develop methods of their inductive proof

References

[1] Arsac W Bella G Chantry X and Compagna L Multi-Attacker Protocol Validation J ofAutomated Reasoning 46(3-4)353-388 (2011)

[2] Bella G Massacci B and Paulson L Verifying the SET Purchase Protocols J of AutomatedReasoning 365 37 (2006)

[3] Bella G Inductive Verification of Smart Card Protocols J of Computer Security 11(1)87-132(2003)

103

Data Conversion Revisited Takahashi Yoshimaru and Goto

[4] Bertot Y and Castran P Interactive Theorem Proving and Program Development - CoqrsquoArtThe Calculus of Inductive Constructions Springer Verlag (1998)

[5] Beyer T and Hedetniemi S M Constant Time Generation of Rooted Trees SIAM J Comput9(4)706-712 (1980)

[6] Cappello P A New Bijection between Natural Numbers and Rooted Trees 4th SIAM Conferenceon Discrete Mathematics (1988)

[7] Chan A Frankel Y and Tsiounins Y Easy Come - Easy Go Divisible Cash EUROCRYPT98pp 561-575 (1998)

[8] Canard S and Gouget A Divisible E-Cash Systems Can Be Truly Anonymous EURO-CRYPT2007 pp482-497 (2007)

[9] Gobel F On a 1-1-Correspondence between Rooted Trees and Natural Numbers J of Combina-torial Theory Series B(29)141-143 (1980)

[10] Hardin D S (ed) Design and Verification of Microprocessor Systems for High-Assurance Appli-cations Springer Verlag (2010)

[11] KaufmannM Monolios P and Moore J S Computer-Aided Reasoning An Approach KluwerAcademic Publishers (2000)

[12] Klein G et al seL4 Formal Verification of an Operating-System Kernel Commun ACM 53(6)107-115 (2010)

[13] Kurita T and Nakatsugawa Y The Application of VDM to the Industrial Development ofFirmware for a Smart Card IC Chip Int J of Software and Informatics 3(2-3)343-355 (2009)

[14] Leroy X Formal Verification of a Realistic Compiler Communications of the ACM 52(7)107-115(2009)

[15] Nakanishi T and Sugiyama Y An Efficiently Improvement on an Unlinkable Divisible ElectronicCash System IEICE Trans on Fundamentals E85-A(19)2326-2335 (2002)

[16] Nipkow T Paulson L and Wenzel M IsabelleHOL A Proof Assistant for Higher-Order LogicSpringer Verlag (2002)

[17] Norell U Dependently Typed Programming in Agda Advanced Functional Programming 2008pp230-266 (2008)

[18] Okamoto T An Efficient Divisible Electronic Cash Scheme The proceedings of Cryptorsquo95pp438-451 (1995)

[19] OwreS RushbyJM and ShankarN PVS A Prototype Verification System The proceedingsof CADE-11 pp748-752 (1992)

[20] Sprenger C Zurich E T H Basin D et al Cryptographically Sound Theorem Proving 19thIEEE Computer Security Foundations Workshop (2006)

[21] Takahashi K and Yoshimaru S Formalization of Data Conversion for Inductive Proof Tunisia-Japan Workshop on Symbolic Computation in Software Science (SCSS 2009) pp135-150 (2009)

[22] httpistksckwanseiacjp~ktakaEMONEY

104

Data Conversion Revisited Takahashi Yoshimaru and Goto

Appendix Proof for E-cash protocol in Coq (tail-recursiveversion)

Require Import Omega List Arith Div2 Bool Recdef Wf_nat

Theorem well_definedness_of_pay

forall(m money)(n nat)

n lt= money_amount m

-gt money_amount(pay m n) = money_amount m - n

Proof

intros m

induction m intros n LNM destruct b simpl in try reflexivity

destruct (eq_nat_dec n 0)

rewrite e reflexivity

assert(n = 1) by omega

rewrite H reflexivity

destruct (lt_dec (money_amount m1) n) simpl

rewrite IHm2 try omega

replace (money_amount (change_false m1)) with 0 try omega

destruct m1 simpl reflexivity

rewrite IHm1 omega

Qed

Lemma bit_sequence_distribution

forall(bs list bool)(b bool)

money_amount(bs_to_money(bs ++ (bnil))) =

2 money_amount(bs_to_money bs) + (if b then 1 else 0)

Proof

intros bs b

induction bs simpl in

destruct b reflexivity

assert(forall(bl bool)money_amount (create_money bl (length

(bs ++ b nil))) =

money_amount (create_money bl (length bs)) + money_amount

(create_money bl (length bs)))

intros clear IHbs destruct bl induction bs simpl try omega

destruct a simpl in rewrite IHbs repeat rewrite plus_0_r

repeat rewrite plus_assoc rewrite H omega

Qed

Lemma one_reminder_div2

forall(n nat)

(2 div2 n) + (if one_reminder n then 1 else 0) = n

Proof

intros n

case_eq (one_reminder n) intros induction n using lt_wf_ind

destruct n try discriminate

destruct n try reflexivity

simpl in H

simpl

replace (S (div2 n + S (div2 n + 0) + 1))

with (S (S (2 div2 n + 1)))

105

Data Conversion Revisited Takahashi Yoshimaru and Goto

repeat f_equal

rewrite H0 try reflexivity try omega

apply H

simpl

omega

destruct n try reflexivity

destruct n try discriminate

simpl in H

simpl

replace (S (div2 n + S (div2 n + 0) + 0))

with (S (S (2 div2 n + 0)))

repeat f_equal

rewrite H0 try reflexivity try omega

apply H

simpl

omega

Qed

Theorem well_definedness_of_cash

forall(n nat)

money_amount (cash n) = n

Proof

intros n

induction n using lt_wf_ind

destruct n try (simpl reflexivity)

destruct n try (simpl reflexivity)

unfold cash rewrite bit_sequence_equation

case_eq (one_reminder (S (S n))) intros

rewrite bit_sequence_distribution unfold cash in H rewrite H

try (apply lt_div2 apply lt_0_Sn)

pose (one_reminder_div2 (S (S n)))

rewrite H0 in e apply e

Qed

Definition listsum(ns list nat) nat = fold_right plus 0 ns

Definition payment_amount(m money)(ns list nat) nat =

money_amount (fold_left pay ns m)

Theorem Divisibility

forall(n nat)(ns list nat)

listsum ns lt= n -gt

payment_amount (cash n) ns = n - listsum ns

Proof

intros n ns LSM

induction ns using rev_ind simpl in

rewrite lt- minus_n_O

apply well_definedness_of_cash

unfold payment_amount in

unfold listsum in

rewrite fold_left_app

rewrite fold_right_app in simpl in

rewrite plus_0_r in

106

Data Conversion Revisited Takahashi Yoshimaru and Goto

assert(fold_right plus 0 ns + x lt= n)

generalize n LSM

clear IHns LSM n

induction ns intros simpl in

omega

assert(fold_right plus x ns lt= n - a) by omega

apply IHns in H omega

rewrite well_definedness_of_pay rewrite IHns simpl in try omega

replace (fold_right plus x ns) with ((fold_right plus 0 ns) + x)

omega

clear IHns H LSM

induction ns simpl

reflexivity

rewrite lt- IHns info omega

Qed

107

Computer Algebra Investigation of Known

Primitive Triangle-Free Strongly Regular

Graphs

Mikhail Klin and Matan Ziv-Av

Ben-Gurion University of the Negevklincsbguacil

matansvgaliborg

Abstract

With the aid of computer algebra systems COCO and GAP with its packages we areinvestigating all seven known primitive triangle-free strongly regular graphs on 5 10 1650 56 77 and 100 vertices These graphs are rank 3 graphs having a rich automorphismgroup The embeddings of each graph from this family to other ones are described the au-tomorphic equitable partitions are classified all equitable partitions in the graphs on up to50 vertices are enumerated Basing on the reported computer aided results and using tech-niques of coherent configurations a few new models of these graphs are suggested whichare relying on knowledge of just a small part of symmetries of a graph in consideration

1 Introduction

This paper appears on the edge between computer algebra systems and algebraic graph theory(briefly AGT) and is mainly devoted to the computer aided investigation of the known primitivetriangle free strongly regular graphs

In fact there are 7 such graphs those on 5 10 16 50 56 77 and 100 vertices The largestone denoted by NL2(10) is the universal graph for this family in the sense that all seven graphsare induced subgraphs of NL2(10) We denote by F the family of those 7 graphs

The history of the discovery of the graphs from F and in particular of NL2(10) is quitestriking Indeed the graph NL2(10) was discovered twice once in 1956 by Dale Mesner andsecond time independently in 1968 by D G Higman and C C Sims The details of thishistory are considered in [15] see also a very brief summary in Section 4

The graphs on 5 10 and 50 vertices form a very significant subfamily consisting of theknown Moore graphs One more possible member of this series (see eg [16]) would have 3250vertices its existence is an open problem of a great significance Moore graphs and their naturalgeneralizations are objects of much interest in extremal graph theory they serve as the bestexamples of optimal network topologies Discovery of a new primitive triangle free stronglyregular graph would be a high level sensation in modern mathematics

This text is oriented towards an interdisciplinary audience though its kernel is strictlyrelated to a concrete kind of application of computer algebra in AGT

Section 2 provides in compact form the necessary background about strongly regular graphssee [11] [5] for more details while in section 3 we briefly introduce the tools of computer algebraused in AGT The seven graphs from the family F are presented in section 4

Our first main result is introduced in Section 5 full description of embeddings of (primitiveand imprimitive) triangle free strongly regular graphs into the graphs in F

108

Triangle-free strongly regular graphs Klin Ziv-Av

The next topic of our investigation is related to equitable partitions with a special emphasison automorphic equitable partitions see definitions in Section 6 The search strategy is de-scribed in Section 7 though much more details may be found in [28] We report the completeenumeration of automorphic equitable partitions and partial results for the general case

Sections 8ndash10 reflect our efforts to understand a few of the computer aided results and topresent them in a computer free form (completely or at least relatively)

In Section 8 we deal with the graph NL2(10) and describe it in a sense locally that isvia so-called metric equitable partitions obtained from the embeddings of a quadrangle anda graph K33 without one edge (Atkinson configuration) with 4 and 8 cells respectively Thespectrum of the second partition contains all of the eigenvalues of NL2(10) (the case of fullspectrum) Some modifications of the famous Robertson model (see [21]) appear in Section 9while in Section 10 we present a handful of models for some other graphs in F

It is worthy to mention that for generations of mathematicians the graphs in F appear asa source of ongoing aesthetic admiration see especially the home page of Andries Brouwer [6]We believe that some of our models shed a new light on those graphs

Last but not least is that as a rule the models we suggest rely on a relatively small subgroupof the group Aut(Γ) for Γ isin F In this way we provide promising patterns for those researcherswho wish in future to face a challenge to try to construct new primitive triangle free stronglyregular graphs cf Section 11

2 Strongly regular graphs a brief survey

An undirected graph Γ is called a strongly regular graph (SRG) with parameters (v k λ micro) ifit is a regular graph of order v and valency k and every pair of adjacent vertices has exactly λcommon neighbors while every pair of non-adjacent vertices has exactly micro common neighborsSometimes we use an extended set of parameters (v k l λ micro) where l is the number of non-neighbors of a vertex that is l = v minus k minus 1

If A = A(Γ) is the adjacency matrix of an undirected graph Γ then Γ is strongly regular ifand only if A2 = kI + λA+ micro(J minus I minus A) This implies that (I A J minus I minus A) is the standardbasis of a rank 3 homogeneous coherent algebra In other words (∆ΓΓ) are the basic graphsof a rank 3 symmetric association scheme (here Γ is the complement of Γ while ∆ contains allthe loops) The adjacency matrix of a strongly regular graph has exactly 3 distinct eigenvaluesFor a strongly regular graph we denote by

bull r gt s the two eigenvalues of A(Γ) different from k r is always positive while s is alwaysnegative

bull f g the multiplicity of the eigenvalues r s respectively

A formula for f and g is given by g f = 12

[(v minus 1)plusmn 2k+(vminus1)(λminusmicro)radic

(λminusmicro)2+4(kminusmicro)

]

A quadruple of parameters (v k λ micro) for which f and g as given by the preceding formulasare positive integers is called a feasible set of parameters See [6] for a list of feasible parametersets with some information about known graphs for some of the sets

A strongly regular graph Γ is called primitive if both Γ and its complement Γ are connectedThis is equivalent to primitivity of the related association scheme (∆ΓΓ)

109

Triangle-free strongly regular graphs Klin Ziv-Av

3 Computer algebra tools in AGT

During the last two decades the significance of the use of computer algebra systems in AGTincreased drastically Such systems are exploited in the search for new combinatorial objectsthe enumeration of objects with prescribed parameters and the understanding of algebraic andstructural properties of a given combinatorial object Γ (such as the automorphism group Aut(Γ)its action and orbits on the ingredients of Γ enumeration of substructures of Γ embeddings ofΓ into larger structures etc)

An ideal case is when the computer aided understanding of an object Γ is followed by furthertheoretical generalizations The foremost goal of this paper is to share with the reader manynew interesting properties of the graphs in the family F in order to promote the search for newprimitive tfSRGs

Below are the main tools we use

bull COCO is a set of programs for dealing with coherent configurations including construc-tion enumeration of subschemes and calculation of automorphism groups

Developed in 1990-2 Moscow USSR mainly by Faradzev and Klin [8] [9]

bull WL-stabilization ndash Weisfeiler-Leman stabilization is an efficient algorithm for calcu-lating coherent closure of a given matrix (see [25] [3]) Two implementations of theWL-stabilization are available (see [2])

bull GAP an acronym for ldquoGroups Algorithms and Programmingrdquo is a system for com-putation in discrete abstract algebra [10] [22] It supports easy addition of extensions(packages in gap nomenclature) that are written in the GAP programming languagewhich can add new features to the GAP system

One such package GRAPE [23] is designed for construction and analysis of finite graphsGRAPE itself is dependent on an external program nauty [18] in order to calculate theautomorphism group of a graph Another package is DESIGN used for construction andexamination of block designs

bull COCO v2 ndash The COCO v2 initiative aims to re-implement the algorithms in COCOWL-stabilization and DISCRETA as a GAP package In addition the new package shouldessentially extend abilities of current version basing on new theoretical results obtainedsince the original COCO package was written

We refer to [14] for a more detailed discussion of the ways in which computer algebra systemsare used in AGT for the purpose of experimentation and further theoretical generalizations

4 The seven known primitive triangle-free strongly regu-

lar graphs

A graph Γ is called triangle free if it admits no triangles that is cliques of size 3 If Γ is also astrongly regular graph then it is called a triangle free strongly regular graph (tfSRG for short)A graph is triangle free if any two neighbors have no common neighbors therefore a tfSRG isan SRG with λ = 0

The 7 known primitive tfSRGs with orders from 5 to 100 vertices are

1 Pentagon with parameters (5 2 0 1) Its automorphism group is D5 of order 10

110

Triangle-free strongly regular graphs Klin Ziv-Av

0

1

2 3

4

25

26

27 28

29

10

11

12 13

14

Figure 1 Hoffman-Singleton graph Robertson model

2 Petersen graph with parameters (10 3 0 1) Its automorphism group is isomorphic to S5

of order 120 A simple model has as vertices 2-subsets of a set of size 5 with two verticesadjacent if the subsets are disjoint

3 Clebsch graph with parameters (16 5 0 2) Usually denoted by 5 Its automorphismgroup is isomorphic to (S5 ≀S2)

pos of order 1920 A simple model is 4-dimensional cube Q4

together with long diagonals or Cayley graph CAY (E24 0001 0010 0100 1000 1111)

4 Hoffman-Singleton graph (HoSi) with parameters (50 7 0 1) Its automorphism group isisomorphic to PΣU(3 52) of order 252000 ([4]) The simplest model is Robertson model([21]) 5 pentagons marked P0 P4 and 5 pentagrams marked Q0 Q4 with vertexi of Pj joined to vertex i+ jk (mod 5) of Qk

5 Gewirtz (or Sims-Gewirtz) graph with parameters (56 10 0 2) Its automorphism groupof order 80640 is a non split extension of PSL3(4) by E22 A simple model is as theinduced subgraph of NL2(10) on the common non-neighbors of two adjacent vertices

6 Mesner graph with parameters (77 16 0 4) The automorphism group is of order 887040and is isomorphic to the stabilizer of a point in the automorphism group of NL2(10) Onesimple model is induced subgraph of NL2(10) on non-neighbors of a vertex

7 NL2(10) with parameters (100 22 0 6) also known as the Higman-Sims graph Its auto-morphism group contains Higman-Sims sporadic simple group as a subgroup of index 2We refer to [15] for a detailed presentation of the original construction of this graph byDale Mesner as it appeared on [19] [20]

Recall that the graph NL2(10) on 100 vertices was constructed twice by Dale Mesner inhis Thesis in 1956 [19] and later on by Higman and Sims in 1968 when they discovered anew sporadic simple group Moreover in 1964 Mesner proved its uniqueness We denote thisgraph by NL2(10) following the parametrization for a family of putative graphs introduced byMesner in [20] In [15] the history of this discovery as well as of related events is discussed withmany details A new wave of interest in tfSRGs stimulated by [15] was especially productivefor us It became clear that this is the time to arrange a serious comprehensive investigation ofdiverse structural properties of the graphs in the family F The goal is to attract the attentionof researchers to such an information in order to provide new ideas how efforts for the searchof new tfSRGs should be arranged We also wish to share with the reader some surprising newfeatures of the graphs in the family F observed with the aid of a computer

111

Triangle-free strongly regular graphs Klin Ziv-Av

5 Embeddings of tfSRGs into known primitive tfSRGs

Usually in graph theory a graph ∆ = (V prime Eprime) is called a subgraph of a graph Γ = (VE) if

V prime sube V and Eprime sube E Of special interest are induced subgraphs in this case Eprime = E capV prime

2

whereX2

is the set of all 2-subsets of X

Proposition 1 A subgraph ∆ of diameter 2 of a graph Γ with no triangles is an inducedsubgraph

Proof Assume that ∆ is not induced then there exists an edge uw isin E uw 6isin Eprime withuw isin V prime Since the diameter of ∆ is 2 there exist a v which is adjacent in ∆ (and thereforein Γ) to u w thus u v w is a triangle in Γ which is a contradiction

The enumeration of all tfSRGs inside of known tfSRGs was the first serious computationalchallenge in this project The results of its complete solution are discussed below

A non-empty imprimitive tfSRG is either a complete bipartite graph (Kllsim= 2 Kl) or

a graph s K2 consisting of s edges with no common vertices Note that K22 is simply aquadrangle

Lemma 2 Graph NL2(10) does not contain subgraph K33

Proof Originally we obtained this result with the aid of a computer In fact easy proof followsfrom the non-edge decomposition of Γ = NL2(10) (see eg [15]) without any assumptions aboutits uniqueness Indeed let ∆ be a subgraph of Γ which is isomorphic to K33 Assume thattwo bipartite parts of ∆ consist of subsets a b c d e f of vertices Consider now non-edgedecomposition of Γ with respect to a b then c belongs to the cell of size 60 while d e fbelong to the cell of size 6 thus c has just g = 2 neighbors in the latter cell a contradictionwith the valency of c equal to 3 in ∆

As a corollary we obtain that every known primitive tfSRG does not contain K33 andmoreover does not contain Kll when l ge 3

Another simple theoretical result (see eg [28]) claims that the number of quadrangles in an

SRG with parameters (v k l λ micro) is equal tovk2 (

λ

2)+vl2 (

micro

2)2 When λ = 0 this reduces to vlmicro(microminus1)

8 Similar formula may be obtained for the number of 2K2 The numbers of imprimitive tfSRGsinside of graphs in F are given in Table 1 in the supplement while the number of orbits of suchembeddings (with respect to Aut(Γ) for Γ isin F) are given in Table 2

Note that there is no induced subgraph of NL2(10) isomorphic to 12 K2 so both tablesin Supplement A end with s = 11 for s K2

Similar computer results are presented in Tables 3 and 4 (Supplement A) for the embeddingsof a graph from the family F into a larger graph in F

Here the final picture is less sophisticated There are just two cases where for pair of graphsXY isin F there exist more than one orbit of embeddings (up to action of Aut(Y )) of X intoY Namely in these terms there are 9 embeddings of Petersen graph into Mesner graph and 5embeddings into NL2(10) Computer free understanding of these embeddings remains a quiteinteresting task for future investigations of the links between the graphs in the family F

In all other cases there exists (up to isomorphism) at most one embedding for consideredpair (XY ) For most pairs there is a reasonably clear explanation in literature such as twoHoSi inside NL2(10) see eg [12] as well as Robertson model of HoSi [21] which explainspositions in it for both pentagon and Petersen graph

Beside this there are two more embeddings which are not immediately evident

112

Triangle-free strongly regular graphs Klin Ziv-Av

The first pair is the embedding of the Petersen graph into Gewirtz graph In fact inthis embedding the Petersen graph appears as a subgraph of the second constituent of theGewirtz graph which in turn is a graph ∆ of valency 8 on 45 vertices It turns out thatAut(∆) sim= Aut(S6) This graph ∆ generates a non-Schurian association scheme with threeclasses see eg [24] [13] example W38 The graph ∆ may be also described as the distance2 graph of the distance transitive graph of diameter 4 and valency 4 on 45 vertices akageneralized octagon GO(2 1) aka line graph of Tuttersquos 8-cage (see [5] for more details) Inthis context the task of explanation of the embedding of Petersen graph into ∆ seems to be anice exercise in AGT though out of the framework of this presentation

The second exceptional pair is the embedding of the Clebsch graph 5 into NL2(10) Thispair is of a definite independent interest and thus is considered separately in Section 10

Finally we mention that the classification of cocliques in graphs from F may be regardedas a degenerate case of subject in this section Indeed empty graph is a particular case of animprimitive tfSRG We however disregard this problem referring to information presented onthe home page of Andries Brouwer [6]

6 Equitable partitions

Let Γ = (VE) be a graph A partition τ of the vertex set V τ = V1 Vs is calledequitable partition (briefly EP) if for i j isin 1 s the numbers |Γ(v) cap Vj | are equal for allv isin Vi Here Γ(v) = u isin V |u v isin E Usually an EP τ is accompanied by intersectiondiagram which represents a kind of quotient graph Γτ on which all intersection numbers aredepicted Many such diagrams appear in [5] The quotient graph Γτ is in fact a multigraphIts (collapsed) adjacency matrix B consists of all intersection numbers

Obviously entries of B are non-negative integers and for a regular graph Γ of valency k thesum of each row in B is k

If H is a subgroup of Aut(Γ) then the set of orbits of H is an EP of Γ Such an EP is calledautomorphic (briefly AEP)

Proposition 3 ([11]) Let Γ be a graph A = A(Γ) the adjacency matrix of Γ If a partitionτ is EP of Γ with matrix B then the characteristic polynomial of B divides the characteristicpolynomial of A

In fact there are more necessary conditions for a prescribed matrix B to be the adjacencymatrix of a suitable EP of Γ which are formulated in terms of spectral graph theory see eg[7] They create a solid background for a clever search of potential EPs in a given graph Γ

7 Search for equitable partitions

In this project we distinguished two alternative problems for the complete search of EPs ingraphs of F

First problem is to enumerate all automorphic EPs Here we strongly rely on the level ofgroup theoretical ldquointellectrdquo of GAP Indeed for groups of relatively small order (say up to afew thousands) GAP allows to establish efficiently the structure of a considered group as wellas the lattice of its subgroups

However for four graphs in F the group G = Aut(Γ) has larger order thus with the growingof |G| extra theoretical input is required For example in case of G = Aut(NL2(10)) we wereusing information from the website of the Atlas of Finite Group Representations ([26]) about

113

Triangle-free strongly regular graphs Klin Ziv-Av

the maximal subgroups of G (this information goes back to [17]) This knowledge together withad hoc tricks inside of GAP made it possible to describe all subgroups of G up to equivalencyclasses with respect to EPs The fact that all groups G = Aut(Γ) Γ isin F are subgroups ofAut(NL2(10)) was also quite beneficial

Finally we successfully enumerated all automorphic EPs for all Γ isin FThe second problem is much more sophisticated to enumerate all EPs for all graphs in FFor the smallest three graphs in F the results were achieved via simple brute force see

corresponding tables in Supplement BFor HoSi we used a few complementary strategies in the search for all EPs First we attacked

partitions with ldquolargerdquo number of cells say s gt 5 Here we introduced extra parameter thesize of the smallest cell which varies from 1 to 9 Each such case was considered separately

On the second stage we step by step enumerated cases 2 le s le 5 by enumerating possiblecollapsed adjacency matrices for each case and for any such matrix enumerating all EPs

The description of our computer activities together with detailed discussion of the resultsis presented in [28] An extra advantage of the enumeration in HoSi is that it serves as a kindof a pleasant interaction of a human and a computer Indeed in spite of the fact that the mainpart of computation was fulfilled by GAP a human can follow search explain its logic and stepby step to comprehend all ongoing results

We admit however that the extra advantage of HoSi is that here parameter micro takes itssmallest possible value of 1 (for a primitive SRG) As soon as micro gt 1 and v is growing theproblem is becoming essentially more difficult

This is why already for the Gewirtz graph with v = 56 we only succeeded in enumeration ofall EPs for which the stabilizer has order at least 2 There are 688 such EPs The enumerationof the rigid EPs cannot be completed by a computer in a reasonable time

The full enumeration of all EPs for the largest two graphs in F (on 77 and 100 vertices) atthis stage looks intractable Only modest particular cases may be proceeded efficiently

We refer to Supplement B for Tables 5 6 and 7 which summarize our activities for bothconsidered problems see [28] for more information

As was mentioned in the introduction one of the main goals of this project is to detect anumber of ldquonicerdquo EPs which may serve as a training model for future search of new primitivetfSRGs At this stage this kind of job only partially relies on the support from computer finallya humanrsquos insight still turns out to be very significant Below we report about interestinginterpretations created by us for a handful of detected EPs

8 Quadrangle and Atkinson EPs of NL2(10)

Recall that Γ = NL2(10) has100middot77middot6middot5

8 = 28875 quadrangles This is a simple result obtainedon a combinatorial level without any knowledge of structure of Γ

Provided that Γ and G = Aut(Γ) are known we easily obtain (with the use of a computer)that all quadrangles in Γ form one orbit under G and stabilizer H of a quadrangle in G hasorder 3072 is isomorphic as abstract group to (Z4 times Z2)(Z4 times Z2)) Z2) Z2) Z3) Z2) Z2

and has in action on V (Γ) four orbits of lengths 4 8 24 and 64Thus we may consider an automorphic EP of size s = 4 There is sense to try again

combinatorial arguments in order to determine all invariants of this EP without any priorknowledge of Γ and its group Fortunately this turns out to be possible

Proposition 4 Let τ be a metric decomposition with respect to a prescribed quadrangle Qinside of Γ Then τ is EP s = 4 sizes of cells are 4 8 24 64 and (with respect to this

114

Triangle-free strongly regular graphs Klin Ziv-Av

ordering of cells) B =

2 4 0 162 0 12 80 4 2 161 1 6 14

See proof in [28]In principle next stage should be to describe a model of NL2(10) in terms of the group

H of order 3072 or one of its subgroups which is transitive on all cells of the quadrangle EPNevertheless in this text we are avoiding this task Instead of we prefer to split the quadrangleEP to one with larger number of cells and to proceed with that new one

A note [1] was published before the announcement of CFSG The author considered 13parameter sets for tfSRGs which may be also rank 3 graphs with the number v of verticeswhere 100 lt v le 1000 and proved that such graphs can not be constructed with the aid ofknown 2-transitive permutation groups Part of exposed details is related to consideration of aconfiguration A (graph K33 minus one edge) in putative graph

We got impression that [1] is overseen through a generation of mathematicians and it mightbe helpful to analyze existence of A (we call it Atkinson configuration) in known tfSRGs

It turns out that A appears only in graphs on 77 and 100 vertices Here we analyze itsposition in Γ = NL2(10)

Let us fix at A a quadrangle for example with the vertices a b c f Then two extra ver-tices have two neighbors in the selected quadrangle namely ends of two non-edges respectively

Now we embed A into the considered above quadrangle decomposition splitting in it cell ofsize 8 into two cells of size 2 (exactly our d e) and the remainder This immediately impliessplit of the cell of size 64 into two cells of sizes 16 and 48 The cell of size 24 is forced to besplit into subcells of sizes 12 6 6 depending on the number of neighbors in d e being 1 2and 0 respectively

A more careful analysis (see [28]) shows that we are still getting an EP

Proposition 5 A metrical decomposition τ(A) of a tfSRG with the parameters of NL2(10)with respect to configuration A is EP with s = 8 and cells of sizes 4 2 16 48 6 12 6 6 Ithas collapsed matrix B as follows with Spec(B) = 22 25 (minus8)2

B =

2 1 4 12 3 0 0 02 0 8 0 0 6 6 01 1 2 12 0 3 0 31 0 4 10 1 3 2 12 0 0 8 0 6 2 40 1 4 12 3 2 0 00 2 0 16 2 0 0 20 0 8 8 4 0 2 0

Originally the proof was obtained with the aid of com-puter analysis of Γ = NL2(10) Later on an outline of asimilar proof as for quadrangle configuration was againobtained without prior knowledge of Γ

Further consideration of τ(A) was fulfilled inside ofknown graph Γ and its group Aut(Γ) It turns out thatH = Aut(τ(A)) sim= D4timesS4 is a group of order 192 H hasexactly 8 orbits on the set V (Γ) thus A is an automorphicEP

Describing further stabilizers of H on each of the 8orbits we elaborated the following ad hoc model of Γ

We start from the auxiliary graph ∆ depicted in Figure 2We identify elements of each orbit in τ(A) with suitable sets of structures described with

the aid of ∆ In fact each set of structures appears as orbit of action of the group H Thus itis enough to describe a representative of each orbit

For example the elements in the cell of size 16 are the vertices of ∆ while the elements ofthe cell of size 4 are the four columns of ∆ The most tricky to find was a representation of the7th cell of size 6

115

Triangle-free strongly regular graphs Klin Ziv-Av

12 13 14 15

8 9 10 11

4 5 6 7

0 1 2 3

Figure 2 Auxiliary graph ∆

We think that this piecewise model of Γ appearing from areasonably small solvable group of order 192 may serve as anoptimistic message for those researchers who are hunting for newtfSRGs see also comments in Section 11

9 Some modifications of Robertson

model

The Robertson model of the Hoffman-Singleton graph (see Figure1) partitions the vertices into five pentagons and five pentagramsand describes a simple arithmetic rule for the edges connectingpentagons and pentagrams (see Section 4) Let pij (qij) be vertexj of pentagon (pentagram) i

Since NL2(10) has an EP to two cells of size 50 where theinduced graph on each cell is isomorphic to HoSi this model can be extended to a model ofNL2(10)

In both cases we get an EP with a collapsed adjacency matrix that has a transitive au-tomorphism group (a permutation g isin Sn is an automorphism of a matrix M isin F

ntimesn if thepermutation matrix Mg commutes with M) We are therefore interested in equitable partitionswith this property

In the list of equitable partitions of HoSi we find another such partition with 10 cells of sizefive The collapsed adjacency matrix of this partition isM The spectrum ofM is 7 24 (minus3)5so it has the full spectrum of HoSi

M =

0 2 2 0 0 0 0 1 1 12 0 1 0 1 2 0 0 1 02 1 0 2 0 0 1 0 0 10 0 2 0 1 1 2 0 0 10 1 0 1 0 2 0 1 0 20 2 0 1 2 0 1 0 1 00 0 1 2 0 1 0 1 2 01 0 0 0 1 0 1 0 2 21 1 0 0 0 1 2 2 0 01 0 1 1 2 0 0 2 0 0

The cells of this partition can be de-scribed in the Robertson model of HoSi foreach i isin [1 5] we construct two cellsp11+i p21+i p32+i p44+i p52+iq11+i q21+i q35+i q43+i q55+i

If we consider this matrix M as the adjacencymatrix of a color graph then the basic graph for thecolor 1 is the Petersen graph while the basic graphfor the color 2 is a cycle of length 10 For compar-ison acting similarly with the Robertson partitionwe get a graph K55

The stabilizer of the (ordered) partition inAut(HoSi) is isomorphic to the dihedral group D5

of order 10 as is the automorphism group of M

The coherent closure of the partition (more specifically of the graph with its vertices coloredaccording to the partition) is a Schurian coherent configuration of rank 300 with the stabilizerof the partition as its automorphism group

This EP of HoSi can be extended to an EP of NL2(10) of 20 independent sets of size 5 Inthis case the matrix has spectrum 22 213 (minus8)6 so this EP has full spectrum as well

The automorphism group of this matrix has order 240 and is isomorphic to Z2 times S5 whilethe stabilizer of the ordered partition is again D5 of order 10

The coherent closure of the partition is a Schurian coherent configuration of rank 1200 withthe stabilizer of the partition as its automorphism group

116

Triangle-free strongly regular graphs Klin Ziv-Av

7 7 7

7 7 7

7 74 4

2 2 2

2 2 2

Figure 3 AEP of Gewirtz graph by a semiregular subgroup of order 7

10 A few more models

The calculated data both about embeddings of tfSRGs inside tfSRGs and about EPs can beused to present new models and constructions for tfSRGs Here we offer a few examples withoutgoing into a lot of details

Example 1 (Two Wagner graphs in Clebsch graph) Wagner graph also known as Mobiusladder of order 8 denoted by M8 is a cubic graph on 8 vertices A simple model for it is aCay(Z8 1minus1 4) The spectrum is 3 12minus1 and Aut(M8) = D8

In one of the three EPs of 5 into two cells of size 8 the induced subgraph on each cell isthe Wagner graph The stabilizer of ordered partition inside Aut(5) is D8

Example 2 (Non-automorphic EP of HoSi) We can construct an EP of HoSi into two cellsby taking one of the cells to be the 20 vertices of two Petersen graphs (any two pentagons andtwo pentagrams in Robertson model) The stabilizer of this partition is D10 of order 20 so itis not automorphic

Example 3 (Inside Gewirtz graph six 7-cycles) There is one automorphic partition of Gewirtzgraph into 8 cells of size 7 The induced graph on 6 of the cells is a cycle of length 7 while theinduced graph on the other two cells has no edges

From the intersection diagram (Figure 3) we see that this partition can be merged to an

equitable partition with 2 cells of sizes 42 and 14 with adjacency matrix

(8 26 4

)

The induced graph on the cell of size 42 of valency 8 is a coherent graph Its coherent closureis a rank 6 imprimitive non-Schurian association scheme This graph is not a rational graphwith spectrum 8 222 (minus1)7 (1 +

radic2)6 (1minus

radic2)6

The induced graph on the cell of size 14 is a bipartite graph with two parts of size 7 It isthe co-Heawood graph that is the bipartite complement to the Heawood graph the Levi graph ofFano plane This is by necessity true since a regular bipartite graph of valency 4 and order 14in which every vertex belongs to exactly one quadrangle is the co-Heawood graph

A Brouwer ([6]) notes that this co-Heawood graph is a subgraph of the Gewirtz graph

Example 4 (Gewirtz graph inside of Mesner graph through the group Z7) We start witha semiregular subgroup Z7 of order 7 this time inside of the automorphism group of Mesnergraph We get an AEP with 11 cells of size 7 the collapsed matrix N of order 11 is presentedin [28] It turns out that Aut(N) sim= S2 ≀ S3 (the wreath product) is a group of order 72 withorbits of sizes 6 2 13 There are three non-equivalent possibilities to merge from this AEP a

117

Triangle-free strongly regular graphs Klin Ziv-Av

non-automorphic EP with 3 cells of sizes 14 21 42 and a collapsed matrix

4 6 6

4 0 12

2 6 8

which

has full spectrumEach of the cases provides also an EP for the Gewirtz graph with two cells of sizes 14 and

42 Thus as a by product we obtain other (cf Example 3) embeddings of the co-Heawoodgraph into the Gewirtz graph This example demonstrates ldquoirregularitiesrdquo which may causeinteresting EPs unpredictable from the first sight

Example 5 (Clebsch graph inside NL2(10)) Recall that up to the automorphism group ofΓ = NL2(10) there is one embedding of 5 into Γ The equitable partition resulting from thisembedding allows us to describe another model for NL2(10)

We start from a group H2 = Z4 times S4 of order 96 with orbits of lengths 16 16 48 128 The collapsed adjacency matrix of the corresponding automorphic equitable partition is Bprimeprime(shown below) Clearly the induced graph on the first cell of the partition is isomorphic to 5

In principle one may try as in previous sections to reconstruct the corresponding matrix Bfrom scratch not relying on knowledge of the graph Γ and its group A promising starting pointwould be justification of existence of a coclique of size 8 and its adjacency with the induced 5

We however prefer to exploit at this stage another possibility Namely it turns out thatthe stabilizers of A and 5 inside of Γ have maximal possible intersection K = Z4timesS3 of order24 K defines an AEP with 11 cells of sizes 2 4 4 6 6 6 12 12 12 12 24 and matrix Bprime

Bprime =

0 2 2 0 0 6 0 6 0 6 01 2 1 3 0 0 3 3 3 0 61 1 2 0 3 0 3 0 3 3 60 2 0 0 4 2 2 0 2 6 40 0 2 4 0 2 2 6 2 0 42 0 0 2 2 0 4 0 4 0 80 1 1 1 1 2 4 3 2 3 41 1 0 0 3 0 3 2 3 3 60 1 1 1 1 2 2 3 4 3 41 0 1 3 0 0 3 3 3 2 60 1 1 1 1 2 2 3 2 3 6

Bprimeprime =

5 4 9 3 14 2 12 0 43 4 11 3 14 0 12 2 42 8 6 6 0

It is easy to recognize how Bprime is split from the matrix B of the metric EP of the configurationA Then we merge the Bprime into Bprimeprime

The cell of size 48 is a merging of the last 3 cells the cell of size 8 is merging of cell of sizes2 and 6 (5th cell) while the cell of size 12 is a merging of two remaining cells of size 6 Eachcell of size 16 is a merging of cells of sizes 4 and 12

Example 6 (Reconstruction of NL2(10) from a subgroup of order 2) Using information inthe atlas [26] (or direct calculation using GAP) we see that G = Aut(NL2(10)) containsone conjugacy class of involutions with no fixed points From such an involution i we getan AEP into 50 cells of size 2 We investigated the quotient graph Γ of this AEP and itscollapsed adjacency matrix denoted by B The structure of Γ may be recovered by consideringthe centralizer CG(i) However we prefer to rely on information of combinatorial nature The

graph Γ has a natural EP into cells of sizes 20 and 30 (representing edges and non-edges inNL2(10))

The induced (color) graph on 20 vertices is the graph K1010 from which a 1-factor is removedThe induced graph on 30 vertices is the incidence graph of generalized quadrangle of order

2 GQ(2)

118

Triangle-free strongly regular graphs Klin Ziv-Av

This equitable partition corresponds to an equitable partition of Γ = NL2(10) into two cellsof sizes 40 and 60

11 Concluding comments

The presentation in this extended abstract is a tip of iceberg Much more concrete informationmay be found in [28] while [27] subject of ongoing polishing and development will reflect alldetected computer data about the graphs from family F We see also more potential to returnagain to construction of further models for graphs in F in particular relying on non-automorphicEPs The new attempts to achieve at least in part enumeration of all EPs of restricted size ofcells for graphs on 77 and 100 vertices are also on agenda The paper [16] as well as a numberof private communications of M Macaj to author MK create a background to attack in nearestfuture the problem of existence of new tfSRGs with relatively small parameters The parameterset on 162 vertices seems to be first interesting and realistic target

It should be mentioned that the results in [16] as well as in numerous private communica-tions of M Macaj to the author MK show that a putative new primitive triangle free stronglyregular graph Γ with prescribed parameters will have a relatively small automorphism groupAut(Γ) very concrete restrictions on the cycle structure of elements in Aut(Γ) are typicallyavailable Transformation of those restrictions to the language of equitable partitions may beregarded as a reasonable starting platform for attempts to construct a new tfSRG

Note however that many experts in AGT do not believe at all that a new tfSRG existsNeedless to say that this question creates a great challenge for the modern scientific community

Acknowledgments

We thank Andy Woldar for ongoing collaboration in this project We acknowledge Sven Re-ichard and Christian Pech for sharing with us their draft versions of COCO II Ongoing com-munication with Martin Macaj is very helpful and stimulative We also are pleased to thankPeter Cameron and Jozef Siran for interest expressed to the topic of our research

References

[1] M D Atkinson On rank 3 groups having λ = 0 Canad J Math 29(4)845ndash847 1977

[2] L Babel S Baumann and M Luedecke Stabcol An efficient implementation of the weisfeiler-leman algorithm Technical Report TUM-M9611 Technical University Munich 1996

[3] L Babel I V Chuvaeva M Klin and D V Pasechnik Algebraic combinatorics in mathematicalchemistry methods and algorithms ii program implementation of the weisfeiler-leman algorithmTechnical Report TUM-M9701 Fakultat fur Mathematik TU Munc 1997 httpwww-litmatumdeveroeffhtml96068019html

[4] C T Benson and N E Losey On a graph of Hoffman and Singleton J Combinatorial TheorySer B 1167ndash79 1971

[5] A E Brouwer A M Cohen and A Neumaier Distance-regular graphs volume 18 of Ergeb-nisse der Mathematik und ihrer Grenzgebiete (3) [Results in Mathematics and Related Areas (3)]Springer-Verlag Berlin 1989

[6] AE Brouwer httpwwwwintuenl~aebgraphs

119

Triangle-free strongly regular graphs Klin Ziv-Av

[7] Dragos Cvetkovic Peter Rowlinson and Slobodan Simic An introduction to the theory of graphspectra volume 75 of London Mathematical Society Student Texts Cambridge University PressCambridge 2010

[8] I A Faradzev and M H Klin Computer package for computations with coherent configurationsIn Proc ISSAC pages 219ndash223 Bonn 1991 ACM Press

[9] I A Faradzev M H Klin and M E Muzichuk Cellular rings and groups of automorphisms ofgraphs In Investigations in algebraic theory of combinatorial objects volume 84 of Math Appl(Soviet Ser) pages 1ndash152 Kluwer Acad Publ Dordrecht 1994

[10] The GAP Group GAP ndash Groups Algorithms and Programming Version 4412 2008

[11] Chris Godsil and Gordon Royle Algebraic graph theory volume 207 of Graduate Texts in Mathe-matics Springer-Verlag New York 2001

[12] Paul R Hafner On the graphs of Hoffman-Singleton and Higman-Sims Electron J Combin11(1)Research Paper 77 33 pp (electronic) 2004

[13] M Klin C Pech and P-H Zieschang Flag algebras of block designs i initial notions steiner2-designs and generalized quadrangles November 1998

[14] Mikhail Klin Christian Pech Sven Reichard Andrew Woldar and Matan Ziv-Av Examples ofcomputer experimentation in algebraic combinatorics Ars Math Contemp 3(2)237ndash258 2010

[15] Mikhail H Klin and Andrew J Woldar Dale Mesner Higman amp Sims and the strongly regulargraph with parameters (100 22 0 6) Bull Inst Combin Appl 6313ndash35 2011

[16] Martin Macaj and Jozef Siran Search for properties of the missing Moore graph Linear AlgebraAppl 432(9)2381ndash2398 2010

[17] Spyros S Magliveras The subgroup structure of the Higman-Sims simple group Bull AmerMath Soc 77535ndash539 1971

[18] B D McKay nauty userrsquos guide (version 15) 1990

[19] Dale Marsh Mesner An investigation of certain combinatorial properties of partially balancedincomplete block experimental designs and association schemes with a detailed study of designs oflatin square and related types ProQuest LLC Ann Arbor MI 1956 Thesis (PhD)ndashMichiganState University

[20] Dale Marsh Mesner Negative latin square designs Mimeo notes 410 Institute of Statistics UNCNC 1964

[21] George Neil Robertson Graphs minimal under girth valency and connectivity constraints Pro-Quest LLC Ann Arbor MI 1969 Thesis (PhD)ndashUniversity of Waterloo (Canada)

[22] Martin Schonert et al GAP ndash Groups Algorithms and Programming ndash version 3 release 4 patch-level 4 Lehrstuhl D fur Mathematik Rheinisch Westfalische Technische Hochschule AachenGermany 1997

[23] Leonard H Soicher GRAPE a system for computing with graphs and groups In Groups andcomputation (New Brunswick NJ 1991) volume 11 of DIMACS Ser Discrete Math TheoretComput Sci pages 287ndash291 Amer Math Soc Providence RI 1993

[24] Edwin R van Dam Three-class association schemes J Algebraic Combin 10(1)69ndash107 1999

[25] B Weisfeiler On construction and identification of graphs Number 558 in Lecture Notes in MathSpringer Berlin 1976

[26] Robert Wilson Peter Walsh Jonathan Tripp Ibrahim Suleiman Richard Parker Simon NortonSimon Nickerson Steve Linton John Bray and Rachel Abbott Atlas of finite group representa-tions - version 3 httpbrauermathsqmulacukAtlasv3

[27] M Ziv-Av Protocols with computer data related to the investigation of known primitive trangle-free strongly regular graphs httpwwwmathbguacil~zivavmath

[28] M Ziv-Av Results of computer algebra calculations for triangle free strongly regular graphshttpwwwmathbguacil~zivavmatheqpartpdf

120

Triangle-free strongly regular graphs Klin Ziv-Av

A Data about embeddings of tfSRGs inside tfSRGs

Quadrangle edge 2 edges 3 4 5 6Pentagon 0 5 0 0 0 0 0Petersen 0 15 15 5 0 0 0Clebsch 40 40 60 40 10 0 0HoSi 0 175 7875 128625 845250 2170350 1817550

Gewirtz 630 280 15120 245280 1370880 2603664 1643040Mesner 6930 616 55440 1330560 10589040 28961856 24641232NL2(10) 28875 1100 154000 5544000 67452000 301593600 477338400

7 edges 8 9 10 11HoSi 40150 15750 3500 350 0

Gewirtz 104160 7560 1400 112 0Mesner 3664320 166320 30800 2464 0NL2(10) 258192000 14322000 924000 154000 11200

Table 1 Number of imprimitive tfSRGs inside tfSRGs

Quadrangle edge 2 edges 3 4 5 6Pentagon 0 1 0 0 0 0 0Petersen 0 1 1 1 0 0 0Clebsch 1 1 1 1 1 0 0HoSi 0 1 1 4 10 21 15

Gewirtz 1 1 2 9 30 48 36Mesner 1 1 1 7 26 56 50NL2(10) 1 1 1 2 7 14 17

7 edges 8 9 10 11HoSi 8 1 1 1 0

Gewirtz 5 2 2 1 0Mesner 14 2 2 1 0NL2(10) 14 3 2 2 1

Table 2 Number of orbits of imprimitive tfSRGs inside tfSRGs

Pentagon Petersen Clebsch HoSi Gewirtz Mesner NL2(10)Pentagon 1 12 192 1260 8064 88704 443520Petersen 1 16 525 13440 1921920 35481600Clebsch 1 0 0 0 924000HoSi 1 0 0 704

Gewirtz 1 22 1030Mesner 1 100NL2(10) 1

Table 3 Number of primitive tfSRGs inside tfSRGs

121

Triangle-free strongly regular graphs Klin Ziv-Av

Pentagon Petersen Clebsch HoSi Gewirtz Mesner NL2(10)Pentagon 1 1 1 1 1 1 1Petersen 1 1 1 1 9 5Clebsch 1 0 0 0 1HoSi 1 0 0 1

Gewirtz 1 1 1Mesner 1 1NL2(10) 1

Table 4 Number of orbits of primitive tfSRGs inside tfSRGs

B Data about equitable partitions of primitive tfSRGs

Pentagon Petersen Clebsch HoSi Gewirtz Mesner NL2(10)EP 3 11 46 163Aut 3 11 38 89 154 236 607

Table 5 Number of orbits of equitable partitions and of automorphic equitable partitions forknown tfSRGs

Size 1 3 5 TotalEP 1 1 1 3Aut 1 1 1 3

Size 1 2 3 4 5 6 7 10 TotalEP 1 2 2 2 1 1 1 1 11Aut 1 2 2 2 1 1 1 1 11

Size 1 2 3 4 5 6 7 8 9 10 12 16 TotalEP 1 4 6 12 5 7 3 4 1 1 1 1 46Aut 1 4 5 10 3 5 2 4 1 1 1 1 38

Size 1 2 3 4 5 6 7 8 9 10 11EP 1 6 8 16 18 20 19 18 11 11 8Aut 1 4 5 7 6 9 9 11 4 9 4Size 12 13 14 15 16 18 20 28 30 50 TotalEP 7 7 2 2 1 2 3 1 1 1 163Aut 4 4 2 1 1 2 3 1 1 1 89

Table 6 Numbers of EPs and automorphic EPs by size of partition for four small graphs

122

Triangle-free strongly regular graphs Klin Ziv-Av

Size 1 2 3 4 5 6 7 8 9 10 11 12 13Aut 1 5 9 12 12 14 15 16 14 11 7 7 6Size 14 16 17 18 19 20 23 28 31 32 35 56 TotalAut 5 3 3 2 2 4 1 1 1 1 1 1 154

Size 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15Aut 1 3 5 8 11 10 20 14 19 12 18 12 16 9 14Size 16 17 18 19 20 21 23 25 29 33 41 45 49 77 TotalAut 5 12 5 9 1 8 4 8 6 2 1 1 1 1 236

Size 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15Aut 1 6 15 21 28 29 31 42 34 35 37 49 30 31 27Size 16 17 18 19 20 21 22 23 24 25 26 27 28 29Aut 26 18 18 13 26 14 11 7 9 6 6 5 2 1Size 30 31 32 33 34 35 39 40 45 50 53 60 65 100 TotalAut 7 1 3 2 2 3 1 4 1 1 1 1 1 1 607

Table 7 Numbers of automorphic EPs by size of partition for larger graphs

123

Usage of Invariants for Symbolic Verification of

Requirements

Short Paper

Alexander Letichevsky1 Alexander Godlevsky1 Anton Guba1 Alexander

Kolchin1 Oleksandr Letychevskyi1 Vladimir Peschanenko2

1 VM Glushkov Institute of Cybernetics Kiev Ukraineletcyfranet godlissorgua antongubaukrnet kolchin avyahoocom litissorgua

2 Kherson State University Kherson Ukrainevladimiriusgmailcom

The main goal of the paper is finding of pre- and post-invariants for transitions betweensymbolic states in the system that must be verified and use them for verification purposesSystems are specified by basic protocols [1] This specification defines a transition system withtransitions s rarr s

prime where s and sprime are symbolic states b is a basic protocol The main problem

of verification is a reachability problem for given properties expressed in specification logiclanguage

We present double approximation method of verification based on computing invariants Themethod is implemented as an iterative algorithm which solves in parallel reachability problemand computes lower and upper approximations of invariants for basic protocols

Currently there are a lot of significant works devoted to computing invariants which areconsidered for loops in programs Loops are marked explicitly - syntactic constructions likewhile and others When we deal with requirement specifications we do not deal with explicitmarked loops moreover basic protocols provide non-deterministic order Existing methodsusually ignore the conditions of the loops Invariants formulae which is obtained as a resultinclude unreachable states and therefore could be used in verification only in the following wayif a property does not intersect with the invariant formula then it is unreachable if intersectsthen conclusion cannot be done Therefore the problem of modification of existing methodsor to develop a new algorithm that could be applied in practice of requirements verification isactual

Research of problems of automatic program invariants generation for a variety of data al-gebras was performed starting from 70-th years in Institute of Cybernetics of NAS of UkraineTheir main results are presented in [2] Double approximation method is the dynamic iterativemethod of invariants generation and it is based on these results and adapted for requirementsverification The method also can be applied to program verification if a program is consideredas a special case of basic protocol specification The method has been implemented in VRS(Verification of Requirement Specifications) system [3] and IMS (Insertion Modeling System)system [4]

References

[1] A Letichevsky J Kapitonova V Volkov A Letichevsky Jr S Baranov V Kotlyarov T WeigertSystem Specification with Basic Protocols Cybernetics and System Analyses vol 4 2005 p 3-21

[2] Godlevsky AB Kapitonova YV Krivoy SL Letichevsky AA Iterative methods of programanalysis Cybernetics vol 2 1989 9-19

[3] Verification for Requirement Specification (VRS) httpissorguaISSVRStoolhtm lastviewed May 2013

[4] APS and IMS Systems httpapsystemorgua last viewed May 2013

124

Lebesgue Constants and Optimal Node Systems

via Symbolic Computations

Short Paper

Robert Vajda

University of Szeged Szeged Hungaryvajdarmathu-szegedhu

Abstract

Polynomial interpolation is a classical method to approximate continuous functionsby polynomials To measure the correctness of the approximation Lebesgue constantsare introduced For a given node system X(n+1) = x1 lt lt xn+1 (xj isin [a b])the Lebesgue function λn(x) is the sum of the modulus of the Lagrange basis polynomialsbuilt on X(n+1) The Lebesgue constant Λn assigned to the function λn(x) is its maximumover [a b] The Lebesgue constant bounds the interpolation error ie the interpolationpolynomial is at most (1 + Λn) times worse then the best approximation The minimumof the Λnrsquos for fixed n and interval [a b] is called the optimal Lebesgue constant Λlowast

n Forspecific interpolation node systems such as the equidistant system numerical results forthe Lebesgue constants Λn and their asymptotic behavior are known [3 7] However togive explicit symbolic expression for the minimal Lebesgue constant Λlowast

n is computationallydifficult In this work motivated by Rack [5 6] we are interested for expressing the minimalLebesgue constants symbolically on [minus1 1] and we are also looking for the characterizationof the those node systems which realize the minimal Lebesgue constants We exploited theequioscillation property of the Lebesgue function [4] and used quantifier elimination andGroebner Basis as tools [1 2] Most of the computation is done in Mathematica [8]

Acknowledgement The research of the author was partially supported by the HSRF(OTKA) grant number K83219

References

[1] D S Arnon - G E Collins - S McCallum Cylindrical Algebraic Decomposition I The BasicAlgorithm In Caviness-Johnson (eds) Quantifier Elimination and Cylindrical Algebraic Decom-position 136-151 Springer 1998

[2] B Buchberger Ein Algorithmus zum Auffinden der Basiselemente des Restklassenringes nach einemnulldimensionalen Polynomideal (An algorithm for finding the basis elements in the residue classring modulo a zero dimensional polynomial ideal) PhD Thesis Innsbruck 1965

[3] J S Hesthaven From electrostatics to almost optimal nodal sets for polynomial interpolation in asimplex SIAM J Numer Anal Vol 35 No 2 655-676 1998

[4] T A Kilgore A characterization of the Lagrange interpolating projection with minimal Tchebycheffnorm J Approx Theory 24 (1978) no 4 273-288

[5] H-J Rack An example of optimal nodes for interpolation International Journal of MathematicalEducation in Science and Technology 15 (3) 355-357 1984

[6] H-J Rack An example of optimal nodes for interpolation revisited Advances in Applied Mathe-matics and Approximation Theory Springer Proceedings in Mathematics amp Statistics Volume 41117-120 2013

[7] S J Simon Lebesgue constants in polynomial interpolation Annales Mathematicae et Informaticae33 109-123 2006

[8] Wolfram Research Inc Mathematica Version 90 Champaign Illinois 2012

125

Author Index

Alpuente Marıa 4

Ballis Demis 4

Buchberger Bruno 1

Comini Marco 19 31

Frechina Francisco 4

Ghourabi Fadoua 50

Godlevsky Alexander 124

Goto Mizuki 93

Guba Anton 124

Ida Tetsuo 50

Kakutani Yoshihiko 64

Kato Go 64

Kawano Yasuhito 64

Klin Mikhail 108

Kolchin Alexander 124

Kubota Takahiro 64

Letichevsky Alexander 124

Letychevskyi Oleksandr 124

Li Wei 2

Matringe Nadir 81

Moura Arnaldo 81

Neumann Severin 70

Ouaknine Joel 3

Peschanenko Vladimir 124

Rebiha Rachid 81

Sakurada Hideki 64

Sapina Julia 4

Takahashi Kazuko 50 93

Torella Luca 19 31

Vajda Robert 125

Yoshimaru Shizuo 93

Ziv-Av Matan 108

Keyword Index

algebraic number 125

automated verification 64

BB84 64

bottom-up semantics 31

computational model 93

computational origami 50

computer algebra 108

debugging 4

Distributed 70

elecronic cash protocol 93

equitable partitions 108

F4 70

formal methods 64

geometrical constraint solving 50

Groebner basis 125

Grobner Basis 70

induction scheme 93

invariants 124

knot fold 50

Lebesgue constant 125

Linear Algebra 81

maude 4

MPI 70

Parallel 70

polynomial interpolation 125

process calculi 64

program animation 4

property-oriented specifications 19

quantifier elimination 125

quantum cryptography 64

requirements specification 124

resultant 125

rewriting logic 4

semantics-based inference methods 19

slicing 4

Static Analysis 81

stepping 4

strongly regular graphs 108

symbolic verification 124

term rewriting 31

Term Rewriting Systems 19 31

Termination Analysis 81

theorem proving 50

theorem proving methods 93

  • Introduction
  • Preliminaries
  • Rewriting Modulo Equational Theories
  • Exploring the Computation Tree
    • Expanding a Program State
    • Computing a Fragment of the Computation Tree
      • Particularizing the Exploration
        • Interactive Stepper
        • Forward Trace Slicer
          • Implementation
          • Conclusions
          • Introduction
            • Notations
              • Many notions of equivalence
              • Deriving specifications from TRSs
                • An effective instance of the presented method
                  • Conclusions and future work
                  • Introduction
                  • Preliminaries
                  • Modeling the small-step rewriting behavior
                    • The semantic domain
                      • Linearizing Narrowing
                        • Operational denotations of TRSs
                          • Evaluation Function
                          • Properties of the TRS operational denotation
                            • Fixpoint denotations of TRSs
                              • Properties of the TRS fixpoint denotation
                                  • Conclusions
                                  • Technical Proofs
                                  • Introduction
                                  • Notations
                                  • Origami Geometrical Construction
                                    • Huzitas Fold Operations
                                    • Extensions
                                      • Knot Fold
                                        • Geometrical Properties
                                        • Geometrical Constraint Solving Approach
                                          • Regular Heptagon by the Knot Fold
                                            • Geometrical Constraints
                                            • Construction by Eos
                                            • Algebraic Interpretation
                                              • Proof
                                                • Theorem to Prove
                                                • Proof by Eos
                                                • Proof Results
                                                  • Conclusion
                                                    • Acknowledgments
                                                      • Introduction
                                                      • The Verifier
                                                      • Application to Shor and Preskills Security Proof
                                                      • Conclusions
                                                      • Introduction
                                                      • Notations
                                                      • Preliminaries
                                                      • Matrix Distribution
                                                      • Simplifying the F4 Algorithm
                                                      • Benchmarks
                                                      • Conclusion
                                                      • Introduction
                                                      • Linear Algebra and Linear Loop Programs
                                                      • Asymptotically Non-terminant Variable Values
                                                      • Automated generation of ANT loci
                                                        • The regular case
                                                        • The general case handling linear diagonalizable programs
                                                          • Discussions
                                                          • Conclusion
                                                          • Introduction
                                                          • Data Conversion Formalization
                                                            • Problem
                                                            • Solution
                                                              • Conversion from BS to BTREE
                                                              • Conversion from NAT to BS
                                                              • Conversion from NAT to BTREE
                                                                  • Modeling of an Electronic Cash Protocol
                                                                    • Ideal Electronic Cash
                                                                    • Definition of money
                                                                    • Creation of money from a natural number
                                                                    • Calculation of the amount of money
                                                                    • Payment
                                                                      • Proof of Properties
                                                                        • Well-definedness of cash
                                                                        • Well-definedness of pay
                                                                        • Divisibility
                                                                          • Discussion
                                                                          • Conclusion
                                                                          • Introduction
                                                                          • Strongly regular graphs a brief survey
                                                                          • Computer algebra tools in AGT
                                                                          • The seven known primitive triangle-free strongly regular graphs
                                                                          • Embeddings of tfSRGs into known primitive tfSRGs
                                                                          • Equitable partitions
                                                                          • Search for equitable partitions
                                                                          • Quadrangle and Atkinson EPs of NL2(10)
                                                                          • Some modifications of Robertson model
                                                                          • A few more models
                                                                          • Concluding comments
                                                                          • Data about embeddings of tfSRGs inside tfSRGs
                                                                          • Data about equitable partitions of primitive tfSRGs
Page 5: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,

Temur Kutsia Research Institute for Symbolic Computa-

tion - RISC Austria

Stephan Merz INRIA-LORIA Nancy France

Ali Mili New Jersey Institute of Technology USA

Yasuhiko Minamide University of Tsukuba Japan

Pierre-Etienne Moreau INRIA-LORIA Nancy France

Andre Platzer Carnegie Mellon University USA

Stefan Ratschan Czech Academy of Sciences The Czech Re-

public

Rachid Rebiha University of Lugano Switzerland and IC

Unicamp Brazil

Enric Rodrıguez Car-

bonell

Technical University of Catalonia Spain

Sorin Stratulat Universite Paul Verlaine France

Thomas Sturm Max Planck Institute for Informatics Ger-

many

Additional Reviewers

Cabarcas Daniel

Eder Christian

Gay Simon

Ghorbal Khalil

Ghourabi Fadoua

Kredel Heinz

Martins Joao G

Vigneron Laurent

Table of Contents

Invited Papers

Mathematics of 21st Century A Personal View 1

Bruno Buchberger

A Semantic Framework for Program Debugging 2

Wei Li

Decision Problems for Linear Recurrence Sequences 3

Joel Ouaknine

Regular Papers

Parametric Exploration of Rewriting Logic Computations 4

Marıa Alpuente Demis Ballis Francisco Frechina and Julia

Sapina

Automatic Inference of Term Equivalence in Term Rewriting

Systems 19

Marco Comini and Luca Torella

A Condensed Goal-Independent Fixpoint Semantics Modeling

the Small-Step Behavior of Rewriting 31

Marco Comini and Luca Torella

Logical and Algebraic Views of a Knot Fold of a Regular

Heptagon 50

Fadoua Ghourabi Tetsuo Ida and Kazuko Takahashi

Automated Verification of Equivalence on Quantum

Cryptographic Protocols 64

Takahiro Kubota Yoshihiko Kakutani Go Kato Yasuhito

Kawano and Hideki Sakurada

A modified parallel F4 algorithm for shared and distributed

memory architectures 70

Severin Neumann

Generating Asymptotically Non-terminant Initial Variable

Values for Linear Diagonalizable Programs 81

Rachid Rebiha Nadir Matringe and Arnaldo Moura

Data Conversion Method between a Natural Number and a

Binay Tree for an Inductive Proof and Its Application 93

Kazuko Takahashi Shizuo Yoshimaru and Mizuki Goto

Computer algebra investigation of known primitive

triangle-free strongly regular graphs 108

Matan Ziv-Av and Mikhail Klin

Short Papers

Usage of Invariants for Symbolic Verification of Requirements 124

Alexander Letichevsky Alexander Godlevsky Anton Guba

Alexander Kolchin Oleksandr Letychevskyi and Vladimir

Peschanenko

Lebesgue Constants and Optimal Node Systems via Symbolic

Computations 125

Robert Vajda

Mathematics of 21st Century

A Personal View

Bruno Buchberger

Research Institute for Symbolic Computation - RISC

Johannes Kepler University Linz Austria

BrunoBuchbergerriscuni-linzacat

Extended Abstract

Mathematics of 19th century and before was rich in content intuition strong ideas motivationfrom natural sciences and had a coherent view of all fields of mathematics (geometry algebraanalysis number theory )

Mathematics of 20th century added three important aspects mathematical logic as themathematical meta-theory of mathematics formalism and abstractness and reduction to firstprinciples (ldquoBourbakismrdquo) and the notion of computing (both as an exact mathematicalnotion and as the foundation of the revolutionary device rdquoprogrammable computerrdquo) In factthe three aspects have a lot to do with each other and are fundamentally interrelated Howeverin practice the three aspects were (and still are) pursued by three different communities Thedeep insights of logicians on the nature of mathematics are hardly used in ever-day practiceof ldquoworking mathematiciansrdquo ldquopure mathematiciansrdquo are often proud that they do not touchthe computer except for writing e-mails typing in LaTeX and using web search and computerscientists often think that what they are doing does not need mathematics or even is oppositeto mathematics

In my view as indicated by trends in late 20th century in 21st century mathematics willevolve as - or return to be - a unified body of mathematical logic abstract structural math-ematics and computer mathematics with no boundaries between the three aspects ldquoWorkingmathematiciansrdquo will have to master the three aspects equally well and integrate them in theirdaily work More specifically working in mathematics will proceed on the ldquoobject levelrdquo ofdeveloping new mathematical content (abstract knowledge and computational methods) andat the same time on the ldquometa-levelrdquo of developing automated reasoning methods for support-ing research on the object level This ldquomassage of the mathematical brainrdquo by jumping backand forth between the object and the meta-level will guide mathematics onto a new level ofsophistication

Symbolic computation is just a way of expressing this general view of mathematics of the21st century and it also should be clear that software science is just another way of expressingthe algorithmic aspect of this view

In the talk we will exemplify the spirit of this new type of mathematics by a report onthe Theorema system being developed in the speakerrsquos research group Theorema is both alogic and a software frame for doing mathematics in the way sketched above On the objectlevel Theorema allows to prove and program within the same logical frame and on the meta-level it allows to formulate reasoning techniques that help proving and programming on theobject level In particular we will show how this type of doing mathematics allows to mimicthe invention process behind the speakerrsquos theory of Grobner bases which provides a generalmethod for dealing with multivariate nonlinear polynomial systems

1

A Semantic Framework for Program Debugging

Wei Li

State Key Laboratory of Software Development Environment

School of Computer Science and Engineering

Beihang University China

liweinlsdebuaaeducn

Abstract

This work aims to build a semantic framework for automated debugging A debugging pro-

cess consists of tracing locating and fixing processes consecutively The first two processes

are accomplished by a tracing procedure and a locating procedure respectively The tracing

procedure reproduces the execution of a failed test case with well-designed data structures and

saves necessary information for locating bugs The locating procedure will use the informa-

tion obtained from the tracing procedure to locate ill-designed statements and to generate a

fix-equation the solution of which is a function that will be used to fix the bugs A structural

operational semantics is given to define the functions of the tracing and locating procedure

Both procedures are proved to terminate and produces one fix-equation The main task of

fixing process is to solve the fix-equation It turns out that for a given failed test case there

exist three different types of solutions 1 the bug is solvable there exists a solution of the

fix-equation and the program can be repaired 2 There exists a non-linear error in the pro-

gram the fix-equation generated at each round of the locating procedure is solvable but a new

bug will arise when the old bug is being fixed 3 There exists a logical design error and the

fix-equation is not solvable

2

Decision Problems for Linear Recurrence

Sequences

Joel Ouaknine

Department of Computer Science

Oxford University United Kingdom

JoelOuakninecsoxacuk

Abstract

Linear recurrence sequences (LRS) such as the Fibonacci numbers permeate vast areas ofmathematics and computer science In this talk we consider three natural decision problemsfor LRS namely the Skolem Problem (does a given LRS have a zero) the Positivity Problem

(are all terms of a given LRS positive) and the Ultimate Positivity Problem (are all but finitelymany terms of a given LRS positive) Such problems (and assorted variants) have applicationsin a wide array of scientific areas such as theoretical biology (analysis of L-systems pop-ulation dynamics) economics (stability of supply-and-demand equilibria in cyclical marketsmultiplier-accelerator models) software verification (termination of linear programs) proba-bilistic model checking (reachability and approximation in Markov chains stochastic logics)quantum computing (threshold problems for quantum automata) discrete linear dynamicalsystems (reachability and invariance problems) as well as combinatorics statistical physicsterm rewriting formal languages cellular automata generating functions etc

We shall see that these problems have deep and fascinating connections to rich mathematicalconcepts and conjectures particularly in the fields of analytic and algebraic number theorydiophantine geometry and approximation real algebraic geometry mathematical logic andcomplexity theory

3

Parametric Exploration of

Rewriting Logic Computations lowast

M Alpuente1 D Ballis2 F Frechina1 and J Sapina1

1 DSIC-ELP Universitat Politecnica de ValenciaCamino de Vera sn Apdo 22012 46071 Valencia Spain

alpuenteffrechinajsapinadsicupves2 DIMI Universita degli Studi di Udine

Via delle Scienze 206 33100 Udine Italy demisballisuniudit

Abstract

This paper presents a parameterized technique for the inspection of Rewriting Logiccomputations that allows the non-deterministic execution of a given rewrite theory to befollowed up in different ways Starting from a selected state in the computation tree theexploration is driven by a user-defined inspection criterion that specifies the explorationmode By selecting different inspection criteria one can automatically derive useful debug-ging facilities such as program steppers and more sophisticated dynamic trace slicers thatfacilitate the detection of control and data dependencies across the computation tree Ourmethodology which is implemented in the Anima graphical tool allows users to capture theimpact of a given criterion validate input data and detect improper program behaviors

1 Introduction

Program animation or stepping refers to the very common debugging technique of executingcode one step at a time allowing the user to inspect the program state and related databefore and after the execution step This allows the user to evaluate the effects of a givenstatement or instruction in isolation and thereby gain insight into the program behavior (ormisbehavior) Nearly all modern IDEs debuggers and testing tools currently support this modeof execution optionally where animation is achieved either by forcing execution breakpointscode instrumentation or instruction simulation

Rewriting Logic (RWL) is a very general logical and semantic framework which is particu-larly suitable for formalizing highly concurrent complex systems (eg biological systems [7] andWeb systems [2 6]) RWL is efficiently implemented in the high-performance system Maude [9]Roughly speaking a rewriting logic theory seamlessly combines a term rewriting system (TRS)together with an equational theory that may include equations and axioms (ie algebraic lawssuch as commutativity associativity and unity) so that rewrite steps are performed modulo theequations and axioms

In recent years debugging and optimization techniques based on RWL have received growingattention [1 13 16 17] but to the best of our knowledge no practical animation tool forRWLMaude has been formally developed To debug Maude programs Maude has a basictracing facility that allows the user to advance through the program execution letting himherselect the statements to be traced except for the application of algebraic axioms that are not

lowastThis work has been partially supported by the EU (FEDER) and the Spanish MEC project ref TIN2010-21062-C02-02 and by Generalitat Valenciana ref PROMETEO2011052 This work was carried out during thetenure of D Ballisrsquo ERCIM lsquoAlain Bensoussanrdquo Postdoctoral Fellowship The research leading to these resultshas received funding from the European Union Seventh Framework Programme (FP72007-2013) under grantagreement n 246016 F Frechina was supported by FPU-ME grant AP2010-5681

4

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

under user control and are never recorded as execution steps in the trace All rewrite steps thatare obtained by applying the equations or rules for the selected function symbols are shown inthe output trace so that the only way to simplify the displayed view of the trace is by manuallyfixing the traceable equations or rules Thus the trace is typically huge and incomplete andwhen the user detects an erroneous intermediate result it is difficult to determine where theincorrect inference started Moreover this trace is either directly displayed or written to afile (in both cases in plain text format) thus only being amenable for manual inspection bythe user This is in contrast with the enriched traces described below which are complete (allexecution steps are recorded by default) and can be sliced automatically so that they can bedramatically simplified in order to facilitate a specific analysis Also the trace can be directlydisplayed or delivered in its meta-level representation which is very useful for further automatedmanipulation

Contributions This paper presents the first parametric (forward) exploration technique forRWL computations Our technique is based on a generic animation algorithm that can be tunedto work with different modalities including incremental stepping and automated forward slicingThe algorithm is fully general and can be applied for debugging as well as for optimizing anyRWL-based tool that manipulates RWL computations Our formulation takes into account theprecise way in which Maude mechanizes the rewriting process and revisits all those rewrite stepsin an instrumented fine-grained way where each small step corresponds to the application ofan equation equational axiom or rule This allows us to explain the input execution trace withregard to the set of symbols of interest (input symbols) by tracing them along the executiontrace so that in the case of the forward slicing modality all data that are not descendants ofthe observed symbols are simply discarded

Related Work Program animators have existed since the early years of programmingAlthough several steppers have been implemented in the functional programming community(see [10] for references) none of these systems applies to the animation and forward slicing ofMaude computations An algebraic stepper for Scheme is defined and formally proved in [10]which is included in the DrScheme programming environment The stepper reduces Schemeprograms to values (according to the reduction semantics of Scheme) and is useful for explainingthe semantics of linguistic facilities and for studying the behavior of small programs It explainsa programrsquos execution as a sequence of reduction steps based on the ordinary laws of algebra forthe functional core of the language and more general algebraic laws for the rest of the languageIn order to discover all of the steps that occur during the program evaluation the stepperrewrites (or rdquoinstrumentsrdquo) the code The inserted code uses a mechanism called ldquocontinuationmarksrdquo to store information about the programrsquos execution as it is running and makes calls tothe stepper before after and during the evaluation of each program expression Continuationmarks allow the stepper to reuse the underlying Scheme implementation without having to re-implement the evaluator The stepperrsquos implementation technique also applies to both ML andHaskell since it supports states continuations multiple threads of control and lazy evaluation[10]

In [4 5] an incremental backward trace slicer was presented that generates a trace slice ofan execution trace T by tracing back a set of symbols of interest along (an instrumented versionof) T while data that are not required to produce the target symbols are simply discarded Thiscan be very helpful in debugging since any information that is not strictly needed to delivera critical part of the result is discarded which helps answer the question of what programcomponents might affect a lsquoselected computationrdquo However for the dual problem of ldquowhatprogram components might be affected by a selected computationrdquo a kind of forward expansionis needed which has been overlooked to date

5

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

Plan of the paper Section 2 recalls some fundamental notions of RWL and Section 3summarizes the rewriting modulo equational theories defined in Maude Section 4 formulatesthe exploration as a parameterized procedure that is completely controlled by the user whileSection 5 formalizes three different inspection techniques that are obtained as an instance ofthe generic scheme Finally Section 6 reports on a prototypical implementation of the proposedtechniques and Section 7 concludes

2 Preliminaries

Let us recall some important notions that are relevant to this work We assume some basicknowledge of term rewriting [18] and Rewriting Logic [14] Some familiarity with the Maudelanguage [9] is also required

We consider an order-sorted signature Σ with a finite poset of sorts (Slt) that models theusual subsort relation [9] We assume an S-sorted family V = VssisinS of disjoint variable setsτ(ΣV)s and τ(Σ)s are the sets of terms and ground terms of sort s respectively We writeτ(ΣV) and τ(Σ) for the corresponding term algebras The set of variables that occur in a termt is denoted by Var(t) In order to simplify the presentation we often disregard sorts when noconfusion can arise

A position w in a term t is represented by a sequence of natural numbers that addressesa subterm of t (Λ denotes the empty sequence ie the root position) By notation w1w2we denote the concatenation of positions (sequences) w1 and w2 Positions are ordered by theprefix ordering that is given the positions w1 and w2 w1 le w2 if there exists a position u suchthat w1u = w2

Given a term t we let Pos(t) denote the set of positions of t By t|w we denote the subtermof t at position w and t[s]w specifies the result of replacing the subterm t|w by the term s

A substitution σ equiv x1t1 x2t2 is a mapping from the set of variables V to the set ofterms τ(ΣV) which is equal to the identity almost everywhere except over a set of variablesx1 xn The domain of σ is the set Dom(σ) = x isin V | xσ 6= x By id we denote theidentity substitution The application of a substitution σ to a term t denoted tσ is defined byinduction on the structure of terms

tσ =

xσ if t = x x isin V

f(t1σ tnσ) if t = f(t1 tn) n ge 0

For any substitution σ and set of variables V σ |V denotes the substitution obtained from σby restricting its domain to V (ie σ |V (x) = xσ if x isin V otherwise σ |V (x) = x) Given twoterms s and t a substitution σ is a matcher of t in s if sσ = t The term t is an instance ofthe term s iff there exists a matcher σ of t in s By matchs(t) we denote the function thatreturns a matcher of t in s if such a matcher exists

A (labelled) equation is an expression of the form [l] λ = ρ where λ ρ isin τ(ΣV) V ar(ρ) subeV ar(λ) and l is a label ie a name that identifies the equation A (labelled) rewrite rule isan expression of the form [l] λ rarr ρ where λ ρ isin τ(ΣV) V ar(ρ) sube V ar(λ) and l is a labelWhen no confusion can arise rule and equation labels are often omitted The term λ (resp ρ)is called left-hand side (resp right-hand side) of the rule λrarr ρ (resp equation λ = ρ)

6

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

3 Rewriting Modulo Equational Theories

An order-sorted equational theory is a pair E = (Σ∆cupB) where Σ is an order-sorted signature∆ is a collection of (oriented) equations and B is a collection of equational axioms (ie algebraiclaws such as associativity commutativity and unity) that can be associated with any binaryoperator of Σ The equational theory E induces a congruence relation on the term algebraτ(ΣV) which is denoted by =E A rewrite theory is a triple R = (Σ∆ cup BR) where(Σ∆ cupB) is an order-sorted equational theory and R is a set of rewrite rules

Example 31The following rewrite theory encoded in Maude specifies a close variant of the fault-tolerantclient-server communication protocol of [15]

mod CLIENT-SERVER-TRANSF is inc INT + QID sorts Content State Msg Cli Serv Addressee

Sender Data CliName ServName Question Answer subsort Msg Cli Serv lt State subsort Addressee Sender CliName ServName lt Qid subsort Question Answer Data lt Nat

ops Srv Srv-A Srv-B Cli Cli-A Cli-B -gt Qid op null -gt State op _amp_ State State -gt State [assoc comm id null] op _lt-_ Addressee Content -gt Msg op __ Sender Data -gt Content op [____] CliName ServName Question Answer -gt Cli op na -gt Answer op [_] ServName -gt Serv [ctor] op f ServName CliName Data -gt Data

vars C S Addr Qid vars Q D A Nat var CNT [Content]

eq [succ] f(S C Q) = s(Q)

rl [req] [C S Q na] =gt[C S Q na] amp S lt- C Q

rl [reply] S lt- C Q amp [S] =gt[S] amp C lt- S f(S C Q)

rl [rec] C lt- S D amp [C S Q A] =gt[C S Q A]

rl [dupl] (Addr lt- CNT) =gt(Addr lt- CNT) amp (Addr lt- CNT)

rl [loss] (Addr lt- CNT) =gt null endm

The specification models an environment where several clients and servers coexist Eachserver can serve many clients while for the sake of simplicity we assume that each clientcommunicates with a single server

The names of clients and servers belong to the sort Qid Clients are represented as 4-tuplesof the form [C S Q D] where C is the clientrsquos name S is the name of the server it wants tocommunicate with Q is a natural number that identifies a client request and D is either a naturalnumber that represents the server response or the constant value na (not available) when theresponse has not been yet received Servers are stateless and are represented as structures [S]with S being the serverrsquos name All messages are represented as pairs of the form Addr lt- CNTwhere Addr is the addresseersquos name and CNT stands for the message contents Such contentsare pairs AddrN with Addr being the senderrsquos name and N being a number that representseither a request or a response

The server S uses a function f (only known to the server itself) that given a question Q

from client C the call f(S C Q) computes the answer s(Q) where s(Q) is the successor of Q Thisfunction is specified by means of the equation succ

Program states are formalized as a soup (multiset) of clients servers and messages whereasthe system behavior is formalized through five rewrite rules that model a faulty communicationenvironment in which messages can arrive out of order can be duplicated and can be lostSpecifically the rule req allows a client C to send a message with request Q to the server SThe rule reply lets the server S consume the client request Q and send a response messagethat is computed by means of the function f The rule rec specifies the client reception of aserver response D that should be stored in the client data structure Indeed the right-handside [C S Q A] of the rule includes an intentional barely perceptible bug that does not let theclient structure be correctly updated with the incoming response D The correct right-hand sideshould be [C S Q D] Finally the rules dupl and loss model the faulty environment and have

7

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

the obvious meaning messages can either be duplicated or lost

Given a rewrite theory (Σ ER) with E = ∆ cup B the rewriting modulo E relation (insymbols rarrRE) can be defined by lifting the usual rewrite relation on terms [12] to the E-congruence classes [t]E on the term algebra τ(ΣV) that are induced by =E [8] that is [t]Eis the class of all terms that are equal to t modulo E Unfortunately rarrRE is in generalundecidable since a rewrite step t rarrRE tprime involves searching through the possibly infiniteequivalence classes [t]E and [tprime]E

The exploration technique formalized in this work is formulated by considering the preciseway in which Maude proves the rewrite steps (see Section 52 in [9]) Actually the Maudeinterpreter implements rewriting modulo E by means of two much simpler relations namelyrarr∆B and rarrRB These allow rewrite rules and equations to be intermixed in the rewritingprocess by simply using an algorithm of matching modulo B We define rarrRcup∆B as rarrRB

cup rarr∆B Roughly speaking the relation rarr∆B uses the equations of ∆ (oriented from leftto right) as simplification rules thus for any term t by repeatedly applying the equations assimplification rules we eventually reach a normalized term tdarr∆ to which no further equationscan be applied The term t darr∆ is called a canonical form of t wrt ∆ On the other handthe relation rarrRB implements rewriting with the rules of R which might be non-terminatingand non-confluent whereas ∆ is required to be terminating and Church-Rosser modulo B inorder to guarantee the existence and unicity (modulo B) of a canonical form wrt ∆ for anyterm [9]

Formally rarrRB and rarr∆B are defined as follows given a rewrite rule r = (λ rarr ρ) isin R(resp an equation e = (λ = ρ) isin ∆) a substitution σ a term t and a position w of t

trσwrarrRB tprime (resp t

eσwrarr∆B tprime) iff λσ =B t|w and tprime = t[ρσ]w When no confusion can arise we

simply write trarrRB tprime (resp trarr∆Btprime) instead of t

rσwrarrRB tprime (resp t

eσwrarr∆B tprime)

Under appropriate conditions on the rewrite theory a rewrite step modulo E on a term t canbe implemented without loss of completeness by applying the following rewrite strategy [11](i) reduce t wrt rarr∆B until the canonical form t darr∆ is reached (ii) rewrite t darr∆ wrt rarrRB

A computation C in the rewrite theory (Σ∆ cupBR) is a rewrite sequence

s0 rarrlowast∆B s0darr∆ rarrRB s1 rarrlowast

∆B s1darr∆

that interleaves rarr∆B rewrite steps and rarrRB rewrite steps following the strategy mentionedabove Terms that appear in computations are also called (program) states

A computation tree TR(s) for a term s and a rewrite theory R is a tree-like representationof all the possible computations in R that originate from the initial state s More preciselyTR(s) is a labelled tree whose root node label identifies the initial state s and whose edges arelabelled with rewrite steps of the form t rarrRcup∆B tprime so that any node in TR(s) represents aprogram state of a computation stemming from s

Example 32

Consider the rewrite theory of Example 31 together with the initial state [Srv-A] amp [Cli-A

Srv-A7na] amp [Cli-BSrv-A17na] In this case the computation tree consists of severalinfinite computations that start from the considered initial state and model interactions betweenclients Cli-A and Cli-B and server Srv-A The computed tree is depicted in the following picturewhere for the sake of simplicity we only display the equations and rules that have been appliedat each rewrite step while other information such as the computed substitution and the rewrite

8

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

position are omitted in the depicted tree

Query Go

Go

Go

Go

Go

Go

GoGoBack

Back

Back

Back

Back

Back

BackBack Anima

[Srv-A] amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]s0

req[Srv-A] amp (Srv-A lt- Cli-A7) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s1 req[Srv-A] amp (Srv-A lt- Cli-B17) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s2

reply[Srv-A] amp (Cli-A lt- Srv-Af(Serv-ACli-A7)) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s3 reqdupl[Srv-A] amp (Srv-A lt- Cli-A7) amp (Srv-A lt- Cli-A7) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s4 req[Srv-A] amp (Srv-A lt- Cli-A7) amp (Srv-A lt- Cli-B17) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s5 loss[Srv-A] amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s6

succ[Srv-A] amp (Cli-A lt- Srv-A8) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s7

Options

Given a computation C it is always possible to expand C in an instrumented computationCinst in which each application of the matching modulo B algorithm is mimicked by the explicitapplication of a suitable equational axiom which is also oriented as a rewrite rule [3]

Also typically hidden inside the B-matching algorithms some flatunflat transformationsallow terms that contain operators that obey associative-commutative axioms to be rewrittenThese transformations allow terms to be reordered and correctly parenthesized in order toenable subsequent rewrite steps Basically this is achieved by producing a single auxiliaryrepresentative of their AC congruence class [3] For example consider a binary AC operatorf together with the standard lexicographic ordering over symbols Given the B-equivalencef(b f(f(b a) c)) =B f(f(b c) f(a b)) we can represent it by using the ldquointernal sequencerdquo

of transformations f(b f(f(b a) c))flatminusrarr lowast

Bf(a b b c)unflatminusrarr lowast

Bf(f(b c) f(a b)) where the firstsubsequence corresponds to a flattening transformation sequence that obtains the AC canonicalform while the second one corresponds to the inverse unflattening transformation This wayany given instrumented computation consists of a sequence of (standard) rewrites using theequations (rarr∆) rewrite rules (rarrR) equational axioms and flatunflat transformations (rarrB)By abuse of notation since equations and axioms are both interpreted as rewrite rules in ourformulation we often abuse the notation λrarr ρ to denote rules as well as (oriented) equationsand axioms Given an instrumented computation Cinst by |Cinst| we denote its length mdashthat isthe number of rewrite steps that occur in Cinst We use the functions head(Cinst) and tail(Cinst)to respectively select the first rewrite step in Cinst and the instrumented computation yieldedby removing the first rewrite step from Cinst In the sequel we also assume the existence of afunction instrument(C) which takes a computation C and delivers its instrumented counterpart

Example 33Consider the rewrite theory of Example 31 together with the following computation

C = [Cli Srv 7 na] amp [Srv] amp Cli lt- Srv f(Srv Cli 7) rarr∆B

[Cli Srv 7 na]amp [Srv] amp Cli lt- Srv 8 rarrRB

[Cli Srv 7 7] amp [Srv]

The corresponding instrumented computation Cinst which is produced by instrument(C) isgiven by 1) suitably parenthesizing states by means of flatteningunflattening transformations

9

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

when needed and 2) making commutative ldquostepsrdquo explicit by using the (oriented) equationalaxiom (X amp Y rarr Y amp X) in B that models the commutativity property of the (juxtaposition)operator amp Note these transformations are needed to enable the application of the rule rec

(of R) to the seventh state

Cinst = [Cli Srv 7 na] amp [Srv] amp Cli lt- Srv f(Srv Cli 7)succminusrarr∆

[Cli Srv 7 na] amp [Srv] amp Cli lt- Srv 8unflatminusrarrB

[Cli Srv 7 na] amp ([Srv] amp Cli lt- Srv 8)commminusrarrB

[Cli Srv 7 na] amp (Cli lt- Srv 8 amp [Srv])flatminusrarrB

[Cli Srv 7 na] amp Cli lt- Srv 8 amp [Srv]unflatminusrarrB

([Cli Srv 7 na] amp Cli lt- Srv 8) amp [Srv]commminusrarrB

(Cli lt- Srv 8 amp [Cli Srv 7 na]) amp [Srv]recminusrarrR

[Cli Srv 7 7] amp [Srv]

4 Exploring the Computation Tree

Computation trees are typically large and complex objects to deal with because of the highly-concurrent nondeterministic nature of rewrite theories Also their complete generation andinspection are generally not feasible since some of their branches may be infinite as they encodenonterminating computations

However one may still be interested in analysing a fragment of a given computation tree fordebugging or program comprehension purposes This section presents an exploration techniquethat allows the user to incrementally generate and inspect a portion T bull

R(sbull) of a computationtree TR(s) by expanding (fragments of) its program states into their descendants starting fromthe root node The exploration is an interactive procedure that is completely controlled by theuser who is free to choose the program state fragments to be expanded

41 Expanding a Program State

A state fragment of a state s is a term sbull that hides part of the information in s that is theirrelevant data in s are simply replaced by special bull-variables of appropriate sort denoted bybulli with i = 0 1 2 Given a state fragment sbull a meaningful position p of sbull is a positionp isin Pos(sbull) such that sbull|p 6= bulli for all i = 0 1 By MPos(sbull) we denote the set thatcontains all the meaningful positions of sbull Symbols that occur at meaningful positions of astate fragment are called meaningful symbols By Varbull(exp) we define the set of all bull-variablesthat occur in the expression exp

Basically a state fragment records just the information the user wants to observe of a givenprogram state

The next auxiliary definition formalizes the function fragment(t P ) that allows a statefragment of t to be constructed wrt a set of positions P of t The function fragment relies onthe function freshbull whose invocation returns a (fresh) variable bulli of appropriate sort which isdistinct from any previously generated variable bullj

Definition 41 Let t isin τ(ΣV) be a state and let P be a set of positions st P sube Pos(t)Then the function fragment(t P ) is defined as follows

fragment(t P ) = recfrag(t PΛ) where

10

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

function inspect(sbull Cinstr I)1 if |Cinstr | = 1 then2 return I(sbull Cinstr )3 elseif |Cinstr | gt 14 if I(sbull head(Cinstr ))= nil then5 return inspect(I(sbull head(Cinstr ))

tail(Cinstr ) I)6 else7 return nil8 end9 endendf

function expand(sbull sR I)1 Ebull

R = empty

2 for each srσwrarrRcup∆B t

with w isin MPos(sbull)

3 Cinst = instrument(srσwrarrRcup∆B t)

4 tbull = inspect(sbull Cinst I)

5 if tbull 6= nil then EbullR = Ebull

R cup sbullrrarr tbull

6 end7 return Ebull

R

endf

Figure 1 The inspect function Figure 2 The expand function

recfrag(t P p) =

f(recfrag(t1 P p1) recfrag(tn P pn))

if t=f(t1 tn) and p isin P

t if t isin V and p isin P

freshbull otherwise

and P = u | u le p and p isin P is the prefix closure of P

Roughly speaking fragment(t P ) yields a state fragment of t wrt a set of positions P thatincludes all symbols of t that occur within the paths from the root to any position in P whileeach maximal subterm t|p with p 6isin P is replaced by means of a freshly generated bull-variable

Example 42Let t = d(f(g(a h(b)) c) a) be a state and let P = 11 12 be a set of positions of t Byapplying Definition 41 we get the state fragment tbull = fragment(t P ) = d(f(g(bull1 bull2) c) bull3)and the set of meaningful positions MPos(tbull) = Λ 1 11 12

An inspection criterion is a function I(sbull srσwrarrK t) that given a rewrite step s

rσwrarrK t with

K isin ∆ RB and a state fragment sbull of s computes a state fragment tbull of the state t Roughlyspeaking an inspection criterion controls the information content conveyed by term fragmentsresulting from the execution of standard rewrite steps Hence distinct implementations of the

inspection criteria I(sbull srσwrarrK t) may produce distinct fragments sbull

rrarr tbull of the considered

rewrite step We assume that the special value nil is returned by the inspection criterionwhenever no fragment tbull can be delivered Several examples of inspection criteria are shown inSection 5

The function inspect of Figure 1 allows an inspection criterion I to be sequentially appliedalong an instrumented computation Cinstr in order to generate the fragment of the last stateof the computation Specifically given an instrumented computation s0 rarrK s1 rarrK rarr snn gt 0 the computation is traversed and the inspection criterion I is recursively applied oneach rewrite step si rarrK si+1 wrt the input fragment sbulli to generate the next fragment sbulli+1

The expansion of a single program state is specified by the function expand(sbull sR I) ofFigure 2 which takes as input a state s and its fragment sbull to be expanded wrt a rewritetheory R and an inspection criterion I Basically expand unfolds the state fragment sbull wrt

all the possible rewrite steps srσwrarrRcup∆B t that occur at the meaningful positions of sbull and

stores the corresponding fragments of sbullrrarr tbull in the set Ebull Note that to compute the state

11

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

fragment tbull for a rewrite step srσwrarrRcup∆B t and a state fragment sbull expand first generates the

instrumented computation Cinst of the considered step and then applies the inspection criterionI over C by using the inspect function

42 Computing a Fragment of the Computation Tree

The construction of a fragment T bullR(sbull0) of a computation tree TR(s0) is specified by the function

explore given in Figure 3 Essentially explore formalizes an interactive procedure that startsfrom a tree fragment (built using the auxiliary function createTree) which only consists of theroot node sbull0 and repeatedly uses the function expand to compute rewrite step fragments thatcorrespond to the visited tree edges wrt a given inspection criterion The tree T bull

R(sbull0) is builtby choosing at each loop iteration of the algorithm the tree node that represents the statefragment to be expanded by means of the auxiliary function pickLeaf (T bull

R(sbull0)) which allowsthe user to freely select a node sbull from the frontier of the current tree T bull

R(sbull0) Then T bullR(sbull0)

is augmented by calling addChildren(T bullR(sbull0) s

bull expand(sbull sR I)) This function call adds allthe edges sbull rarr tbull which are obtained by expanding sbull to the tree T bull

R(sbull0)The special value EoE (End of Exploration) is used to terminate the inspection process

when the function pickLeaf (T bullR(sbull0)) is equal to EoE no state to be expanded is selected and

the exploration terminates delivering the computed fragment T bullR(sbull0)

function explore(sbull0 s0R I)1 T bull

R(sbull0) = createTree(sbull0)2 while(sbull = pickLeaf (T bull

R(sbull0)) 6= EoE) do3 T bull

R(sbull0) = addChildren(T bullR(sbull0) s

bull expand(sbull sR I))4 od5 return T bull

R(sbull0)endf

Figure 3 The explore function

5 Particularizing the Exploration

The methodology given in Section 4 provides a generic scheme for the exploration of com-putation trees wrt a given inspection criterion I that must be provided by the user Inthis section we show three implementations of the criterion I that produce three distinct ex-ploration strategies In the first case the considered criterion allows an interactive programstepper to be derived in which rewriting logic computations of interest can be animated Inthe second case we implement a partial stepper that allows computations with partial inputsto be animated Finally in the last example the chosen inspection criterion implements anautomated forward slicing technique that allows relevant control and data information to beextracted from computation trees

51 Interactive Stepper

Given a computation tree TR(s0) for an initial state s0 and a rewrite theory R the stepwiseinspection of the computation tree can be directly implemented by instantiating the explorationscheme of Section 4 with the inspection criterion

Istep(sbull s

rσwrarr K t) = t

12

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

that always returns the reduced state t of the rewrite step srσwrarr K t with K isin ∆ RB

This way by starting the exploration from a state fragment that corresponds to the wholeinitial state s0 (ie sbull0 = s0) the call explore(s0R Istep) generates a fragment T bull

R(sbull0) of thecomputation tree TR(s0) whose topology depends on the program states that the user decidesto expand during the exploration process

Example 51Consider the rewrite theoryR in Example 31 and the computation tree in Example 32 Assumethe user starts the exploration by calling explore(s0R Istep) which allows the first level of thecomputation tree to be unfolded by expanding the initial state s0 wrt the inspection criterion

Istep This generates the tree TbullR(s0) containing the edges s0

reqrarr s1 s0

reqrarr s2 Now if the user

carries on with the exploration of program state s1 and then quits s1 will be expanded and thetree T bull

R(s0) will be augmented accordingly Specifically the resulting T bullR(s0) will include the

following edges s0reqrarr s1 s0

reqrarr s2 s1

succrarr s3 s1

reqrarr s4 s1

duplrarr s4 s1

reqrarr s5 s1

lossrarr s6

It is worth noting that all the program state fragments produced by the program stepperdefined above are ldquoconcreterdquo (ie state fragments that do not include bull-variables) Howeversometimes it may be useful to work with partial information and hence with state fragmentsthat abstract ldquoconcreterdquo program states by using bull-variables This approach may help to focususerrsquos attention on the parts of the program states that the user wants to observe disregardingunwanted information and useless rewrite steps

Example 52Consider the following two rewrite rules [r1] f(x b) rarr g(x) and [r2] f(a y) rarr h(y) togetherwith the initial state f(a b) Then the computation tree in this case is finite and only contains

the tree edges f(a b)r1xaΛ

rarr g(a) and f(a b)r2ybΛ

rarr h(b) Now consider the state fragmentf(bull1 b) where only the second input argument is relevant If we decided to expand the initialstate fragment f(bull1 b) we would get the tree fragment represented by the single rewrite step

f(bull1 b)r1rarr g(bull1) since the partial input encoded into f(bull1 b) cannot be rewritten via r2

In light of Example 52 and our previous considerations we define the following inspectioncriterion

Ipstep(sbull s

rσwrarr K t) = if sbull

rσbullwrarr K tbull then return tbull else return nil

Roughly speaking given a rewrite step micro srσwrarr K t with K isin ∆ RB the criterion

Ipstep returns a state fragment tbull of the reduced state t whenever sbull can be rewritten to tbull

using the very same rule r and position w that occur in microThe particularization of the exploration scheme with the criterion Ipstep allows an interac-

tive partial stepper to be derived in which the user can work with state information of interestthereby producing more compact and focused representations of the visited fragments of thecomputation trees

52 Forward Trace Slicer

Forward trace slicing is a program analysis technique that allows computations to be simplifiedwrt a selected fragment of their initial state More precisely given a computation C withinitial state s0 and a state fragment sbull0 of s0 forward slicing yields a simplified view Cbull of Cin which each state s of the original computation is replaced by a state fragment sbull that only

13

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

function Islice(sbull s

λrarrρσwrarr t)

1 if w isin MPos(sbull) then2 θ = xfreshbull | x isin V ar(λ)3 λbull = fragment(λMPos(Varbull(sbull|w)) cap Pos(λ))

4 ψλ = 〈|θmatchλbull(sbull|w)|〉

5 tbull = sbull[ρψλ]w6 else7 tbull = nil8 fi9 return tbull

endf

Figure 4 Inspection criterion that models forward slicing of a rewrite step

records the information that depends on the meaningful symbols of sbull0 while unrelated dataare simply pruned away

In the following we define an inspection criterion Islice that implements the forward slicingof a single rewrite step The considered criterion takes two parameters as input namely a

rewrite step micro = (srσwrarr K t) (with r = λ rarr ρ and K isin ∆ RB) and a state fragment

sbull of a state s It delivers the state fragment tbull which includes only those data that arerelated to the meaningful symbols of sbull Intuitively the state fragment tbull is obtained fromsbull by ldquorewritingrdquo sbull at position w with the rule r and a suitable substitution that abstractsunwanted information of the computed substitution with bull-variables A rigorous formalizationof the inspection criterion Islice is provided by the algorithm in Figure 4

Note that by adopting the inspection criterion Islice the exploration scheme of Section 4automatically turns into an interactive forward trace slicer that expands program states usingthe slicing methodology encoded into the inspection criterion Islice In other words given acomputation tree TR(s0) and a user-defined state fragment sbull0 of the initial state s0 any branchsbull0 rarr sbull1 rarr sbulln in the tree T bull

R(sbull0) which is computed by the explore function is the slicedcounterpart of a computation s0 rarrRcup∆B s1 rarrRcup∆B sn (wrt the state fragment sbull0) thatappears in the computation tree TR(s0)

Roughly speaking the inspection criterion Islice works as follows When the rewrite stepmicro occurs at a position w that is not a meaningful position of sbull (in symbols w 6isin MPos(sbull))trivially micro does not contribute to producing the meaningful symbols of tbull This amounts tosaying that no relevant information descends from the state fragment sbull and hence the functionreturns the nil value

On the other hand when w isin MPos(sbull) the computation of tbull involves a more in-depthanalysis of the rewrite step which is based on a refinement process that allows the descendantsof sbull in tbull to be computed The following definition is auxiliary

Definition 53 (substitution update) Let σ1 and σ2 be two substitutions The update ofσ1 wrt σ2 is defined by the operator 〈| |〉 as follows

〈|σ1 σ2|〉 = σ|Dom(σ1) where

xσ =

xσ2 if x isin Dom(σ1) capDom(σ2)xσ1 otherwise

The operator 〈|σ1 σ2|〉 updates (overrides) a substitution σ1 with a substitution σ2 where bothσ1 and σ2 may contain bull-variables The main idea behind 〈| |〉 is that for the slicing of the

14

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

rewrite step micro all variables in the applied rewrite rule r are naıvely assumed to be initiallybound to irrelevant data bull and the bindings are incrementally updated as we apply the rule r

More specifically we initially define the substitution θ = xfreshbull | x isin V ar(ρ) thatbinds each variable in λ rarr ρ to a fresh bull-variable This corresponds to assuming that all theinformation in micro which is introduced by the substitution σ can be marked as irrelevant Thenθ is refined as follows

We first compute the state fragment λbull = fragment(λMPos(Varbull(sbull|w))capPos(λ)) that onlyrecords the meaningful symbols of the left-hand side λ of the rule r wrt the set of meaningfulpositions of sbull|w Then by matching λbull with sbull|w we generate a matcher matchλbull(sbull|w) thatextracts the meaningful symbols from sbull|w Such a matcher is then used to compute ψλ which

is an update of θ wrt matchλbull(sbull|w) containing the meaningful information to be trackedFinally the state fragment tbull is computed from sbull by replacing its subterm at position w withthe instance ρψλ of the right-hand side of the applied rule r This way we can transfer all therelevant information marked in sbull into the fragment of the resulting state tbull

Example 54Consider the computation tree of Example 32 whose initial state is

s0 = [Srv-A] amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

Let sbull0 = bull amp [Cli-Abull7 bull ] amp bull be a state fragment1 of s0 where only request 7 of ClientCli-A is considered of interest By sequentially expanding the nodes sbull0 s

bull1 s

bull3 and s

bull5 wrt

the inspection criterion Islice we get the following fragment of the given computation tree

Query Go

Go

Go

Go

Go

Go

GoGoBack

Back

Back

Back

Back

Back

BackBack AnimaOptions

bull amp [Cli-Abull7bull] amp bullsbull0

reqbull amp (bull lt- Cli-A7) amp [Cli-Abull7na] amp bullsbull1

reqduplbull amp (bull lt- Cli-A7) amp (bull lt- Cli-A7) amp [Cli-Abull7na] amp bull

sbull2 reply[bull] amp (Cli-A lt- bullf(bullCli-A7)) amp [Cli-Abull7na] amp bull

sbull3 lossbull amp [Cli-Abull7na] amp bullsbull4

succ[bull] amp (Cli-A lt- bull8) amp [Cli-Abull7na] amp bullsbull5

req[bull] amp (bull lt- Cli-A7) amp(Cli-A lt- bull8) amp [Cli-Abull7na] amp bull

sbull6 dupl[bull] amp (Cli-A lt- bull8) amp(Cli-A lt- bull8) amp [Cli-Abull7na] amp bull

sbull7 loss[bull] amp [Cli-Abull7na] amp bullsbull8 rec

[bull] amp [Cli-Abull77] amp bullsbull9

Note that the slicing process automatically computes a tree fragment that represents apartial view of the protocol interactions from client Cli-Arsquos perspective Actually irrelevantinformation is hidden and rules applied on irrelevant positions are directly ignored whichallows a simplified fragment to be obtained favoring its inspection for debugging and analysispurposes In fact if we observe the highlighted computation in the tree we can easily detectthe wrong behaviour of the rule rec Specifically by inspecting the state fragment sbull9 = ([bull]amp [Climinus A bull 7 7] amp bull) which is generated by an application of the rule rec we immediatelyrealize that the response 8 produced in the parent state sbull5 has not been stored in sbull9 whichclearly indicates a buggy implementation of the considered rule

1Throughout the example we omit indices from the considered bull-variables to keep notation lighter andimprove readability So any variable bulli i = 0 1 is simply denoted by bull

15

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

Finally it is worth noting that the forward trace slicer implemented via the criterion Islicediffers from the partial stepper given at the end of Section 51 Given a state fragment sbull and

a rewrite steprσwrarrK t Islice always yields a fragment tbull when the rewrite occurs at a meaningful

position By contrast the inspection criterion Ipstep encoded in the partial stepper may fail toprovide a computed fragment tbull when sbull does not rewrite to tbull

Example 55

Consider the same rewrite rules and initial state f(bull1 b) of Example 52 By expanding f(bull1 b)wrt the inspection criterion Islice we get the computation tree fragment with tree edgesf(bull1 b)

r1rarr g(bull1) and f(bull1 b)r2rarr h(b) whereas the partial stepper only computes the tree edge

f(bull1 b)r1rarr g(bull1) as shown in Example 52

6 Implementation

The exploration methodology developed in this paper has been implemented in the Anima

tool which is publicly available at httpsafe-toolsdsicupvesanima The underlyingrewriting machinery of Anima is written in Maude and consists of about 150 Maude functiondefinitions (approximately 1600 lines of source code)

Anima also comes with an intuitive Web user inter-

Database

Anima Client

JAX-RS API

Initial State Rewriting LogicSpecification Animation

Anima Web Service

Anima Core

Figure 5 Anima architecture

face based on AJAX technology which allows usersto graphically display and animate computation treefragments The core exploration engine is specified asa RESTful Web service by means of the Jersey JAX-RS API

The architecture of Anima is depicted in Figure 5and consists of five main components Anima ClientJAX-RS API AnimaWeb Service Database and An-ima Core The Anima Client is purely implementedin HTML5 and JSP It represents the front-end layerof our tool and provides an intuitive versatile Webuser interface which interacts with the Anima Web Service to invoke the capabilities of theAnima Core and save partial results in the Database component

A screenshot that shows the Anima tool at work on the case study that is described inExample 54 is given in Figure 6

These are the main features provided by Anima

1 Inspection strategies The tool implements the three inspection strategies described inSection 5 As shown in Figure 6 the user can select a strategy by using the selectorprovided in the option pane

2 ExpandingFolding program states The user can expand or fold states by right-clicking onthem with the mouse and by selecting the ExpandFold Node options from the contextualmenu For instance in Figure 6 a state fragment on the frontier of the computed treehas been selected and is ready to be expanded through the Expand Node option

3 Selecting meaningful symbols State fragments can be specified by highlighting the statesymbols of interest either directly on the tree or in the detailed information window

16

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

GoGoGoGoGoBackBackBackBackBack Anima

Options

View

Rule Labels

State Labels

Zoom 100

- +

Interactive StepperInteractive StepperInteractive StepperInteractive StepperInteractive Stepper

Simple Advanced

ON OFF

ON Transition information from state to sbull1 sbull2

Rule

rl [reply] S lt- C Q amp [S] =gt [S] amp C lt- S f(S C Q)

amp [Cli-Abull7na]

bull amp [Cli-Abull7bull] amp bull

sbull0

req

bull amp (bull lt- Cli-A7) amp [Cli-Abull7na] amp bull

sbull1

reqdupl

bull amp (bull lt- Cli-A7) amp (bull

lt- Cli-A7) amp [Cli-Abull

7na] amp bull

sbull2 reply

[bull] amp (Cli-A lt- bullf(bullCl

i-A7))

amp bull

sbull3 loss

bull amp [Cli-Abull7na] amp bull

sbull4

Expand node

Fold node

Show full information

Show transition information

Expand view

Collapse view

Figure 6 Anima at work

4 Search mechanism The search facility implements a pattern language that allows stateinformation of interest to be searched on huge states and complex computation trees Theuser only has to provide a filtering pattern (the query) that specifies the set of symbols thatheshe wants to search for and then all the states matching the query are automaticallyhighlighted in the computation tree

5 Transition information Anima facilitates the inspection of a selected rewrite step s rarr tthat occurs in the computation tree by underlining its redex in s and the reduced subtermin t Some additional transition information is also displayed in the transition informa-tion window (eg the ruleequation applied the rewrite position and the computedsubstitution of the considered rewrite step) by right-clicking on the corresponding option

7 Conclusions

The analysis of execution traces plays a fundamental role in many program analysis approachessuch as runtime verification monitoring testing and specification mining We have presenteda parametrized exploration technique that can be applied to the inspection of rewriting logiccomputations and that can work in different ways Three instances of the parameterized ex-ploration scheme (an incremental stepper an incremental partial stepper and a forward traceslicer) have been formalized and implemented in the Anima tool which is a novel program an-imator for RWL The tool is useful for Maude programmers in two ways First it concretelydemonstrates the semantics of the language allowing the evaluation rules to be observed inaction Secondly it can be used as a debugging tool allowing the users to step forward andbackward while slicing the trace in order to validate input data or locate programming mis-takes

17

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

References

[1] M Alpuente D Ballis M Baggi and M Falaschi A FoldUnfold Transformation Frameworkfor Rewrite Theories extended to CCT In Proc 2010 ACM SIGPLAN Workshop on PartialEvaluation and Program Manipulation PEPM 2010 pages 43ndash52 ACM 2010

[2] M Alpuente D Ballis J Espert and D Romero Model-checking Web Applications with Web-TLR In Proc of 8th Intrsquol Symposium on Automated Technology for Verification and Analysis(ATVA 2010) volume 6252 of LNCS pages 341ndash346 Springer-Verlag 2010

[3] M Alpuente D Ballis J Espert and D Romero Backward Trace Slicing for Rewriting LogicTheories In Proc CADE 2011 volume 6803 of LNCSLNAI pages 34ndash48 Springer-Verlag 2011

[4] M Alpuente D Ballis F Frechina and D Romero Backward Trace Slicing for ConditionalRewrite Theories In Proc LPAR-18 volume 7180 of LNCS pages 62ndash76 Springer-Verlag 2012

[5] M Alpuente D Ballis F Frechina and J Sapina Slicing-Based Trace Analysis of RewritingLogic Specifications with iJulienne In Matthias Felleisen and Philippa Gardner editors Procof 22nd European Symposium on Programming ESOP 2013 volume 7792 of Lecture Notes inComputer Science pages 121ndash124 Springer 2013

[6] M Alpuente D Ballis and D Romero Specification and Verification of Web Applications inRewriting Logic In Formal Methods Second World Congress FM 2009 volume 5850 of LNCSpages 790ndash805 Springer-Verlag 2009

[7] M Baggi D Ballis and M Falaschi Quantitative Pathway Logic for Computational Biology InProc of 7th Intrsquol Conference on Computational Methods in Systems Biology (CMSB rsquo09) volume5688 of LNCS pages 68ndash82 Springer-Verlag 2009

[8] R Bruni and J Meseguer Semantic Foundations for Generalized Rewrite Theories TheoreticalComputer Science 360(1ndash3)386ndash414 2006

[9] M Clavel F Duran S Eker P Lincoln N Martı-Oliet J Meseguer and C Talcott MaudeManual (Version 26) Technical report SRI Intrsquol Computer Science Laboratory 2011 Availableat httpmaudecsuiucedumaude2-manual

[10] J Clements M Flatt and M Felleisen Modeling an Algebraic Stepper In Proc 10th EuropeanSymposium on Programming volume 2028 of LNCS pages 320ndash334 Springer-Verlag 2001

[11] F Duran and J Meseguer A Maude Coherence Checker Tool for Conditional Order-SortedRewrite Theories In Proc of 8th International Workshop on Rewriting Logic and Its Applications(WRLArsquo10) number 6381 in LNCS pages 86ndash103 Springer-Verlag 2010

[12] JW Klop Term Rewriting Systems In S Abramsky D Gabbay and T Maibaum editorsHandbook of Logic in Computer Science volume I pages 1ndash112 Oxford University Press 1992

[13] N Martı-Oliet and J Meseguer Rewriting Logic Roadmap and Bibliography Theoretical Com-puter Science 285(2)121ndash154 2002

[14] J Meseguer Conditional Rewriting Logic as a Unified Model of Concurrency Theoretical Com-puter Science 96(1)73ndash155 1992

[15] J Meseguer The Temporal Logic of Rewriting A Gentle Introduction In Concurrency Graphsand Models Essays Dedicated to Ugo Montanari on the Occasion of his 65th Birthday volume5065 pages 354ndash382 Berlin Heidelberg 2008 Springer-Verlag

[16] A Riesco A Verdejo R Caballero and N Martı-Oliet Declarative Debugging of RewritingLogic Specifications In Recent Trends in Algebraic Development Techniques 19th Intrsquol WorkshopWADT 2008 volume 5486 of LNCS pages 308ndash325 Springer-Verlag 2009

[17] A Riesco A Verdejo and N Martı-Oliet Declarative Debugging of Missing Answers for MaudeIn 21st Intrsquol Conference on Rewriting Techniques and Applications RTA 2010 volume 6 of LIPIcspages 277ndash294 Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik 2010

[18] TeReSe editor Term Rewriting Systems Cambridge University Press Cambridge UK 2003

18

Automatic Inference of Term Equivalence in

Term Rewriting Systems

Marco Comini1 and Luca Torella2

1 DIMI University of Udine Italymarcocominiuniudit

2 DIISM University of Siena Italylucatorellaunisiit

Abstract

In this paper we propose a method to automatically infer algebraic property-orientedspecifications from Term Rewriting Systems Namely having three semantics with suitableproperties given the source code of a TRS we infer a specification which consists of a setof most general equations relating terms that rewrite for all possible instantiations to thesame set of constructor terms

The semantic-based inference method that we propose can cope with non-constructor-based TRSs and considers non-ground terms Particular emphasis is put on avoiding thegeneration of ldquoredundantrdquo equations that can be a logical consequence of other ones

1 Introduction

In the last years there has been a growing interest in the research on automatic inference ofhigh-level specifications from an executable or the source code of a system This is probablydue to the fact that the size of software systems is growing over time and certainly one cangreatly benefit from the use of automatic tools There are several proposals like [1 7 6] whichhave proven to be very helpful

Specifications have been classified by their characteristics [8] It is common to distin-guish between property-oriented specifications and model-oriented or functional specificationsProperty-oriented specifications are of higher description level than other kinds of specificationsthey consist of an indirect definition of the systemrsquos behavior by stating a set of propertiesusually in the form of axioms that the system must satisfy [11 10] In other words a specifi-cation does not represent the functionality of the program (the output of the system) but itsproperties in terms of relations among the operations that can be invoked in the program (ieidentifies different calls that have the same behavior when executed) This kind of specifica-tions is particularly well suited for program understanding the user can realize non-evidentinformation about the behavior of a given function by observing its relation to other functionsMoreover the inferred properties can manifest potential symptoms of program errors which canbe used as input for (formal) validation and verification purposes

We can identify two mainstream approaches to perform the inference of specifications glass-box and black-box The glass-box approach [1] assumes that the source code of the programis available In this context the goal of inferring a specification is mainly applied to documentthe code or to understand it Therefore the specification must be more succinct and compre-hensible than the source code itself The inferred specification can also be used to automatethe testing process of the program or to verify that a given property holds [1] The black-boxapproach [7 6] works only by running the executable This means that the only informationused during the inference process is the input-output behavior of the program In this setting

19

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

the inferred specification is often used to discover the functionality of the system (or services ina network) [6] Although black-box approaches work without any restriction on the consideredlanguage ndash which is rarely the case in a glass-box approach ndash in general they cannot guaranteethe correctness of the results (whereas indeed semantics-based glass-box approaches can)

For this work we developed a (glass-box) semantic-based algebraic specification synthesismethod for the Term Rewriting Systems formalism that is completely automatic ie needsonly the source TRS to run Moreover the outcomes are very intuitive since specifications aresets of equations of the form e1 = e2 where e1 e2 are generic TRS expressions so the userdoes not need any kind of extra knowledge to interpret the results The underpinnings of ourproposal are radically different from other works for functional programming since the presenceof non-confluence or non-constructor-based TRSs poses several additional problems

11 Notations

We assume that the reader is familiar with the basic notions of term rewriting For a thoroughdiscussion of these topics see [9] In the paper we use the following notations V denotes a(fixed) countably infinite set of variables and T (ΣV) denotes the terms built over signatureΣ and variables V T (Σempty) are ground terms Substitutions over T (Σempty) are called groundsubstitutions Σ is partitioned in D the defined symbols and C the constructor symbols

T (CV) are constructor terms Substitutions over T (CV) are said constructor substitutionsC[t1 tn] denotes the replacement of t1 tn in context C A TRS R is a set of rules l rarr r

where l = f(t1 tn) l r isin T (ΣV) var(r) sube var(l) and f isin D t1 tn are the argumentpatterns of l rarr r and need not necessarily be in T (CV) unlike in functional programmingwhere only constructor-based TRSs are considered (with ti isin T (CV))

2 Many notions of equivalence

In the functional programming paradigm an equation e1 = e2 is typically interpreted as aproperty that holds for any well-typed constructor ground instance of the variables occurringin the equation Namely for all bindings of variables with well-typed (constructor ground)terms ϑ the constructor term computed for the calls e1ϑ and e2ϑ is the same In functionalprogramming we can consider only constructor instances because by having constructor-basedconfluent TRSs the set of values for non-constructor instances is the same as for constructorones

Differently from the functional programming case the TRS formalism admits variables ininitial terms and defined symbols in the patterns of the rules moreover rules are evaluatednon-deterministically and can rewrite to many constructor terms Thus an equation can beinterpreted in many different ways We will discuss the key points of the problem by means ofa (very simple) illustrative example

Example 21 Consider the following (non constructor based) TRS R where we provide a prettystandard definition of the arithmetic operations + - and (modulo)

0 + x -gt x x - 0 -gt x x s(y) -gt (x - s(y)) s(y)

s(x) + y -gt s(x+y) s(x) - s(y) -gt x - y (0 - s(x)) s(y) -gt y - x

Note that since the TRS formalism is untyped a term like 0 + a is admissible and is evaluatedto constructor term a

20

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

For this TRS one could expect to have in its property-oriented specification equations like

(x + y) + z = x + (y + z) (21)

x - (y + z) = (x - y) - z (22)

(x - y) - z = (x - z) - y (23)

0 + x = x (24)

x + 0 = x (25)

x + y = y + x (26)

These equations of the form e1 = e2 can be read as the (observable) outcomes of e1 are thesame of e2 The first essential thing is to formalize the meaning of ldquoobservable outcomesrdquo ofthe evaluation of an expression e (which contains variables) In the TRS formalism we haveseveral possible combinations First it is technically possible to literally interpret variables ine and decide to observe either the set of normal forms of e or the set of constructor terms ofe However as can be quickly verified only (24) is valid in either of these forms Indeedconsider for example terms x - (y + z) and (x - y) - z For both terms no rule can beapplied hence they are both (non constructor) normal forms and thus (22) is not literally validClearly this is quite a radical choice An interesting alternative would be to request that forany possible interpretation of variables with any term the expressions rewrite to the same setof constructor terms Formally by defining the rewriting behavior of a term t as

BJtRK ∶= ϑ sdot s∣ tϑETHrarrR

lowast s s isin T (CV) ϑ∶V rarr T (ΣV) dom(ϑ) sube var(t) (27)

we can interpret e1 = e2 as e1 =RB e2 ∶lArrrArr BJe1RK = BJe2RK In the following we call thisequivalence rewriting behavior equivalence Actually eqs (21) to (24) are valid wrt =RB

Note that if we would have chosen to use normal forms instead of constructor terms in (27)(ie s rarr instead of s isin T (CV)) then we would still have the same situation described beforewhere only (24) holds

The other equations (eqs (25) and (26)) are not valid in this sense For instance BJx + 0K =xt sdot si(0)∣tETHrarrlowast si(0) 1 while BJxK = xt sdot v∣tETHrarr

R

lowast v v isin T (CV) (and then ε sdot x isin BJxK ∖

BJx + 0K) These equations are not valid essentially because we have variables which cannotbe instantiated but if we consider ground constructor instancies which ldquotriggerrdquo in either terman evaluation to constructor terms then we actually obtain the same constructor terms Forexample for t1 = x and t2 = x + 0 for all ϑi = xsi(0) we have BJt1ϑiK = BJt2ϑiK = ε sdot si(0)∣Thus (25) holds in this sense

Decidedly also this notion of equivalence is interesting for the user We can formalize it ast1 =G t2 ∶lArrrArr forallϑ ground constructor BJt1ϑK cupBJt2ϑK sube ε sdot t∣t isin T (CV)rArr BJt1ϑK = BJt2ϑK Wewill call it ground constructor equivalence Note that =G is the only possible notion in the purefunctional paradigm where we can just have evaluations of ground terms and where we haveonly confluent constructor-based TRSs In this case the latter definition boils down to twoexpressions are equivalent if all its ground constructor instances rewrite to the same constructorterm This fact allows one to have an intuition of the reason why the problem of specificationsynthesis is definitively more complex in the full TRS paradigm

Since we do not consider only constructor-based TRSs there is another very relevant differ-ence wrt the pure functional case For instance let us consider the TRS Q obtained by addingthe rule g((x - y) - z) -gt x - (y + z) to TRS R of Example 21 Let t1 = x - (y + z)

1Here by si(0) we mean i repeated applications of s to 0 including the degenerate case for i = 0

21

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

and t2 = (x-y)-z We have BJt1QK = BJt2QK = x0 y0 z0 sdot 0xs(0) y0 z0 sdot s(0)xs(0) ys(0) z0 sdot 0xs(0) y0 zs(0) sdot 0 ∣ While the term g(t2) has this same be-havior BJg(t1)QK = empty

In general in the case of the TRS formalism terms embedded within a context do notnecessarily manifest the same behavior Thus it is also interesting to additionally ask to theequivalence notion =RB that the behaviors must be the same also when the two terms areembedded within any context Namely e1 =C e2 ∶lArrrArr forall contextC BJC[e1]RK = BJC[e2]RKWe call this equivalence contextual equivalence We can see that =C is (obviously) strongerthan =RB which is in turn stronger than =G Actually they are strictly stronger Indeed onlyeqs (21) and (24) are valid wrt =C (while eqs (22) and (23) are not)

We believe that all these notions are interesting for the user thus we formalize our notionof (algebraic) specification as follows

Definition 22 A specification S is a set of (sequences of) equations of the form t1 =K t2 =K =K tn with K isin CRB G and t1 t2 tn isin T (ΣV)

Thus for TRS Q we would get the following (partial) specification

(x + y) + z =C x + (y + z) 0 + x =C x

x - (y + z) =RB (x - y) - z (x - y) - z =RB (x - z) - y

x + y =G y + x x + 0 =G x

(x + y) z =G ((x z) + (y z)) z (x + y) y =G x y

(x - y) z =G (((x + z) z) - (y z)) z

In the following we present a first proposal of a semantics-based method that infers such spec-ifications for TRSs and tackles the presented issues (and discuss about its limitations) It isan adaptation for the TRS paradigm of ideas from [2] for the Functional Logic paradigm Thisadaptation is not straightforward since the Functional Logic paradigm is quite similar to theFunctional paradigm but considerably different from the TRS paradigm Moreover this worksignificantly extends the inference process by tackling equations like f(x y) = f(y x) which arereally important

3 Deriving specifications from TRSs

The methodology we are about to present is parametric wrt three semantics evaluation func-tions which need to enjoy some properties Namely

ERBJt RK gives the rewriting behavior (RB) semantics of term t with (definitions from) TRSR This semantics has to be fully abstract wrt rewriting behavior equivalence Namelywe require that ERBJt1 RK = ERBJt2 RK lArrrArr t1 =RB t2

EC Jt RK gives the contextual (C) semantics of the term t with the TRS R This semantics hasto be fully abstract wrt contextual equivalence Namely EC Jt1 RK = EC Jt2 RK lArrrArrt1 =C t2

EGJt RK gives the ground (G) semantics of the term t with the TRS R This semanticshas to be fully abstract wrt ground constructor equivalence Namely EGJt1 RK =EGJt2 RK lArrrArr t1 =G t2

22

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

The idea underlying the process of inferring specifications is that of computing the semanticsof various terms and then identify all terms which have the same semantics However not allequivalences are as important as others given the fact that many equivalences are simplelogical consequences of others For example if ti =C si then for all constructor contexts CC[t1 tn] =C C[s1 sn] thus the latter derived equivalences are uninteresting and shouldbe omitted Indeed it would be desirable to synthesize the minimal set of equations from whichby deduction all valid equalities can be derived This is certainly a complex issue in testingapproaches With a semantics-based approach it is fairly natural to produce just the relevantequations The (high level) idea is to proceed bottom-up by starting from the evaluation ofsimpler terms and then newer terms are constructed (and evaluated) by using only semanticallydifferent arguments Thus by construction only non-redundant equations are produced

There is also another source of redundancy due to the inclusion of relations =K For examplesince =C is the finer relation t =C s implies t =RB s and t =G s To avoid the generation of coarserredundant equations a simple solution is that of starting with =C equivalences and once theseare all settled to proceed only with the evaluation of the =RB equivalences of non =C equivalentterms Thereafter we can evaluate the =G equivalences of non =RB equivalent terms

Clearly the full computation of a programsrsquo semantics is not feasible in general For themoment for the sake of comprehension we prefer to present the conceptual framework leavingout of the picture the issues related to decidability We will show a possible decidable instanceof the method in Section 31

Let us describe in more detail the specification inference process The input of the processconsists of a TRS to be analyzed and two additional parameters a relevant API Σr and amaximum term size max size The relevant API allows the user to choose the operations inthe program that will be present in the inferred specification whereas the maximum term sizelimits the size of the terms in the specification As a consequence these two parameters tunethe granularity of the specification both making the process terminating and allowing the userto keep the specification concise and easy to understand

The output consists of a set of equations represented by equivalence classes of terms (withdistinct variables) Note that inferred equations may differ for the same program dependingon the considered API and on the maximum term size Similarly to other property-orientedapproaches the computed specification is complete up to terms of size max size ie it includesall the properties (relations) that hold between the operations in the relevant API and that areexpressible by terms of size less or equal than max size

Terms are classified by their semantics into a data structure which we call classificationconsisting (conceptually) of a set of equivalence classes (ec) formed by

bull sem(ec) the semantics of (all) the terms in that classbull rep(ec) the representative term of the class (rep(ec) isin terms(ec))bull terms(ec) the set of terms belonging to that equivalence classbull epoch(ec) an integer to record the moment of introduction of that equivalence class

The representative term is the term which is used in the construction of nested expressionswhen the equivalence class is considered To output smaller equations it is better to choose thesmallest term in the class (wrt the function size) but any element of terms(ec) can be used

The inference process consists of successive phases one for each kind of equality (in orderof discriminating power ie C RB G) as depicted in Figure 1

Computation of the initial classification (epochs 0 and 1) The first phase of the algo-rithm is the computation of the initial classification that is needed to compute the classificationwrt =C We initially create a classification which contains

23

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

Inference Process

Computation of the initial classification

Generation of =C -classification

Generation of =RB -classification

Generation of =G -classification

Generation of =C -equations

Generation of =RB -equations

Generation of =G -equations

Specification

TRS

Program

API

max size

Figure 1 A general view of the inference process

bull one class for a free (logical) variable ⟨EC JxK x x 0⟩bull the classes for any constructor symbol ie for all cn

2 isin C and x1 xn distinct variables

⟨EC JtK t t 0⟩ where t = c(x1 xn)

Then for all symbols fn of the relevant API Σr and distinct variables x1 xn we add

to classification the term t = f(x1 xn) with semantics s = EC Jt RK and epoch m = 1This operation denoted addEC (t sm) is the most delicate part of the method If we wouldnot consider the generation of ldquopermutedrdquo equations like f(x y) = f(y x) then the wholeactivity would just boil down to look for the presence of s in some equivalence class and thenupdating the classification accordingly (like in [2]) Handling of permutations cannot be done bynaıvely adding all (different) permutations of s In this way we would generate many redundantequations Consider for instance the TRS Q

f(abc) -gt 0

f(bac) -gt 0

f(acb) -gt 0

f(bca) -gt 0

f(cab) -gt 0

f(cba) -gt 0

From the minimal set f(x y z) =C f(y x z) =C f(x z y) we can generate all other valid per-mutations like f(x y z) =C f(y z x) =C f(z x y) Thus in this case we should only generatepermutated equations where we just swap two variables However for the TRS R

f(abc) -gt 0 f(bca) -gt 0 f(cab) -gt 0

f(x y z) neC f(y x z) neC f(x z y) but f(x y z) =C f(y z x) Moreover f(x y z) =C f(z x y)can be deduced by this Thus in this case we should only generate permutated equations witha rotation of three variables since all other rotations of three variables are just a consequence

Thus not all permutations have to be considered while adding a semantics to a classificationand it is not necessary to look for all permutations within the semantics already present in theclassification To generate only a minimal set of necessary permutated equations we need toconsider for each k variables a set Πn

k of generators of the permutations of n variables whichdo not move n minus k variables (note that Πn

1 = id ) Then for a term t = f(x1 xn) westart sequentially for i from 1 to n and look if for some π isin Πn

i we have an equivalence classec in the current classification whose semantics coincides with sπ (ie ec = ⟨sπ tprime T mprime⟩) Ifit is found then the term tπminus1 is added to the set of terms in ec (ie ec is transformed inecprime = ⟨sπ tprime T cup tπminus1 mprime⟩) and we stop Otherwise we iterate with next i If all fails a newequivalence class ⟨s t T m⟩ has to be created but we have to determine the right term set

2Following the standard notation fn denotes a function f of arity n

24

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

T (to possibly generate equations like f(x y) = f(y x)) We initially start with T = t andj = n and sequentially for i from 2 to j we check if for some π isin Πj

i we have s = sπ If wefind it we add tπ to T and decrement j by i minus 1 (i variables are now used in a valid equationand thus from this moment on i minus 1 variables have no longer to be considered) Otherwise wecontinue with next i The final T is used for the new equivalence class

For example for t = f(x y z) in TRS Q we start with variables x y z and T = t Nowconsider for instance π = (xy) isin Π3

2 Since EC JtK = EC JtπK then T = f(x y z) f(y x z)and then we drop x and remain with variables y z Now we have only πprime = (y z) isin Π2

2 andsince EC JtK = EC JtπprimeK then T = f(x y z) f(y x z) f(x z y) we drop y and (thus) finishInstead for t = f(x y z) in TRS R we start with variables x y z and T = t Now considerfor instance π1 = (xy) isin Π3

2 Since EC JtK ne EC Jtπ1K then we consider π2 = (y z) isin Π3

2 and sinceEC JtK ne EC Jtπ2K we increase i Now we have only π3 = (xy z) isin Π3

3 and since EC JtK = EC Jtπ3Kthen T = f(x y z) f(y z x) we drop x y and (thus) finish

Generation of =C classification (epochs 2 and above) The second phase of the algo-rithm is the (iterative) computation of the successive epochs until we complete the constructionof the classification of terms wrt =C At each iteration (with epoch k) for all symbols fnof the relevant API Σr we select from the current classification all possible combinations of nequivalence classes ec1 ecn such that at least one eci was newly produced in the previousiteration (ie whose epoch is k minus 1) We build the term t = f(rep(ec1) rep(ecn)) whichby construction has surely not been considered yet Then if size(t) le max size we computethe semantics s = EC Jt RK and update the current classification by adding to classification theterm t and its semantics s (addEC (t s k)) as described before

If we have produced new equivalence classes then we continue to iterate This phase eventu-ally terminates because at each iteration we consider by construction terms which are differentfrom those already existing in the classification and whose size is strictly greater than the sizeof its subterms (but the size is bounded by max size)

The following example illustrates how the iterative process works

Example 31 Let us use the program R of Example 21 and choose as relevant API the func-tions + - and In the first step the terms

t11 = x + y t12 = x - y t13 = x y

are built Since (all permutations of) the semantics of all these terms are different and differentfrom the other semantics already in the initial classification three new classes are added to theinitial classification

During the second iteration the following two terms (among others) are built

bull the term t21 = (xrsquo + yrsquo) + y is built as the instantiation of x in t11 with (a renamedapart variant of) t11 and

bull the term t22 = x + (xrsquo + yrsquo) as the instantiation of y in t11 with t11

The semantics of these two terms is the same s but it is different from the semantics of theexisting equivalence classes Thus during this iteration (at least) the new equivalence classecprime ∶= ⟨s t21 t21 t22 n⟩ is computed Hereafter only the representative of the class will beused for constructing new terms Since we have chosen t21 instead of t22 as the representativeterms like (x + (xrsquo + yrsquo)) z will never be built

Thanks to the closedness wrt context of the semantics this strategy for generating terms issafe In other words when we avoid to build a term it is because it is not able to produce a

25

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

behavior different from the behaviors already included by the existing terms thus we are notlosing completeness

Generation of the =C specification Since by construction we have avoided much redun-dancy thanks to the strategy used to generate the equivalence classes we now have only to takeeach equivalence class with more than one term and generate equations for these terms

Generation of =RB equations The third phase of the algorithm works on the former clas-sification by first transforming each equivalence class ec by replacing the C-semantics sem(ec)with ERBJrep(ec) RK and terms(ec) with the (singleton) set rep(ec) After the transforma-tion some of the previous equivalence classes which had different semantic constructor termsmay now have the same RB -semantics and then we merge them making the union of the termsets terms(ec)

Thanks to the fact that before merging all equivalence classes were made of just singletonterm sets we cannot generate (again) equations t1 =RB t2 when an equation t1 =C t2 had beenalready issued Let us clarify this phase by an example

Example 32 Assume we have a classification consisting of three equivalence classes with C-semantics s1 s2 and s3 and representative terms t11 t22 and t31

ec1 = ⟨s1 t11t11 t12 t13⟩ ec2 = ⟨s2 t22t21 t22⟩ ec3 = ⟨s3 t31t31⟩

We generate equations t11 =C t12 =C t13 and t21 =C t22Now assume that ERBJt11K = w0 and ERBJt22K = ERBJt31K = w1 Then (since t12 t13 and

t21 are removed) we obtain the new classification

ec4 = ⟨w0 t11 t11 n⟩ ec5 = ⟨w1 t22 t22 t31 n⟩

Hence the only new equation is t22 =RB t31 Indeed equation t11 =RB t12 is uninterestingsince we already know t11 =C t12 and equation t21 =RB t31 is redundant (because t21 =C t22 andt22 =RB t31)

The resulting (coarser) classification is then used to produce the =RB equations as donebefore by generating equations for all non-singletons term sets

Generation of the =G equations In the last phase we transform again the classificationby replacing the RB -semantics with the G-semantics (and terms(ec) with the set rep(ec))Then we merge eventual equivalence classes with the same semantics and finally we generate=G equations for non singleton term sets

Theorem 33 (Correctness) For all equations e1 = e2 generated in the second third andforth phase we have that e1 =C e2 e1 =RB e2 and e1 =G e2 respectively

Proof By construction of equivalence classes in the second phase an equation t1 = t2 isgenerated if and only if the semantics EC Jt1 RK = EC Jt2 RK Then since EC Jt1 RK =EC Jt2 RK lArrrArr t1 =C t2 the first part of thesis follows immediately Then by the succes-sive trasformation and reclassification in the third phase we issue an equation t1 = t2 if andonly if ERBJt1 RK = ERBJt2 RK Then since ERBJt1 RK = ERBJt2 RK lArrrArr t1 =RB t2 we havethe second part of thesis The proof of the third part of thesis since EGJt1 RK = EGJt2 RK lArrrArrt1 =G t2 is analogous

26

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

Example 34 Let us recall (again) the programR of Example 21 The terms x + y and y + xbefore the transformation belong to two different equivalence classes (since their rewritingbehavior is different) Anyway after the transformation the two classes are merged since theirG-semantics is the same namely x0 y0 sdot 0xs(0) y0 sdot s(0)x0 ys(0) sdot s(0) ∣

We now present some examples to show how our proposal deals with non-contructor basedor non-confluent TRS plus some to show that we can infer several non-trivial equations

Example 35 Consider the definition for the boolean data type with constructor terms trueand false and boolean operations and or not and imp

and(true x) -gt x

and(false x) -gt false

or(true x) -gt true

or(false x) -gt x

not(true) -gt false

not(false) -gt true

imp(false x) -gt true

imp(true x) -gt x

This is a pretty standard ldquoshort-cutrdquo definition of boolean connectives With our method weget the following equations

not(or(xy)) =C and(not(x)not(y)) imp(xy) =C or(not(x)y)

not(and(xy)) =C or(not(x)not(y)) not(not(x)) =G x

and(xand(yz)) =C and(and(xy)z) and(xy) =G and(yx)

Example 36 Let us consider the following non-constructor based TRS implementing someoperations over the naturals in Peano notation

x - 0 -gt x

s(x) - s(y) -gt x - y

g(x) -gt chk(x - s(x))

chk(0) -gt 0

chk(s(x)) -gt s(x)

chk(0 - s(x)) -gt err

The definition of - is a standard definition of the minus operation over naturals The chk

function simply returns the natural passed as argument or returns err if the argument is anot defined subtraction It is easy to see that the TRS is not constructor-based because ofthe presence of the - in the pattern of a rule The artificial function g which checks if thesubtraction of a number by its successor is a natural number is doomed to return err Withour classification we actually derive equation g(x) =C err

Example 37 Let us consider the following (artificial) non-orthogonal TRS

coin -gt 0

coin -gt 1

d(x) -gt g(xx)

g(01) -gt true

t(x) -gt k(xxx)

k(101) -gt true

The coin function can return both 0 and 1 The functions d and t call an auxiliary functionduplicating and triplicating (respectively) the variable received as argument Functions f andg require a specific combination of 0 and 1 to return the constructor term true Notice thatto reach the constructor term true from d and t respectively it is necessary to use a nondeterministic function able to rewrite to both 0 and 1 Some of the inferred equations for thisTRS are t(x) =C d(x) and t(coin) =C g(coincoin) =C k(coincoincoin) =C d(coin)

27

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

Example 38 Let us consider the following TRS that computes the double of numbers inPeano notation

double (0) -gt 0

double(s(x)) -gt s(s(double(x)))

dbl(x) -gt plus(xx)

plus(0y) -gt y

plus(s(x)y) -gt s(plus(xy))

Some of the inferred equations for the TRS are

dbl(dbl(double(x))) =G dbl(double(dbl(x))) (31)

double(x) =G dbl(x) (32)

dbl(dbl(x)) =G dbl(double(x))=Gdouble(dbl(x)) =G double(double(x)) (33)

plus(double(x)y) =G plus(dbl(x)y) (34)

We can observe that all equations hold with the =G relation and not with the =RB relationThis is due to the fact that the two functions dbl and dbl even if at a first sight could seemto evaluate the same constructor terms can behave differently For instance if we add to theTRS the two rules coin -gt 0 and coin -gt s(0) we can notice that the terms double(coin)and dbl(coin) return different constructor terms This is due to the non determinism ofthe coin function that exploits the right non-linearity of function dbl While double(coin)

evaluates to 0 and s(s(0)) the term dbl(coin) can be reduced even to s(0) (by dbl(coin)

rarr plus(coincoin) rarr2 plus(0s(0)) rarr s(0))This characteristic of the program is not easy to realize by just looking at the code

Example 39 Let us consider the following TRS defining two functions over an extension ofthe Peano notation able to handle negative integers

abs(-(x)) -gt abs(x)

abs(s(x)) -gt s(x)

abs(0) -gt 0

f(-(-(x))) -gt f(x)

f(0) -gt 0

f(s(x)) -gt s(x)

f(-(s(x))) -gt 0

Function abs is a standard definition of the absolute value function f returns its input if it isa positive number and 0 if it is not Some of the inferred equations are f(f(x)) =C abs(f(x))

and f(abs(x)) =C abs(abs(x))

Example 310 Let us consider the following program which implements a two-sided queue in a(non-trivial) efficient way The queue is implemented as two lists where the first list correspondsto the first part of the queue and the second list is the second part of the queue reversed Theinl function adds the new element to the head of the first list whereas the inr function addsthe new element to the head of the second list (the last element of the queue) The outl (outr)function drops one element from the left (right) list unless the list is empty in which case itreverses the other list and then swaps the two lists before removal

new -gt Q(Nil Nil)

inl(xQ(xs ys)) -gt Q((xxs)ys)

inr(xQ(xs ys)) -gt Q(xs (xys))

outl(Q(Nil ys)) -gt

Q(tail(rev(ys))Nil)

outl(Q((xxs)ys)) -gt Q(xsys)

outr(Q(xs Nil)) -gt

Q(Nil tail(rev(xs)))

outr(Q(xs (yys))) -gt Q(xsys)

null(Q((xxs)ys)) -gt False

null(Q(Nil (xxs))) -gt False

null(Q(Nil Nil)) -gt True

28

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

tail ((xxs)) -gt xs

rev(xs) -gt rv rsquo(xs Nil)

rv rsquo(Nil ys) -gt ys

rv rsquo((xxs)ys) -gt rv rsquo(xs (xys))

With our method (amongst others) we derive

null(new) =C True (35)

new =C outl(inl(xnew)) =C outr(inr(xnew)) (36)

outl(inl(xq)) =C outr(inr(xq)) (37)

inr(xinl(yq)) =C inl(yinr(xq)) (38)

inl(xoutl(inl(yq))) =C outr(inl(xinr(yq))) (39)

null(inl(xnew)) =C null(inr(xnew)) =C False (310)

We can see different kinds of non-trivial equations eqs (36) and (37) state that adding andremoving one element produces always the same result independently from the side in which weadd and remove it Equations (38) and (39) show a sort of restricted commutativity betweenfunctions

31 An effective instance of the presented method

In a semantics-based approach one of the main problems to be tackled is effectiveness Thesemantics of a program is in general infinite and thus some approximation has to be used inorder to have a terminating method To experiment on the validity of our proposal we startedby using a novel (condensed) fixpoint semantics which we have developed for left-linear TRSsthat is fully abstract wrt =C

3 Such semantics is defined as the fixpoint of an immediateconsequences operator P JRK We have opted for this semantics because it has some propertieswhich are very important from a pragmatical point of view

bull it is condensed meaning that denotations are the smallest possible (between all thosesemantics which induce the same program equivalence) This is a very relevant (if notessential) feature to develop a semantic-based tool which has to compute the semantics

bull The semantics ERB can be obtained directly by transforming the EC semantics concretelyjust by loosing internal structure Therefore no (costly) computation of ERB is needed

We have implemented the basic functionality of the proposed methodology in a prototype writ-ten in Haskell TRSynth available at httpsafe-toolsdsicupvestrsynth (for a detaileddescription see [4]) The implementation of =G equality is still ongoing work because we arelacking of a suitable implementation of the G-semantics

To achieve termination the prototype computes a fixed number k of steps of P JRK Thenit proceeds with the classification as described in Section 3 Clearly in presence of terms withinfinite solutions with such a rough approximation we may loose both correctness (by mis-takenly equating terms which become semantically different after k iterates) and completeness(by mistakenly not equating terms which will become semantically equivalent) Neverthelessthe results are encouraging For instance TRSynth detects all =C and =RB which we showed inexamples (except of Example 38 because of a bug in the computation of the semantics)

3The writing of articles related to the formal definition of this semantics is in progress [3]

29

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

4 Conclusions and future work

This paper discusses about the issues that arise for the automatic inference of high-levelproperty-oriented (algebraic) specifications because of non-confluent or non-constructor basedTRS Then a first proposal which overcomes these issues is presented

Our method computes a concise specification of program properties from the source code ofa TRS We hope to have convinced the reader (with all examples) that we reached our maingoal that is to get a concise and clear specification (that is useful for the programmer in orderto discover unseen properties or detect possible errors)

We have developed a prototype that implements the basic functionality of the approach Weare aware that many other attempts to guarantee termination could be used in other instanciesof the presented method Certainly given our know-how in the future we will experiment withabstractions obtained by abstract interpretation [5] (our novel semantics itself has been obtainedas an abstract interpretation) Actually we already have an ongoing work to implement thedepth(k) abstract version of our semantics In the depth(k) abstraction terms (occurring in thenodes of the semantic trees) are ldquocutrdquo at depth k by replacing them with cut variables distinctfrom program variables Hence for a given signature Σ the universe of abstract semantic treesis finite (although it increases exponentially wrt k) Therefore the finite convergence of thecomputation of the abstract semantics is guaranteed

References

[1] G Ammons R Bodık and J R Larus Mining specifications In 29th ACM SIGPLAN-SIGACTsymposium on Principles of programming languages (POPLrsquo02) pages 4ndash16 New York NY USA2002 Acm

[2] G Bacci M Comini M A Feliu and A Villanueva Automatic Synthesis of Specifications forFirst Order Curry Programs In Proceedings of the 14th symposium on Principles and practice ofdeclarative programming pages 25ndash34 New York NY USA 2012 ACM

[3] M Comini and L Torella A Condensed Goal-Independent Fixpoint Semantics Modeling theSmall-Step Behavior of Rewriting Technical Report DIMI-UD012013RR Dipartimento diMatematica e Informatica Universita di Udine 2013

[4] M Comini and L Torella TRSynth a Tool for Automatic Inference of Term Equivalence inLeft-linear Term Rewriting Systems In E Albert and S-C Mu editors PEPM rsquo13 Proceedingsof the ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation pages 67ndash70Acm 2013

[5] P Cousot and R Cousot Abstract Interpretation A Unified Lattice Model for Static Analysisof Programs by Construction or Approximation of Fixpoints In Proceedings of the 4th ACMSIGACT-SIGPLAN symposium on Principles of programming languages Los Angeles CaliforniaJanuary 17ndash19 pages 238ndash252 New York NY USA 1977 ACM Press

[6] C Ghezzi A Mocci and M Monga Synthesizing intensional behavior models by graph trans-formation In 31st International Conference on Software Engineering (ICSErsquo09) pages 430ndash4402009

[7] J Henkel C Reichenbach and A Diwan Discovering Documentation for Java Container ClassesIEEE Transactions on Software Engineering 33(8)526ndash542 2007

[8] A A Khwaja and J E Urban A property based specification formalism classification TheJournal of Systems and Software 832344ndash2362 2010

[9] TeReSe editor Term Rewriting Systems Cambridge University Press Cambridge UK 2003

[10] H van Vliet Software EngineeringndashPrinciples and Practice John Wiley 1993

[11] J M Wing A specifierrsquos introduction to formal methods Computer 23(9)10ndash24 1990

30

A Condensed Goal-Independent Fixpoint

Semantics Modeling the Small-Step Behavior of

Rewriting

Marco Comini1 and Luca Torella2

1 DIMI University of Udine Italy mdash marcocominiuniudit

2 DIISM University of Siena Italy mdash lucatorellaunisiit

Abstract

In this paper we present a novel condensed narrowing-like semantics that contains theminimal information which is needed to describe compositionally all possible rewritings ofa term rewriting system We provide its goal-dependent top-down definition and moreimportantly an equivalent goal-independent bottom-up fixpoint characterization

We prove soundness and completeness wrt the small-step behavior of rewriting forthe full class of term rewriting systems

1 Introduction

Nowadays the formalism of Term Rewriting Systems (TRSs) is used besides for functionalprogramming also for many other applications (like specification of communication protocolsto mention one) There has been a lot of research on the development of tools for the formalverification and (in general) automatic treatmentmanipulation of TRSs Within the proposalsthere are semantics-based approaches which can guarantee correctness by construction How-ever they cannot employ directly the construction of the semantics since in general it is infiniteThus some kind of approximation has to be used

Given the potentiality of application of the TRS formalism we have turned our attentiontoward the development of semantics-based TRS manipulation tools with the intention to useAbstract Interpretation theory as fundament to devise semantics approximations correct byconstruction However as also noted by [9] defining a suitable (concrete) semantics is usuallythe first crucial step in adapting the general methodology of Abstract Interpretation to thesemantic framework of the programming language at hand When a concrete semantics isused to define via abstract interpretation abstract (approximate) semantics to be employedto develop semantics-based manipulation tools it is particularly relevant if it is condensedand defined compositionally In the literature a semantics is said to be condensing when thesemantics of an instance of an expression (term goal call) can be obtained with a semanticoperation directly from the semantics of the (un-instantiated) expression In such a situationonly the semantics for most general expressions can be maintained in denotations We saythat a semantics is condensed when the denotations themselves do not contain redundancy iewhen it is not possible to semantically derive the components of a denotation from the othercomponents Indeed the abstract semantics operations which are obtained from a condensedconcrete semantics involve the use of the join operation (of the abstract domain) at each iterationin parallel onto all components of rules instead of using several subsequent applications for allcomponents This has a twofold benefit On one side it speeds up convergence of the abstractfixpoint computation On the other side it considerably improves precision

In [2] we developed an automatic debugging methodology for the TRS formalism based onabstract interpretation of the big-step rewriting semantics that is most commonly considered

31

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

in functional programming ie the set of constructor termsnormal forms However theresulting tool was inefficient The main reason for this inefficiency is because the chosen concretesemantics is not condensing and thus because of its accidental high redundancy it causes thealgorithms to use and produce much redundant information at each stage In contrast thesame methodology gave good results in [5] because it was applied to a condensed semantics

The constructor termsnormal forms semantics is not condensed because it contains allpossible rewritings but there are many possible rewritings which can be obtained by someother ones since rewriting is closed under substitution (stability) and replacement (t ETHrarr

R

lowast s

implies C[t]p ETHrarrR

lowast C[s]p) Thus in [1] we tried to directly devise a semantics fully abstract

wrt the big-step rewriting semantics with the specific objective to avoid all redundancy whilestill characterizing the rewritings of any term In particular we searched a semantics which

bull has a compositional goal-independent definitionbull is the fixpoint of a bottom-up constructionbull is as condensed as possible

Unfortunately (in [1]) we just partially achieved this goal since the semantics is defined only forsome classes of TRSs In the meantime for a (quite) different language in [4 3] we obtainedmdashfor the full languagemdasha semantics with the mentioned characteristics by following a differentapproach

1 Define a denotation fully abstract wrt the small-step behavior of evaluation of expres-sions which enjoys the mentioned properties

2 Obtain by abstraction of this small-step semantics a denotation (which enjoys the men-tioned properties) correct wrt the big-step behavior

This approach has the additional advantage that the small-step semantics can be reused alsoto develop other semantics more concrete than the big-step one (for instance semantics whichcan model functional dependencies that are suitable to develop pre-post verification methods)

Unfortunately in the case of the TRS formalism we do not have a suitable small-step se-mantics to start with For Curry we defined the small-step semantics by collecting just themost general traces of the small-step operational semantics which correspond (in our case) tothe rewriting derivations of the terms f(x1 xn) The problem is that we cannot obtainjust from the traces of all f(x1 xn) the rewriting derivations of all (nested) terms withoutusing again (directly or indirectly) the rewriting mechanism In fact usually f(x1 xn) isimmediately a normal form because we cannot instantiate variables however there are manyinstances which can trigger the rules Narrowing [7] can seem a possible solution to this prob-lem but we have an issue related to the interference of non-confluence (ie non-determinism)with non-linearity as shown by this example

Example 11Let us consider the following TRS R

coin rarr Tail Head ne Tail rarr True diff (x)rarr x ne xcoin rarrHead Tail ne Head rarr True

We have rewriting derivations diff (x) ETHrarr x ne x ↛ diff (Head) ETHrarr Head ne Head ↛ diff (Tail) ETHrarrTail ne Tail ↛ while diff (coin)ETHrarrlowast True Moreover we have the narrowing derivation diff (x) ε

x ne x 32

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

Narrowing can instantiate variables (according to rules) but a variable is instantiated with thesame term in all of its occurrences (it would make little sense to do differently for a top-downresolution mechanism) However Example 11 shows that it is not possible to retrieve thatdiff (coin) ETHrarrlowast True from all possible narrowing derivations of diff (x) since the only narrowingderivation (of diff (x)) does not reach True

In this paper we define a variation of narrowing (linearizing narrowing) which admits dif-ferent instances of variables with multiple occurrences With linearizing narrowing we definea denotation fully abstract wrt the small-step behavior of rewriting which enjoys the men-tioned properties for generic TRSs without restrictions The outline to achieve this is thefollowing

bull We gather all linearizing narrowing derivations into trees (Definition 310)bull We show that all possible rewritings can be reconstructed from linearizing narrowing trees(Theorem 314)

bull We define top-down condensed denotations OJRK by collecting just the linearizing nar-rowing trees of most general terms (f(ETHrarrxn)) and we prove that with a suitable semanticevaluation function E we can reconstruct any linearizing narrowing tree starting from

OJRK (Theorem 323)bull By using E we define a (bottom-up) immediate consequence operator whose least fixpointF JRK is equal to OJRK (Theorem 330) Thus from F JRK we can reconstruct all possiblerewritings of R and we have full abstraction wrt the rewriting behavior (Corollary 331)

Note that the proofs of all results are in the appendix

2 Preliminaries

We assume that the reader is familiar with the basic notions of term rewriting For a thoroughdiscussion of these topics see [10] In the paper we use the following notions and notations

We writeETHrarron for the list of syntactic objects o1 on Given a monotonic function F ∶ Lrarr Lover lattice L whose bottom is and lub is ⊔ by F uarrk we denote function λxF k(x) and byF uarrω function λx⊔F k(x)∣k isin N By lfp(F ) we denote the least fixed point of F (and recallthat for a continuos F lfp(F ) = F uarrω)Terms and Substitutions

Σ denotes a signature and V denotes a (fixed) countably infinite set of variables T (ΣV)denotes the terms built over signature Σ and variables V Σ is partitioned in D the definedsymbols (also called operations) and C the constructor symbols (also called data constructors)

T (CV) are called constructor terms The set of variables occurring in a term t is denoted byvar(t) while the sequence (in order) of variables occurring in a term t is denoted by ETHrarrvar(t) Aterm is linear if it does not contain multiple occurrences of any variable LT (ΣV) denotes theset of linear terms

t∣p denotes the subterm of t at position p and t[s]p denotes the result of replacing thesubterm t∣p by the term s

Given a substitution ϑ = x1t1 xntn we denote by dom(σ) and range(σ) the domainset x1 xn and the range set ⋃n

i=1 var(ti) respectively The identity substitution is denotedby ε By tσ we denote the application of σ to t σV denotes the restriction of substitution σto set V sube V σϑ denotes the composition of ϑ and σ ie the substitution st x(σϑ) = (xσ)ϑfor any x isin V Given two substitutions ϑ1 and ϑ2 and two terms t1 and t2 we say that ϑ1

33

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

(respectively t1) is more general than ϑ2 (respectively t2) denoted ϑ1 ⪯ ϑ2 (respectively t1 ⪯ t2)if and only if there exists a substitution σ st ϑ1σ = ϑ2 (respectively t1σ = t2) We denote by≃ the induced equivalence ie ϑ ≃ σ if and only if there exists a renaming ρ st ϑρ = σ (andσρminus1 = ϑ) With σ uarr σprime we indicate the lub (wrt ⪯) of σ and σprime

A substitution ϑ is an unifier for terms t and s if tϑ = sϑ t and s unifyare unifiable whenthere exists a unifier A unifier σ for t and s is a most general unifier denoted as σ =mgu(t s)when σ ⪯ ϑ for any unifier ϑ of t and s

Rewriting

A term rewriting system (TRS for short) R is a set of rules l rarr r where l r isin T (ΣV) var(r) subevar(l) l = f(t1 tn) and f isin D t1 tn are the argument patterns of l rarr r and neednot necessarily be in T (CV) unlike in functional programming where only constructor-basedTRSs are considered (ie with ti isin T (CV)) We denote by RΣ the set of all TRSs defined onsignature Σ

Given TRS R a rewrite step tpETHrarrR

tprime is defined if there are a position p in t l rarr r isin R and

a substitution η with dom(η) sube var(l) such that t∣p = lη and tprime = t[rη]p As usual we omit towrite position p when it is not relevant and omit R when is clear from the context Moreoverwe use ETHrarrlowast to denote the transitive and reflexive closure of the rewriting relation ETHrarr

A term t is called a normal form denoted by t↛ if there is no term s such that tETHrarrlowast sA substitution x1t1 xntn is R-normalized (wrt a TRS R) if all ti are normal forms

(which trivially includes the case when ti isin T (CV))Full Narrowing

In the paper with s≪X we denote a renamed apart variant s of an element belonging to a setof syntactic objects X ie a renaming of variable names of some x isin X that does not containvariables that appear in the context of the definition where s ≪ X is used (this is also calledldquousing fresh variables names in srdquo)

The combination of variable instantiation and rewriting is called narrowing [7] Formally a

(full) narrowing step tσp

Rtprime is defined if there is a position p in t l rarr r ≪R and σ =mgu(t∣p l)

such that t∣p notin V and tprime = (t[r]p)σ In such a case we have that tσpETHrarrR

tprime Again we omit to

write position p when it is not relevant and omit R when is clear from the contextt denotes that there is no term s such that t s

3 Modeling the small-step rewriting behavior

In this section we introduce the concrete semantics which is suitable to model the small-steprewriting behavior In order to formally state such relationship we first need to formally definethe concept of small-step rewriting behavior

Definition 31 (Rewriting behavior) Given t0 isin T (ΣV) and R isin RΣ the small-step rewrit-ing behavior of t0 in R is

BssJt0 in RK ∶= t0 ETHrarrR

t1 ETHrarrR⋯ETHrarrR

tnminus1 ETHrarrR

tn∣forallti isin T (ΣV) (31)

and the small-step rewriting behavior of R is BssJRK ∶= ⋃tisinT (ΣV)BssJt in RK

34

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

This notion of observable behavior induces the definition of TRS equivalence

forallR1 R2 isin RΣR1 asympss R2 ∶lArrrArr BssJR1 K = BssJR2 K (32)

Thanks to the following property we can restrain the check of Bss equivalence of two TRSs tolinear terms Moreover in the sequel we will also restrict our attention only to denotations forlinear terms

Proposition 32 Let R1 R2 isin RΣ Then R1 asympss R2 lArrrArr R1 is a variant of R2 lArrrArr forallt isinLT (ΣV) BssJt in R1 K = BssJt in R2 K

31 The semantic domain

We now define a notion of ldquohypothetical rewritingrdquo which resembles full narrowing [7] butit ldquodecouplesrdquo multiple occurrences of variables This way we maintain the potentiality tochoose different evolutions of the rewritings of redexes once variables are instantiated with nonconstructor terms

The semantic domain of our semantics will be made of trees with all possible derivations ofthis variation of narrowing

311 Linearizing Narrowing

Definition 33 (Term Linearization) Let t isin T (ΣV) r isin LT (ΣV) and σ∶ V rarr V We saythat (r σ) is a linearization of t denoted (r σ) = lin(t) if rσ = t and var(t) sube var(r) Thesubstitution σ will be called delinearizator

If a term is linear then lin(t) = (t ε) while for non-linear terms we can have different possibilities(for instance lin(f(xx)) = (f(x y)yx) = (f(z x)zx) = ) However the followingconstructions which involve linearization are actually independent upon the particular choiceof linearization in the sense that all possible different results are variants (analogously to whathappens for the choice of different mgursquos)

It may be useful to note that a delinearizer σ has one binding for each (further) multipleoccurrence of a variable

Definition 34 (Linearizing Narrowing Derivation) Let t s isin LT (ΣV) and R isin RΣ There

exists a linearizing narrowing step tθp

OcircrArrσR

s if there exist a position p of t l rarr r ≪ R

θprime =mgu(t∣p l) and σ∶ V rarr V such that

t∣p notin V (s σ) = lin(t[rθprime]p) θ = θprimevar(t)We omit to write position p when it is not relevant and omit R when is clear from the context

A sequence t0θ1

OcircrArrσ1

t1 θn

OcircrArrσn

tn is called linearizing narrowing derivation With t0θ

OcircrArrσ

lowast tn we

denote the existence of a linearizing narrowing derivation such that θ = θ1⋯θn and σ = σ1⋯σnNote that in linearizing narrowing derivations we do not apply mgu θ to all reduct (t[r]p)θ asnarrowing does This would not make any difference since terms are kept linear by constructionand thus θ cannot alter the context outside positions being reduced

Linearizing narrowing is correct wrt rewriting (as narrowing is) as proven by the followingtheorem which is the analogous of Theorem 38 of [8] (Theorem 1 of [7]) where we use linearizing

35

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

narrowing instead of narrowing Actually linearizing narrowing is more general than narrowingin the sense that when we have a narrowing derivation then we will surely have a linearizingnarrowing derivation which possibly compute more general instances (in case there are non-linear terms)

Theorem 35 Let R isin RΣ s0 isin LT (ΣV) t0 isin T (ΣV) η0 an R-normalized substitution suchthat t0 = s0η0 and V sub V such that var(s0) cup dom(η0) sube V If t0 ETHrarrlowast tn then there exist a termsn isin LT (ΣV) and substitutions ηn θ σ such that

s0θ

OcircrArrσ

lowast sn tn = snσηn (θηn)V = η0V ηn is R-normalized

where s0θ

OcircrArrσ

lowast sn and t0 ETHrarrlowast tn employ the same rewrite rules at the same positions

Note that while it is always possible to transform rewrite derivations into linearizing narrowingderivations (in the sense of Theorem 35) the opposite does not hold in general as we will showin Example 37 As anticipated we gather all linearizing narrowing derivations (of the sameterm t) into a tree

Definition 36 (Linearizing Narrowing Trees) Let t isin LT (ΣV) A linearizing narrowingtree T for t is a (not necessarily finite) labelled tree which is rooted in t and where

1 paths are linearizing narrowing derivations2 sibling subtrees have the same root terms if and only if their incoming arcs have different

substitutions

We denote with LNTΣ (or simply LNT when clear from the context) the set of all thelinearizing narrowing trees (over Σ) Moreover for any t isin LT (ΣV) we denote with LNTt theset of all linearizing narrowing trees for t

Point 2 ensures that all sibling steps in a linearizing tree are pairwise distinct and thus that wecannot have two different paths of the tree with the same terms and labels

Example 37Consider TRS R of Example 11 The linearizing narrowing tree starting from term diff (x) is

diff (x) x ne x1True

xHead x1Tailε

TruexTa

il x1Head

εε

x1x

This linearizing narrowing derivation diff (x) xHeadx1Tail

OcircOcircOcircOcircOcircOcircrArrx1x

lowast True can be read as if there is a

term t that can rewrite both to Head and Tail then diff (t) rewrites to True Indeed diff (coin)does rewrite to True (a possible rewriting derivation is diff (coin) ETHrarr coin ne coin ETHrarr Head necoin ETHrarr Head ne Tail ETHrarr True)

In this case is not possible to transform these linearizing narrowing derivations into rewritederivations (since diff (x)ETHrarr x ne x↛ as well as diff (t)ETHrarr t ne t↛ for all t isin T (CV))

This example also shows that linearizing narrowing can have longer derivations wrt (stan-dard) narrowing since diff (x) ε

x ne x

36

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

Definition 38 (Variance on LNT) Let t isin LT (ΣV) and T1 T2 isin LNTt We say that T1 andT2 are local variants if there exists a renaming ρ such that T1ρ = T2Two linearizing narrowing trees are local variants if and only if they have the same root t andtheir steps are equal up to renaming of variables which do not occur in t

Note Since the actual choices of local variable names is completely irrelevant from now onwith an abuse of notation by LNT we will actually indicate its quotient wrt localvariance Moreover all linearizing narrowing trees presented in the sequel will actuallybe an arbitrary representative of an equivalence class

Definition 39 (Order on LNT) Let denote with paths(T ) the set of all the paths of T start-ing from the root

Given T1 T2 isin LNT we define T1 ⊑ T2 if and only if paths(T1) sube paths(T2)Given a set T sube LNTt the least upper bound ⊔T is the tree whose paths are ⋃T isinT paths(T )

Dually for the greatest lower bound ⊓It is worth noticing that for any t isin LT (ΣV) LNTt is a complete lattice

By Point 2 of Definition 36 paths is injective thus it establishes an order preserving iso-

morphism (LNTt ⊑) minusminusminusminusminusminusminusminusminusrarrETHrarrlarrlarrETHminusminusminusminusminusminusminusminusminuspaths

prfxtree (paths(LNTt) sube) where the adjoint of paths prfxtree builds

a tree from a set of paths (by merging all common prefixes) So we have two isomorphic rep-resentations of linearizing narrowing trees and in the sequel we can simply write d isin T ford isin paths(T ) The set representation is very convenient for technical definitions while forexamples the tree representation is better suited

Definition 310 (Linearizing Narrowing Tree of a term) Let t isin LT (ΣV) and R isin RΣA linearizing narrowing tree NJt in RK for term t in TRS R is

NJt in RK ∶= d isin LNTt∣d uses rules from RIntuitively NJt in RK denotes the linearizing narrowing behavior of linear term t in TRS Rmodulo local variance (ie local variables are up to renaming)

Example 311Given the following TRS R

m(H (x))rarr d(xK(x)) d(C (x)K (E(y)))rarr f(xx y y)f (A x y F)rarr B(y y) f (E(x) y AA)rarrK(E(y))

The linearizing narrowing tree NJm(x) in RK is

m(x) d(x1K(x2)) f(x3 x4 y y1)B(y y2)

x3Ay1Fy2y

K(E(x4))x3E(x5)

yAy1A

ε

x1C(x3)x2E(y)

x4x3 y1y

xH(x1)

x2x1

Linearizing narrowing trees ldquocapturerdquo the behavioral TRS equivalence asympss since the TRSequivalence induced by N coincides with asympss

Theorem 312 Let R1 R2 isin RΣ Then R1 asympss R2 if and only if for every t isin LT (ΣV)NJt in R1 K =NJt in R2 K

37

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

Even more from linearizing narrowing trees we can completely reconstruct the small-steprewriting behavior To formally prove this we need to introduce the following operation to buildrewriting derivations from linearizing narrowing derivations

Definition 313 Let R isin RΣ and d = s0 θ1OcircrArrσ1

s1θ2OcircrArrσ2

θnOcircrArrσn

sn be a linearizing narrowing deriva-

tion The linear narrowing to rewriting operator is defined as

lfloordrfloor ∶= t0 ETHrarr t1 ETHrarr tk ∣ ξ is an R-normalized substitution 0 le k le nη = θ1 uarr σ1 uarr uarr θk uarr σk forall0 le i le k ti = siηξ (33)

We abuse notation and lift lfloorsdotrfloor also to sets as lfloorSrfloor ∶= ⋃disinSlfloordrfloorIntuitively this operation takes a prefix d of a linear narrowing derivation and if it can simulta-neously satisfy all its computed answers and delinearizators with substitution η then it buildsa rewriting sequence by applying ηξ to all terms of d for any R-normalized substitution ξ

Theorem 314 Let R isin RΣ and t isin LT (ΣV) Then BssJt in RK = lfloorNJt in RKrfloorHence NJt inRK is indeed a condensed representation of BssJt inRK Now the next step for theconstruction of a semantics with the desired characteristics is to achieve compositionality Todo so we should look for a denotation for most general terms f (ETHrarrxn) (of a TRS R) which couldbe used to retrieve with suitable semantic operations NJt in RK for any t isin LT (ΣV)32 Operational denotations of TRSs

The operational denotation of a TRS can be defined as an interpretation giving meaning to thedefined symbols over linearizing narrowing trees ldquomodulo variancerdquo Essentially we define thesemantics of each function in D over formal parameters (whose names are actually irrelevant)

Definition 315 (Interpretations) Let MGTD ∶= f (ETHrarrxn) ∣ fn isin D ETHrarrxn are distinct variablesTwo functions I J ∶MGTD rarr LNTΣ are (global) variants denoted by I cong J if for each

π isinMGTD there exists a renaming ρ such that (I(π))ρ = J(πρ)An interpretation is a function I ∶MGTD rarr LNTΣ modulo variance2 such that for every

π isinMGTD I(π) is a linearizing narrowing tree for πThe semantic domain IΣ (or simply I when clear from the context) is the set of all inter-

pretations ordered by the pointwise extension of ⊑The partial order on I formalizes the evolution of the computation process (I ⊑) is a completelattice and its least upper bound and greatest lower bound are the pointwise extension of ⊔and ⊓ respectively In the sequel we abuse the notations for LNT for I as well The bottomelement of I is I ∶= λππ (for each π isin MGTD) In the sequel we abuse the notations forLNT for I as well

It is important to note that MGTD (modulo variance) has the same cardinality of D (andis then finite) and thus each interpretation is a finite collection (of possibly infinite elements)Hence we will often explicitly write interpretations by cases like

I ∶=⎧⎪⎪⎪⎪⎨⎪⎪⎪⎪⎩

π1 ↦ T1

πn ↦ Tn

for

I(π1) ∶= T1⋮

I(πn) ∶= Tn2ie a family of elements of LNTΣ indexed by MGTD modulo variance

38

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

In the following any I isin I is implicitly considered as an arbitrary function MGT rarr LNT

obtained by choosing an arbitrary representative of the elements of I in the equivalence classgenerated by cong Actually in the sequel all the operators that we use on I are also independentof the choice of the representative Therefore we can define any operator on I in terms of itscounterpart defined on functions MGT rarr LNT

Moreover we also implicitly assume that the application of an interpretation I to a specificπ isin MGT denoted by I(π) is the application I(π) of any representative I of I which is

defined exactly on π For example if I = (λf (x y) f(x y) xc(z)

OcircOcircOcircrArrε

c(y z))congthen I(f(u v)) =

f(u v) uc(z)

OcircOcircOcircrArrε

c(v z)While defined symbols have to be interpreted according to TRS rules constructor symbols

are meant to be interpreted as themselves In order to treat them as a generic case of functionapplication we assume that any interpretation I is also implicitly extended on constructors asI(c(ETHrarrxn)) ∶= c(ETHrarrxn) In the sequel we will use ϕ when we refer to a generic (either constructoror defined) symbol whence f for defined symbols and c for constructor ones

Definition 316 (Operational denotation of TRSs) Let R isin RΣ Then the operationaldenotation of R is

OJRK ∶= (λf (ETHrarrxn) NJf(ETHrarrxn) in RK)cong

(34)

Intuitively O collects the linearizing narrowing tree of each f (ETHrarrxn) in R abstracting from theparticular choice of the variable names ETHrarrxn

Example 317The operational denotation of TRS R of Example 11 is

OJRK =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

coin ↦ coin

Tail

Head

εεεε

x ne y ↦ x ne yTrue

True

xTail yH

ead

εxHead yTailε

diff (x)↦ diff (x) x ne x1True

True

ε

x1x

xHead x1T

ail

εxTail x

1Headε

The (small-step) rewriting behavior of any term t can be ldquoreconstructedrdquo from OJRK bymeans of the following evaluation function E 321 Evaluation Function

When we have the interpretation with the linearizing narrowing tree of f (ETHrarrxn) we can easily

reconstruct the rewriting behavior of any f (ETHrarrtn) for (renamed apart)

ETHrarrtn isin LT (CV) by sim-

ply replacing the most general bindings along a derivation with constructor terms ti (clearly

39

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

pruning branches with inconsistent instances) However with non-constructor nested termsthings gets more involved In practice we have an interleaving of parts of all sub-derivationscorresponding to the evaluation of arguments leaded by the derivation of f (ETHrarrxn) Intuitively thebasic building block of our proposal is the definition of a semantics embedding operation thatmimics parameter passing Namely taken two linearizing narrowing trees T1 T2 and a variablex of (the root of) T1 the tree-embedding operation T1[xT2] transforms T1 by modifying itssteps accordingly to steps of T2 which provides specific actual parameter values to x in placeswhere x in T1 was originally ldquofreelyrdquo instantiated

In order to define T1[xT2] we need to introduce an auxiliary (technical) relation whichworks on single derivations Note that in the sequel to shorten definitions when we adornlinearizing narrowing derivations or trees with a term s like ds or Ts we mean that the headof ds or the root of Ts is term s

Definition 318 Let π isin LT (ΣV) dg be a linearizing narrowing derivation with head g andTb isin LNTb Then dgπTb ⊢ d is the least relation that satisfies the rules

dtπTs ⊢ tmicromicro = larrETHETHmgu(s π) (35a)

dtπTsprime ⊢ d

dtπTs ⊢ tmicroθq

OcircrArrσ

dmicro = larrETHETHmgu(s π) s

θp

OcircrArrσ

Tsprime isin Ts existq s∣p = tmicro∣q (35b)

dt0 π0Ts0 ⊢ dt1 dtn πnTsn ⊢ dtn+1

(t θp

OcircrArrσ

dt0)πTs0 ⊢ tmicro θprimep

OcircrArrσprimeprime

dtn+1

micro = larrETHETHmgu(s0 π)θprime = larrETHETHmgu(tmicro tθ)var(tmicro) x1y1 xnyn = proj (var(πθ) σ)Ts1 Tsn ≪ Ts0

π0 = πθ foralli isin 1 n πi = π0yixiforallj isin 0 n ETHrarrvj =ETHrarrvar(sj)

σprimeprime = (σ cup

n

⋃i=1

ETHrarrvi ETHrarrv0)var(tn+1)

(35c)

where

bull proj (Vσ) = xy isin σ ∣ y isin V bulllarrETHETHmgu(t s) is an mgu θ of t and s such that forallx isin var(t) xθ isin V

Broadly speaking the role of π in a statement dtπTs ⊢ d is that of the ldquoparameter patternrdquoresponsible to constrain ldquofreelyrdquo instantiated formal parameters in dt to the actual parametersvalues which are actually ldquocomingrdquo from Ts More specifically Rules 35 govern the inlaying ofthe steps of a linearizing narrowing tree Ts into a derivation dt In particular

bull The axiom 35a stops any further possible inlayingbull The rule 35b considers the case when we want to proceed with an inner linearizingnarrowing step employing a step coming from Ts In this case t plays the role of contextand the inner step is done accordingly to the one chosen from Ts Note that is it possibleto do the step only if exists q such that s∣p = tmicro∣q Namely the defined symbol over whichthe step is done needs to be ldquovisiblerdquo in tmicro

bull The rule 35c considers the case when we want to do an outermost step First the stephas to be compatible with the way we instantiated t so far namely exists mgu(tmicro tθ)Then we choose from σ only the delinearizers that depend on the variable from whichwe started the embedding Each of these delinearizer comes from the linearization of amultiple occurrence of a same variable z Thus for each rename zprime of z we sequentiallyembed into zprime a (possibly different) sub-derivation coming from a renamed apart variant of

40

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

Ts Note that if we would not have multiple occurrences of z (ie proj (var(πθ) σ) = empty)the rule would simply be

dt0 π0Ts0 ⊢ dt1(t θpOcircrArr

σ

dt0)πTs0 ⊢ tmicro θprimepOcircrArrσ

dt1

micro = larrETHETHmgu(s0 π) θprime = larrETHETHmgu(tmicro tθ)var(tmicro)

π0 = πθ

Note that in Rules 35 we use a selected form of mgu (ie larrETHETHmgu which does not rename variablesin the left argument) in order to avoid to change variable names along the way

Example 319Consider OJRK of Example 317 Let Tcoin ∶= OJRK(coin) and d0 ∶= diff (x) ε

OcircOcircrArrx1x

d1 isinOJRK(diff (x)) where d1 = x ne x1 xHeadx1Tail

OcircOcircOcircOcircOcircOcircOcircrArrε

True

Let us build a proof tree to find a derivation d such that d0xTcoin ⊢ d We have to startwith an application of rule (35c) which (in this case) has two premises since the delinearizatorx1x in the first step of d0 has one binding The first subtree which embeds the Head branchof Tcoin into x is

(35a)TrueHead Head ⊢ True

(35c)d1xHead ⊢ Head ne x1 x1Tail

OcircOcircOcircrArrε

True(35b)

d1xTcoin ⊢ coin ne x1 ε

OcircrArrε

Head ne x1 x1Tail

OcircOcircOcircrArrε

True

acutesup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1cedilsup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1parad3

(PT)

Now we can build the full proof tree (by building the second subtree which starting from d3can finish to embed the Tail branch of Tcoin into x1)

(PT)

(35a)TrueTail Tail ⊢ True

(35c)d2 x1Tail ⊢ Head ne Tail ε

OcircrArrε

True(35b)

d2 x1Tcoin ⊢ Head ne coin ε

OcircrArrε

Head ne Tail ε

OcircrArrε

True(35c)

d3 x1Tcoin ⊢ coin ne coin ε

OcircrArrε

Head ne coin ε

OcircrArrε

Head ne Tail ε

OcircrArrε

True(35c)

d xTcoin ⊢ diff (coin) ε

OcircrArrε

coin ne coin ε

OcircrArrε

Head ne coin ε

OcircrArrε

Head ne Tail ε

OcircrArrε

True

We have analogous proof tree for d xTcoin ⊢ diff (coin) ε

OcircrArrε

coin ne coin ε

OcircrArrε

Tail ne coin ε

OcircrArrε

Tail neHead

ε

OcircrArrε

True In total we have ten possible proof trees four of whom that have derivations

which reach True

Tree-embedding is simply defined by collecting all contributes of dxT ⊢ dprime

Definition 320 (Tree-embedding) Let Tg isin LNTg and Tb isin LNTg such that

1 Tg and Tb do not share any local variable2 x is a variable which does not occur in Tb

Then the tree-embedding operation Tg[xTb] is defined as Tg[xTb] ∶= d∣dg isin Tg dgxTb ⊢ d41

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

The evaluation function is obtained by repeated application of tree-embedding

Definition 321 (Evaluation Function) Let t isin LT (ΣV) and I isin I The evaluation of twrt I denoted E JtKI is defined by induction on the structure of t as follows

E JxKI ∶= x (36a)

E Jϕ(ETHrarrtn)KI ∶= I(ϕ(ETHrarrxn))[x1 E Jt1KI ] [xn E JtnKI ] ETHrarrxn renamed apart distinct (36b)

Example 322Consider OJRK of Example 317 The evaluation of E Jdiff (coin)KOJRK is

E Jdiff (coin)KOJRK = [ by Equation (36b) with n = 1 ]OJRK(diff (x))[x E JcoinKOJRK] = [ by Equation (36b) with n = 0 ]OJRK(diff (x))[xOJRK(coin)]

Then by completing what shown in Example 319 we have that E Jdiff (coin)KOJRK is

diff (coin)

diff (Head)Head ne Head

εεε

ε

coin ne coin

Head ne coinHead ne Head

εε

Head ne Tail Trueεεε

ε

εε

Tail ne coinTail ne Head True

εε

εε

Tail ne Tailεε

εε

coin ne HeadHead ne Head

εε

Tail ne Head Trueεεε

ε

εε

coin ne TailHead ne Tail True

εε

εε

Tail ne Tailεε

εε

εε

diff (Tail)Tail ne Tail

εε

εε

322 Properties of the TRS operational denotation

The following result states formally that from OJRK the evaluation function E can reconstructthe linearizing narrowing tree of any linear term

Theorem 323 For all R isin RΣ and t isin LT (ΣV) E JtKOJRK =NJt in RK

A straightforward consequence of Theorems 323 and 312 is

Corollary 324 For all R1 R2 isin RΣ OJR1 K = OJR2 K if and only if R1 asympss R2

Thus semantics O is fully abstract wrt asympss

33 Fixpoint denotations of TRSs

We will now define a bottom-up goal-independent denotation which is equivalent to O and thus(by Corollary 324) adequate to characterize the small-step behavior for TRSs It is definedas the fixpoint of an abstract immediate operator over interpretations P JRK This operatoris essentially given in terms of evaluation E of right hand sides of rules Namely given aninterpretation I it essentially consists in

42

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

bull building an initial linearizing narrowing step for a most general term according to rulesrsquoleft hand side

bull applying the evaluation operator E to the right hand side of the rule over I Definition 325 Let R isin RΣ P JRK∶ I rarr I is defined for all f isin D (of arity n) as

P JRKI (f(ETHrarrxn)) ∶=⊔f(ETHrarrxn) θ

OcircrArrσ

E JrprimeKI ∣ f(ETHrarrxn)θ rarr r ≪R

(rprime σ) = lin(r) (37)

Moreover we define our fixpoint semantics as F JRK ∶= lfp P JRK

F JRK is well defined since P JRK is continuous

Proposition 326 Let R isin RΣ Then P JRK is continuous

Example 327Let us consider the (artificial) TRS R ∶= g rarr f(h(a)) h(a) rarr h(b) f (h(b)) rarr a taken from[1] which is neither constructor-based nor confluent The evaluation of the right hand sidesof all rules is E Jf(h(a))KI = I(f(x))[x E Jh(a)KI ] = f(x)[xh(a)] = f(h(a)) E Jh(b)KI =h(x)[xb] = h(b) and E JaKI = a Hence

I1∶= P JRKuarr1 =

⎧⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎩

g ↦ g f(h(a))εε

h(x)↦ h(x) h(b)xa

ε

f(x)↦ f(x) axh(b)

ε

In the next iteration we have to evaluate E Jf(h(a))KI1= I

1(f(x))[x E Jh(a)KI

1] Since E Jh(a)KI

1=

I1(h(x))[x E JaKI

1] = h(a) ε

OcircrArrε

h(b) we have

P JRKuarr2 =⎧⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎩

g ↦ g f(h(a)) f(h(b)) aεε

εε

εε

h(x)↦ h(x) h(b)xa

ε

f(x)↦ f(x) axh(b)

ε

Now since P JRKuarr3 = P JRKuarr2 this is also the fixpoint F JRK

Example 328Consider TRS R of Example 11 The iterates of P JRK are

P JRKuarr1 =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

coin ↦ coin

Tail

Head

εεεε

x ne y ↦ x ne yTrue

True

xTail yH

ead

εxHead yTailε

diff (x)↦ diff (x) x ne x1ε

x1x

43

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

P JRKuarr2 =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

coin ↦ coin

Tail

Head

εεεε

x ne y ↦ x ne yTrue

True

xTail yH

ead

εxHead yTailε

diff (x)↦ diff (x) x ne x1True

True

ε

x1x

xHead x1T

ail

εxTail x

1Headε

Now since P JRKuarr3 = P JRKuarr2 this is also the fixpoint F JRK

Example 329Let us consider the TRS R ∶= zeros rarr ∶(0 zeros) take(0 x) rarr nil take(s(n) ∶(y z))) rarr∶(y take(n z)) f (n)rarr take(n zeros) The first two iterates of P JRK are

P JRKuarr1 =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

zeros ↦ zeros ∶(0 zeros)εε

take(x1 y1)↦ take(x1 y1 )

nil

x10

ε ∶(y0 take(x0 z))

x1s(x

0)y1 ∶(y

0 z)ε

f(x0)↦ f(x0) take(x0 zeros)εε

P JRKuarr2 =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

zeros ↦ zeros ∶(0 zeros) ∶(0 ∶(0 zeros))εε

εε

take(x2 y2)↦ take(x2 y2 )

nil

x20

ε ∶(y1 take(x1 z1))∶(y1nil)

εε ∶(y1 ∶(y0 take(x0 z0)))

x1s(x

0)z1 ∶(y

0 z0)

ε

x2s(x

1)y2 ∶(y

1 z1)ε

f(x1)↦ f(x1)

take(x1 zeros)

nil

x10

ε

take(x1 ∶(0 zeros))

nil

x10

ε

∶(0 take(x0 zeros))x

1s(x0)

ε

εε

εε

Note that to highlight the construction order of the various subtrees we used indices in variablesnames that respect the order of introduction and boxed the subtrees which correspond to the

44

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

previous iterate By continuing the computation of the iterates we obtain

F JRK =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

zeros ↦ zeros ∶(0 zeros) ∶(0 ∶(0 zeros))εε

εε

take(x y)↦ take(x y)

nil

x0

ε ∶(yprime take(xprime z))∶(yprimenil)

εε ∶(yprime ∶(yprimeprime take(xprimeprime zprime)))

x primes(x primeprime)z ∶(y primeprime z prime)ε

xs(x prime)y ∶(y prime z)ε

f(x)↦ f(x)

take(x zeros)

nil

x0

ε

take(x ∶(0 zeros))nil

x0

ε

take(x ∶(0 ∶(0 zeros)))εε ∶(0 take(xprime zeros))

∶(0nil)xprime 0

ε

∶(0 take(xprimeprime ∶(0 zeros)))

x primes(x primeprime)

ε

xs(x prime)ε

εε

εε

We can observe that since terms in R are linear the linearizing narrowing trees have justε as delinearizers and actually they are isomorphic to full narrowing trees

331 Properties of the TRS fixpoint denotation

The top-down goal-dependent denotation O and the bottom-up goal-independent denotationF are actually equivalent

Theorem 330 (Equivalence of denotations) Let R isin RΣ Then OJRK = F JRK

A straightforward consequence of Theorem 330 and Corollary 324 is

Corollary 331 (Correctness and full abstraction of F ) Let R1 R2 isin RΣ Then F JR1 K =F JR2 K if and only if R1 asympss R2

4 Conclusions

We have presented a condensed compositional bottom-up semantics for the full class of termrewriting systems which is fully abstract wrt the small-step behavior of rewriting

We are going to use this semantics to define by abstraction a condensed bottom-up se-mantics for the full class of term rewriting systems which is fully abstract wrt the big-stepbehavior of rewriting and thus suitable for semantic-based program manipulation tools Actu-ally we have developed a first proposal of such a semantics (by following this approach) but

45

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

restricted to the class of left-linear TRSs We already used it to develop a semantics-basedautomatic specification synthesis prototype [6] which is giving promising results

However we believe that our notion of linearized narrowing which differently from nar-rowing represents faithfully the small-step behavior of rewriting (in a compact way) could beinteresting for other applications as well

References

[1] M Alpuente M Comini S Escobar M Falaschi and J Iborra A Compact Fixpoint Semanticsfor Term Rewriting Systems Theoretical Computer Science 411(37)3348ndash3371 2010

[2] M Alpuente M Comini S Escobar M Falaschi and S Lucas Abstract Diagnosis of FunctionalPrograms In M Leuschel editor Logic Based Program Synthesis and Transformation ndash 12th

International Workshop LOPSTR 2002 Revised Selected Papers volume 2664 of Lecture Notes

in Computer Science pages 1ndash16 Berlin 2003 Springer-Verlag

[3] G Bacci An Abstract Interpretation Framework for Semantics and Diagnosis of Lazy Functional-

Logic Languages PhD thesis Dipartimento di matematica e Informatica Universita di Udine2011

[4] G Bacci and M Comini A Fully-Abstract Condensed Goal-Independent Bottom-Up FixpointModeling of the Behaviour of First Order Curry Submitted for Publication 2012

[5] M Comini G Levi M C Meo and G Vitiello Abstract Diagnosis Journal of Logic Program-

ming 39(1-3)43ndash93 1999

[6] M Comini and L Torella TRSynth a Tool for Automatic Inference of Term Equivalence inLeft-linear Term Rewriting Systems In E Albert and S-C Mu editors PEPM rsquo13 Proceedings

of the ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation pages 67ndash70Acm 2013

[7] J-M Hullot Canonical Forms and Unification In Proceedings of the 5th International Conference

on Automated Deduction volume 87 of Lecture Notes in Computer Science pages 318ndash334 Berlin1980 Springer-Verlag

[8] A Middeldorp and E Hamoen Completeness results for basic narrowing Applicable Algebra in

Engineering Communication and Computing 5213ndash253 1994 101007BF01190830

[9] H R Nielson and F Nielson Infinitary Control Flow Analysis a Collecting Semantics for ClosureAnalysis In Symposium on Principles of Programming Languages pages 332ndash345 1997

[10] TeReSe editor Term Rewriting Systems Cambridge University Press Cambridge UK 2003

A Technical Proofs

Proof of Proposition 32

Point 1 Implication lArrOcirc is straightforward We prove OcircrArr by reduction to absurd Supposethat R1 asympss R2 and R1 is not a variant of R2 Then there is at least one rule which isdifferent in R1 wrt R2 (or vice versa) Thus by Equation (31) we can have rewritingsteps which employ that rule in BssJR1 K which cannot be in BssJR2 K which is absurd

Point 2 Similarly to previous point but restricting to initial linear terms

In the sequel we use the following results

46

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

Proposition A1 ([8]) Suppose we have substitutions θ ρ ρprime and sets A B of variables suchthat (B minus dom(θ)) cup range(θ) sube A If ρA = ρprimeA then (θρ)A = (θρprime)AProposition A2 ([8]) Let R be a TRS and suppose we have substitutions θ ρ ρprime and setsA B of variables such that the following conditions are satisfied

ρA R-normalized θρprimeA = ρA B sube (A minus dom(θ)) cup range(θA)Then ρprimeB is also R-normalized

Proof of Theorem 35 We prove the thesis by induction on the length of the rewriting derivationfrom t0 to tn The case of length zero is straightforward

Suppose t0 ETHrarr t1 ETHrarr ETHrarr tn is a rewriting derivation of length n gt 0 We may assumewithout loss of generality that var(l) cap V = empty We have (s0η0)∣p = s0∣pη0 = τ l for somesubstitution τ with dom(τ) sube var(l) Let micro ∶= τ cup η0 We have s0∣pmicro = s0∣pη0 = lτ = lmicro so s0∣pand l are unifiable Let θprime

1∶= mgu(s0∣p l) and θ1 ∶= θprime1var(s0∣p) Clearly dom(θ1) cup range(θ1) sube

var(s0∣p) cup var(l) Moreover there exists a substitution ψ such that

θ1ψ = micro (1)

Now let (s1 σ1) ∶= lin(s0[rθprime1]p) By Definition 34

s0θ1p

OcircOcircrArrσ1 lrarrr

s1 (2)

Let V1 ∶= (V minus dom(θ1)) cup range(θ1) cup dom(σ1) andη1 ∶= (σ1ψ)V1

(3)

Clearly dom(η1) sube V1 We have var(s1) = dom(σ1)cup var(s0[rθ1]p) sube dom(σ1)cup var(s0[lθ1]p) =dom(σ1) cup var(s0θ1) sube V1 Therefore var(s1) cup dom(θ1) sube V1 By (1) and (3) we have s1σ1η1 =s1σ1ψ = s0[rθ1]pψ = s0[r]pθ1ψ = s0[r]pmicro = s0micro[rmicro]p Since V cap dom(τ) = empty we have

microV = η0V (4)

Likewise microvar(r) = η0var(r) Hence s0micro[rmicro]p = s0η0[rτ]p = t0[rτ]p = t1 Thust1 = s1σ1η1 (5)

Next we have to verify that (θ1η1)V = η0V By (3) and by Proposition A1 we have that(θ1η1)V = (θ1σ1ψ)V By (1) and (4) (θ1η1)V = (θ1σ1ψ)V Since dom(σ1) notin V we havethat (θ1σ1ψ)V = (θ1ψ)V = microV = η0V Thus

(θ1η1)V = η0V (6)

Now we show that η1 is R-normalized Since dom(η1) sube V1 it suffices to show that η1V1isR-normalized Let B ∶= (V minusdom(θ1))cuprange(θ1V ) Proposition A2 yields the normalization

of η1B Recall that range(θ1) sube var(s0∣p) cup var(l) Let x isin range(θ1) since θ1 is idempotentclearly x notin dom(θ1) If x isin var(s0∣p) sube V then x isin V minus dom(θ1) sube B If x isin var(l) thenx isin var(lθ1) = var(s0∣pθ1) thus x isin range(θ1V ) sube B Thus range(θ1) sube B and then V1 =B cup dom(σ1) By this and (3) since η1B is R-normalized η1V1

is R-normalized as well

47

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

By inductive hypothesis we have a term sn and substitutions θprime σprime and ηn such that

s1θprimeOcircrArrσprime

lowast sn (7)

tn = snσprimeηn (8)

(θprimeηn)V1= η1V1

(9)

ηn is R-normalized (10)

Moreover s1θprimeOcircOcircrArr

σprimeR

lowast sn and t1 ETHrarrR

lowast tn apply the same rewrite rules at the same positions

Let θ ∶= θ1θprime and σ = σ1σprime By (2) and (7) we obtain s0θ

OcircrArrσ

lowast sn By construction this

narrowing derivation makes use of the same rewriting rules at the same positions as the rewritingderivation t0 ETHrarr

R

lowast tn It remains to show that (θηn)V = η0V By (9) and Proposition A1

(θ1θprimeηn)V = (θ1η1)V Therefore by (6) (θηn)V = (θ1η1)V = η0V Proof of Theorem 312 We prove OcircrArr by reduction to absurd Suppose that R1 asympss R2 andexistt isin LT (ΣV) NJt in R1 K neNJt in R2 K This means that there is at least one derivation whichbelongs to NJt in R1 K and not to NJt in R2 K (or vice versa) Hence there is at least a rulewhich is not in common to the two programs Thus R1 asympss R2 which is absurd

We prove lArrOcirc by reduction to absurd Suppose that forallt isin LT (ΣV) NJt inR1 K =NJt inR2 Kand R1 asympss R2 Then there is at least one rule which is different in R1 wrt R2 Thus byEquation (31) and Theorem 35 NJt in R1 K neNJt in R2 K which is absurd

Proof of Theorem 314 We prove the two inclusions separately Inclusion supe is immediate byDefinition 313

Inclusion sube is proved by reduction to absurd Assume that there exists a derivation t0 ETHrarrR

lowast tn

such that it does not belong to lfloorNJt0 inRKrfloor Then by Theorem 35 taken η0 = ε there exists arelaxed narrowing derivation of the form s0

θ1

OcircrArrσ1

θn

OcircrArrσn

sn Note that for each i isin 1n θi andσi are just renaming ηi = ε and ti = siσi σ0 Let η ∶= η0 = ε It is easy to see that there existsηprime such that ηprime = θ1 uarr σ1 uarr uarr θn uarr σn By Definition 313 there exists a rewriting derivationtprime0ETHrarrR

lowast tprimen where tprimei = siηprime for each i isin 1n Moreover dom(σk) isin var(si) for each k isin i+ 1nand θi = (σj)dom(θi) or θi = (σj)dom(θi) for some j Hence siη

prime = siσi σ0 Thus tprimei = ti foreach i isin 1n which is absurd

Lemma A3 Let R a TRS x isin V and t s isin T (ΣV) such that they do not share variables andx isin t x isin s Then NJt in RK[xNJs in RK] =NJtxs in RK

Proof It is sufficient to prove that given dt isin NJt in RK and Ts = NJs in RK if dtxTs ⊢ dthen d isin NJtxs in RK To this aim we will prove a stronger result let π isin T (CV) letTs = NJs in RK and for any dt isin NJt in RK such that dtπTs ⊢ d then d isin NJtη in RK whereη =larrETHETHmgu(s π) We proceed by structural induction on the proof tree

rule 35a) straightforward

rule 35b) By inductive hypothesis dtπTsprime ⊢ dtmicro lArrrArr dtmicro isinNJtmicro inRK If it exists dtmicro then

tmicro∣p = s∣p Moreover existmicroprime such that microprime = larrETHETHmgu(sprime π) and tmicroprime∣p = sprime∣p Thus tmicroθp

OcircrArrσ

dtmicro isinNJtmicro in RK

48

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

rule 35c) By inductive hypothesis we have that dt0 π0Ts0 ⊢ dt1 lArrrArr dt1 isin NJtmicro0 inRK dtn πnTsn ⊢ dtn+1 lArrrArr dtn+1 isin NJtmicron in RK where micro0 = larrETHETHmgu(s0 π0) micron =larrETHETHmgu(sn πn) We know that exists a linearizing narrowing step t

θp

OcircrArrσ

t0 where θ2 =mgu(t∣p l) θ = θ2var(t) (s σ) = lin(rθ2) tmicro = t[s]p We need to prove that it exists the

linearizing narrowing step tmicroθprimep

OcircrArrσprimeprime

tn+1 Since it exists mgu(t∣p l) and mgu(tmicro tθ) thenit exists θ3 such that θ3 = mgu((tmicro)∣p l) Now let θprime ∶= θ3var(tmicro) and (sprime σprime) = lin(rθ3)then tmicro[sprime]p = t Let us observe that t1 = t0micro0 t2 = t0micro0micro1 tn+1 = t0micro0 micron wheremicro0 =larrETHETHmgu(s0 π0) micron =larrETHETHmgu(sn πn) Let microlowast = micro0 micron then tn+1 = t0microlowast = tmicrolowast[smicrolowast]p =tmicro[smicrolowast]p = t

Proof of Theorem 323 We proceed by structural induction on term t

t = x Immediate by Equation (36a)

t = ϕ(ETHrarrtn)

E Jϕ(ETHrarrtn)KOJRK =[ by Equation (36b) ]

= OJRK(ϕ(ETHrarrxn))[x1 E Jt1KOJRK] [xn E JtnKOJRK] =[ by inductive hypothesis ]

=NJϕ(ETHrarrxn) in RK[x1NJt1 in RK] [xnNJtn in RK] =[ by Lemma A3 ]

=NJϕ(ETHrarrtn) in RK

Proof of Proposition 326 It is straightforward to prove that P JP K is monotone and finitarythus it is continuous

Proof of Theorem 330 We prove the two inclusions separately

⊑) Let indicate with Ok all derivations of OJRK with length le k by induction we prove thatforallk Ok ⊑ P JRKuarrk

k = 0) immediate

k gt 0) foralld isin Ok we have that d = f(x) θΛ

OcircrArrσ

dprime such that (by Theorem 323) dprimet isin E JtKOkminus1

Thus by monotonicity of E we have that dprimet isin E JtKP JRKuarrkminus1 By the definition of P d isin P JP KP JRKuarrkminus1 = P JRKuarrk

Thus by Proposition 326 OJRK = ⊔kge0Ok ⊑ ⊔kge0P JRKuarrk = F JRK

⊒) We need to prove that f(ETHrarrxn) θΛ

OcircrArrσ

E JrprimeKOJRK ⊑NJf(ETHrarrxn) inRK By Theorem 323 E JrprimeKOJRK

is a linearizing narrowing tree Since θ = mgu(f(ETHrarrxn l))ETHrarrxnand (σ rprime) = lin(r) we can

conclude that f(ETHrarrxn) θΛ

OcircrArrσ

E JrprimeKOJRK ⊑NJf(ETHrarrxn) in RK

49

Logical and Algebraic Views of a Knot Fold of a

Regular Heptagon

Fadoua Ghourabi1 Tetsuo Ida2 and Kazuko Takahashi1

1 Kwansei Gakuin University Japanghourabikwanseiacjp ktkakwanseiacjp

2 University of Tsukuba Japanidai-eosorg

Abstract

Making a knot on a rectangular origami or more generally on a tape of a finite lengthgives rise to a regular polygon We present an automated algebraic proof that makingtwo knots leads to a regular heptagon Knot fold is regarded as a double fold operationcoupled with Huzitarsquos fold operations We specify the construction by describing thegeometrical constraints on the fold lines to be used for the construction of a knot Thealgebraic interpretation of the logical formulas allows us to solve the problem of howto find the fold operations ie to find concrete fold lines The logical and algebraicframework incorporated in a system called Eos (e-origami system) is used to simulate theknot construction as well as to prove the correctness of the construction based on algebraicproof methods

1 Introduction

From the early history of mathematics the correspondence between geometry and algebra hasbeen recognized and has been the subject of constant study In some sense ancient geometrywas a mother of algebra In particular solving algebraic equations has been related to therealm of Euclidean geometry Early mathematicians notably Khawarizmi and Khayyam gavegeometrical meanings to the solutions of equations Khayyamrsquos insight was that solutions ofcertain cubic equations are points of intersections of conic sections [1] Seven centuries laterafter freeing algebra from geometrical thinking Wantzel proved that solving cubic solutionsis impossible by Euclidean tools ie compass and straightedge [2] Further tools have beeninvented and used to perform constructions that are impossible by Euclidean tools

Paper folding ie origami allows solving cubic equations and hence geometrical construc-tions such as trisection of an arbitrary angle or a regular heptagon are realizable Given anorigami paper what we can do by hand is to construct creases and points The creases areconstructed by folding the paper along the lines which we call fold lines The points are con-structed by the intersection of lines Huzita presented a set of fold operations (known also asHuzitarsquos axioms in literature) with which he showed how to obtain fold lines [3] Huzitarsquos foldoperations are simple to perform by hand but powerful enough to solve cubic equations [4]

The geometrical construction of a regular heptagon has a unique history in that it belongsto the famous classical impossible problems by Euclidean tools Using paper folding the con-struction was shown to be possible In this paper we show another method of constructing aregular heptagon based on an extension of Huzitarsquos fold operations by introducing knottingThe constructions of regular n-gons (in particular of regular pentagon and heptagon) by makingknots have not been rigorously specified and the observation that their constructions purportto problems of solving geometrical constraints is missing

50

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

We investigate the geometrical constraints of the knot fold towards constructions of regu-lar polygons and proofs of the correctness of these constructions The knot fold operation isspecified by an existentially quantified formula of the first-order predicate logic The formulais then translated into a set of algebraic equalities and disequalities which then are solved byspecialized solvers based on Grobner basis theory andor CAD (Cylindrical Algebraic Decom-position) We have developed a computational origami system called Eos [5] using computeralgebra system Mathematica In brief it is an e-origami system which allows us to do virtualorigami It has capabilities of constructing and visualizing origami geometrical objects alge-braically analyzing origami folds and proving the correctness of origami constructions Eos

supports Huzitarsquos fold operations and has been extended to include multi-fold operations Weuse Eos to assist us with our mathematical study of the knot fold

The rest of the paper is organized as follows In Sect 2 we give the notations that we useIn Sect 3 we present Huzitarsquos fold operations and their extensions In Sect 4 we explain thegeometrical properties of the knot fold The construction of regular heptagon by Eos is shownin Sect 5 and its formal and algebraic proof is discussed in Sect 6 In Sect 7 we summarizeour results and point out a direction of further research

2 Notations

In this paper we restrict the use of geometrical objects to points segments and lines Pointsare denoted by a single capital letter of the Latin alphabet eg A B C D X Y etc Linesare denoted by m n t u and v Let X and Y be two points then XY denotes the line passingthrough points X and Y For brevity we often write XY to refer to the line passing through Xand Y We use the same notation to denote the segment between points X and Y Althoughthe meaning of the notation XY should be clear from the context we precede the notation XYwith either the word ldquosegmentrdquo or the word ldquolinerdquo to emphasize which objects we are working

with We also useminusminusrarrXY to denote a vector from point X to point Y The distance between two

points X and Y is denoted by |XY |Since we use Cartesian coordinate system in this paper a line is represented by a linear

equation ax+ by+ c = 0 in variables x and y The sets of all points and lines are denoted by Πand L respectively Abusing the set notation we use X isin m to mean that point X is incidentto line m and X1 Xp sub m to mean that all the points X1 Xp are incident to m

When an origami is folded along a line m some of the points are moved to superpose withtheir reflections across m We denote by Xm the reflection of point X across line m

A simple knot is denoted by K Ki denotes the ith knot The notation K = 〈mn t〉 meansthat the knot K is defined by 3 fold lines (to be explained in Sect 4)m n and t and furthermoreK is obtained by folding along the lines following the order of their appearance in 〈mn t〉

3 Origami Geometrical Construction

31 Huzitarsquos Fold Operations

By O we denote an origami An origami O is supposed to represent a square sheet of paperwith four points on the corners and four edges that is subject to folding1 We call A B Cand D the points on the corner Some intersections of lines may not fit on the square paper

1We could take O to be any convex polygon that can be constructed from a square sheet of paper Howeverthis could be an unnecessary generalization in our study

51

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

As we want to work with these points we consider O to be a sufficiently large (bounded) 2Dplane so that all the points and lines of interest are on O Huzita observed that the degreeof freedom of paper fold by fold lines can be made finite by specifying how certain points andlines are superposed Then he gave the following operations (O1) sim (O6) which serve as basicoperations in the geometrical construction of origamis Operation (O7) was added later byJustin [6] We call collectively (O1) sim (O7) Huzitarsquos fold operations

(O1) Given two distinct points P and Q fold O along the unique line that passes through Pand Q

(O2) Given two distinct points P and Q fold O along the unique line to superpose P and Q

(O3) Given two distinct lines m and n fold O along a line to superpose m and n

(O4) Given a line m and a point P fold O along the unique line passing through P to superposem onto itself

(O5) Given a line m a point P not on m and a point Q fold O along a line passing throughQ to superpose P and m

(O6) Given two lines m and n a point P not on m and a point Q not on n where m and n aredistinct or P and Q are distinct fold O along a line to superpose P and m and Q and n

(O7) Given two linesm and n and a point P not onm fold O along the unique line to superposeP and m and n onto itself

We note that the above statements are slightly different from the original ones To formalizethe above statements with the view to rigorous geometrical construction we restate Huzitarsquosoperations by carefully adding and removing side conditions of degeneracy and incidence [7]In essence treating origamis with a program requires rigorous specification of these operations

Huzitarsquos fold operations determine fold lines by specifying superpositions of constructedpoints and lines In Eos these specifications are formulas in a language of many-sorted first-order predicate logic By the algebraic interpretation of the formulas we derive polynomialequalities The problem of finding fold line(s) is therefore reduced to solving constraints ex-pressed in multi-variate polynomials of degree 3 over the field of origami constructible numbers[8 5]

32 Extensions

The contribution of Huzitarsquos fold operations is powerful enough to perform relevant geometri-cal constructions by way of solving algebraic equations of degree up to 3 Examples of suchconstructions are trisecting an arbitrary angle constructing a regular heptagon etc Somestudies have explored possible extensions of Huzitarsquos fold operations in an attempt to increasethe power of paper folding ie to solve higher degree equations

Alperin and Lang proposed multi-fold method where the origami is folded along more thanone fold line simultaneously [9] The idea is to find fold lines that are mutually dependentThe multi-fold construction allows solving higher degree equations We presented a construc-tion method of angle trisection using 2-fold operation [5] and angle quintisection using 4-foldoperation [10] Although the p-fold method generates an arbitrarily high degree polynomialaccurately folding an origami by p lines simultaneously would be difficult to do by hand evenfor p = 2

52

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

Folding polygonal knots has been traditionally used in Japan For example folding a broadsash for a kimono by a pentagon is a common practice of daily life However it is unknownwhen the knot fold was first mathematically studied The earliest contributions of which weare aware are those of Cundy and Rollett [11] Brunton [12] and Sakaguchi [13] Cundy andRollett showed models of knots that make some regular polygons Brunton elaborated themathematical study of the knot fold and showed that the number of necessary knots dependson the number of the edges of the polygon

4 Knot Fold

In order to determine the geometrical constraints of knot fold we first analyze key geometricalproperties of a knot

41 Geometrical Properties

(a) (b) (c)

Figure 1 Knot-fold of regular pentagon FEIHG

Let us examine the operation of knotting in Fig 1 We make one simple knot by tyingtogether the two ends of the origami tape in Fig 1(a) Note that we use a rectangular shapeof an origami When the height of the tape ie |AD| and |BC| is infinitesimal and both endsof the paper are connected the tape becomes a curve ie an object of study in knot theoryThe knot with 3 crossings is the most basic one in knot theory When we bring the height backto the original without distorting the tape except for folds we obtain the polygonal knot Awell fastened and well flattened knot becomes a polygonal shape as depicted in Fig 1(c) Theobtained polygonal shape exhibits a regular pentagonal form As it is inferred from the knottheory making the knot in Fig 1(c) requires 3 folds along the lines m n and t that extend theedges FE GH and IEn respectively2 The knot K = 〈mn t〉 is the one in Fig 1(c)

When the knot is entirely unfolded we obtain the tape with the creases and the generatedpoints as shown in Fig 2 We note the following geometrical properties The vertices E H andI are lined up on the edge CD whereas vertices F and G are incident to the edge AB The foldalong m passes through F and superposes point H and line AB Point E is the intersectionof m and CD Similarly the fold line n passes through G and the fold along n superposespoint E and line AB Point H is the intersection of n and CD Note that fold lines m and nare mutually defined The fold is a 2-fold operation where m and n are defined simultaneouslyLine t can be determined by applying operation (O5) of Huzitarsquos fold operation set Namely

2Recall that En is the reflection point of E across line n as defined in Sect 2

53

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

Figure 2 Unknotted tape

line t passes through I and superposes G and CD Note that the parameters of (O5) points IG and line CD are considered with respect to the configuration before the fold Refer to Fig 2The origami after the the 2-fold (ie along m and n) is shown in Fig 1(b) The purposes ofthe fold along t is first to construct the vertex I and second to fasten and lock the knot

A purely geometrical proof that the knot fold creates a regular polygon is sketched in [14]In the following we present a formal and automated algebraic proof that uses properties of theoperation of folding such as preservation of some of distances parallelism etc

42 Geometrical Constraint Solving Approach

The question now becomes how to determine the fold lines m n and t such that the knot isa regular pentagon The proof that the knot fold gives rise to regular pentagons shows thateach of the fold line makes angles 2α = 2π

5 with the edges [14] where α = ∡GEH = ∡EHF In origami geometry construction of angles using Huzitarsquos fold operations is not trivial Theproblem of constructing angles is boiled down to a sequence of fold steps which makes theconstruction tedious where the number of intermediate points and lines is prone to increaseFurthermore not all angles are constructible by Huzitarsquos fold operations The construction ofa regular 11-gon whose interior angles are equal to 9π

11 is shown to be impossible by Huzitarsquosfold operations [15] Hence we carefully choose a specification of the knot fold that couldbe extended towards the construction of regular n-gons where n ge 7 We are led to avoidconstruction of angles in order to solve the knot fold construction problem We consider theknot fold construction as a geometrical constraint solving problem without use of angles

Example Regular pentagon

Our method of constructing a regular pentagon by the knot fold uses a multi-fold togetherwith Huzitarsquos fold operations We consider the example in Fig 1 where we make a knotK = 〈mn t〉 We try to define the geometrical properties of K in a systematic way so thatwe can generalize it to the knot fold of regular n-gons where n ge 7 We observe the followinggeometrical properties on m n t E F G H and I

bull Points E and F are incident to mbull Points G and H are incident to nbull Points E H and I are incident to CDbull Points F and G are incident to ABbull The fold line m superposes H and AB ie Hm isin ABbull The fold line n superposes E and AB ie En isin ABbull The fold line t passes through I and superposes G and CD ie I isin t and Gt isin CDbull The distances |EF | |FG| and |GH| are equal

54

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

The above properties are described by the following first order logical formula φK

φK equiv existmn t isin L existEFGH I isin Π

EF sub m and GH sub n and EH I sub CD and FG sub ABand

Hm isin AB and En isin AB and I isin t andGt isin CD and |EF | = |FG| = |GH|

(1)

We used Eos to construct the regular pentagon in Fig 1 It is possible to determine t indepen-dently from m and n We consider the formula (2) that defines the 2-fold operation to solvelines m and n first

φprimeK equiv existmn isin L existEFGH isin Π

EF sub m and GH sub n and EH sub CD and FG sub ABand

Hm isin AB and En isin AB and |EF | = |FG| = |GH|

(2)

The fold line t is obtained by applying operation (O5) Namely line t passes through pointI and superposes point H and line AB

We can prove automatically that the generated shape is a regular pentagon based on Grobnerbases theory We will omit the proof of the correctness of the pentagon knot construction Inthe next sections we will discuss the construction and the proof of a regular heptagon by theknot fold in details

5 Regular Heptagon by the Knot Fold

Brunton studied the construction of regular n-gons where n ge 3 [12] He showed that the

number of necessary knots is Φ(n)2 minus 1 in order to construct a regular n-gon where Φ(n) is

Eulerrsquos totient function Hence to construct a regular heptagon we perform 2 knots K1 andK2 We explained in Sect 4 that a knot can be decomposed into 3-fold operations along threefold lines In the case of regular heptagon we need 5 fold lines m n t u and v whereK1 = 〈mn t〉 and K2 = 〈v um〉 Let EKJIHGF be the constructed regular heptagonFigure 3 exhibits the vertices of the regular heptagon after unfolding K1 and K2 The foldlines are extensions of edges of EKJIHGF as follows Lines m n and t are the extension ofsegment EF IJ and GFn respectively Lines v and u are extensions of segments KEu andHIm respectively Figure 4 shows a sketch of a regular heptagon with the lines m n t u andv

51 Geometrical Constraints

Figure 3 Unfolded regular heptagon EKJIHGF

Lines m and n of the knot K1 = 〈mn t〉 are defined by the following properties on m n tE F I J G and H

55

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

tn

mu

vE

F

G

H

I

J

K

Figure 4 Sketch of a regular heptagon EKJIHGF and lines m n t u and v

bull Points E and F are incident to mbull Points I and J are incident to nbull Points E and J are incident to CDbull Points F I G and H are incident to ABbull The fold line m superposes I and CD ie Im isin CDbull The fold line n superposes F and CD ie Fn isin CDbull The distances |EF | |IJ | |FGn| |IHm| and |GnHm| are equal3

We write formula φK1in a similar fashion to the formula (1)

φK1equiv existmn t isin L existEF I JGH isin Π

EF sub m and I J sub n and F IGH sub AB and E J sub CDand

Im isin CD and Fn isin CD andG isin t and J t isin ABand

|EF | = |IJ | = |FGn| = |IHm| = |GnHm|

(3)

Similarly to our discussion in Sect 42 line t can be constructed independently from lines mand n We therefore can separate the construction t and use φprime

K1in (4) to solve for m and n

first

φprimeK1

equiv existmn existEF I JGH isin Π

EF sub m and I J sub n and F IGH sub AB and E J sub CDand

Im isin CD and Fn isin CDand

|EF | = |IJ | = |FGn| = |IHm| = |GnHm|

(4)

Knot K2 = 〈v um〉 is defined by the following properties on v u m K X H Y Z and F bull Points K and X are on vbull Points H and Y are on ubull Points K and Y are on CDbull Points Z H F and X are on ABbull The fold line v superposes H and CD ie Hv isin CD

3Refering to Fig 3 distances |GFn| and |FGn| are equal due to the fact that reflection across line n preservesthe distances Similarly distances |HIm| and |IHm| are equal

56

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

bull The fold line u superposes X and CD ie Xu isin CDbull The fold line m passes through F and superposes Y and AB ie Y m isin ABbull The distances |KX| |HY | |XFu| |HZv| and |FuZv| are equal

φK2equiv existv um isin L existKXH Y Z F isin Π

KX sub v and HY sub u and KY sub CD and XHZ F sub ABand

Hv isin CD andXu isin CD and F isin m and Y m isin ABand

|KX| = |HY | = |XFu| = |HZv| = |FuZv|

(5)

However referring to Fig 3 points X Y and Z are equal to points Eu Im and ((((Gn)m)u)v)From formula φprime

K1 E I and G are obtained It is possible to determine the fold lines that

make K2 in an easier way than solving constraints in formula (5) as we explain in the nextsub-section

52 Construction by Eos

We first assume that the initial origami is a rectangle ABCD We work with the Cartesiancoordinate system and the coordinates of points A B C and D are (0 0) (wd 0) (wd ht)and (0 ht) respectively The width wd and the height ht can be taken arbitrary Of coursewd is sufficiently larger than ht so that the knot construction is feasible For concreteness ofour presentation using Eos we set wd = 900 and ht = 60 Furthermore let E be an arbitrarybut fixed point on segment CD Let the coordinates of E be (400 ht) for simplicity and clarityof the construction Our objective is to construct a regular heptagon EKJIHGF by the knotfold Recall that the construction requires a 2-fold operation prior to Huzitarsquos fold operations(see Sect 41) The first folding step is the crucial one ie the 2-fold operation

In Eos Huzitarsquos fold operations can be performed using function HO The extension to themulti-fold is natural as HO is implemented with the generality that allows the specification oflogical formulas describing the multi-fold Multi-fold is realized by the call of the followingMathematica function

HO [ H Constraint rarr φ ]

H is a list of points on the origami which determine the faces to be moved φ is a formula in thefirst-order predicate logic The formula φ specifies the constraints that the geometrical objectsconcerned have to satisfy In our example the geometrical constraints that specify the 2-foldoperation are expressed by formula φprime

K1in (4) We write φprime

K1in the language of Eos and call

HO as follows

HO[C A Constraint rarr existmmLineexistnnLineexistff PointexistiiPointexistjjPointexistggPointexisthhPoint

(E f sub m and i j sub n and f i g h sub AB and j isin CDand

im isin CD and fn isin CDand

SqDistance[E f ] == SqDistance[i j] == SqDistance[f gn] ==

SqDistance[i hm] == SqDistance[gn hm])]

(6)

The term SqDistance[XY ] is the square of the distance between X and Y (ie |XY |2)Notations like ldquoexistmmLinerdquo ldquoE f sub mrdquo ldquoimrdquo ldquoim isin CDrdquo are Eos extension of Mathematicasyntax

The evaluation of (6) generates 24 distinct cases of possible configurations of points F GH I and J and lines m and n We deduce that the algebraic interpretation of the constraintsas defined by φprime

K1 is a well constrained system of equations since we obtained finite number of

solutions However not all of the 24 cases are relevant to our construction problem They may

57

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

(a) Case 1 (b) Case 2

(c) Case 3 (d) Case 4

(e) Case 5 (f) Case 6

Figure 5 6 possible cases for lines m and n

correspond to degenerate cases that lead to failure of the proof by Grobner bases In order toeliminate the degenerate cases and also to get a reasonable number of cases we further narrowthe search space of the configuration of points and lines For that we add the following extraconstraints

E isin nandj isin mandSqDistance[E i] == SqDistance[j f ] == SqDistance[E h] == SqDistance[j g]

The sub-formula E isin n and j isin m eliminates the degenerate cases where E and j are equalSub-formula SqDistance[E i] == SqDistance[j f ] == SqDistance[E h] == SqDistance[j g]specifies further conditions on points E F G H I and J We evaluate the following HO call

HO[C A Constraint rarr existmmLineexistnnLineexistff PointexistiiPointexistjjPointexistggPointexisthhPoint

(E f sub m and i j sub n and f i g h sub AB and j isin CDand

im isin CD and fn isin CD and

SqDistance[E f ] == SqDistance[i j] == SqDistance[f gn] ==

SqDistance[i hm] == SqDistance[gn hm]and

E isin n and j isin m and SqDistance[E i] == SqDistance[j f ] == SqDistance[E h] == SqDistance[j g])

MarkPointAt rarr F I J G H]

(7)

Consequently we obtain 6 cases as shown in Fig 5 Two of them namely those in Fig 5(a) andin Fig 5(f) lead to the construction of a regular heptagon Eos allows the user to interactivelychoose the suitable case to proceed with the construction Keyword MarkPointAt tells the Eoshow to label the existentially quantified points f i j g and h The outcome of folding in thecase 6 is shown in Fig 6

Next we apply two operations (O1) to fold along the line FGn and IHm in Fig 6 by callingHO with suitable arguments The lines FGn and IHm are the fold lines t and u respectivelyThe results are shown in Fig 7(a) and 7(b) Finally given the origami of Fig 7(b) we constructthe remaining vertex K We apply operation (O6) to obtain v which brings H and G onto ICand HB respectively Point K is the intersection of IC and line v We obtain the heptagonEKJIHGF in Fig 7(c)

58

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

Figure 6 Step 1 Folds along lines m and n

53 Algebraic Interpretation

This algebraic interpretation is used to ldquoevaluaterdquo the function calls of HO as well as the auto-mated proof of the correctness of the construction We take HO in (7) as an example To obtaingeometrical objects m n F G H I and J the formula in (7) is transformed into a set ofalgebraic equalities Further details of the algebraic interpretation are explained in [8] and [5]

Let the coordinates of A B D and E be (0 0) (900 0) (0 60) and (400 60) respectivelyFor an atomic formula φ let [[φ]] denote the set of polynomial relations that are the algebraicmeaning of φ An atomic formula is interpreted as a set of polynomial relations (equalities orinequalities) and a term is given as a rational function The set of (non-simplified) polynomialequalities (8) ndash (14) is the algebraic interpretation of formula in (7)

400a5+ 60b6+ c7 == 0 c7+ a5x11+ b6y12 == 0 c10+ a8x13+ b9y14 == 0

c10+ a8x15+ b9y16 == 0minus900y12 == 0minus900y14 == 0

minus900y20 == 0minus900y18 == 0minus54000 + 900y16 == 0 (8)

minus54000 +900

(

minus2b6(c7+ a5x13) + a52y14minus b62y14)

a52 + b62== 0 (9)

minus54000 +900

(

minus2b9(c10+ a8x11) + a82y12minus b92y12)

a82 + b92== 0 (10)

(400minus x11)2 + (60minus y12)2 == (x13minus x15)2 + (y14minus y16)2 ==(

y12minusminus2b9(c10+ a8x17) + a82y18minus b92y18

a82 + b92

)2

+

(

x11minusminusa82x17+ b92x17minus 2a8(c10+ b9y18)

a82 + b92

)2

==

(

y14minusminus2b6(c7+ a5x19) + a52y20minus b62y20

a52 + b62

)2

+

(

x13minusminusa52x19+ b62x19minus 2a5(c7+ b6y20)

a52 + b62

)2

==

(

minus2b9(c10+ a8x17) + a82y18minus b92y18

a82 + b92minus

minus2b6(c7+ a5x19) + a52y20minus b62y20

a52 + b62

)2

+

(

minusa82x17+ b92x17minus 2a8(c10+ b9y18)

a82 + b92minus

minusa52x19+ b62x19minus 2a5(c7+ b6y20)

a52 + b62

)2

(11)

59

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

400a8+ 60b9+ c10 6= 0 c7+ a5x15+ b6y16 6= 0 (12)

(minus400 + x13)2 + (minus60 + y14)2 ==

(x11minus x15)2 + (y12minus y16)2 == (minus400 + x19)2 + (minus60 + y20)2 ==

(x15minus x17)2 + (y16minus y18)2 (13)

(minus1 + b9)b9 == 0 (minus1 + a8)(minus1 + b9) == 0 1 + a82 6= 0 (minus1 + b6)b6 == 0

(minus1 + a5)(minus1 + b6) == 0 1 + a52 6= 0 (14)

A line a x + b y + c = 0 is represented by (a b c) together with the constraint (minus1 + b)b =0 and (minus1 + a)(minus1 + b) = 0 and a2 + 1 6= 0 Lines m and n are represented by (a5 b6 c7) and(a8 b9 c10) respectively Hence we have the equalities and disequalities in (14)

The equalities in (8) are the algebraic interpretation of the sub-formula E f sub mandi j subnand f i g h sub AB and j isin CD The first equation 400a5+ 60b6+ c7 == 0 means that point Eat (400 60) is incident to m defined by the equation a5x+ b6y + c7 = 0 Similarly the rest ofthe equations in (8) are interpretations of f at (x11 y12) is on m i at (x13 y14) is on n j at(x15 y16) is on n f is on AB i is on AB h at (x19 y20) is on AB g at (x17 y18) is on ABand j is on CD respectively

The reflection of point i at (x13 y14) across line m is the point im whose coordinates are

(minusa52x13 + b62x13minus 2a5(c7 + b6y14)

a52 + b62minus2b6(c7 + a5x13) + a52y14minus b62y14

a52 + b62)

Equation (9) states that im is incident to CD represented by (0 1 -60) Similarly equation(10) is the algebraic interpretation of fn isin CD Eos transforms rational form p

q== 0 to

p == 0 Note that in (9)ndash(11) q comes from coefficient of lines and q 6= 0 is deduced from (14)The disequalities of (12) states that the coordinates of point E and j do not satisfy the

equation of lines n and m respectively Eos changes the disequalities into equalities by addingslack variables introduced by Rabinowitch trick

Now we examine the equalities (11) and (13) [[SqDistance[E f ]==SqDistance[i j]]] givesrise to the first equality in (11) namely (400minusx11)2+(60minusy12)2 == (x13minusx15)2+(y14minusy16)2where E at (400 60) f at (x11 y12) i at (x13 y14) and j at (x15 y16) The rest of theequalities in (11) and equalities in (13) are obtained in the same way

By solving the above set of polynomial equalities for the coefficients of m and n and coor-dinates of f i j g and h we obtain the 6 cases in Fig 5

6 Proof

61 Theorem to Prove

We prove the following theorem

Theorem 61 Given the origami in Fig 7(c) we have(a) |EF | = |FG| = |GH| = |HI| = |IJ | = |JK| = |KE| and(b) ∡EOF = ∡FOG = ∡GOH = ∡HOI = ∡IOJ = ∡JOK = ∡KOE = 2π

7 where O is thecenter of EKJIHGF

Let θ = ∡EOF and α = eiθ VectorminusminusrarrFG is the rotation of

minusminusrarrEF through θ around center O

To prove the theorem 61 we show that the rotations ofminusminusrarrEF through angles 2θ 3θ 4θ 5θ and

60

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

(a) (b) (c)

Figure 7 Construction of (a) the edge GF (step 2) (b) the edge IH (step 3) and (c) vertex Kand final heptagon EKJIHG (step 4)

6θ givesminusminusrarrGH

minusrarrHI

minusrarrIJ

minusminusrarrJK and

minusminusrarrKE respectively and furthermore that θ = 2π

7 We show thatafter the construction the following holds

forallα isin C (αminusminusrarrEF minus

minusminusrarrFG = 0 rArr

α2minusminusrarrEF minusminusminusrarrGH = 0 and α3minusminusrarrEF minus

minusrarrHI = 0 and α4minusminusrarrEF minus

minusrarrIJ = 0and

α5minusminusrarrEF minusminusminusrarrJK = 0 and α6minusminusrarrEF minus

minusminusrarrKE = 0 and α7 minus 1 = 0)

(15)

Let P be the geometrical constraints accumulated during the construction Let C equiv forallα isinC (C1 rArr C2 and C3 and C4 and C5 and C6 and C7) be the formula (15) P and C form the premise andconclusion of the proposition (16) that we want to prove

P rArr forallα isin C (C1 rArr C2 and C3 and C4 and C5 and C6 and C7) (16)

Formula (16) is semantically equivalent to the conjunctions of the formulas (17)ndash(22)

P rArr forallα isin C (C1 rArr C2) (17)

P rArr forallα isin C (C1 rArr C3) (18)

P rArr forallα isin C (C1 rArr C4) (19)

P rArr forallα isin C (C1 rArr C5) (20)

P rArr forallα isin C (C1 rArr C6) (21)

P rArr forallα isin C (C1 rArr C7) (22)

62 Proof by Eos

We show how the validity of (17) is proved and the rest is achieved in a similar way We addthe conclusion forallα isin C C1 rArr C2 by calling Eos function Goal as follows

Goal[forallααisinComplexes(VectorToComplex[αminusminusrarrEF minus

minusminusrarrFG]==0 rArr

(VectorToComplex[α2minusminusrarrEF minusminusminusrarrGH]==0))]

(23)

Expressions C1 equiv αminusminusrarrEF minus

minusminusrarrFG = 0 and C2 equiv α2minusminusrarrEF minus

minusminusrarrGH = 0 written in the language of

Eos are VectorToComplex[αminusminusrarrEF minus

minusminusrarrFG] and VectorToComplex[α2minusminusrarrEF minus

minusminusrarrGH]==0 respectively

61

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

Function Goal adds the negation of the conclusion to the premise By calling Goal we obtainP and not(forallα isin C (C1 rArr C2)) In order to translate P and not(forallα isin C (C1 rArr C2)) into algebraic formwe fix the coordinate system to be Cartesian with points A B C D and E as follows

map = DefMapping[A Point[0-wd]B Point[wd0]

C Point[wd ht] D Point[0 ht] E Point[0 ht] ]amp(24)

Without loss of generality we set the size of the initial origami to be 2wdtimesht where the widthwd is taken to be arbitrary and the height ht is equal to 1 The point E is fixed at location(0 ht) Finally we check whether the reduced Grobner basis of the algebraic interpretation ofP and not(forallα isin C (C1 rArr C2)) is 1 by calling function Prove

Prove[ldquoKnot Heptagonrdquo Mapping rarr map GroebnerBasis rarr

CoefficientDomain rarr RationalFunctions

MonomialOrder rarr DegreeReverseLexicographic]

(25)

The above call of function Prove tells Eos to compute Grobner basis of the polynomial set[[P and not(forallα isin C (C1 rArr C2))]] Let V be the set of variables in [[P and not(forallα isin C (C1 rArr C2))]] TheGrobner basis computation is carried out in the domain of polynomials whose variables are inV wd and whose coefficients are in functions of Q(wd) Eos computes Grobner basis andgenerates a proof document (whose title is given by the first argument of the call of Prove) [16]

63 Proof Results

The proofs of (17)ndash(22) are successful The CPU time used for Grobner basis computation onMac OS X (Intel Core i7 8G 24GHz) machine varies from 69236984 seconds (for proving (17))to 1994889588 seconds (for proving (20))

7 Conclusion

We presented the construction of a regular heptagon using the knot fold Our method consistsin applying 2-fold operation coupled with Huzitarsquos fold operations The fold lines that makethe knot fold are determined by solving geometrical constraints We further showed the proofof the correctness of the construction of a regular heptagon based on Grobner bases

Note that using Huzitarsquos fold operations (O1) sim (O7) a regular heptagon is constructibleWith Eos we need 9 Huzitarsquos fold operations and more than 10 auxiliary operations such asunfolding and marking supporting points Further investigation of the geometrical constraintsby the knot fold is required to construct regular 11-gon which is impossible by Huzitarsquos foldoperations

Another issue that should be investigated in the future research is the rigidity of the knotfold We need to define the notion of rigidity in mathematical terms in this knot fold as wellas in more general origami that may involve 3D constructions

71 Acknowledgments

We thank Stephen Watt of Western Ontario University for drawing our attention to the knotfold This work is supported by JSPS KAKENHI Grant No 25330007 The first author of thispaper is supported by a postdoctoral fellowship at Kwansei Gakuin University

62

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

References

[1] D S Kasir The Algebra of Omar Khayyam (English translation of Khayyamrsquos original workAl-Jabr Wrsquoal Muqabalah) Teachers College Press 1931

[2] P L Wantzel Recherches sur les moyens de connaıtre si un probleme de geometrie peut se resoudreavec la regle et le compas Journal de Mathematiques Pures et Appliquees pages 366ndash372 1837

[3] H Huzita Axiomatic Development of Origami Geometry In Proceedings of the First InternationalMeeting of Origami Science and Technology pages 143ndash158 1989

[4] R C Alperin A Mathematical Theory of Origami Constructions and Numbers New York Journalof Mathematics 6119ndash133 2000

[5] T Ida A Kasem F Ghourabi and H Takahashi Morleyrsquos Theorem Revisited Origami Con-struction and Automated Proof Journal of Symbolic Computation 46(5)571 ndash 583 2011

[6] J Justin Resolution par le pliage de lrsquoequation du troisieme degre et applications geometriques InProceedings of the First International Meeting of Origami Science and Technology pages 251ndash2611989

[7] F Ghourabi A Kasem and C Kaliszyk Algebraic Analysis of Huzitarsquos Origami Operations andtheir Extensions In Automated Deduction in Geometry LNAILNCS Springer 2013 (to appear)

[8] F Ghourabi T Ida H Takahashi M Marin and A Kasem Logical and Algebraic View ofHuzitarsquos Origami Axioms with Applications to Computational Origami In Proceedings of the22nd ACM Symposium on Applied Computing (SACrsquo07) pages 767ndash772 Seoul Korea 2007

[9] R C Alperin and R J Lang One- Two and Multi-fold Origami Axioms In Origami4 Pro-ceedings of the Fourth International Meeting of Origami Science Mathematics and Education(4OSME) pages 371ndash393 2009

[10] F Ghourabi T Ida and H Takahashi Computational Origami of Angle Quintisection InProceedings of the Workshop in Symbolic Computation in Software Science (SCSS2008) RISCTechnical Report Series 08-08 pages 57ndash68 2008

[11] H M Cundy and A P Rollett Mathematical Models Oxford University Press 1961

[12] J K Brunton Polygonal Knots The Mathematical Gazette 45(354)299ndash301 1961

[13] K Sakaguchi On Polygons Made by Knotting Slips of Paper Technical Report of ResearchInstitute of Education Nara University of Education 1855ndash58 1982

[14] J Maekawa Introduction of the study of knot tape In Origami5 Proceedings of the FourthInternational Meeting of Origami Science Mathematics and Education (5OSME) pages 395ndash403 2011

[15] D A Cox Galois Theory Wiley-Interscience 2004

[16] F Ghourabi T Ida and A Kasem Proof Documents for Automated Origami Theorem ProvingIn Automated Deduction in Geometry volume 6877 of LNCS pages 78ndash97 Springer 2011

63

Automated Verification of Equivalence on

Quantum Cryptographic Protocols

Takahiro Kubota1 Yoshihiko Kakutani1 Go Kato2

Yasuhito Kawano2 and Hideki Sakurada2

1 The University of Tokyo Tokyo Japantakahirok11 30kakutaniissu-tokyoacjp

2 NTT Communication Science Laboratories Kanagawa Japankatogokawanoyasuhitosakuradahidekilabnttcojp

Abstract

It is recognized that security verification of cryptographic protocols tends to be difficultand in fact some flaws on protocol designs or security proofs were found after they had beenpresented The use of formal methods is a way to deal with such complexity Especiallyprocess calculi are suitable to describe parallel systems Bisimilarity which denotes thattwo processes behave indistinguishably from the outside is a key notion in process calculiHowever by-hand verification of bisimilarity is often tedious when the processes have manylong branches in their transitions We developed a software tool to automatically verifybisimulation relation in a quantum process calculus qCCS and applied it to Shor andPreskillrsquos security proof of BB84 The tool succeeds to verify the equivalence of BB84 andan EDP-based protocol which are discussed in their proof

1 Introduction

Security proofs of cryptographic protocols tend to be complex and difficult to verify Thisfact has been recognized in the classical cryptography and there is a line of researches to dealwith the complexity of verification [1 2] Since by-hand proofs are prone to human error andtime consumption efforts have been put into automating security proofs and verification in theclassical cryptography Security proofs are also complex in the quantum cryptography where wemust also consider attacks using entanglements The first security proof of BB84 quantum keydistribution (QKD) protocol by Mayers [3] is about 50 pages long After that paper researchershave been seeking simpler proofs [4 5] Since QKD is one of the closest application to practicein the quantum information field it is important to examine QKD systemsrsquo security formallyand make it machine-checkable

There are several formal frameworks for quantum protocols Feng et al developed a processcalculus qCCS [6] In this calculus a protocol is formalized as a configuration A configurationis a pair of a process and a quantum state corresponding to quantum variables Weak openbisimulation relation on qCCS configurations is defined Weakly open bisimilar configurationshave the same transitions up to internal ones and reveal the identical quantum states to theoutsider (adversary) in each step The relation is proven to be closed by parallel composition ofprocesses A use case of a process calculus for formal verification is to prove weak bisimilarityof implementation and specification described as configurations qCCS has been applied toquantum teleportation superdense coding and BB84 protocols

To extend application of formal methods to security proofs we applied qCCS to Shor andPreskillrsquos security proof of BB84 [4] in the previous paper [7] In Shor and Preskillrsquos securityproof security of BB84 is proven to be equivalent to that of another protocol based on anentanglement distillation protocol (EDP) and then the latter is proven to be secure We

64

Automated Verification of Equivalence on Quantum Cryptographic Protocols Kubota et al

formalized BB84 and the EDP-based protocol as configurations and proved their bisimilarityby hand However by-hand verification of bisimilarity is often tedious when configurationshave many long branches in their transitions In this paper we present a software tool to verifybisimilarity of given two qCCS configurations There are two main contributions of our work

First we implemented a software tool that formally verifies bisimilarity of qCCS configu-rations without recursive structures A protocol possibly takes security parameters for variouspurposes As for BB84 it takes two parameters one determines the length of qubits whichAlice sends to Bob in the first quantum communication and the other is for tolerated error-ratein the eavesdropping detection step Such parameters are passed to the verifier as symbols andare interpreted appropriately In our verifierrsquos framework quantum states and operations aredescribed as symbols Since attacks from the adversary are also treated as symbols our verifiercan deal with unspecified attacks To examine the behavioural equivalence adversaryrsquos viewsdenoted by partial traces must be checked to be equal in each step of a protocol The verifierautomatically checks the equality using user-defined equations

Second we applied our verifier to Shor and Preskillrsquos security proof of BB84 [4] The verifiertakes as input two configurations denoting BB84 and the EDP-based protocol and equationsabout the properties of error-correcting codes and measurement of the halves of EPR pairsThe verifier succeeds to verify the bisimilarity of the configurations of the two protocols

The package of the verifier is available from httphagiissu-tokyoacjp~tkqccs

verifiertargz It includes a user manual and and example scripts in the folders doc andscriptsRelated Work The authors of qCCS presented the notion of symbolic bisimulation for quan-tum processes [8] A purpose is to verify bisimilarity algorithmically They proved the strong(internal actions should be simulated) symbolic bisimilarity is equivalent to the strong openbisimilarity and actually presented an algorithm to verify symbolic ground (outsiders do notperform quantum operations adaptively) bisimilarity Since our purpose is to apply a pro-cess calculus to security proofs where adversarial interference must be taken into account weimplemented a tool that verifies weak open bisimilarity on the basis of the original qCCS [6]

2 The Verifier

Formal Framework The verifier employs a sublanguage of qCCS where the syntax of recur-sion and the use of classical data are restricted The framework is still expressive because ourtarget protocols do not need recursion and classical probability distributions can be representedas quantum states denoted by diagonal operators The syntax of the processes in the verifier isas follows

P = discard(q) | cqP | cqP | meas b then P saem | op[q]P | P ||P | PL

Intuitively discard(q)means termination of a process keeping a sequence of quantum variablesq secret cqP sends a quantum variable q to a channel c and then executes P cqP receivesquantum data to a variable q from a channel c and then executes P meas b then P saem

measures a quantum bit b and executes P if the outcome is 0 or terminates if the outcome is1 op[q]P performs a superoperator op to quantum variables q and then executes P P ||P prime

executes P and P prime in parallel PL where L is a set of channels executes P keeping channelsin L private Let qv(P ) be the set of quantum variables that occur in a process P cqP meas b then P saem op[q]P and P ||P prime are defined only if q isin qv(P ) b isin qv(P ) q sub qv(P )and qv(P ) cap qv(P prime) = empty respectively In our verifier each quantum variable is defined with its

65

Automated Verification of Equivalence on Quantum Cryptographic Protocols Kubota et al

qubit-length that is indicated by a natural number symbol declared beforehand The adoptionof natural number symbols is important to treat security parameters in the verifier Quantumstates are represented as character strings called environments The syntax of the environmentsis given as follows

ρ = X[q] | op[q](ρ) | ρ ρ | proji[b](ρ) | Tr[q](ρ)

Let qv(ρ) be the set of quantum variables that occur in an environment ρ X[q] meansthat quantum variables q are in a quantum state X op[q](ρ) is a quantum state after theapplication of operation op to quantum variables q in an environment ρ ρ ρprime represents thetensor product of ρ and ρprime but ρ ρprime and ρprime ρ are identified in the verifier ρ ρprime is definedonly if qv(ρ) cap qv(ρprime) = empty proji[b](ρ) means the reduced density operator |i〉〈i|bρ|i〉〈i|b withi isin 0 1 Tr[q](ρ) means the partial trace of ρ by q We call a pair 〈P ρ〉 of a process Pand an environment ρ a configuration only if qv(P ) sub qv(ρ) because quantum states of qubitsoccurring in P must be defined in ρ For example an agent that sends the halves of n EPR pairsto the outside is formalized as a configuration 〈cqdiscard(r) EPR[qr]ANY[s]〉 where thequantum variables q r are of the qubit length n and the quantum variable s is defined with anarbitrary qubit-length EPR[qr] is interpreted to (|00〉〈00|+ |00〉〈11|+ |11〉〈00|+ |11〉〈11|)otimesn

qr

and ANY[s] is arbitrarily for adversaryrsquos density operatorsA labelled transition system based on the original one [6] is implemented in the verifier

Transitions are interpreted as interactions between configurations and the adversary For exam-

ple the configuration above performs a transition 〈cqdiscard(r) EPR[qr]ANY[s]〉cqminusminusrarr

〈discard(r) EPR[qr]ANY[s]〉 where the adversary can recognize that the quantum vari-able q is sent through the channel c Transitions caused by internal actions such as quantumoperations internal communications and conditional branches are labelled τ The label τ intu-itively means that the action is invisible from the outside The transition rules of conditionalbranch are 〈meas b then P saem ρ〉

τminusrarr 〈P proj0[b](ρ)〉 and 〈meas b then P saem ρ〉

τminusrarr

〈discard(qv(P )) proj1[b](ρ)〉 These may decrease the trace of the density operator de-noting a quantum state Since the trace indicates the probability to reach to a configurationwe can restore the probability from configurations to conditional branches We identify thebranches that are evoked by an identical quantum variable Eventually probability is absorbedin quantum states and excluded from the transition system

The transition system of the original qCCS is probabilistic which is caused by the mea-surement construction M [qx] in the syntax [6] It measures an observable M of a quantumvariable q and stores the result in a classical variable x There are two ways to formalize quan-tum measurement since one can be also formalized as a superoperator Because only M [qx]evokes a probabilistic branch processes with different formalization of measurement are notbisimilar in general We proposed a criteria how to select the way in our previous work [7] weshould use M [qx] if a process behaves differently according to the measurement For examplethe case where a process performs different labeled transitions is typical Otherwise we shouldformalize measurement by a superoperator In our verifierrsquos framework M [qx] cannot be writ-ten independently Instead the syntax meas b then P saem is the composition of M [qx] andthe conditional branch in the original qCCS This restriction and the conditions on quantumvariables prevent the situation where two configurations with the different ways of formalizationof measurement are not bisimilarProcedure to Check Bisimulation Weak bisimulation relation [6] is defined on qCCS con-figurations Roughly speaking weakly bisimilar configurations (1) perform identical labelledtransitions up to τ transitions and (2) reveal identical density operators whatever operations theadversary performs to her quantum variables The adversaryrsquos view is denoted by the partial

66

Automated Verification of Equivalence on Quantum Cryptographic Protocols Kubota et al

trace Tr[q](ρ) when the global quantum state is ρ and q are the quantum variables that arenot revealed to the adversary The verifier takes as input two configurations and user-definedequations on environments and returns true or false It is designed to be sound with respectto the original qCCS that is two configurations are bisimilar if the verifier returns true withthem and some valid equations This is because

Reqs = (CD) |The verifier returns true given CD and eqs

is a bisimulation relation for all valid equations eqs Precisely Reqs is converted accordinglybecause meas b then P saem is decomposed to M [bx] and a conditional branch which performsa two-step transition in the branch with x = 0 The recursive procedure to verify bisimilarityis as follows Since the transitions of the processes written in our sublanguage are finite theprocedure always terminates

1 The procedure takes as input two configurations 〈P0 ρ0〉 〈Q0 σ0〉 and user-defined equa-tions on environments

2 If P0 and Q0 can perform any τ -transitions of superoperator applications they are allperformed at this point Let 〈P ρ〉 and 〈Q σ〉 be the obtained configurations

3 Whether qv(P ) = qv(Q) is checked If it does not hold the procedure returns false

4 Whether Tr[qv(P )](ρ) = Tr[qv(Q)](σ) is checked with user-defined equations Theprocedure to check the equality of quantum states are described in the next subsectionIf it does not hold the procedure returns false

5 A new superoperator symbol E[qv(ρ)minus qv(P )] that stands for an adversarial operationis generated

6 For each 〈P prime ρprime〉 such that 〈P E[qv(ρ) minus qv(P )](ρ)〉αminusrarr 〈P prime ρprime〉 the procedure checks

whether there exists 〈Qprime σprime〉 such that 〈Q E[qv(σ) minus qv(Q)](σ)〉τlowastminusrarr

αminusrarr

τlowastminusrarr 〈Qprime σprime〉 and

the procedure returns true with the input 〈P prime ρprime〉 and 〈Qprime σprime〉 If there exists it goes tothe next step 7 Otherwise it returns false

7 For each 〈Qprime σprime〉 such that 〈Q E[qv(σ) minus qv(Q)](σ)〉αminusrarr 〈Qprime σprime〉 the procedure checks

whether there exists 〈P prime ρprime〉 such that 〈P E[qv(ρ) minus qv(P )](ρ)〉τlowastminusrarr

αminusrarr

τlowastminusrarr 〈P prime ρprime〉 and

the procedure returns true with the input 〈Qprime σprime〉 and 〈P prime ρprime〉 If there exists it returnstrue Otherwise it returns false

The step 2 prominently reduces the search space Indeed 〈op1[q]P ||op

2[r]Q ρ〉 and

〈P ||QF rop2

(E qop1

(ρ))〉 are bisimilar and F rop2

(E qop1

(ρ)) = E qop1

(F rop2

(ρ)) holds because q cap r = emptyholds Therefore superoperators that can originally cause τ transitions are disposedEquality Test of Quantum States To test the equality of given two environments the verifierchecks whether they are transformed to the same form There are two kinds of transformationstrace out and application of user-defined rules

Partial trace is significant to test the equality of quantum states For example two differentquantum states op1[q](X[q]Y[r]Z[s]) and op2[r](U[q]V[r]Z[s]) have the same par-tial trace Z[s] under Tr[qr] for arbitrary interpretation of the superoperators op1 op2 andthe quantum states X Y Z U V The verifier eliminates symbols of superoperators and quantumstates according to the partial trace rules below

Tr[q](E[r](ρ)) = Tr[q](ρ) if r sub q (1) Tr[q](ρ) = Tr[r](Tr[s](ρ)) if q = r cup s (2)

Tr[q](E[r](ρ)) = E[r](Tr[q](ρ)) if q cap r = empty (3) Tr[q](ρ lowast ρq lowast σ) = ρ lowast σ (4)

67

Automated Verification of Equivalence on Quantum Cryptographic Protocols Kubota et al

If r sub q holds Tr[q](E[r](ρ)) is rewritten to Tr[q](ρ) eliminating E[r] by the rule (1)otherwise by the rules (2) and (3) the trace-out symbol with quantum variables that are disjointto targets of superoperator goes inside of itrsquos application After eliminating superoperatorsquantum states are traced out by the rule (4)

If an objective quantum state has a part that matches to the left-hand side of a user-defined equation the part is rewritten to the right-hand side To apply a user-definedequation the verifier automatically solves commutativity of superoperators or partial tracesthat are applied to disjoint sets of quantum variables For example if the objectivequantum state is Tr[q](hadamard[s] (EPR[qr]X[s])) and a user defines an equationTr[q](EPR[qr])=Tr[q](PROB [qr]) (E1) the application goes as follows

Tr[q](hadamard[s](EPR[qr]X[s])) = hadamards[s](Tr[q](EPR[qr]X[s])) (by 5)

= hadamard[s](Tr[q](PROB[qr]X[s])) (by E1)

Since the trace-out rules may have become applicable after applications of user-defined rulesthe trace-out procedure is applied again In each opportunity to test the equality of quantumstates each user-defined equation is applied only once This guarantees whatever rules a userdefines the equality test terminates

3 Application to Shor and Preskillrsquos Security Proof

The two protocols BB84 and the EDP-based protocol [4] are formalized as qCCS configurationson the basis of our previous work [7] Readers can find the script scriptsshor-preskillscrin the package The interpretations of the symbols of the quantum states and the superoperatorsthat are used in the formalization are also included as docshor-preskill symbolspdfOn Channels As in general QKD protocols three kinds of channels are used public quantumchannels private classical channels and public no-interpolate classical channels Since thesyntax has channel restriction PL formalization of private channels is straightforward Publicno-interpolate classical channels are realized by copying the data If a quantum variable q wherea classical value is assigned is sent through a public no-interpolate channel c this is formalizedas copy[qQ]cqdQ c where Q is a new quantum variable a superoperatorcopy copies the value of q to Q and d is a new non-restricted channel q will securely sentthrough the restricted channel c and an adversary obtains the same value accessing Q througha public channel d Note that the value of q can be copied because it is classicalEquations for the Proof We defined 10 equations in the verifier Equations are interpretedto those on density operators and proven correct For example the equation below tells theverifier that the halves of EPR pairs are indistinguishable from the uniform distribution Thisis used to check that the adversaryrsquos views are identical in the EDP-based protocol and BB84before Alice in the EDP-based protocol measures her halves of the check qubits

equation E7

Tr[q1_A](EPR[q1_Aq2_A]) = Tr[q1_A](PROB[q1_Aq2_A])

end

The user-defined rule above is interpreted to an equation trq1 A(|00〉〈00|+ |00〉〈11|+ |11〉〈00|+

|11〉〈11|)otimesnq1 Aq2 A = trq1 A(|00〉〈00|+ |11〉〈11|)otimesn

q1 Aq2 A The other rules are related to CSS codespartial traces and measurement of quantum states We obtained them by formalizing theequality of quantum states that are discussed in the original proof [4]

It is actually natural to express quantum states as symbols with some equations in inputs Incryptographic protocols the dimension of quantum states and superoperators cannot be fixed

68

Automated Verification of Equivalence on Quantum Cryptographic Protocols Kubota et al

as a certain number as they depend on security parameters In addition qubits going throughpublic channels are potentially interpolated by the adversary Since arbitrary computationby the adversary must be considered it should be described as an unspecified superoperatorTherefore quantum states are difficult to be expressed as concrete matrices which can benumerically analyzed Although quantum states are treated symbolically automatic calculationof partial traces is still possible focusing on occurrence of quantum variables in environmentsExperiment Result We ran the verifier with the input of shor-preskillscr We used anote PC with Intel Core i5 CPU M 460 253GHz and 1GB memory The transition tree ofthe EDP-based protocol has 621 nodes and 165 paths and that of BB84 has 588 nodes and 165paths The verifier checked the bisimilarity of the two protocols in 1598 seconds The recursiveprocedure was called 951 times

4 Conclusions

We presented a software tool to check bisimulation of qCCS configurations and applied it to asecurity proof of BB84 [4] In security proofs equivalence on protocols is often discussed Itcan be described as bisimulation relation but it is nearly impossible to check by hand if statetransitions of processes have many long branches In addition the equality of an adversaryrsquosview between two protocols has to be checked in each step An adversaryrsquos view is calculatedfrom a global quantum states which is possibly denoted by a huge matrix The verifier doesexhausting parts of proofs of behavioral equivalence namely it checks the correspondence ofall state transitions up to invisible ones and an adversaryrsquos view up to equations On the otherhand a user only have to examine the correctness of formalization of protocols and validityof equations that he defines It could be difficult to find all appropriate equations for a proofimmediately The verifier is also able to show environments andor processes when the checkprocedure returns false With the information a user can modify equations to inputFuture WorkWe plan to define probabilistic bisimilarity which denotes that configurations be-have indistinguishably up to some probability This will be helpful to prove ldquoindistinguishabilityup to negligible probabilityrdquo of protocols It is quite common argument in the cryptography

References

[1] S Halevi A plausible approach to computer-aided cryptographic proofs Cryptology ePrint ArchiveReport 2005181 2005

[2] B Blanchet A D Jaggard A Scedrov and J-K Tsay Computationally sound mechanized proofsfor basic and public-key kerberos In Proceedings of the 2008 ACM symposium on Informationcomputer and communications security pages 87ndash99 2008

[3] D Mayers Unconditional security in quantum cryptography J ACM 48351ndash406 May 2001

[4] P W Shor and J Preskill Simple proof of security of the bb84 quantum key distribution protocolPhys Rev Lett 85(2)441ndash444 Jul 2000

[5] H-K Lo and H F Chau Unconditional security of quantum key distribution over arbitrarily longdistances Phys Rev Lett 283(5410)2050ndash2056 Mar 1999

[6] Y Deng and Y Feng Open bisimulation for quantum processes In Theoretical Computer Sciencevolume 7604 of LNCS pages 119ndash133 2012

[7] T Kubota Y Kakutani G Kato Y Kawano and H Sakurada Application of a process calculusto security proofs of quantum protocols In Proceedings of WORLDCOMPFCS2012 Jul 2012

[8] Y Feng Y Deng and M Ying Symbolic bisimulation for quantum processes arXiv preprintarXiv12023484 2012

69

A Modified Parallel F4 Algorithm for Shared

and Distributed Memory Architectures

Severin Neumann

Fakultat fur Mathematik und InformatikUniversitat Passau D-94030 Passau Germany

neumansfimuni-passaude

Abstract

In applications of symbolic computation an often required but complex procedure is findingGrobner bases for polynomial ideals Hence it is obvious to realize parallel algorithms tocompute them There are already flavours of the F4 algorithm like [4] and [13] using thespecial structure of the occurring matrices to speed up the reductions on parallel architec-tures with shared memory In this paper we start from these and present modificationsallowing efficient computations of Grobner bases on systems with distributed memory Toachieve this we concentrate on the following objectives decreasing the memory consump-tion and avoiding communication overhead We remove not required steps of the reductionsplit the columns of the matrix in blocks for distribution and review the effectiveness of theSIMPLIFY function Finally we evaluate benchmarks with up to 256 distributed threads ofan implementation being available at httpsgithubcomsvrnmparallelGBC

1 Introduction

Parallelization is one of the most used methods to improve the performance of existing softwareBut it should be introduced systematically One chooses the most time-consuming segments ofa program and tries to improve these first In applications of symbolic computation an oftenrequired but complex procedure is finding Grobner bases for polynomial ideals Therefore itis obvious to realize parallel versions of algorithms to compute them Although it is possibleto use Buchbergerrsquos algorithm [14] we favour Faugerersquos algorithm F4 [3] since the reduction isdone due to matrix transformation which is known for being well parallelizable

There are already parallel flavours of F4 like [4] and [13] using the special structure ofthe occurring matrices to speed up the reduction Both approaches have been developed formulticore and multiprocessor systems with shared memory For these systems the number ofparallel processing units is limited and currently there are not many platforms serving morethan 64 processors Compared with that clusters of several suchlike computers can have antheoretical unlimited number of processors This advantage comes with the downside of dis-tributed memory realizing algorithms requires to consider that data has to be transfered Bythat memory duplication and communication overhead are introduced

In the following we start from the mentioned developments for shared memory systemsand present modifications which will finally allow efficient computation of Grobner bases alsofor systems with distributed memory To achieve this we have concentrated on the followingobjectives reducing the memory consumption and avoiding communication overhead Weremove needless steps of the reduction split the columns of the matrix in blocks for distributionand review the effectiveness of the SIMPLIFY function

At the end we will evaluate benchmarks of an implementation using eight distributed nodeshaving 32 processor cores each The source code is available at httpsgithubcomsvrnmparallelGBC

70

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

2 Notations

In the following we will use the notation of [11] Hence K denotes a field and K[x1 xn] thepolynomial ring over K in n indeterminantes Tn is defined as the set of all terms xα1

1 middot middotxαnn

σ is a term ordering on this set For a polynomial f isin K[x1 xn] with f =summ

i=1 ci middot tiwhere ci isin K and ti isin T

n for all i we call the set Supp(f) = t1 tm support of f Thenthe leading term of f is defined as LTσ(f) = tk = maxσ(Supp(f)) and the leading coefficientis LCσ(f) = ck

Let F = f1 fs isin K[x1 xn] 0 be a set of polynomials Then I = 〈F〉 is theideal generated by F The elements of the set B = (i j) | 1 le i lt j lt s are called criticalpairs For each critical pair exists an S-polynomial Sij = 1

LCσ(fi)middot tij middot fi minus

1LCσ(fj)

middot tji middot fj

with tij =lcm(LTσ(fi)LTσ(fj))

LTσ(fi)and tji =

lcm(LTσ(fj)LTσ(fi))LTσ(fj)

The set F is a σ-Grobner basis of I if for all critical pairs the S-polynomials can be reducedto zero by the elements of F with respect to σ

If not stated otherwise we will use the degree reverse lexicographic termordering (DegRevLex)and the finite field with 32003 elements (F32003) for examples and benchmarks

3 Preliminaries

The F4 algorithm was introduced by Faugere in 1999 [3] By using the special structure ofthe matrix and column-based parallelism Faugere and Lachartre introduced a parallelizationimproving the performance remarkable [4] We have presented another modification [13] for F4speeding up the computation by row-based parallelization

In the following we give a quick summary about Grobner bases computation and the men-tioned developments For a given set of polynomials F = f1 fs isin K[x1 xn] 0generating an ideal I = 〈F〉 a σ-Grobner basis G = g1 gt isin K[x1 xn] can be com-puted using the F4 algorithm by the following four steps

1 Create and update the set of critical pairs B using Gebauerrsquos and Mollerrsquos UPDATE func-tion [6] This function guarantees that the leading terms tij middot fi = tji middot fj of the minuendand subtrahend of the S-polynomial is unique among the critical pairs

2 Select a subset of all critical pairs for reduction using the normal or the sugar cubestrategy [7] At this point the details are not relevant For our benchmarks we chose thesugar cube strategy Although we have to mention that our implementation supports thenormal strategy and for some of the polynomial systems we used as example this strategymight perform better

3 Symbolic preprocess the selected pairs to obtain a coefficient matrix representing theS-polynomials The matrix is additionally filled with rows representing reduction polyno-mials for each term which can be reduced using elements of the partial computed Grobnerbasis G The SIMPLIFY method can be applied to reuse results of previous reductions

4 Reduce the generated matrix until row-echelon form This is equivalent to top-reducingthe S-polynomials All non-zero rows of this matrix having leading terms which are notdivisible by any element of G are inserted into G As long as new elements are found thealgorithm continues with step 1

The most time-consuming step is the reduction of the coefficient matrix The mentioned par-allelizations of Lachartre and Faugere as well as our own approach concentrate on speeding

71

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

up this step We want to show how to use these improvements also for distributed parallelarchitectures therefore we have to review them

Starting after symbolic preprocessing we obtain a coefficient matrix M which has to bereduced to a row-echelon form M has n rows and m columns with m ge n and can bedecomposed in submatrices

1 Submatrices S1 and S2 arise from the subtrahends and minuends of the S-polynomialsSince the UPDATE function guarantees that all polynomials have distinct leading terms therepresenting rows have unique pivot columns Therefore S1 and S2 are upper-triangular

2 Submatrix R represents the reduction polynomials They were computed during symbolicpreprocessing For each reducible term there is only one reduction polynomial Becauseof that R is upper-triangular

3 Finally these submatrices can be split up in pivot and non-pivot columns The pivots of Rand S1 are forming the submatrix A and the non-pivots the submatrix B The submatrixS2 is split into C containing its pivots and D containing the non-pivot columns Thisnotation was introduced in [4]

The following example demonstrates the construction of a matrix occurring during Grobnerbases computations

Example 1 Let K = K32003 P = K[x1 x2 x3] and let the polynomials g1 = x21 + x2

2g2 = x1 middot x2 + x2

2 + x2 middot x3 and g3 = x22 + x2

3 + x3 form the ideal I = 〈g1 g2 g3〉 for which aGrobner basis with respect to DegRevLex should be computed Using UPDATE we get the criticalpairs (2 3) and (1 2) They have the same sugar degree sugar(g2 g3) = 3 = sugar(g1 g2) Sowe reduce the following polynomials

f12 =(x21 + x2

2) middot x2 = x21 middot x2 + x3

2

f21 =(x1 middot x2 + x22 + x2 middot x3) middot x1 = x2

1 middot x2 + x1 middot x22 + x1 middot x2 middot x3

f23 =(x1 middot x2 + x22 + x2 middot x3) middot x2 = x1 middot x

22 + x3

2 + x22 middot x3

f32 =(x22 + x2

3 + x3) middot x1 = x1 middot x22 + x1 middot x

23 + x1 middot x3

and as set of reduction polynomials we obtain

r1 =g3 middot x2 = x32 + x2 middot x

23 + x2 middot x3

r2 =g2 middot x3 = x1 middot x2 middot x3 + x22 middot x3 + x2 middot x

23

r3 =g3 middot x3 = x22 middot x3 + x3

3 + x23

At the end we get the following matrix M

f12f23r1r2r3f21f32

1 0 1 0 0 0 0 0 0 0 00 1 1 0 1 0 0 0 0 0 00 0 1 0 0 0 1 0 0 1 00 0 0 1 1 0 1 0 0 0 00 0 0 0 1 0 0 1 0 0 11 1 0 1 0 0 0 0 0 0 00 1 0 0 0 1 0 0 1 0 0

One can easily see the mentioned structure of the matrix The upper left submatrix is A andits pivots are highlighted Below is C and the non-pivot columns are forming B and D

72

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

Using this decomposition the (full) reduction of the matrix can be computed using thefollowing algorithm

1 Primary reduction Reduce B to Aminus1 middotB

2 Secondary reduction Reduce D to D minus C middotAminus1 middotB

3 Final reduction Reduce D to its reduced row-echelon form using Gaussian elimination

4 Optional reduction Reduce B using the pivots of D

Especially the primary reduction can be efficiently parallelized since the matrix is in uppertriangular form and so all pivots are known The primary and secondary reduction can becomputed in parallel because a reduced row of B can be applied independently on rows of D

After the final reduction all non-zero rows of D are elements of the Grobner basis andcan be used to compute further critical pairs Matrix (AB) does not contain any requiredelements because by construction the pivots of A are equivalent to leading terms which arealready contained in the Grobner basis Hence the fourth step is optional and only required ifSIMPLIFY is used

There are two different approaches to achieve parallelization Column-based as suggestedby Faugere and Lachatre and row-based as suggested by us Actually these two are not mu-tually exclusive and we will use this property to advance the parallelism on architectures withdistributed memory In the following we will use the row-based approach for shared memoryparallelism but one can easily see that all modifications are also applicable to the column-basedapproach of Faugere and Lachatre

4 Matrix Distribution

In the case of the matrix reduction during Grobner basis computation we have to considerhow to distribute the coefficient matrices with least duplication and communication Like anyother parallel and distributed algorithm for transforming matrices into row echelon form wecan choose between row- and column-based distribution or a combination of both

If row-based or combined distribution is chosen the algorithm scatters rows or blocks amongthe computation nodes and these need to send rows from one to each other if they are requiredfor further reductions To reduce the communication overhead this needs to use a strategywhich decides how the matrix is distributed Since we use rows-based parallelization for theshared memory level and since the column-based distribution does play well with the specialproperties of Grobner basis computations we didnrsquot analyse the effectiveness of the row-basedor combined approach

If column-based distribution is chosen the pivot matricesA and C have to be send to all nodesand the non-pivot matrices B and D can be distributed without duplication Since all pivotsare preset for primary and secondary reduction this approach does only require communicationbefore and after all reductions are done

Furthermore the matrices are sparse and by using appropriate matrix formats the commu-nication overhead can be reduced even more We chose to store the off-diagonal elements of Aand C in a coordinate list ie there is one list storing tuples of row column and value Thisformat allows reordering in parallel executable sets to improve the row-based parallelization aspresented in [13] For B and D a modified list of lists format is used storing pairs of row indexand value for each column This allows to distribute columns independently As suggested in[8 Chapter 6] the columns are distributed round-robin to optimize load balancing Afterwards

73

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

each node can use row-based parallelism on the local shared memory The following shows thedistribution of the matrix constructed in example 1

Example 2 Using two parallel nodes the matrix M of the previous example is decomposedinto one coordinate list and two lists of lists Afterwards the pivots are sent to both nodes andthe two sets of non pivot columns are distributed among the nodes Finally the two nodes areholding the following data

Node 1 Node 2

(A C)(411) (431) (201)(211) (351)(051)(151)(161)

(B D)5 (61)7 (41)9 (43)

(A C)(411) (431) (201)(211) (351)(051)(151)(161)

(B D)6 (21) (31)8 (61) -10 (41) -

Table 1 shows that the final reduction can be computed on a single node because thesubmatrix D consumes only a tiny fraction of the whole matrix One can easily check thatthis is true in general the submatrices S1 and S2 have s rows each and the submatrix R hasr rows There are p pivot columns and n non-pivot columns Hence the coefficient matrix has2 middots+r rows and p+n columns After primary and secondary reduction the final reduction onlyrequires the submatrix D which has s remaining rows and n columns Therefore all reducedcolumns can be gathered on one node which executes the Gaussian elimination on D

Polynomial System Sugar degree primary matrix final matrix ratio ()Gametwo 7 [10] 17 7731 x 5818 2671x2182 13Cyclic 8 [1] 14 3819 x 4244 612x1283 48Cyclic 9 16 70251 x 75040 4014x10605 08

Katsura 12 [9] 9 12141 x 11490 2064x2155 32Katsura 13 9 26063 x 23531 4962x4346 35Eco 12 [12] 9 12547 x 10937 2394x1269 22Eco 13 10 25707 x 24686 2883x2310 10F966 [5] 9 60274 x 63503 4823x9058 11

Table 1 Ratio of primary matrix and final matrix during reduction for selected problems

The optional reduction is an obstacle for the effectiveness of the algorithm since it requiresthat the reduced matrix D has to be distributed again to be applied on B Because of that weexamine if the optional reduction is useful at all Even more we put to test if the SIMPLIFY

method and distributed computation play well together

5 Simplifying the F4 Algorithm

Removing the optional reduction may scale down the required communication overhead andthe reduction time Even more if SIMPLIFY isnrsquot used during symbolic preprocessing the

74

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

distributed matrix has not to be gathered completely since the columns of the reduced matrixB are not required after primary and secondary reduction

Algorithm 1 SIMPLIFY

Input t isin Tn a term f isin K[x1 xn] a polynomial F isin (Fk)k=1dminus1) where Fk is

finite subset of K[x1 xn]Output a non evaluated product ie an element of Tn timesK[x1 xn]foreach u isin list of divisors of t do1

if existj(1 le j lt d) such that (u middot f) isin Fj then2

Fj is the row echelon form of Fj wrt σ 3

there exists a (unique) p isin Fj

+such that LTσ(p) = LTσ(u middot f) 4

if u 6= t then return SIMPLIFY( tu pF) else return (1 p)5

end6

end7

The SIMPLIFY method does not guarantee that a reduction is improved by reusing previousresults Actually SIMPLIFY proves it effectiveness mostly by application Hence we requirea best possible implementation of the method Algorithm 1 is a repetition of the originalSIMPLIFY [3] It leaves some details open and there are some possibilities for optimization

bull Searching through all divisors of t is time consuming regarding the fact that only somedivisors of u will satisfy the condition (u f) isin Fj for j isin (1 le j lt d)

bull To check if there exists a j with (u f) in Fj it is important how Fj is stored A naiveimplementation will require to loop over all rows of Fj until the condition is satisfied

bull This algorithm does not check if there is another jprime 6= j satisfying the condition andprovides a better replacement

To address these issues we propose the following modifications

bull All rows of F1 Fdminus1 are stored in a two-dimensional map The first key is a polynomialf and the second is a term u This allows to update (u f) if a better replacement is foundBy that only one value per pair is stored This will decrease the required memory

bull The first map should provide a fast random access to the value of key f and the secondmap should have an ordering to allow a decreasing iteration of the possible terms In thisway the search space for possible replacements is reduced to the multiples of f only

bull The value of a map element is the reduced form of f middot u

We call this data structure SimplifyDB We can provide an improved version of SIMPLIFY asshown by algorithm 2 Additionally we have to introduce a function to update the SimplifyDB

Therefore after reduction we execute algorithm 3 for each row of Fj

+ The insertion step allows

us to compare candidates for the SimplifyDB In our implementation for two candidates thebetter is the one which has less elements in its support This is equivalent to the first weightedlength function wlen(p) = Supp(p) in [2] At this point we didnrsquot try any other suggestedweighted length function

SIMPLIFY can be improved even more During symbolic preprocessing it is called twiceonce for the selected critical pair (m f) with m isin T

n and f isin G and once to create reduction

75

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

Algorithm 2 SIMPLIFY with SimplifyDB

Input t isin Tn a term f isin K[x1 xn] a polynomial SimplifyDB

Output a non evaluated product ie an element of Tn timesK[x1 xn]foreach u le t isin SimplifyDB[f ] do1

if u divides t then2

p = SimplifyDB[f ][u] 3

if u 6= t then return SIMPLIFY( tu p SimplifyDB) else return (1p) 4

end5

end6

Algorithm 3 Insertion into SimplifyDB

Input t isin Tn a term f p isin K[x1 xn] polynomials SimplifyDB

Output SimplifyDBif existu isin SimplifyDB[f ] t = u then1

Replace SimplifyDB[f ][u] with p if it is better 2

else3

SimplifyDB[f ][t] = p 4

end5

polynomials mprime middot f with mprime isin Tn and f prime isin G As one can easily see the second input parameter

is always an element of G So it stands to reason to restrict SIMPLIFY

SIMPLIFY(t i) where i is the index of gi isin G

Still there is the recursive call of SIMPLIFY taking a polynomial p as parameter which mightnot be an element of G Recall that p was found in the SimplifyDB using f and a term u = t

z

with z isin Tn With the knowledge that f = gi isin G we can write p = f middotuminus r = gi middotuminus r where

r isin K[x1 xn] is the sum of all reductions applied on f during a previous reduction stepThe recursive call is looking for another polynomial pprime which simplifies z middot p = z middot (gi middot u minus r)If such a polynomial pprime exists we can write pprime = z middot (gi middot u minus r) minus rprime = z middot u middot gi minus (z middot r minus rprime)Hence if the SimplifyDB stores pprime at index (gi z middot u) instead of (p z) the recursion is obsoleteand SIMPLIFY can be replaced with algorithm 4 being recursion free

Algorithm 4 New SIMPLIFY algorithm

Input t isin Tn a term i is the index of gi isin G SimplifyDB

Output a non evaluated product ie an element of Tn timesK[x1 xn]foreach u le t isin SimplifyDB[f ] do1

if u divides t then return ( tu SimplifyDB[f ][u]) 2

end3

Before benchmarking different variants of the distributed versions of the algorithm a firstlook at timings using only shared memory will thin out the number of combinations Forthe following computations we used a system with 48 AMD Opteron

TM

6172 cores having64 gigabyte of main memory The implementation of the parallelization for the shared memoryis presented in [13] and in its latest version it is realized using Intel Rcopy Threading Building Blocks(TBB) and Open Multi-Processing (OpenMP) for parallelization

76

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

Table 2 shows that the optional reduction is mostly useless and can be left out duringGrobner basis computation Table 3 shows that our new recursion-free SIMPLIFY is also inpractice faster and even more memory efficient

Finally SIMPLIFY is improving performance by increasing memory usage and so for solvinglarger polynomial systems it might be possible to find a solution within the bounds of availablememory by disabling SIMPLIFY Consequently we will compare computations with and withoutthe improved SIMPLIFY for the distributed parallel implementation in the following section

Polynomial systems without optional reduction with optional reductionmax matrix size runtime max matrix size runtime

Gametwo 7 7808 x 5895 2846 7731 x 5818 2985Cyclic 8 3841 x 4295 1118 3819 x 4244 1215Cyclic 9 70292 x 75080 6067 70251 x 75040 6283

Katsura 12 12142 x 11491 3449 12141 x 11490 3666Katsura 13 26063 x 23531 1522 26063 x 23531 1692Eco 12 12575 x 11349 2522 12547 x 10937 2836Eco 13 25707 x 24686 9176 25707 x 24686 1037F966 60898 x 63942 9832 60274 x 63503 1185

Table 2 Comparison of computations with and without optional reduction The new SIMPLIFY

algorithm was used in both cases

Polynomial with new SIMPLIFY with original SIMPLIFY without SIMPLIFYsystems runtime (s) memory runtime memory runtime memory

Gametwo 7 2846 459MB 2882 721MB 2997 262MBCyclic 8 1118 262MB 1443 393MB 1228 131MBCyclic 9 6067 156GB 6492 240GB 5429 210GB

Katsura 12 3449 655MB 3928 157GB 4374 328MBKatsura 13 1522 256GB 1872 727GB 2071 917MBEco 12 2522 328MB 3875 138GB 5087 262MBEco 13 9176 114GB 1364 577GB 2182 852MBF966 9832 256GB 2182 113GB 2125 125GB

Table 3 Comparison of original and new SIMPLIFY

6 Benchmarks

For the following benchmarks of our distributed implementation we used a cluster of up toeight systems having 16 Intel Rcopy Xeon Rcopy E5-2670 cores with hyperthreading and 64GB of RAMallowing us using up to 256 parallel threads For data distribution we use the Message PassingInterface (MPI) and the BoostMPI wrapper

Table 4 compares once again runtimes for computations with and without SIMPLIFY usingone two or four nodes For all polynomial input systems the computation time goes up andthe distribution has no positive effect However we accomplished to speed-up the reductiontime This is not an inconsistency The overall runtime goes up due to the communication

77

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

overhead and the possibility to improve the performance is limited to decreasing the reductiontime Hence the problem is the small size of the given polynomial systems Figure 1 illustratesthis issue for Cyclic 9

Table 5 adds further and more difficult examples Especially for Katsura 15 and Cyclic 10the distributed parallelization takes effect providing a speed-up of 23 and 27 for the overallcomputation time and 57 and 50 for the reduction using four respectively eight nodes Exclud-ing the Eco 14 system the computation is most effective without SIMPLIFY and in particularfor Cyclic 10 computations were not even possible with it due to memory overflows

Eco 14 is an counterexample because it is not possible to decrease the computation timeusing a distributed system This is caused by the effectiveness of SIMPLIFY for the probleminstance

The crashed computations for Katsura 15 and for Cyclic 10 without SIMPLIFY with twonodes are caused by a not yet solved overflow in the MPI implementation if more than 512 MBhave to be transfered in one operation This does not happen with four or eight nodes becausethe matrix size for each node decreases by factor two respectively four

At the end no distributed computation with SIMPLIFY is faster and hence it should beremoved in further developments of distributed parallel algorithms for Grobner bases compu-tations

Polynomial systems with SIMPLIFY without SIMPLIFY nodes 1 2 4 1 2 4

Gametwo 7 2985 3455 5603 2848 3853 2888(5549) (6709) (6010) (6630) (4607) (3427)

Cyclic 8 7798 1112 9520 7497 1406 2078(1327) (1707) (1953) (1332) (1473) (1168)

Cyclic 9 5060 5182 4947 3306 3617 4276(2222) (1952) (1388) (1499) (1224) (7373)

Katsura 12 4200 4636 5523 2859 3997 6685(6083) (8220) (7762) (6699) (4535) (3362)

Katsura 13 1874 1900 1864 1396 1588 1760(4046) (4661) (3682) (5003) (3107) (1815)

Eco 12 2135 2940 4149 2498 4108 8802(2564) (3760) (3953) (6458) (3664) (3097)

Eco 13 9178 1065 1209 1114 1575 2126(1210) (1632) (1462) (3865) (2310) (1467)

F966 9188 1062 1321 9360 1392 1851(2086) (2629) (2391) (3859) (2632) (1870)

Table 4 Distributed computation (and reduction) times for 12 or 4 nodes

78

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

1woS 2woS 4woS 1wS 2wS 4wS

0

100

200

300

400

500

600

Overhead

Reduction

Prepare

Update

Figure 1 Computation time in detail for Cyclic 9 with and without SIMPLIFY

Poly sys with SIMPLIFY without SIMPLIFY nodes 1 2 4 8 1 2 4 8

Katsura 14 9575 8310 7489 7448 7756 6599 6754 991(3139) (2634) (2012) 1691 (3984) (2244) (1351) (86)

Katsura 15 5719 crashed 3440 3252 5615 3857 3252 3372(2571) (-) 1272 1008 (3781) (1960) (1094) (666)

Cyclic 10 crashed crashed crashed crashed 30400 crashed 13270 11280(-) (-) (-) (-) (25240) (-) (7862) (5010)

Eco 14 5098 5194 5526 626 8005 7870 9967 1660(1106) (1177) (9802) (8938) (4113) (2240) (1277) (7824)

Table 5 Distributed computation (and reduction) times for larger input systems

7 Conclusion

We have shown that the parallelization of the F4 algorithm can be expanded form a sharedmemory system to a cluster of distributed nodes providing a multiple of the computation powerof a single system This was primarily achieved by using column-based parallelism removingthe optional reduction and the SIMPLIFY function It allowed us to solve larger input systemslike Katsura 15 or Cyclic 10 almost three times faster using four or respectively eight distributednodes Some work is still required to optimize the speed-up and the communication of the nodeshas to be improved to make solving of even larger problem instances possible

79

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

References

[1] Goran Bjorck and Uffe Haagerup All cyclic p-roots of index 3 found by symmetry-preservingcalculations 2008

[2] Michael Brickenstein Slimgb Grobner bases with slim polynomials Revista Matematica Com-

plutense 23(2)453ndash466 2010

[3] Jean-Charles Faugere A new efficient algorithm for computing Grobner bases (F4) Journal of

Pure and Applied Algebra 139(1ndash3)61ndash88 June 1999

[4] Jean-Charles Faugere and Sylvain Lachartre Parallel Gaussian Elimination for Grobner basescomputations in finite fields In Proceedings of the 4th International Workshop on Parallel and

Symbolic Computation PASCO rsquo10 pages 89ndash97 New York USA July 2010 ACM

[5] Jean-Charles Faugere Moreau Francois De Saint Martin and Fabrice Rouillier Design of regularnonseparable bidimensional wavelets using Groebner basis techniques IEEE Transactions on

Signal Processing 46(4)845ndash856 1998

[6] Rudiger Gebauer and H Michael Moller On an installation of buchbergerrsquos algorithm Journal

of Symbolic Computation 6275ndash286 December 1988

[7] Alessandro Giovini Teo Mora Gianfranco Niesi Lorenzo Robbiano and Carlo Traverso rdquoOnesugar cube pleaserdquo or selection strategies in the buchberger algorithm In Proceedings of the 1991

international symposium on Symbolic and algebraic computation ISSAC rsquo91 pages 49ndash54 NewYork USA 1991 ACM

[8] Gene H Golub and Charles F Van Loan Matrix Computations Johns Hopkins Studies in theMathematical Sciences Johns Hopkins University Press 1996

[9] Shigetoshi Katsura Wataru Fukuda Sakari Inawashiro Nahomi Fujiki and Rudiger GebauerDistribution of effective field in the ising spin glass of the plusmnj model at t = 0 Cell Biochemistry

and Biophysics 11309ndash319 1987

[10] David M Kreps and Robert Wilson Sequential equilibria Econometrica 50(4)863ndash94 July 1982

[11] Martin Kreuzer and Lorenzo Robbiano Computational Commutative Algebra 1 ComputationalCommutative Algebra Springer 2000

[12] Alexander Morgan Solving polynomial systems using continuation for engineering and scientific

problems Classics in applied mathematics SIAM 2009

[13] Severin Neumann Parallel reduction of matrices in Grobner bases computations In Vladimir PGerdt Wolfram Koepf Ernst W Mayr and Evgenii V Vorozhtsov editors Computer Algebra in

Scientific Computing volume 7442 of Lecture Notes in Computer Science pages 260ndash270 SpringerBerlin Heidelberg 2012

[14] Kurt Siegl A parallel factorization tree grobner basis algorithm In Parallel Symbolic Computation

PASCO 1994 Proceedings of the First International Symposium River Edge USA 1994 WorldScientific Publishing Co Inc

80

Generating Asymptotically Non-Terminant

Initial Variable Values for Linear Diagonalizable

Programs

Rachid Rebiha1lowast Nadir Matringe23 and Arnaldo Vieira Moura1

1 Institute of Computing UNICAMP University of Campinas SP Brasilrachidicunicampbr

2 Universit de Poitiers Laboratoire Mathmatiques et Applications France3 Institue de Mathematiques de Jussieu Universite Paris 7-Denis Diderot France

Abstract

We present the key notion of asymptotically non-terminant initial variable values fornon-terminant loop programs We show that those specific values are directly associated toinital variable values for which the corresponding loop program does not terminate Con-sidering linear diagonalizable programs we describe powerful computational methods thatgenerate automatically and symbolically a semi-linear space represented by a linear systemof equalities and inequalities Each element of this space provides us with asymptoticallynon-terminant initial variable values Our approach is based on linear algebraic methodsWe obtain specific conditions using certain basis and matrix encodings related to the loopconditions and instructions

1 Introduction

Research on formal methods for program verification [12 15 8 17] aims at discovering math-ematical techniques and developing their associated algorithms to establish the correctness ofsoftware hardware concurrent systems embedded systems or hybrid systems Static programanalysis [12 15] is used to check that a software is free of defects such as buffer overflows orsegmentation faults which are safety properties or termination and non-termination which areliveness properties Proving termination of while loop programs is necessary for the verificationof liveness properties that any well behaved and engineered system or any safety critical em-bedded system must guarantee We could list here many verification approaches that are onlypractical depending on the facility with which termination can be automatically determinedVerification of temporal properties of infinite state systems [20] is another example

Recent work on automated termination analysis of imperative loop programs has focusedon a partial decision procedure based on the discovery and synthesis of ranking functions Suchfunctions map the loop variable to a well-defined domain where their value decreases furtherat each iteration of the loop [9 10] Several interesting approaches based on the generationof linear ranking functions have been proposed [3 4] for loop programs where the guards andthe instructions can be expressed in a logic supporting linear arithmetic For the generation ofsuch functions there are effective heuristics [14 10] and in some cases there are also completemethods for the synthesis of linear ranking functions [16] On the other hand it is easy togenerate a simple linear terminant loop program that does not have a linear ranking functionAnd in this case such complete synthesis methods [16] fail to provide a conclusion about thetermination or the non termination of such a program

lowastSupported by FAPESP grant 201108947-1 and FAPESP grant BEPE 201304734-9

81

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

In this work we address the non-termination problem for linear while loop programs Inother words we consider the class of loop programs where the loop condition is a conjunc-tion of linear inequalities and the assignments to each of the variables in the loop instructionblock are affine or linear forms In matrix notation linear loop programs will be representedin a general form as while (Bx gt b) x = Ax + c (ie A and B are matrices b and c arevectors of real numbers and that x is a vector of variables) Without loss of generality theterminationnon-termination analysis for such a class of linear programs could be reduced tothe problem of terminationnon-termination for homogeneous linear programs [6 21] Thosebeing programs where linear assignments consist of homogeneous expressions and where thelinear loop condition consists of at most one inequality Concerning effective program trans-formations and simplification techniques non-termination analysis for programs presented in amore complex form can often be reduced to an analysis of a program expressed in this basicaffine form Despite tremendous progress over the years [6 5 7 13 11 2 1] the problem offinding a practical sound and complete methods for determining or analyzing non termina-tion remains very challenging for this class of programs and for all initial variable values Westarted our investigation from our preliminary technical reports [19 18] where we introduced atermination analysis in which algorithms ran in polynomial time complexity Here consideringa non terminating loop we introduce new static analysis methods that compute automaticallyand in polynomial time complexity the set of initial input variable values for which the programdoes not terminate and also a set of initial inputs values for which the program does terminateThis justifies the innovation of our contributions ie none of the other mentioned related workis capable of generating such critical information over non-terminating loops We summarizeour contributions as follows

bull To the best of our knowledge we introduce a new key notion for non-termination and ter-mination analysis for loop programs we identify the important concept of asymptoticallynon-terminant initial variable values ANT for short Any asymptotically non-terminantinitial variable values can be directly related to an initial variable value for which theconsidered program does not terminate

bull Our theoretical contributions provide us with efficient computational methods running inpolynomial time complexity and allowing the exact computation of the set of all asymp-totically non-terminant initial variable values for a given loop program

bull We generate automatically a set of linear equalities and inequalities describing a semi-linear space that represents symbolically the set of all asymptotically non-terminant initialvariable values The set of ANT values contains the set of non-terminant initial variablevalues On the other hand the complementary set of ANT values is a precise under-approximation of the set of terminant inputs for the same program

Example 11 (Motivating Example) Consider the following program depicted below on theleft We show a part of the output of our algorithm below on the right

(i) Pseudo code

while(2x+3y-zgt0)

x= y + z

y= -(12)x+(32)y -(12)z

z=(32)x -(32)y+(12)z

(ii) Output of our prototype

Locus of ANT

[[4u[1]+u[2]+u[3]gt0]

AND[u[1]+4u[2]+4u[3]gt0]

AND[-u[1]+u[2]-u[3]=0]]

OR[[-u[1]+u[2]-u[3]gt0]]

82

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

The semi-linear ANT = u = (u1 u2 u3)⊤ isin E | 4u1 + u2 + u3 gt 0 and u1 + 4u2 + 4u3 gt

0 andminusu1 + u2 minus u3 = 0 cup u = (u1 u2 u3)⊤ isin E | minus u1 + u2 minus u3 gt 0 represents symbolically

all asymptotically initial variable values that are directly associated to initial variable valuesfor which the program does not terminate On the other hand the complementary of this setco-ANT = u = (u1 u2 u3)

⊤ isin E | 4u1 + u2 + u3 le 0 or u1 + 4u2 + 4u3 le 0 orminusu1 + u2 minus u3 6=0 cap u = (u1 u2 u3)

⊤ isin E | minus u1 + u2 minus u3 le 0 is a precise under-approximation of the setof all initial variable values on which the program terminates

The rest of this article is organized as follows Section 2 can be seen as a preliminarysection where we introduce some key notions and results from linear algebra which will be usedto build our computational methods In this section we also present our computational modelfor programs and some further notations Section 3 introduces the new notion of asymptoticallynon-terminant initial variable values Section 4 provides the main theoretical contributionsof this work This section also presents our computational methods that generate a symbolicrepresentation of the asymptotically non-terminant variable values for linear programs Weprovide a complete dicussion in Section 5 Finally Section 6 states our conclusions

2 Linear Algebra and Linear Loop Programs

Here we present key linear algebraic notions and results which are central in the theoretical andalgorithmic development of our methods We denote by M(mnK) the set of mtimes n matriceswith entries in K and simply M(nK) when m = n The Kernel of A also called its nullspacedenoted by Ker(A) is Ker(A) = v isin K

n | A middot v = 0Km In fact when we deal with squarematrices these Kernels are Eigenspaces Let A be a ntimes n square matrix with entries in K Anonzero vector x isin K is an eigenvector for A associated with the eigenvalue λ isin K if A middotx = λxie (A minus λIn) middot x = 0 where In is the n times n identity matrix The nullspace of (A minus λIn) iscalled the eigenspace of A associated with eigenvalue λ Let n be a positive integer we willdenote R

n by E and its canonical basis by Bc = (e1 en) Let A be a square matrix inM(nR) Let us introduce the notation Spec(A) for the set of eigenvalues of A in R and wewill write Spec(A)lowast for the set Spec(A)minus 0 For λ isin Spec(A) we will denote by Eλ(A) thecorresponding eigenspace Throughout the paper we write dλ for the dimension of Eλ(A) Wewill say that A is diagonalizable if E = oplusλisinSpec(A)Eλ(A) Let A be a diagonalizable matrixFor each eigenspace Eλ(A) we will take a basis Bλ = (eλ1 eλdλ

) and we define

B = cupλisinSpec(A)Bλ

as a basis for E

Definition 21 Let x belong to E We denote by xλ its component in Eλ(A) If x admits the

decompositionsum

λisinSpec(A)(sumdλ

i=1 xλieλi) in B we have xλ =sumdλ

i=1 xλieλi

We denote by P the transformation matrix corresponding to B whose columns are the vectorsof B decomposed in Bc Letting di denote the integer dλi

for the ease of notation we recallthe following lemma

Lemma 21 We have Pminus1AP = diag(λ1Id1 λtIdt) We denote by D the matrix Pminus1AP

As we will obtain our results using the decomposition of x in B we recall how one obtains itfrom the decomposition of x in Bc

83

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

Lemma 22 Let x isin E If x =sumn

i=1 xiei = (x1 xn)⊤ isin Bc and x decomposes as

sumtj=1(

sumdj

i=1 xλj ieλj i) in B the coefficients xλj i are those of the column vector Pminus1x in Bc

Throughout the paper we write lt gt for the canonical scalar product on E which is given by lt

x y gt=sumn

i=1 xiyi and recall as it is standard in static program analysis that a primed symbolxprime refers to the next state value of x after a transition is taken Next we present transitionsystems as representations of imperative programs and automata as their computational models

Definition 22 A transition system is given by 〈x L T l0Θ〉 where x = (x1 xn) is a setof variables L is a set of locations and l0 isin L is the initial location A state is given by aninterpretation of the variables in x A transition τ isin T is given by a tuple 〈lpre lpost qτ ρτ 〉where lpre and lpost designate the pre- and post- locations of τ respectively and the transitionrelation ρτ is a first-order assertion over x cup xprime The transition guard qτ is a conjunction ofinequalities over x Θ is the initial condition given as a first-order assertion over x Thetransition system is said to be linear when ρτ is an affine form

We will use the following matrix notations to represent loop programs and their associatedtransitions systems

Definition 23 Let P be a loop program represented by the transition system 〈x =(x1 xn) l0 T = 〈l l qτ ρτ 〉 l0Θ〉 We say that P is a linear loop program if the followingconditions hold

bull Transition guards are conjunctions of linear inequalities We represent the loop conditionin matrix form as V x gt b where V isin M(mnR) and b isin R

m By V x gt b we mean thateach coordinate of vector V x is greater than the corresponding coordinate of vector b

bull Transition relations are affine or linear forms We represent the linear assignments inmatrix form as x = Ax+ c where A isin M(nR) and c isin R

n

The linear loop program P = P (A V b c) will be represented in its most general form aswhile (V x gt b) x = Ax+ c

In this work we use the following linear loop program classifications

Definition 24 We identify the following three types of linear loop programs from the morespecific to the more general form

bull Homogeneous We denote by PH the set of programs where all linear assignments consistof homogeneous expressions and where the linear loop condition consists of at most oneinequality If P is in PH then P will be written in matrix form as while (lt v x gtgt

0) x = Ax where v is a (ntimes 1)-vector corresponding to the loop condition and whereA isin M(nR) is related to the list of assignments in the loop We say that P has ahomogeneous form and it will also be denoted as P (A v)

bull Generalized Condition We denote by PG the set of linear loop programs where the loopcondition is generalized to a conjunction of multiple linear homogeneous inequalities

bull Affine Form We denote by P A the set of loop programs where the inequalities and theassignments are generalized to affine expressions If P is in P A it will be written aswhile (V x gt b) x = Ax+ c for A and V in M(nR) b isin R

m and c isin Rn

84

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

Without lost of generality the static analysis for the class of linear programs P A could bereduced to the problem of terminationnon-termination for homogeneous linear programs inPH In this work we consider programs in PH The generalization to programs in P A canalready be done and it will be reported elsewhere

3 Asymptotically Non-terminant Variable Values

In this section we present the new notion of asymptotically non-terminant variable values Itwill prove to be central in analysis of termination in general Let A be a matrix in M(nR)and v be a vector in E Consider the program P (A v) while (lt v x gtgt 0) x = Ax whichtakes values in E We first give the definition of the termination of such a program

Definition 31 The program P (A v) is said to be terminating on x isin E if and only iflt vAk(x) gt is not positive for some k ge 0

In other words Definition 31 states that if the program P (A v) performs k ge 0 loopiterations from initial variables xin E we obtain x = Ak(x) Thus if lt vAk(x) gtle 0the loop condition is violated and so P (a v) terminates Next we introduce the followingimportant notion

Definition 32 We say that x isin E is an asymptotically non terminating value for P (A v) ifthere exists kx ge 0 such that P (A v) is non terminating on Akx(v) We will write that x isANT for P (A v) or simply x is ANT We will also write that P (A v) is ANT on x

Note that if P (A v) is non terminating on Akx(x) then lt vAk(x) gt is gt 0 for k ge kxThe following result follows directly from the previous definition

Corollary 31 An element x isin E is ANT if and only if lt vAk(x) gt is positive for k largeenough

If the set of ANT points is not empty we say that the program P (A v) is ANT We willalso write NT for non terminant For the programs we study here the following lemma alreadyshows the importance of such a set

Lemma 31 The program P (A v) is NT if and only if it is ANT

Proof It is clear that NT implies ANT (ie NT sube ANT ) as a NT point of P (A v) is ofcourse ANT (with kx = 0) Conversely if P (A v) is ANT call x an ANT point then Akx(x)is a NT point of P (A v) and so P (A v) is NT

As one can easily see the set of NT points is included in the set of ANT points But themost important property of the ANT set remains in the fact that each of its point provides uswith an associated element in NT for the corresponding program In other words each elementx in the ANT set even if it does not necessarily belong to the NT set refers directly to initialvariable values yx = Ak[x](x) for which the program does not terminate ie yx is an NT pointWe can say that there exists a number of loop iterations k[x] departing from the initial variable

values x such that Ak[x](x) correspond to initial variable values for which P (A v) does notterminate But it does not necessarily implies that x is also an NT point for P (A v) In factprogram P (A v) could terminate on the initial variable values x by performing a number of

85

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

loop iterations strictly smaller than k[x] On the other hand the complementary set co-ANT

provides us with a quite precise under approximation of the set of all initial variable values forwhich the program terminates

The set of ANT points of a program is also important to the understanding of the terminationof a program with more than one conditional linear inequality as well as for termination overthe rationals for example This will be reported elsewhere

4 Automated generation of ANT loci

In this section we show how we generate automatically and exactly the ANT Locus ie the setof all ANT points for linear diagonalizable programs over the reals We represent symbolicallythe computed ANT Locus by a semi-linear space defined by linear equalities and inequalitiesConsider the program P (A v) while (lt v x gtgt 0) x = Ax The study of ANT setsdepends on the spectrum of A Recall the introductory discussion and Definition 21 at Section2

Proposition 41 For x in E and k ge 1 the scalar product lt vAk(x) gt is equal to

sum

λisinSpec(A)

λk lt v xλ gt=sum

λisinSpec(A)lowast

λk lt v xλ gt

Proof It is a direct consequence of the equality Ak(xλ) = λkxλ

41 The regular case

We first analyze the situation where A is what we call regular

Definition 41 We say that A is regular if Spec(A) cap[

minus Spec(A)]

is an empty set ie ifλ belongs to Spec(A) then minusλ does not belong to Spec(A)

In this case we make the following observation

Proposition 42 Let micro be the nonzero eigenvalue of largest absolute value if it exists such thatlt v xmicro gt is nonzero For k large the quantity lt vAk(x) gt is equivalent to microk lt v xmicro gt

Proof Indeed we can write lt vAk(x) gt as

microk lt v xmicro gt +sum

λ|λ|lt|micro|

λk lt v xλ gt= microk(lt v xmicro gt +sum

λ|λ|lt|micro|

λk

microklt v xλ gt)

and λk

microk approaches zero when k goes to infinity

We then define the following sets

Definition 42 For micro a positive eigenvalue of A we define Smicro as follows

Smicro = x isin Elt v xmicro gtgt 0 lt v xλ gt= 0 for |λ| gt |micro|

86

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

In order to obtain Smicro for all positive eigenvalues micro of A one needs to calculate lt v xmicro gtand lt v xλ gt for all eigenvalues λ such that |λ| gt |micro| For all eigenvalues λ involved inthe computation of Smicro one also needs to evaluate the coefficients cλi =lt v eλi gt for all

eigenvectors eλi isin B and 1 le i le dλ Thus we have lt v xλ gt=sumdλ

i=1 cλixλi Now we onlyneed to compute the coefficient xλi which are those of the column vector Pminus1x in Bc whereP is the transformation matrix corresponding to B See Lemma 22

We ca now state the following theorem allowing the exact computation of the ANT Locusfor the regular case

Theorem 41 The program P (A v) is ANT on x if and only if x belongs to

microgt0isinSpec(A)

Smicro

Proof Let x belong to E If all lt v xλ gt are zero for λ isin Spec(A) then lt vAk(x) gt= 0and x is not ANT Otherwise let micro be the eigenvalue of largest absolute value such thatlt v xmicro gt is nonzero Then according to Proposition 42 the sign of lt vAk(x) gt is the signof microk lt v xmicro gt for k large If micro is negative this sign will be alternatively positive and negativedepending on the parity of k and x is not ANT If micro is positive this sign will be the sign oflt v xmicro gt hence x will be ANT if and only if lt v xmicro gt is positive This proves the result

Example 41 (Running example) Consider the program P (A v) depicted as follows

(i) Pseudo code

while(x+y-2zgt0)

x= x-4y-4z

y= 8x-11y-8z

z= -8x+8y+5z

(ii) Associated matrices

A =

1 minus4 minus48 minus11 minus8minus8 8 5

and v =

11minus2

Step 1 Diagonalization of the matrix A

P =

1 1 12 1 0minus2 0 1

D =

1 0 00 minus3 00 0 minus3

and Pminus1 =

1 minus1 minus1minus2 3 22 minus2 minus1

Using our notations the obtained eigenvectors (ie the column vectors of P ) are denoted asfollows e11 = (1 2minus2)⊤ eminus31 = (1 1 0)⊤ eminus32 = (1 0 1)⊤

Step 2 We compute Smicro for all positive micro isin Spec(A)lowast

bull We compute first the coefficients cλic11 =lt v e11 gt=lt (1 1minus2)⊤ (1 2minus2)⊤ gt= 7

cminus31 =lt v eminus31 gt=lt (1 1minus2)⊤ (1 1 0)⊤ gt= 2

cminus32 =lt v eminus31 gt=lt (1 1minus2)⊤ (1 0 1)⊤ gt= minus1

bull We compute the coefficient xλi which are those of the column vector Pminus1 middotu in Bc whereu = (u1 u2 u3) is the vector encoding the initial variable values

Pminus1

u1

u2

u3

=

u1 minus u2 minus u3)minus2u1 + 3u2 + 2u3)2u1 minus 2u2 minus u3)

=

x11

xminus31

xminus32

We can now proceed to the generation of the linear constraints defining a semi-linear space

87

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

describing symbolically and exactly Smicrolt v x1 gt= c11x11 = 7(u1 minus u2 minus u3)lt v xminus3 gt= cminus31xminus31 + cminus32xminus32 = minus6u1 + 8u2 + 5u3)Hence we have S1 = u = (u1 u2 u3)

⊤ isin E | (u1minusu2minusu3 gt 0)and(minus6u1+8u2+5u3 = 0)

Step 3 We apply Theorem 41 to generate the ANT Locus It reduces to the semi-linear spaceS1 = u = (u1 u2 u3)

⊤ isin E | (u1 minus u2 minus u3 gt 0) and (minus6u1 + 8u2 + 5u3 = 0)

42 The general case handling linear diagonalizable programs

For the general case in the asymptotic expansion of lt vAk(x) gt one can have compensationsbetween λk lt v xλ gt and (minusλ)k lt v xλ gt as these terms can be zero when k is even forinstance and of a well determined sign when k is odd We thus need to take care of this issueTo this end we introduce the following notation

Definition 43 If λ does not belong to Spec(A) for any x isin E we write xλ = 0

We have the following propositions which give the asymptotic behavior of lt vAk(x) gt

Proposition 43 Let micro be the nonzero eigenvalue of largest absolute value if it exists suchthat lt v x|micro| + xminus|micro| gt is nonzero For k large the quantity lt vA2k(x) gt is equivalent to

|micro|2k(lt v x|micro| + xminus|micro| gt)

Proof Indeed we can write lt vA2k(x) gt as

micro2k(lt v x|micro| gt + lt v xminus|micro| gt) +sum

|λ||λ|lt|micro|

λ2k(lt v x|λ| gt + lt v xminus|λ| gt)

= micro2k(lt v x|micro| gt + lt v xminus|micro| gt) +sum

|λ||λ|lt|micro|

λ2k

micro2k(lt v x|λ| gt + lt v xminus|λ| gt))

and λk

microk approaches to zero when k goes to infinity

Proposition 44 Let micro be the nonzero eigenvalue of largest absolute value if it exists suchthat lt v x|micro| minus xminus|micro| gt is nonzero For k large the quantity lt vA2k+1(x) gt is equivalent to

|micro|2k+1(lt v x|micro| minus xminus|micro| gt)

Proof The proof is similar to the proof of Proposition 43

As in the previous Section we introduce the following relevant sets

Definition 44 For |micro| in |Spec(A)lowast| we define the sets S0|micro| and S1

|micro| as follows

S0|micro| = x isin Elt v x|micro| + xminus|micro| gtgt 0 lt v x|λ| + xminus|λ| gt= 0 for |λ| gt |micro| and

S1|micro| = x isin Elt v x|micro| minus xminus|micro| gtgt 0 lt v x|λ| minus xminus|λ| gt= 0 for |λ| gt |micro|

In order to compute the sets S0|micro| and S1

|micro| we obtain the coefficients cλi =lt v eλi gt for alleigenvalues λ If the λ appearing as index in the coefficient cλi is not an eigenvalue then we fix

cλi = 0 and dλ = 0 (see Definition 43) Thus we have lt v x|λ| + xminus|λ| gt=sumd|λ|

i=1 c|λ|ix|λ|i +sumdminus|λ|

i=1 cminus|λ|ixminus|λ|i and lt v x|λ| minus xminus|λ| gt=sumd|λ|

i=1 c|λ|ix|λ|i minussumdminus|λ|

i=1 cminus|λ|ixminus|λ|iWe finally obtain the following main theorem

88

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

Theorem 42 The program P (A v) is ANT on x if and only if x belongs to the set

(|micro||microprime|)isin|Spec(A)lowast|times|Spec(A)lowast|

S0|micro| cap S1

|microprime|

Proof It is obvious that x is ANT if and only if lt vA2k(x) gt and lt vA2k+1(x) gt are bothpositive for k large Now reasoning as in the proof of Theorem 41 but using Propositions 43and 44 instead of Proposition 42 we obtain that lt vA2k(x) gt is positive for k large if andonly if x belongs to S0

|micro| for some micro isin |Spec(A)lowast| and that lt vA2k+1(x) gt is positive for k

large if and only if x belongs to S1|microprime| for some microprime isin |Spec(A)lowast| The result follows

The following two examples illustrate how Theorem 42 applies to different cases

Example 42 (Running example) Consider the program P (A v) depicted as follows

(i) Pseudo code

while(2x+3y-zgt0)

x=15x+18y-8z+6s-5t

y=5x+3y+z-t-3s

z=-4y+5z-4s-2t

s=-43x-46y+17z-14s+15t

t=26x+30y-12z+8s-10t

(ii) Associated matrices

A =

15 18 minus8 6 minus55 3 1 minus1 minus30 minus4 5 minus4 minus2

minus43 minus46 17 minus14 1526 30 minus12 8 minus10

v =

11231

Step 1 Diagonalization of the matrix A

P =

2 1 minus1 1 1minus1 0 2 0 minus1minus2 0 2 minus1 minus2minus4 minus1 0 minus2 minus12 2 1 2 1

D =

minus3 0 0 0 00 minus1 0 0 00 0 0 0 00 0 0 1 00 0 0 0 2

and Pminus1 =

minus3 minus3 1 minus1 1minus1 minus2 1 0 1minus5 minus4 1 minus1 210 10 minus3 2 minus4minus7 minus6 1 minus1 3

We obtain the following eigenvectors written using our notation e01 = (minus1 2 2 0 1)⊤e11 = (1 0minus1minus2 2)⊤ e21 = (1minus1minus2minus1 1)⊤ eminus11 = (1 0 0minus1 2)⊤ and eminus31 =(2minus1minus2minus4 2)⊤

Step 2 Computing Smicro for all positive micro isin Spec(A)lowast

bull Our algorithm first computes the coefficients cλi We obtain c01 = 6 c11 = minus5c21 = minus6 cminus11 = 0 and cminus31 = minus13

bull Then our algorithm computes the coefficients of the decomposition of the initial vari-able values in B They are those of the column vector Pminus1 middot u in Bc where u =(u1 u2 u3 u4 u5)

⊤ is the vector encoding the initial variable values

Pminus1

u1

u2

u3

u4

u5

=

minus3u1 minus 3u2 + u3 minus u4 + u5

minusu1 minus 2u2 + u3 + u5

minus5u1 minus 4u2 + u3 minus u4 + 2u5

10u1 + 10u2 minus 3u3 + 2u4 minus 4u5

minus7u1 minus 6u2 + u3 minus u4 + 3u5

=

xminus31

xminus11

x01

x11

x21

Now the algorithm obtains all the non-zero terms appearing in the definition of S0|λ| and S1

|λ|

lt v x|1| + xminus|1| gt= c11x11 = minus5(10u1 + 10u2 minus 3u3 + 2u4 minus 4u5)lt v x|2| + xminus|2| gt= c21x21 = minus6(minus7u1 minus 6u2 + u3 minus u4 + 3u5)

89

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

lt v x|minus3| + xminus|minus3| gt= cminus31xminus31 = minus13(minus3u1 minus 3u2 + u3 minus u4 + u5)lt v x|minus3| minus xminus|minus3| gt= minuscminus31xminus31 = 13(minus3u1 minus 3u2 + u3 minus u4 + u5)

All the sets S0|λ| and S1

|λ| can now be computed exactly

S0

|1| = u isin E | 5(10u1 + 10u2 minus 3u3 + 2u4 minus 4u5) gt 0 and minus6(minus7u1 minus 6u2 + u3 minus u4 + 3u5) = 0 and

minus 13(minus3u1 minus 3u2 + u3 minus u4 + u5) = 0

S1

|1| = u isin E|5(10u1 + 10u2 minus 3u3 + 2u4 minus 4u5) gt 0 and minus6(minus7u1 minus 6u2 + u3 minus u4 + 3u5) = 0 and

13(minus3u1 minus 3u2 + u3 minus u4 + u5) = 0

S0

|2| = u isin E| minus 6(minus7u1 minus 6u2 + u3 minus u4 + 3u5) gt 0 and minus13(minus3u1 minus 3u2 + u3 minus u4 + u5) = 0

S0

|2| = u isin E| minus 6(minus7u1 minus 6u2 + u3 minus u4 + 3u5) gt 0 and minus13(minus3u1 minus 3u2 + u3 minus u4 + u5) = 0

S1

|2| = u isin E| minus 6(minus7u1 minus 6u2 + u3 minus u4 + 3u5) gt 0 and 13(minus3u1 minus 3u2 + u3 minus u4 + u5) = 0

S0

|minus3| = u isin E| minus 13(minus3u1 minus 3u2 + u3 minus u4 + u5) gt 0

S1

|minus3| = u isin E| 13(minus3u1 minus 3u2 + u3 minus u4 + u5) gt 0

Step 3 We apply Theorem 42 to generate the ANT LocusThe algorithm computes the following intersections S0

1 capS11 S

01 capS1

2 S01 capS1

3 S02 capS1

1 S02 capS1

2 S02 cap S1

3 S03 cap S1

1 S03 cap S1

2 and S03 cap S1

1 In fact the previous computational step already allows our algorithm to perform implicit sim-plifications For instance it appears that S0

|1| = S1|1| S

0|1| = S1

|1| = S0|minus1| = S1

|minus1| S0|2| = S1

|2|

and that S0|minus3| cap S1

|minus3| is the empty set According to Theorem 42 the ANT locus reduces tothe following semi-linear space

u = (u1 u2 u3 u4 u5)⊤ isin E | minus 10u1 minus 10u2 + 3u3 minus 2u4 + 4u5 gt 0 and

minus 7u1 minus 6u2 + u3 minus u4 + 3u5 = 0 and

minus 3u1 minus 3u2 + u3 minus u4 + u5 = 0⋃

u = (u1 u2 u3 u4 u5)⊤ isin E | minus 10u1 minus 10u2 + 3u3 minus 2u4 + 4u5 gt 0 and

minus 3u1 minus 3u2 + u3 minus u4 + u5) gt 0 and

minus 7u1 minus 6u2 + u3 minus u4 + 3u5 = 0⋃

u = (u1 u2 u3 u4 u5)⊤ isin E | 7u1 + 6u2 minus u3 + u4 minus 3u5 gt 0 and

minus 3u1 minus 3u2 + u3 minus u4 + u5 = 0

5 Discussions

This work is complementary to our previous work [19] which dealt with termination analysisIn [19] we first prove a sufficient condition for the termination of homogeneous linear programsThis statement was conjectured in the important work of [21] where the first attempt toprove this result contains non trivial mistakes As we shown in [19] the actual proof of thissufficient condition requires expertise in several independent mathematical fields Also thenecessary condition proposed in [21] does not apply as expected in practice We then wentto generalize the previous result and to the best of our knowledge we presented the firstnecessary and sufficient condition (NSC for short) for the termination of linear programsIn fact this NSC exhibits a complete decidability result for the class of linear programs on all

90

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

initial values Moreover departing from this NSC we showed the scalability of these approachesby demonstrating that one can directly extract a sound and complete computational methodrunning in polynomial time complexity to determine termination or nontermination for linearprograms On the other hand all other related and previous works mentioned in this paper donot provide any techniques capable of generating automatically the set of initial input variablevalues for which a loop does not terminate The main contributions of this paper remain ona sound and complete computational method to compute the set of input variable values forwhich the programs do not terminate The overall time complexity of our algorithm is also oforder O(n3) As can be seen the main results ie Theorems 41 and 42 provide us with adirect symbolic representation of the ANT set Even if those theorems are rigorously stated andproofs are quite technical they are really easy to apply we only need to compute the explicitterms S0

|micro| and S1|microprime| in order to directly obtain a formula representing exactly and symbolically

the ANT set In a same manner we extended this techniques to linear program not necessarilydiagonalizable and we obtained similar theoretical and practical results As their associatedproofs are more technical they would required more space to be fully expressed and we left themfor an ensuing report In other more recent work on termination static analysis for programsover the rationals or the integers with several conditional linear inequalities we also show thatthe notion ANT remains central

6 Conclusion

We presented the new notion of asymptotically non-terminant initial variable values for linearprograms Considering a linear diagonalizable program our theoretical results provided us withsound complete and fast computational methods allowing the automated generation of the setsof all asymptotically non-terminant initial variable values represented symbolically and exactlyby a semi-linear space eg conjunctions and disjunctions of linear equalities and inequalitiesAlso by taking the complementary set of the semi-linear set of ANT initial variable values weobtain a precise under-approximation of the set of terminant initial variable values for the (non-terminant) program Actually this type of method can be vastly generalized to tackle the ter-mination and non-termination problem of linear programs not necessarily diagonalizable withmore than one conditional linear inequality on rational or integer initial values for instanceWe leave this investigation for an ensuing report

References

[1] Amir M Ben-Amram and Samir Genaim On the linear ranking problem for integer linear-constraint loops In Proceedings of the 40th annual ACM SIGPLAN-SIGACT symposium onPrinciples of programming languages POPL rsquo13 pages 51ndash62 New York NY USA 2013 ACM

[2] Amir M Ben-Amram Samir Genaim and Abu Naser Masud On the termination of integer loopsIn VMCAI pages 72ndash87 2012

[3] Aaron R Bradley Zohar Manna and Henny B Sipma Linear ranking with reachability In InCAV pages 491ndash504 Springer 2005

[4] Aaron R Bradley Zohar Manna and Henny B Sipma Termination analysis of integer linearloops In In CONCUR pages 488ndash502 Springer-Verlag 2005

[5] Aaron R Bradley Zohar Manna and Henny B Sipma Termination of polynomial programsIn In VMCAIrsquo2005 Verification Model Checking and Abstract Interpretation volume 3385 ofLNCS pages 113ndash129 Springer 2005

91

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

[6] Mark Braverman Termination of integer linear programs In In Proc CAV06 LNCS 4144 pages372ndash385 Springer 2006

[7] Hong Yi Chen Shaked Flur and Supratik Mukhopadhyay Termination proofs for linear simpleloops In Proceedings of the 19th international conference on Static Analysis SASrsquo12 pages 422ndash438 Berlin Heidelberg 2012 Springer-Verlag

[8] Edmund M Clarke Orna Grumberg and Doron Peled Model Checking MIT Press CambridgeMA 2000

[9] Michael Colon and Henny Sipma Synthesis of linear ranking functions In Proceedings of the 7thInternational Conference on Tools and Algorithms for the Construction and Analysis of SystemsTACAS 2001 pages 67ndash81 London UK 2001 Springer-Verlag

[10] Michael A Colon and Henny B Sipma Practical methods for proving program termination InIn CAV2002 Computer Aided Verification volume 2404 of LNCS pages 442ndash454 Springer 2002

[11] Byron Cook Andreas Podelski and Andrey Rybalchenko Termination proofs for systems codeSIGPLAN Not 41(6)415ndash426 June 2006

[12] P Cousot and R Cousot Abstract interpretation and application to logic programs Journal ofLogic Programming 13(2ndash3)103ndash179 1992

[13] Patrick Cousot and Radhia Cousot An abstract interpretation framework for termination SIG-PLAN Not 47(1)245ndash258 January 2012

[14] Dennis Dams Rob Gerth and Orna Grumberg A heuristic for the automatic generation of rankingfunctions In Workshop on Advances in Verification pages 1ndash8 2000

[15] Zohar Manna Mathematical Theory of Computation McGraw-Hill 1974

[16] Andreas Podelski and Andrey Rybalchenko A complete method for the synthesis of linear rankingfunctions In VMCAI pages 239ndash251 2004

[17] Jean-Pierre Queille and Joseph Sifakis Specification and verification of concurrent systems incesar In Proceedings of the 5th International Symposium in Programming pages 337ndash351 LondonUK 1982 Springer-Verlag

[18] Rachid Rebiha Nadir Matringe and Arnaldo V Moura A complete approach for terminationanalysis of linear programs Technical Report IC-13-08 Institute of Computing University ofCampinas February 2013

[19] Rachid Rebiha Nadir Matringe and Arnaldo V Moura Necessary and sufficient condition fortermination of linear programs Technical Report IC-13-07 Institute of Computing University ofCampinas February 2013

[20] Henny B Sipma Tomas E Uribe and Zohar Manna Deductive model checking Form MethodsSyst Des 15(1)49ndash74 July 1999

[21] Ashish Tiwari Termination of linear programs In Rajeev Alur and Doron Peled editors ComputerAided Verification 16th International Conference CAV 2004 Boston MA USA volume 3114 ofLecture Notes in Computer Science pages 70ndash82 Springer 2004

92

Data Conversion Method between a Natural

Number and a Binary Tree for an Inductive

Proof and Its Application

Kazuko Takahashi1 Shizuo Yoshimaru1lowast

and Mizuki Goto1

1 School of Science and Technology Kwansei Gakuin Universityktakakwanseiacjp

2 School of Science and Technology Kwansei Gakuin Universityshizuoyoshimarugmailcom

3 School of Science and Technology Kwansei Gakuin Universitybub85144kwanseiacjp

Abstract

This paper presents modeling of a binary tree that represents a natural number andgives an inductive proof for its properties using theorem provers We define a function forconverting data from a natural number into a binary tree and give an inductive proof forits well-definedness We formalize this method develop a computational model based onit and apply it to an electronic cash protocol We also define the payment function onthe binary tree and go on to prove the divisibility of electronic cash using the theoremprovers IsabelleHOL and Coq respectively Furthermore we discuss the effectiveness ofthis method

1 Introduction

Theorem proving is an important technique to provide a certified system or to ensure bug-free programming Several theorem provers which may be called proof assistants have beendeveloped including ACL2 [11] PVS [19] IsabelleHOL [16] Coq [4] Agda [17] and so onThese tools help users to develop formal proofs either interactively or semi-automaticallytypically using induction as the proof strategy There are numerous applications for suchprovers There are relatively few practical applications of these tools in most fields comparedto their use in pure mathematics although there are some outstanding results in microprocessordesign [10] C compilers [14] operating system kernels [12] security protocols [1] and securecard systems [3 13] To use these provers successfully it is necessary to construct a suitablemodel and then select an appropriate proof strategy In practical applications it may be difficultto form a natural inductive model and so it may be necessary to build a data structure whichcan be difficult for these provers to handle

We have previously attempted to prove the divisibility of an electronic cash protocol [21] Inthis experience we have encountered difficulties in proving the properties regarding the functionthat converts a natural number to a binary tree The binary tree is a complete binary treewhere a Boolean value is attached to each node and the value of which is defined as a sum ofthe value of the left and right subtrees The problem can be reduced to the fact that there existsa function that cannot be defined in a primitive recursive form on an inductively defined datastructure Because a natural number has a linear structure with only one successor whereas a

lowastCurrently Nochu Information System CoLTD

93

Data Conversion Revisited Takahashi Yoshimaru and Goto

binary tree has a branching structure with two successors at each branching point the inductionschemes are different which complicates the proof

To solve this problem we introduced a bit sequence as an intermediate data structure anddefined the function from a natural number to a binary tree as a composition of two recursivefunctions via a bit sequence Specifically the first function describes the mapping from anatural number to an intermediate bit sequence and the second function is the mapping fromthe bit sequence to the binary tree We formalized this model and associated proof method andapplied it to the divisibility of an electronic cash protocol using IsabelleHOL However thisprevious work had several drawbacks First the model was complicated because of an intricatelabeling for the nodes of a tree a simpler and more natural model for this specific binary treehas subsequently been identified Second the proof was incomplete as one of the lemmas thatrelates the bit sequence to the binary tree was left as an axiom Third the effectiveness of themethod was not discussed we did not know whether this method could be applied similarlywith theorem provers other than IsabelleHOL or whether a large number of modificationswould be required In this paper we provide a simplified model give complete proofs of thedivisibility using the theorem provers IsabelleHOL and Coq and discuss the effectiveness ofthe method

The rest of this paper is organized as follows In Section 2 we describe in detail the problemsof data conversion and our solution In Sections 3 and 4 we present a formalization and aninductive proof of the divisibility of an electronic cash protocol In Section 5 we provide adiscussion and in Section 6 we present our conclusions

2 Data Conversion Formalization

21 Problem

First we illustrate the problem of converting between a natural number and a binary treewhich are data structures with different induction schemes

Let NAT and BTREE be a natural number and a binary tree respectively NAT is induc-tively defined with one successor BTREE is inductively defined in such a form that there aretwo successors ie

nat_p(0)

nat_p(n) =gt nat_p(Suc(n))

tree_p(Tip)

tree_p(lt) amp tree_p(rt) =gt tree_p(Node(_ltrt))

where Suc denotes the successor function Node is a constructor for a tree rsquo rsquo denotes ananonymous variable that corresponds to a parent node lt and rt are the left and right subtreesrespectively and T ip is a leaf node The symbols amp and =gt denote conjunction and implicationrespectively

Consider data conversion between NAT and BTREE Let f be a function that maps fromNAT to BTREE and g be a function that maps from BTREE to NAT We assume that thesefunctions are defined inductively in the following form

f NAT --gt BTREE

f(Suc(n)) = c1(f(n))

f(0) = Tip

94

Data Conversion Revisited Takahashi Yoshimaru and Goto

g BTREE --gt NAT

g(Node(_ltrt)) = c2(g(lt) g(rt))

g(Tip) = 0

where c1 is a function from BTREE to BTREE and c2 is a function from NATtimes NAT to NATConsider proving the following relationship between f and g

g(f(n)) = n

We use the following induction scheme IS on NAT to prove it

foralln( (forallnprimenprime lt n =rArr g(f(nprime)) = nprime) =rArr g(f(n)) = n ) [IS]

The proof proceeds by rewriting g(f(n)) in succession as follows

g(f(n)) = g(f(c2(n1 n2)))= g(Node( f(n1) f(n2)))= c2(g(f(n1)) g(f(n2)))= c2(n1 n2)

where c2(n1 n2) = n for a certain n1 n2 lt nThe induction scheme IS is used to proceed from the third line to the fourth line To succeed

in this proof there are two problems to be solved The first is the progression from the first lineto the second line we have to prove the equality f(c2(n1 n2)) = Node( f(n1) f(n2)) Thisproblem is how to divide a natural number into two parts suitably The second and arguablymore challenging problem is that we cannot find c1 that defines f in a recursive form naturallyConsider the function f which maps a natural number to a binary tree The forms of the datastructures f(n) and f(Suc(n)) are considerably different and the differences depend on thevalues of n For example compare the operation of adding a leaf node labeled ldquoTruerdquo to thebinary tree shown in Figure 1 In this figure (a) shows the operation of adding a node to thebinary tree that has two leaf nodes labeled ldquoTruerdquo and (b) shows the operation of adding anode to the binary tree that has three leaf nodes labeled ldquoTruerdquo These operations cannot berepresented uniformly therefore f(n) cannot be uniformly defined for all n Furthermore evenif f is defined the proof over the properties on f is not straightforward

(a)

T F F F

T T

(b)

T T T TT T T F

T

T T T

T T

T T

T

T

Figure 1 Operation on adding a ldquoTruerdquo node to a binary tree

On the other hand the definition of g is simpler because it is a conversion from a data typethat is not totally-ordered to one that is totally-ordered

22 Solution

To solve the problem shown above we introduce the bit sequence BS as an intermediate datastructure between NAT and BTREE

95

Data Conversion Revisited Takahashi Yoshimaru and Goto

221 Conversion from BS to BTREE

First we describe the conversion from BS to BTREE We choose a specific binary tree used inan electronic cash protocol This tree is a complete binary tree and a Boolean value is attachedto each node the value of which is defined as a sum of the values of its left and right subtrees

Let b0b1 bn be a sequence of Boolean values that corresponds to a natural number kThen k = bprime0 middot 2

n + bprime1 middot 2nminus1 + + bprimen middot 20 where bprimei = 10 for bi = TrueFalse (1 le i le n)

respectively We encode bprime0 middot2n as the left tree and the remainder as the right tree The function

from BS to BTREE is defined as follows

bs_to_btree() = (Tipfalse)

bs_to_btree(bbs) = (if b

then Node(true create_btree(truelength(bs)) bs_to_btree(bs) )

else Node(true bs_to_btree(bs) create_btree(falselength(bs)) )

)

where is an operator combining the head and tail of the list T ip indicates a leaf node thefunction create btree(bool nat) creates a binary tree of height nat in which all nodes are labeledwith bool and length(list) denotes the length of list 1 Intuitively when scanning the datafrom the head of BS descending by one bit corresponds to descending one subtree in BTREEThe induction scheme for the bit sequence is that if some property holds on a bit sequence bsit also holds on bbs If b = True (ie k ge 2n) then all nodes in the left subtree are labeledTrue this is referred to as a full tree However if b = False (ie k lt 2n) then none of thenodes in the right tree are labeled True this is referred to as an empty tree Thus the datatypes BS and BTREE are matched in their induction schemes

Let a bit sequence be represented as a list the elements of which are either True or FalseFigure 2 shows the conversion of the bit sequence [True False T rue] into a binary tree Inthis figure the black trees are full trees the white trees are empty trees and the dotted treesare the others

T

T T T

FTFTT

[TrueFalseTrue] [FalseTrue] [True]

Figure 2 The mapping between a bit sequence and a binary tree

Because the binary tree corresponding to [True False T rue] is not an empty tree the rootnode is labeled True Because the first bit in the sequence is True the left tree is a full treeThe tree to the right of it is the tree corresponding to the remaining bit sequence [False T rue]after the first bit has been extracted Now consider the coding of [False T rue] because the

1We can define a mirror tree in which left and right subtrees are exchanged

96

Data Conversion Revisited Takahashi Yoshimaru and Goto

first bit of the sequence is False the right tree must be an empty tree and the left tree isthe tree corresponding to the remaining bit sequence Then we consider the coding of [True]because the first bit of the bit sequence is True the left tree is a full tree and the right tree isthe binary tree corresponding to the remaining bit sequence Finally we obtain a T ip for [ ]

T

T

T

T F

T

T

T T T T T F F F

Figure 3 The binary tree for [True False T rue]

The binary tree obtained from [True False T rue] is thus as follows (Figure 3)

( True

( True ( TrueTrueTrue ) ( TrueTrueTrue ) )

( True ( TrueTrueFalse ) ( FalseFalseFalse ) )

)

The function bs to btree can give an inductive definition that provides for the division of ninto n1 and n2 corresponding to the left and right subtrees respectively in the proof processfor IS in the previous subsection

222 Conversion from NAT to BS

Next we give a definition for the conversion from NAT to BS We show two different modelsone using a general function and one using a primitive recursive function

First we define the general function naive nat to bs This is defined in an iterative formand determines the value of a a bit sequence from the least-significant bit as follows

naive_nat_to_bs(0) = [False]

naive_nat_to_bs(1) = [True]

naive_nat_to_bs(n) = (naive_nat_to_bs(div(n2))) ([mod(n2) = 1])

where is the concatenation operator for lists div(n 2) and mod(n 2) return the result ofdivision of n by 2 and its remainder respectively

Second we define the primitive recursive function nat to bs This is defined in a tail-recursive form and determines the value of a bit sequence from the most-significant bit Thedefinition is more complex than that of the iterative form

nat_to_bs(0) = [false]

nat_to_bs(Suc(n)) = calc(lg(Suc(n))Suc(n))

calc(0m) = [true]

calc(Suc(n)m) = (if 2^n lt= m) then True(calc(nm-2^(Suc(n))))

else False(calc(nm))

lg(n) = (if nlt=1 then 0

else Suc(lg (div(n2))))

97

Data Conversion Revisited Takahashi Yoshimaru and Goto

where lg is a key function that returns the place number of the bit sequence corresponding toa given argument ie the natural number m that satisfies m le log n lt m+ 1 The followingtable shows the relationship of a natural number nat a bit sequence bs and the value of lgNote that when n increases by 1 the location in the bit sequence which is equal to the heightof the tree increases logarithmically

nat bs lg

1 1 02 10 13 11 14 100 25 101 26 110 27 111 28 1000 39 1001 3

223 Conversion from NAT to BTREE

Finally nat to btree is defined as the composition of the two functions naive nat to bs andbs to btree or the composition of nat to bs and bs to btree nat to bs and bs to btree are prim-itive recursive functions whereas naive nat to bs is a recursive function

The definition of nat to bs is more suitable to an induction scheme than that ofnaive nat to bs because induction is typically applied from the head to the tail

In the next two sections we apply this formalization to the electronic cash protocol definedin [18] and prove its divisibility

3 Modeling of an Electronic Cash Protocol

31 Ideal Electronic Cash

An electronic cash (e-cash) protocol is in general a combination of cryptography techniquessuch as zero-knowledge proof and public key encryption We consider the ideal e-cash protocolproposed by Okamoto [18] In this protocol a coin of some monetary value is encoded asa binary tree and a payment function is defined over it This binary tree approach makese-cash efficient and unlinkable and is used in many divisible e-cash schemes [7 8 15 18]We formalize this protocol and prove its divisibility on a data level ie a user can spend acoin in several separate transactions by dividing its value without overspending if and only ifa payment function satisfies the payment rules This is one of the properties that an ideale-cash protocol should satisfy We define the data structure of money and define two primitiverecursive functions of money amount and pay on money The definitions are shown using Coqcode in this section

32 Definition of money

A coin is represented as a binary tree called money Each node of the tree represents a certaindenomination The root node is assigned the monetary value of the money and the values of

98

Data Conversion Revisited Takahashi Yoshimaru and Goto

all other nodes are defined as half the value of their parent nodesMoney is defined as an inductive function It is a binary tree where nodes are labeled with

Boolean values The label True means that a node is usable while False means that it is notFor a given Boolean value b and a natural number n we can create money in which all of thenodes have the label b

Inductive money Type =

| Tip bool -gt money

| Node bool -gt money -gt money -gt money

Fixpoint create_money(b bool)(n nat) money =

match n with

| 0 =gt Tip b

| S nrsquo =gt Node b (create_money b nrsquo) (create_money b nrsquo)

end

33 Creation of money from a natural number

cash is a function that createsmoney corresponding to a given natural number that is defined asa composition of bs to money and naive nat to bs (or nat to bs) bs to money can be definedin a manner similar to that of bs to btree

Definition cash(n nat) money = bs_to_money (naive_nat_to_bs n)

Note that cash is the money that satisfies a specific condition whereas type money al-lows any complete binary tree whose nodes are labeled as Boolean values For exampleNode(false T ip(true) T ip(true)) is an element of money but not a result of a function cash

34 Calculation of the amount of money

The function money amount computes the amount of money that can be used If the rootnode is labeled True the amount of the tree is the sum of that of the left tree and the righttree otherwise the amount is 0

Fixpoint money_amount(m money) nat =

match m with

| Tip true =gt 1

| Tip false =gt 0

| Node true l r =gt money_amount l + money_amount r

| Node false _ _ =gt 0

end

35 Payment

Payment rules are set in [18] as follows when we spend some amount from the coin we searchfor a node (or combination of nodes) whose value is equal to the payment value and then cancelthese nodes at the same time all of the ancestors and all of the descendants are also canceledOverspending is prevented if and only if these rules are satisfied

The function pay corresponds to payment according to the payment rules When we pay nfrom money where n is less than or equal to the amount of money then we pay all of n fromthe left tree and the right tree remains as it is if the amount of the left tree is more than n

99

Data Conversion Revisited Takahashi Yoshimaru and Goto

Otherwise we exhaust the left tree in the payment and pay the remainder from the right treeFor example money amount(pay(cash(13) 4) = 9

In the following code eq nat dec and lt dec are functions on NAT that denote rsquo=rsquo and rsquoltrsquorespectively change false is a function that changes the label of a node to False

Fixpoint pay(m money)(n nat) money =

match m with

| Tip true =gt Tip (if eq_nat_dec n 0 then true else false)

| Node true l r =gt

if lt_dec (money_amount l) n

then Node true (change_false l) (pay r (n - money_amount l))

else Node true (pay l n) r

| _ =gt m

end

4 Proof of Properties

We prove three properties on the divisibility of the e-cash protocol On proving these propertiesinductively we apply the method proposed in Section 2

In this section we only show the outline of the proof focusing on how induction is appliedThe complete Coq proof is shown in the Appendix

First the distribution property over money amount holds

money amount(Node( left right)) =money amount(left) +money amount(right) middot middot middot (1)

This can readily be proved We rewrite the left side of the given equation

41 Well-definedness of cash

The monetary value of money created by cash from a natural number is equal to that valueThis property is represented as follows

forall n (money amount (cash(n)) = n)

and is proved using the properties of the bit sequence Below we show a case in which the firstbit b of the sequence is True When it is False the proof proceeds in the same manner

money amount(cash(n))= money amount(bs to money(bbs)) middot middot middot (2)= money amount( Node(true

bs to money(bs) create money(true length(bs) ) middot middot middot (3)= money amount(bs to money(bs))+

money amount(create money(true (length(bs)))) middot middot middot (4)

Formula (2) is obtained by unfolding cash where nat to bs(n) = bbs formula (3) isobtained by unfolding bs to money and formula (4) is obtained by the distribution propertyof money amount (1)

The first term of formula (4) is transformed as follows

100

Data Conversion Revisited Takahashi Yoshimaru and Goto

money amount(bs to money(bs))= money amount(bs to money(nat to bs(nminus 2lg n))) middot middot middot (5)= money amount(cash(nminus 2lgn)) middot middot middot (6)

Formula (5) is obtained using case split tactics on n property of lg and several other tacticsFormula (6) is obtained by unfolding cash

The second term of formula (4) is transformed as follows

money-amount(create money(true length(bs)))= money amount(cash(2lgn)) (7)

Here we use the following induction scheme of NAT

if forall k k lt n money amount(cash(k)) = kthen money mount(cash(n)) = n holds

We can prove 2lg n le n and nminus 2lg n lt n If 2lg n lt n we apply this type of induction toboth formulas (6) and (7) and so formula (4) is finally transformed into the following form

money amount(cash(2lg n)) +money amount(cash(nminus 2lg n))= 2lg n + (nminus 2lg n)= n

In case 2lg n = n the proof is simpler without using induction

42 Well-definedness of pay

The amount remaining after payment is the difference between the original value and thepayment value This property is represented as follows 2

forall nforall m (money amount(pay(cash(n)m)) = nminusm)

This is derived from the following lemma

forall cforall n (money-amount(pay(c n)) = money-amount(c)minus n

which is proved as follows When we pay n from c if n does not exceed the amount of c wepay m1 from the left subtree as far as possible and pay the remainder m2 from the right treem1 and m2 are determined as follows if n lt money amount(left) then m1 = n and m2 = 0otherwise m1 = money amount(left) and m2 = n minus money amount(left) This is provedusing induction Below we show an inductive case because the proof is simple for the basecase

money amount(pay(cm1 +m2))= money amount(pay(Node( left right)m1 +m2)) middot middot middot (8)= money amount(pay(leftm1)) +money amount(pay(rightm2)) middot middot middot (9)= money amount(left)minusm1 +money amount(right) minus m2 middot middot middot (10)= (money amount(left) + money amount(right)) minus (m1 + m2)= money amount(Node( left right)) minus (m1 +m2) middot middot middot (11)= money amount(c) minus (m1 +m2)

2Note that nminusm = 0 when m gt n

101

Data Conversion Revisited Takahashi Yoshimaru and Goto

Formula (8) is obtained by expanding c Formula (9) is obtained by the distribution propertyofmoney amount and the property of payment onmoney Formula (10) is obtained by applyinginduction tomoney Formula (11) is obtained from the distribution property ofmoney amount

43 Divisibility

Given that ms is a list of values each of which corresponds to a transaction if a user paysfrom the head of this list in succession then the remainder is the correct value This propertyis represented as follows

forallnforallms( n ge listsum(ms)

=rArr money amount (foldl(pay(cash(n)ms))) = n minus listsum(ms) )

Here foldl and listsum are the functions handling a list Let ms be a list [m1 mk]foldl(pay(cms)) is rewritten in the following form

(pay( (pay(cm1) mk)

and listsum(ms) is rewritten in the following form

m1 + + mk

This theorem can be proved using the result of the proofs for the above two properties ofwell-definedness

5 Discussion

Modeling the e-cash protocol and proving the properties described in the previous sections wereperformed using the theorem provers IsabelleHOL and Coq respectively First we comparethese two provers

Both of them are interactive theorem-proving environments based on inductive theoremproving The data types and functions are defined in recursive form and the proof proceeds byconnecting suitable tactics

IsabelleHOL has a more powerful engine for automatic proof than Coq A proof may suc-ceed simply by using the lsquoautorsquo command without connecting multiple lemmas in IsabelleHOLwhereas a user must specify tactics manually in Coq However the proof procedure in Coq iseasier to understand

Both provers are based on typed logics and adopt higher-order functions In Coq type-checking is richer and proof-checking is reduced to type checking It requires the user to provethe termination of a recursive function IsabelleHOL also requires the user to prove thetermination of a recursive function but has a stronger automatic mechanism and user doesnot need to supply much input

We developed a model for an e-cash protocol and set out to prove three properties of themodel using IsabelleHOL and subsequently translated the model into Coq The translationwas basically straightforward The definition of a primitive recursive function using primrec inIsabelleHOL was translated to Fixpoint in Coq the definition of a recursive function usingfun was translated to Function the definition of a non-recursive function using definitionwas translated to Definition In addition we must prove the termination of the functionintroduced via Function

102

Data Conversion Revisited Takahashi Yoshimaru and Goto

The tactics used in the proofs of two provers were quite different Generally more tactics arerequired in Coq however the proof in Coq provides a useful basis from which to make a proofin IsabelleHOL Actually we completed the proof of the unproved lemma in IsabelleHOL byreferring to the proof in Coq From this experience it is expected that similar modeling withother provers is possible and that the existing proofs will be useful as a basis for forming proofsin those other provers All definitions and proofs in IsabelleHOL and Coq are shown in [22]

In the field of protocol verification there are a number of works on the verification ofsecurity protocols using IsabelleHOL (eg[2]) However they mainly proved security or safetyof protocols To the best of our knowledge there exists no research on a proof that focuses onthe divisibility of electronic cash protocols using a theorem-proving approach

Bijection between the set of natural numbers and rooted trees has been discussed in severalworks [5 6 9] In these works prime decomposition of the natural numbers was used toconstruct the corresponding rooted tree They used an incomplete tree in which each primenumber forms an individual branch It appears to be impossible to define this bijection in aninductive manner Attempts to provide the mechanical proof were not made and the correctnessof the methods has not been proved using theorem provers On the other hand we propose amethod for automated theorem proving using a complete binary tree

The data conversion method described here is applicable to conversion from an inductivelydefined data structure with one successor to one with n successors by introducing a list inwhich each element takes n values as an intermediate data structure instead of a bit sequenceFollowing this transformation the proof can proceed in a similar manner to the one shown inthis paper although the number of lemmas would increase Moreover it can be extended todata conversion from data structures with m successors to data structures with n successors bycomposing two data-conversion functions ie one from an inductively defined data structurewith m successors to that with one successor and then a second function from an inductivelydefined data structure with one successor to one with n successors

6 Conclusion

We have described a function for converting data from a natural number to a binary treeand have given an inductive proof for its well-definedness We have described a method ofintroducing a bit sequence as an intermediate data structure to provide a model for inductivelydefined data structures with different induction schemes We formalized this method developeda computational model based on it and applied it to an electronic cash protocol We succeededin proving the properties of divisibility of the protocol using the theorem provers IsabelleHOLand Coq and discussed the effectiveness of the method

In future we would like to investigate other functions andor properties on such a binarytree that is handled here and develop methods of their inductive proof

References

[1] Arsac W Bella G Chantry X and Compagna L Multi-Attacker Protocol Validation J ofAutomated Reasoning 46(3-4)353-388 (2011)

[2] Bella G Massacci B and Paulson L Verifying the SET Purchase Protocols J of AutomatedReasoning 365 37 (2006)

[3] Bella G Inductive Verification of Smart Card Protocols J of Computer Security 11(1)87-132(2003)

103

Data Conversion Revisited Takahashi Yoshimaru and Goto

[4] Bertot Y and Castran P Interactive Theorem Proving and Program Development - CoqrsquoArtThe Calculus of Inductive Constructions Springer Verlag (1998)

[5] Beyer T and Hedetniemi S M Constant Time Generation of Rooted Trees SIAM J Comput9(4)706-712 (1980)

[6] Cappello P A New Bijection between Natural Numbers and Rooted Trees 4th SIAM Conferenceon Discrete Mathematics (1988)

[7] Chan A Frankel Y and Tsiounins Y Easy Come - Easy Go Divisible Cash EUROCRYPT98pp 561-575 (1998)

[8] Canard S and Gouget A Divisible E-Cash Systems Can Be Truly Anonymous EURO-CRYPT2007 pp482-497 (2007)

[9] Gobel F On a 1-1-Correspondence between Rooted Trees and Natural Numbers J of Combina-torial Theory Series B(29)141-143 (1980)

[10] Hardin D S (ed) Design and Verification of Microprocessor Systems for High-Assurance Appli-cations Springer Verlag (2010)

[11] KaufmannM Monolios P and Moore J S Computer-Aided Reasoning An Approach KluwerAcademic Publishers (2000)

[12] Klein G et al seL4 Formal Verification of an Operating-System Kernel Commun ACM 53(6)107-115 (2010)

[13] Kurita T and Nakatsugawa Y The Application of VDM to the Industrial Development ofFirmware for a Smart Card IC Chip Int J of Software and Informatics 3(2-3)343-355 (2009)

[14] Leroy X Formal Verification of a Realistic Compiler Communications of the ACM 52(7)107-115(2009)

[15] Nakanishi T and Sugiyama Y An Efficiently Improvement on an Unlinkable Divisible ElectronicCash System IEICE Trans on Fundamentals E85-A(19)2326-2335 (2002)

[16] Nipkow T Paulson L and Wenzel M IsabelleHOL A Proof Assistant for Higher-Order LogicSpringer Verlag (2002)

[17] Norell U Dependently Typed Programming in Agda Advanced Functional Programming 2008pp230-266 (2008)

[18] Okamoto T An Efficient Divisible Electronic Cash Scheme The proceedings of Cryptorsquo95pp438-451 (1995)

[19] OwreS RushbyJM and ShankarN PVS A Prototype Verification System The proceedingsof CADE-11 pp748-752 (1992)

[20] Sprenger C Zurich E T H Basin D et al Cryptographically Sound Theorem Proving 19thIEEE Computer Security Foundations Workshop (2006)

[21] Takahashi K and Yoshimaru S Formalization of Data Conversion for Inductive Proof Tunisia-Japan Workshop on Symbolic Computation in Software Science (SCSS 2009) pp135-150 (2009)

[22] httpistksckwanseiacjp~ktakaEMONEY

104

Data Conversion Revisited Takahashi Yoshimaru and Goto

Appendix Proof for E-cash protocol in Coq (tail-recursiveversion)

Require Import Omega List Arith Div2 Bool Recdef Wf_nat

Theorem well_definedness_of_pay

forall(m money)(n nat)

n lt= money_amount m

-gt money_amount(pay m n) = money_amount m - n

Proof

intros m

induction m intros n LNM destruct b simpl in try reflexivity

destruct (eq_nat_dec n 0)

rewrite e reflexivity

assert(n = 1) by omega

rewrite H reflexivity

destruct (lt_dec (money_amount m1) n) simpl

rewrite IHm2 try omega

replace (money_amount (change_false m1)) with 0 try omega

destruct m1 simpl reflexivity

rewrite IHm1 omega

Qed

Lemma bit_sequence_distribution

forall(bs list bool)(b bool)

money_amount(bs_to_money(bs ++ (bnil))) =

2 money_amount(bs_to_money bs) + (if b then 1 else 0)

Proof

intros bs b

induction bs simpl in

destruct b reflexivity

assert(forall(bl bool)money_amount (create_money bl (length

(bs ++ b nil))) =

money_amount (create_money bl (length bs)) + money_amount

(create_money bl (length bs)))

intros clear IHbs destruct bl induction bs simpl try omega

destruct a simpl in rewrite IHbs repeat rewrite plus_0_r

repeat rewrite plus_assoc rewrite H omega

Qed

Lemma one_reminder_div2

forall(n nat)

(2 div2 n) + (if one_reminder n then 1 else 0) = n

Proof

intros n

case_eq (one_reminder n) intros induction n using lt_wf_ind

destruct n try discriminate

destruct n try reflexivity

simpl in H

simpl

replace (S (div2 n + S (div2 n + 0) + 1))

with (S (S (2 div2 n + 1)))

105

Data Conversion Revisited Takahashi Yoshimaru and Goto

repeat f_equal

rewrite H0 try reflexivity try omega

apply H

simpl

omega

destruct n try reflexivity

destruct n try discriminate

simpl in H

simpl

replace (S (div2 n + S (div2 n + 0) + 0))

with (S (S (2 div2 n + 0)))

repeat f_equal

rewrite H0 try reflexivity try omega

apply H

simpl

omega

Qed

Theorem well_definedness_of_cash

forall(n nat)

money_amount (cash n) = n

Proof

intros n

induction n using lt_wf_ind

destruct n try (simpl reflexivity)

destruct n try (simpl reflexivity)

unfold cash rewrite bit_sequence_equation

case_eq (one_reminder (S (S n))) intros

rewrite bit_sequence_distribution unfold cash in H rewrite H

try (apply lt_div2 apply lt_0_Sn)

pose (one_reminder_div2 (S (S n)))

rewrite H0 in e apply e

Qed

Definition listsum(ns list nat) nat = fold_right plus 0 ns

Definition payment_amount(m money)(ns list nat) nat =

money_amount (fold_left pay ns m)

Theorem Divisibility

forall(n nat)(ns list nat)

listsum ns lt= n -gt

payment_amount (cash n) ns = n - listsum ns

Proof

intros n ns LSM

induction ns using rev_ind simpl in

rewrite lt- minus_n_O

apply well_definedness_of_cash

unfold payment_amount in

unfold listsum in

rewrite fold_left_app

rewrite fold_right_app in simpl in

rewrite plus_0_r in

106

Data Conversion Revisited Takahashi Yoshimaru and Goto

assert(fold_right plus 0 ns + x lt= n)

generalize n LSM

clear IHns LSM n

induction ns intros simpl in

omega

assert(fold_right plus x ns lt= n - a) by omega

apply IHns in H omega

rewrite well_definedness_of_pay rewrite IHns simpl in try omega

replace (fold_right plus x ns) with ((fold_right plus 0 ns) + x)

omega

clear IHns H LSM

induction ns simpl

reflexivity

rewrite lt- IHns info omega

Qed

107

Computer Algebra Investigation of Known

Primitive Triangle-Free Strongly Regular

Graphs

Mikhail Klin and Matan Ziv-Av

Ben-Gurion University of the Negevklincsbguacil

matansvgaliborg

Abstract

With the aid of computer algebra systems COCO and GAP with its packages we areinvestigating all seven known primitive triangle-free strongly regular graphs on 5 10 1650 56 77 and 100 vertices These graphs are rank 3 graphs having a rich automorphismgroup The embeddings of each graph from this family to other ones are described the au-tomorphic equitable partitions are classified all equitable partitions in the graphs on up to50 vertices are enumerated Basing on the reported computer aided results and using tech-niques of coherent configurations a few new models of these graphs are suggested whichare relying on knowledge of just a small part of symmetries of a graph in consideration

1 Introduction

This paper appears on the edge between computer algebra systems and algebraic graph theory(briefly AGT) and is mainly devoted to the computer aided investigation of the known primitivetriangle free strongly regular graphs

In fact there are 7 such graphs those on 5 10 16 50 56 77 and 100 vertices The largestone denoted by NL2(10) is the universal graph for this family in the sense that all seven graphsare induced subgraphs of NL2(10) We denote by F the family of those 7 graphs

The history of the discovery of the graphs from F and in particular of NL2(10) is quitestriking Indeed the graph NL2(10) was discovered twice once in 1956 by Dale Mesner andsecond time independently in 1968 by D G Higman and C C Sims The details of thishistory are considered in [15] see also a very brief summary in Section 4

The graphs on 5 10 and 50 vertices form a very significant subfamily consisting of theknown Moore graphs One more possible member of this series (see eg [16]) would have 3250vertices its existence is an open problem of a great significance Moore graphs and their naturalgeneralizations are objects of much interest in extremal graph theory they serve as the bestexamples of optimal network topologies Discovery of a new primitive triangle free stronglyregular graph would be a high level sensation in modern mathematics

This text is oriented towards an interdisciplinary audience though its kernel is strictlyrelated to a concrete kind of application of computer algebra in AGT

Section 2 provides in compact form the necessary background about strongly regular graphssee [11] [5] for more details while in section 3 we briefly introduce the tools of computer algebraused in AGT The seven graphs from the family F are presented in section 4

Our first main result is introduced in Section 5 full description of embeddings of (primitiveand imprimitive) triangle free strongly regular graphs into the graphs in F

108

Triangle-free strongly regular graphs Klin Ziv-Av

The next topic of our investigation is related to equitable partitions with a special emphasison automorphic equitable partitions see definitions in Section 6 The search strategy is de-scribed in Section 7 though much more details may be found in [28] We report the completeenumeration of automorphic equitable partitions and partial results for the general case

Sections 8ndash10 reflect our efforts to understand a few of the computer aided results and topresent them in a computer free form (completely or at least relatively)

In Section 8 we deal with the graph NL2(10) and describe it in a sense locally that isvia so-called metric equitable partitions obtained from the embeddings of a quadrangle anda graph K33 without one edge (Atkinson configuration) with 4 and 8 cells respectively Thespectrum of the second partition contains all of the eigenvalues of NL2(10) (the case of fullspectrum) Some modifications of the famous Robertson model (see [21]) appear in Section 9while in Section 10 we present a handful of models for some other graphs in F

It is worthy to mention that for generations of mathematicians the graphs in F appear asa source of ongoing aesthetic admiration see especially the home page of Andries Brouwer [6]We believe that some of our models shed a new light on those graphs

Last but not least is that as a rule the models we suggest rely on a relatively small subgroupof the group Aut(Γ) for Γ isin F In this way we provide promising patterns for those researcherswho wish in future to face a challenge to try to construct new primitive triangle free stronglyregular graphs cf Section 11

2 Strongly regular graphs a brief survey

An undirected graph Γ is called a strongly regular graph (SRG) with parameters (v k λ micro) ifit is a regular graph of order v and valency k and every pair of adjacent vertices has exactly λcommon neighbors while every pair of non-adjacent vertices has exactly micro common neighborsSometimes we use an extended set of parameters (v k l λ micro) where l is the number of non-neighbors of a vertex that is l = v minus k minus 1

If A = A(Γ) is the adjacency matrix of an undirected graph Γ then Γ is strongly regular ifand only if A2 = kI + λA+ micro(J minus I minus A) This implies that (I A J minus I minus A) is the standardbasis of a rank 3 homogeneous coherent algebra In other words (∆ΓΓ) are the basic graphsof a rank 3 symmetric association scheme (here Γ is the complement of Γ while ∆ contains allthe loops) The adjacency matrix of a strongly regular graph has exactly 3 distinct eigenvaluesFor a strongly regular graph we denote by

bull r gt s the two eigenvalues of A(Γ) different from k r is always positive while s is alwaysnegative

bull f g the multiplicity of the eigenvalues r s respectively

A formula for f and g is given by g f = 12

[(v minus 1)plusmn 2k+(vminus1)(λminusmicro)radic

(λminusmicro)2+4(kminusmicro)

]

A quadruple of parameters (v k λ micro) for which f and g as given by the preceding formulasare positive integers is called a feasible set of parameters See [6] for a list of feasible parametersets with some information about known graphs for some of the sets

A strongly regular graph Γ is called primitive if both Γ and its complement Γ are connectedThis is equivalent to primitivity of the related association scheme (∆ΓΓ)

109

Triangle-free strongly regular graphs Klin Ziv-Av

3 Computer algebra tools in AGT

During the last two decades the significance of the use of computer algebra systems in AGTincreased drastically Such systems are exploited in the search for new combinatorial objectsthe enumeration of objects with prescribed parameters and the understanding of algebraic andstructural properties of a given combinatorial object Γ (such as the automorphism group Aut(Γ)its action and orbits on the ingredients of Γ enumeration of substructures of Γ embeddings ofΓ into larger structures etc)

An ideal case is when the computer aided understanding of an object Γ is followed by furthertheoretical generalizations The foremost goal of this paper is to share with the reader manynew interesting properties of the graphs in the family F in order to promote the search for newprimitive tfSRGs

Below are the main tools we use

bull COCO is a set of programs for dealing with coherent configurations including construc-tion enumeration of subschemes and calculation of automorphism groups

Developed in 1990-2 Moscow USSR mainly by Faradzev and Klin [8] [9]

bull WL-stabilization ndash Weisfeiler-Leman stabilization is an efficient algorithm for calcu-lating coherent closure of a given matrix (see [25] [3]) Two implementations of theWL-stabilization are available (see [2])

bull GAP an acronym for ldquoGroups Algorithms and Programmingrdquo is a system for com-putation in discrete abstract algebra [10] [22] It supports easy addition of extensions(packages in gap nomenclature) that are written in the GAP programming languagewhich can add new features to the GAP system

One such package GRAPE [23] is designed for construction and analysis of finite graphsGRAPE itself is dependent on an external program nauty [18] in order to calculate theautomorphism group of a graph Another package is DESIGN used for construction andexamination of block designs

bull COCO v2 ndash The COCO v2 initiative aims to re-implement the algorithms in COCOWL-stabilization and DISCRETA as a GAP package In addition the new package shouldessentially extend abilities of current version basing on new theoretical results obtainedsince the original COCO package was written

We refer to [14] for a more detailed discussion of the ways in which computer algebra systemsare used in AGT for the purpose of experimentation and further theoretical generalizations

4 The seven known primitive triangle-free strongly regu-

lar graphs

A graph Γ is called triangle free if it admits no triangles that is cliques of size 3 If Γ is also astrongly regular graph then it is called a triangle free strongly regular graph (tfSRG for short)A graph is triangle free if any two neighbors have no common neighbors therefore a tfSRG isan SRG with λ = 0

The 7 known primitive tfSRGs with orders from 5 to 100 vertices are

1 Pentagon with parameters (5 2 0 1) Its automorphism group is D5 of order 10

110

Triangle-free strongly regular graphs Klin Ziv-Av

0

1

2 3

4

25

26

27 28

29

10

11

12 13

14

Figure 1 Hoffman-Singleton graph Robertson model

2 Petersen graph with parameters (10 3 0 1) Its automorphism group is isomorphic to S5

of order 120 A simple model has as vertices 2-subsets of a set of size 5 with two verticesadjacent if the subsets are disjoint

3 Clebsch graph with parameters (16 5 0 2) Usually denoted by 5 Its automorphismgroup is isomorphic to (S5 ≀S2)

pos of order 1920 A simple model is 4-dimensional cube Q4

together with long diagonals or Cayley graph CAY (E24 0001 0010 0100 1000 1111)

4 Hoffman-Singleton graph (HoSi) with parameters (50 7 0 1) Its automorphism group isisomorphic to PΣU(3 52) of order 252000 ([4]) The simplest model is Robertson model([21]) 5 pentagons marked P0 P4 and 5 pentagrams marked Q0 Q4 with vertexi of Pj joined to vertex i+ jk (mod 5) of Qk

5 Gewirtz (or Sims-Gewirtz) graph with parameters (56 10 0 2) Its automorphism groupof order 80640 is a non split extension of PSL3(4) by E22 A simple model is as theinduced subgraph of NL2(10) on the common non-neighbors of two adjacent vertices

6 Mesner graph with parameters (77 16 0 4) The automorphism group is of order 887040and is isomorphic to the stabilizer of a point in the automorphism group of NL2(10) Onesimple model is induced subgraph of NL2(10) on non-neighbors of a vertex

7 NL2(10) with parameters (100 22 0 6) also known as the Higman-Sims graph Its auto-morphism group contains Higman-Sims sporadic simple group as a subgroup of index 2We refer to [15] for a detailed presentation of the original construction of this graph byDale Mesner as it appeared on [19] [20]

Recall that the graph NL2(10) on 100 vertices was constructed twice by Dale Mesner inhis Thesis in 1956 [19] and later on by Higman and Sims in 1968 when they discovered anew sporadic simple group Moreover in 1964 Mesner proved its uniqueness We denote thisgraph by NL2(10) following the parametrization for a family of putative graphs introduced byMesner in [20] In [15] the history of this discovery as well as of related events is discussed withmany details A new wave of interest in tfSRGs stimulated by [15] was especially productivefor us It became clear that this is the time to arrange a serious comprehensive investigation ofdiverse structural properties of the graphs in the family F The goal is to attract the attentionof researchers to such an information in order to provide new ideas how efforts for the searchof new tfSRGs should be arranged We also wish to share with the reader some surprising newfeatures of the graphs in the family F observed with the aid of a computer

111

Triangle-free strongly regular graphs Klin Ziv-Av

5 Embeddings of tfSRGs into known primitive tfSRGs

Usually in graph theory a graph ∆ = (V prime Eprime) is called a subgraph of a graph Γ = (VE) if

V prime sube V and Eprime sube E Of special interest are induced subgraphs in this case Eprime = E capV prime

2

whereX2

is the set of all 2-subsets of X

Proposition 1 A subgraph ∆ of diameter 2 of a graph Γ with no triangles is an inducedsubgraph

Proof Assume that ∆ is not induced then there exists an edge uw isin E uw 6isin Eprime withuw isin V prime Since the diameter of ∆ is 2 there exist a v which is adjacent in ∆ (and thereforein Γ) to u w thus u v w is a triangle in Γ which is a contradiction

The enumeration of all tfSRGs inside of known tfSRGs was the first serious computationalchallenge in this project The results of its complete solution are discussed below

A non-empty imprimitive tfSRG is either a complete bipartite graph (Kllsim= 2 Kl) or

a graph s K2 consisting of s edges with no common vertices Note that K22 is simply aquadrangle

Lemma 2 Graph NL2(10) does not contain subgraph K33

Proof Originally we obtained this result with the aid of a computer In fact easy proof followsfrom the non-edge decomposition of Γ = NL2(10) (see eg [15]) without any assumptions aboutits uniqueness Indeed let ∆ be a subgraph of Γ which is isomorphic to K33 Assume thattwo bipartite parts of ∆ consist of subsets a b c d e f of vertices Consider now non-edgedecomposition of Γ with respect to a b then c belongs to the cell of size 60 while d e fbelong to the cell of size 6 thus c has just g = 2 neighbors in the latter cell a contradictionwith the valency of c equal to 3 in ∆

As a corollary we obtain that every known primitive tfSRG does not contain K33 andmoreover does not contain Kll when l ge 3

Another simple theoretical result (see eg [28]) claims that the number of quadrangles in an

SRG with parameters (v k l λ micro) is equal tovk2 (

λ

2)+vl2 (

micro

2)2 When λ = 0 this reduces to vlmicro(microminus1)

8 Similar formula may be obtained for the number of 2K2 The numbers of imprimitive tfSRGsinside of graphs in F are given in Table 1 in the supplement while the number of orbits of suchembeddings (with respect to Aut(Γ) for Γ isin F) are given in Table 2

Note that there is no induced subgraph of NL2(10) isomorphic to 12 K2 so both tablesin Supplement A end with s = 11 for s K2

Similar computer results are presented in Tables 3 and 4 (Supplement A) for the embeddingsof a graph from the family F into a larger graph in F

Here the final picture is less sophisticated There are just two cases where for pair of graphsXY isin F there exist more than one orbit of embeddings (up to action of Aut(Y )) of X intoY Namely in these terms there are 9 embeddings of Petersen graph into Mesner graph and 5embeddings into NL2(10) Computer free understanding of these embeddings remains a quiteinteresting task for future investigations of the links between the graphs in the family F

In all other cases there exists (up to isomorphism) at most one embedding for consideredpair (XY ) For most pairs there is a reasonably clear explanation in literature such as twoHoSi inside NL2(10) see eg [12] as well as Robertson model of HoSi [21] which explainspositions in it for both pentagon and Petersen graph

Beside this there are two more embeddings which are not immediately evident

112

Triangle-free strongly regular graphs Klin Ziv-Av

The first pair is the embedding of the Petersen graph into Gewirtz graph In fact inthis embedding the Petersen graph appears as a subgraph of the second constituent of theGewirtz graph which in turn is a graph ∆ of valency 8 on 45 vertices It turns out thatAut(∆) sim= Aut(S6) This graph ∆ generates a non-Schurian association scheme with threeclasses see eg [24] [13] example W38 The graph ∆ may be also described as the distance2 graph of the distance transitive graph of diameter 4 and valency 4 on 45 vertices akageneralized octagon GO(2 1) aka line graph of Tuttersquos 8-cage (see [5] for more details) Inthis context the task of explanation of the embedding of Petersen graph into ∆ seems to be anice exercise in AGT though out of the framework of this presentation

The second exceptional pair is the embedding of the Clebsch graph 5 into NL2(10) Thispair is of a definite independent interest and thus is considered separately in Section 10

Finally we mention that the classification of cocliques in graphs from F may be regardedas a degenerate case of subject in this section Indeed empty graph is a particular case of animprimitive tfSRG We however disregard this problem referring to information presented onthe home page of Andries Brouwer [6]

6 Equitable partitions

Let Γ = (VE) be a graph A partition τ of the vertex set V τ = V1 Vs is calledequitable partition (briefly EP) if for i j isin 1 s the numbers |Γ(v) cap Vj | are equal for allv isin Vi Here Γ(v) = u isin V |u v isin E Usually an EP τ is accompanied by intersectiondiagram which represents a kind of quotient graph Γτ on which all intersection numbers aredepicted Many such diagrams appear in [5] The quotient graph Γτ is in fact a multigraphIts (collapsed) adjacency matrix B consists of all intersection numbers

Obviously entries of B are non-negative integers and for a regular graph Γ of valency k thesum of each row in B is k

If H is a subgroup of Aut(Γ) then the set of orbits of H is an EP of Γ Such an EP is calledautomorphic (briefly AEP)

Proposition 3 ([11]) Let Γ be a graph A = A(Γ) the adjacency matrix of Γ If a partitionτ is EP of Γ with matrix B then the characteristic polynomial of B divides the characteristicpolynomial of A

In fact there are more necessary conditions for a prescribed matrix B to be the adjacencymatrix of a suitable EP of Γ which are formulated in terms of spectral graph theory see eg[7] They create a solid background for a clever search of potential EPs in a given graph Γ

7 Search for equitable partitions

In this project we distinguished two alternative problems for the complete search of EPs ingraphs of F

First problem is to enumerate all automorphic EPs Here we strongly rely on the level ofgroup theoretical ldquointellectrdquo of GAP Indeed for groups of relatively small order (say up to afew thousands) GAP allows to establish efficiently the structure of a considered group as wellas the lattice of its subgroups

However for four graphs in F the group G = Aut(Γ) has larger order thus with the growingof |G| extra theoretical input is required For example in case of G = Aut(NL2(10)) we wereusing information from the website of the Atlas of Finite Group Representations ([26]) about

113

Triangle-free strongly regular graphs Klin Ziv-Av

the maximal subgroups of G (this information goes back to [17]) This knowledge together withad hoc tricks inside of GAP made it possible to describe all subgroups of G up to equivalencyclasses with respect to EPs The fact that all groups G = Aut(Γ) Γ isin F are subgroups ofAut(NL2(10)) was also quite beneficial

Finally we successfully enumerated all automorphic EPs for all Γ isin FThe second problem is much more sophisticated to enumerate all EPs for all graphs in FFor the smallest three graphs in F the results were achieved via simple brute force see

corresponding tables in Supplement BFor HoSi we used a few complementary strategies in the search for all EPs First we attacked

partitions with ldquolargerdquo number of cells say s gt 5 Here we introduced extra parameter thesize of the smallest cell which varies from 1 to 9 Each such case was considered separately

On the second stage we step by step enumerated cases 2 le s le 5 by enumerating possiblecollapsed adjacency matrices for each case and for any such matrix enumerating all EPs

The description of our computer activities together with detailed discussion of the resultsis presented in [28] An extra advantage of the enumeration in HoSi is that it serves as a kindof a pleasant interaction of a human and a computer Indeed in spite of the fact that the mainpart of computation was fulfilled by GAP a human can follow search explain its logic and stepby step to comprehend all ongoing results

We admit however that the extra advantage of HoSi is that here parameter micro takes itssmallest possible value of 1 (for a primitive SRG) As soon as micro gt 1 and v is growing theproblem is becoming essentially more difficult

This is why already for the Gewirtz graph with v = 56 we only succeeded in enumeration ofall EPs for which the stabilizer has order at least 2 There are 688 such EPs The enumerationof the rigid EPs cannot be completed by a computer in a reasonable time

The full enumeration of all EPs for the largest two graphs in F (on 77 and 100 vertices) atthis stage looks intractable Only modest particular cases may be proceeded efficiently

We refer to Supplement B for Tables 5 6 and 7 which summarize our activities for bothconsidered problems see [28] for more information

As was mentioned in the introduction one of the main goals of this project is to detect anumber of ldquonicerdquo EPs which may serve as a training model for future search of new primitivetfSRGs At this stage this kind of job only partially relies on the support from computer finallya humanrsquos insight still turns out to be very significant Below we report about interestinginterpretations created by us for a handful of detected EPs

8 Quadrangle and Atkinson EPs of NL2(10)

Recall that Γ = NL2(10) has100middot77middot6middot5

8 = 28875 quadrangles This is a simple result obtainedon a combinatorial level without any knowledge of structure of Γ

Provided that Γ and G = Aut(Γ) are known we easily obtain (with the use of a computer)that all quadrangles in Γ form one orbit under G and stabilizer H of a quadrangle in G hasorder 3072 is isomorphic as abstract group to (Z4 times Z2)(Z4 times Z2)) Z2) Z2) Z3) Z2) Z2

and has in action on V (Γ) four orbits of lengths 4 8 24 and 64Thus we may consider an automorphic EP of size s = 4 There is sense to try again

combinatorial arguments in order to determine all invariants of this EP without any priorknowledge of Γ and its group Fortunately this turns out to be possible

Proposition 4 Let τ be a metric decomposition with respect to a prescribed quadrangle Qinside of Γ Then τ is EP s = 4 sizes of cells are 4 8 24 64 and (with respect to this

114

Triangle-free strongly regular graphs Klin Ziv-Av

ordering of cells) B =

2 4 0 162 0 12 80 4 2 161 1 6 14

See proof in [28]In principle next stage should be to describe a model of NL2(10) in terms of the group

H of order 3072 or one of its subgroups which is transitive on all cells of the quadrangle EPNevertheless in this text we are avoiding this task Instead of we prefer to split the quadrangleEP to one with larger number of cells and to proceed with that new one

A note [1] was published before the announcement of CFSG The author considered 13parameter sets for tfSRGs which may be also rank 3 graphs with the number v of verticeswhere 100 lt v le 1000 and proved that such graphs can not be constructed with the aid ofknown 2-transitive permutation groups Part of exposed details is related to consideration of aconfiguration A (graph K33 minus one edge) in putative graph

We got impression that [1] is overseen through a generation of mathematicians and it mightbe helpful to analyze existence of A (we call it Atkinson configuration) in known tfSRGs

It turns out that A appears only in graphs on 77 and 100 vertices Here we analyze itsposition in Γ = NL2(10)

Let us fix at A a quadrangle for example with the vertices a b c f Then two extra ver-tices have two neighbors in the selected quadrangle namely ends of two non-edges respectively

Now we embed A into the considered above quadrangle decomposition splitting in it cell ofsize 8 into two cells of size 2 (exactly our d e) and the remainder This immediately impliessplit of the cell of size 64 into two cells of sizes 16 and 48 The cell of size 24 is forced to besplit into subcells of sizes 12 6 6 depending on the number of neighbors in d e being 1 2and 0 respectively

A more careful analysis (see [28]) shows that we are still getting an EP

Proposition 5 A metrical decomposition τ(A) of a tfSRG with the parameters of NL2(10)with respect to configuration A is EP with s = 8 and cells of sizes 4 2 16 48 6 12 6 6 Ithas collapsed matrix B as follows with Spec(B) = 22 25 (minus8)2

B =

2 1 4 12 3 0 0 02 0 8 0 0 6 6 01 1 2 12 0 3 0 31 0 4 10 1 3 2 12 0 0 8 0 6 2 40 1 4 12 3 2 0 00 2 0 16 2 0 0 20 0 8 8 4 0 2 0

Originally the proof was obtained with the aid of com-puter analysis of Γ = NL2(10) Later on an outline of asimilar proof as for quadrangle configuration was againobtained without prior knowledge of Γ

Further consideration of τ(A) was fulfilled inside ofknown graph Γ and its group Aut(Γ) It turns out thatH = Aut(τ(A)) sim= D4timesS4 is a group of order 192 H hasexactly 8 orbits on the set V (Γ) thus A is an automorphicEP

Describing further stabilizers of H on each of the 8orbits we elaborated the following ad hoc model of Γ

We start from the auxiliary graph ∆ depicted in Figure 2We identify elements of each orbit in τ(A) with suitable sets of structures described with

the aid of ∆ In fact each set of structures appears as orbit of action of the group H Thus itis enough to describe a representative of each orbit

For example the elements in the cell of size 16 are the vertices of ∆ while the elements ofthe cell of size 4 are the four columns of ∆ The most tricky to find was a representation of the7th cell of size 6

115

Triangle-free strongly regular graphs Klin Ziv-Av

12 13 14 15

8 9 10 11

4 5 6 7

0 1 2 3

Figure 2 Auxiliary graph ∆

We think that this piecewise model of Γ appearing from areasonably small solvable group of order 192 may serve as anoptimistic message for those researchers who are hunting for newtfSRGs see also comments in Section 11

9 Some modifications of Robertson

model

The Robertson model of the Hoffman-Singleton graph (see Figure1) partitions the vertices into five pentagons and five pentagramsand describes a simple arithmetic rule for the edges connectingpentagons and pentagrams (see Section 4) Let pij (qij) be vertexj of pentagon (pentagram) i

Since NL2(10) has an EP to two cells of size 50 where theinduced graph on each cell is isomorphic to HoSi this model can be extended to a model ofNL2(10)

In both cases we get an EP with a collapsed adjacency matrix that has a transitive au-tomorphism group (a permutation g isin Sn is an automorphism of a matrix M isin F

ntimesn if thepermutation matrix Mg commutes with M) We are therefore interested in equitable partitionswith this property

In the list of equitable partitions of HoSi we find another such partition with 10 cells of sizefive The collapsed adjacency matrix of this partition isM The spectrum ofM is 7 24 (minus3)5so it has the full spectrum of HoSi

M =

0 2 2 0 0 0 0 1 1 12 0 1 0 1 2 0 0 1 02 1 0 2 0 0 1 0 0 10 0 2 0 1 1 2 0 0 10 1 0 1 0 2 0 1 0 20 2 0 1 2 0 1 0 1 00 0 1 2 0 1 0 1 2 01 0 0 0 1 0 1 0 2 21 1 0 0 0 1 2 2 0 01 0 1 1 2 0 0 2 0 0

The cells of this partition can be de-scribed in the Robertson model of HoSi foreach i isin [1 5] we construct two cellsp11+i p21+i p32+i p44+i p52+iq11+i q21+i q35+i q43+i q55+i

If we consider this matrix M as the adjacencymatrix of a color graph then the basic graph for thecolor 1 is the Petersen graph while the basic graphfor the color 2 is a cycle of length 10 For compar-ison acting similarly with the Robertson partitionwe get a graph K55

The stabilizer of the (ordered) partition inAut(HoSi) is isomorphic to the dihedral group D5

of order 10 as is the automorphism group of M

The coherent closure of the partition (more specifically of the graph with its vertices coloredaccording to the partition) is a Schurian coherent configuration of rank 300 with the stabilizerof the partition as its automorphism group

This EP of HoSi can be extended to an EP of NL2(10) of 20 independent sets of size 5 Inthis case the matrix has spectrum 22 213 (minus8)6 so this EP has full spectrum as well

The automorphism group of this matrix has order 240 and is isomorphic to Z2 times S5 whilethe stabilizer of the ordered partition is again D5 of order 10

The coherent closure of the partition is a Schurian coherent configuration of rank 1200 withthe stabilizer of the partition as its automorphism group

116

Triangle-free strongly regular graphs Klin Ziv-Av

7 7 7

7 7 7

7 74 4

2 2 2

2 2 2

Figure 3 AEP of Gewirtz graph by a semiregular subgroup of order 7

10 A few more models

The calculated data both about embeddings of tfSRGs inside tfSRGs and about EPs can beused to present new models and constructions for tfSRGs Here we offer a few examples withoutgoing into a lot of details

Example 1 (Two Wagner graphs in Clebsch graph) Wagner graph also known as Mobiusladder of order 8 denoted by M8 is a cubic graph on 8 vertices A simple model for it is aCay(Z8 1minus1 4) The spectrum is 3 12minus1 and Aut(M8) = D8

In one of the three EPs of 5 into two cells of size 8 the induced subgraph on each cell isthe Wagner graph The stabilizer of ordered partition inside Aut(5) is D8

Example 2 (Non-automorphic EP of HoSi) We can construct an EP of HoSi into two cellsby taking one of the cells to be the 20 vertices of two Petersen graphs (any two pentagons andtwo pentagrams in Robertson model) The stabilizer of this partition is D10 of order 20 so itis not automorphic

Example 3 (Inside Gewirtz graph six 7-cycles) There is one automorphic partition of Gewirtzgraph into 8 cells of size 7 The induced graph on 6 of the cells is a cycle of length 7 while theinduced graph on the other two cells has no edges

From the intersection diagram (Figure 3) we see that this partition can be merged to an

equitable partition with 2 cells of sizes 42 and 14 with adjacency matrix

(8 26 4

)

The induced graph on the cell of size 42 of valency 8 is a coherent graph Its coherent closureis a rank 6 imprimitive non-Schurian association scheme This graph is not a rational graphwith spectrum 8 222 (minus1)7 (1 +

radic2)6 (1minus

radic2)6

The induced graph on the cell of size 14 is a bipartite graph with two parts of size 7 It isthe co-Heawood graph that is the bipartite complement to the Heawood graph the Levi graph ofFano plane This is by necessity true since a regular bipartite graph of valency 4 and order 14in which every vertex belongs to exactly one quadrangle is the co-Heawood graph

A Brouwer ([6]) notes that this co-Heawood graph is a subgraph of the Gewirtz graph

Example 4 (Gewirtz graph inside of Mesner graph through the group Z7) We start witha semiregular subgroup Z7 of order 7 this time inside of the automorphism group of Mesnergraph We get an AEP with 11 cells of size 7 the collapsed matrix N of order 11 is presentedin [28] It turns out that Aut(N) sim= S2 ≀ S3 (the wreath product) is a group of order 72 withorbits of sizes 6 2 13 There are three non-equivalent possibilities to merge from this AEP a

117

Triangle-free strongly regular graphs Klin Ziv-Av

non-automorphic EP with 3 cells of sizes 14 21 42 and a collapsed matrix

4 6 6

4 0 12

2 6 8

which

has full spectrumEach of the cases provides also an EP for the Gewirtz graph with two cells of sizes 14 and

42 Thus as a by product we obtain other (cf Example 3) embeddings of the co-Heawoodgraph into the Gewirtz graph This example demonstrates ldquoirregularitiesrdquo which may causeinteresting EPs unpredictable from the first sight

Example 5 (Clebsch graph inside NL2(10)) Recall that up to the automorphism group ofΓ = NL2(10) there is one embedding of 5 into Γ The equitable partition resulting from thisembedding allows us to describe another model for NL2(10)

We start from a group H2 = Z4 times S4 of order 96 with orbits of lengths 16 16 48 128 The collapsed adjacency matrix of the corresponding automorphic equitable partition is Bprimeprime(shown below) Clearly the induced graph on the first cell of the partition is isomorphic to 5

In principle one may try as in previous sections to reconstruct the corresponding matrix Bfrom scratch not relying on knowledge of the graph Γ and its group A promising starting pointwould be justification of existence of a coclique of size 8 and its adjacency with the induced 5

We however prefer to exploit at this stage another possibility Namely it turns out thatthe stabilizers of A and 5 inside of Γ have maximal possible intersection K = Z4timesS3 of order24 K defines an AEP with 11 cells of sizes 2 4 4 6 6 6 12 12 12 12 24 and matrix Bprime

Bprime =

0 2 2 0 0 6 0 6 0 6 01 2 1 3 0 0 3 3 3 0 61 1 2 0 3 0 3 0 3 3 60 2 0 0 4 2 2 0 2 6 40 0 2 4 0 2 2 6 2 0 42 0 0 2 2 0 4 0 4 0 80 1 1 1 1 2 4 3 2 3 41 1 0 0 3 0 3 2 3 3 60 1 1 1 1 2 2 3 4 3 41 0 1 3 0 0 3 3 3 2 60 1 1 1 1 2 2 3 2 3 6

Bprimeprime =

5 4 9 3 14 2 12 0 43 4 11 3 14 0 12 2 42 8 6 6 0

It is easy to recognize how Bprime is split from the matrix B of the metric EP of the configurationA Then we merge the Bprime into Bprimeprime

The cell of size 48 is a merging of the last 3 cells the cell of size 8 is merging of cell of sizes2 and 6 (5th cell) while the cell of size 12 is a merging of two remaining cells of size 6 Eachcell of size 16 is a merging of cells of sizes 4 and 12

Example 6 (Reconstruction of NL2(10) from a subgroup of order 2) Using information inthe atlas [26] (or direct calculation using GAP) we see that G = Aut(NL2(10)) containsone conjugacy class of involutions with no fixed points From such an involution i we getan AEP into 50 cells of size 2 We investigated the quotient graph Γ of this AEP and itscollapsed adjacency matrix denoted by B The structure of Γ may be recovered by consideringthe centralizer CG(i) However we prefer to rely on information of combinatorial nature The

graph Γ has a natural EP into cells of sizes 20 and 30 (representing edges and non-edges inNL2(10))

The induced (color) graph on 20 vertices is the graph K1010 from which a 1-factor is removedThe induced graph on 30 vertices is the incidence graph of generalized quadrangle of order

2 GQ(2)

118

Triangle-free strongly regular graphs Klin Ziv-Av

This equitable partition corresponds to an equitable partition of Γ = NL2(10) into two cellsof sizes 40 and 60

11 Concluding comments

The presentation in this extended abstract is a tip of iceberg Much more concrete informationmay be found in [28] while [27] subject of ongoing polishing and development will reflect alldetected computer data about the graphs from family F We see also more potential to returnagain to construction of further models for graphs in F in particular relying on non-automorphicEPs The new attempts to achieve at least in part enumeration of all EPs of restricted size ofcells for graphs on 77 and 100 vertices are also on agenda The paper [16] as well as a numberof private communications of M Macaj to author MK create a background to attack in nearestfuture the problem of existence of new tfSRGs with relatively small parameters The parameterset on 162 vertices seems to be first interesting and realistic target

It should be mentioned that the results in [16] as well as in numerous private communica-tions of M Macaj to the author MK show that a putative new primitive triangle free stronglyregular graph Γ with prescribed parameters will have a relatively small automorphism groupAut(Γ) very concrete restrictions on the cycle structure of elements in Aut(Γ) are typicallyavailable Transformation of those restrictions to the language of equitable partitions may beregarded as a reasonable starting platform for attempts to construct a new tfSRG

Note however that many experts in AGT do not believe at all that a new tfSRG existsNeedless to say that this question creates a great challenge for the modern scientific community

Acknowledgments

We thank Andy Woldar for ongoing collaboration in this project We acknowledge Sven Re-ichard and Christian Pech for sharing with us their draft versions of COCO II Ongoing com-munication with Martin Macaj is very helpful and stimulative We also are pleased to thankPeter Cameron and Jozef Siran for interest expressed to the topic of our research

References

[1] M D Atkinson On rank 3 groups having λ = 0 Canad J Math 29(4)845ndash847 1977

[2] L Babel S Baumann and M Luedecke Stabcol An efficient implementation of the weisfeiler-leman algorithm Technical Report TUM-M9611 Technical University Munich 1996

[3] L Babel I V Chuvaeva M Klin and D V Pasechnik Algebraic combinatorics in mathematicalchemistry methods and algorithms ii program implementation of the weisfeiler-leman algorithmTechnical Report TUM-M9701 Fakultat fur Mathematik TU Munc 1997 httpwww-litmatumdeveroeffhtml96068019html

[4] C T Benson and N E Losey On a graph of Hoffman and Singleton J Combinatorial TheorySer B 1167ndash79 1971

[5] A E Brouwer A M Cohen and A Neumaier Distance-regular graphs volume 18 of Ergeb-nisse der Mathematik und ihrer Grenzgebiete (3) [Results in Mathematics and Related Areas (3)]Springer-Verlag Berlin 1989

[6] AE Brouwer httpwwwwintuenl~aebgraphs

119

Triangle-free strongly regular graphs Klin Ziv-Av

[7] Dragos Cvetkovic Peter Rowlinson and Slobodan Simic An introduction to the theory of graphspectra volume 75 of London Mathematical Society Student Texts Cambridge University PressCambridge 2010

[8] I A Faradzev and M H Klin Computer package for computations with coherent configurationsIn Proc ISSAC pages 219ndash223 Bonn 1991 ACM Press

[9] I A Faradzev M H Klin and M E Muzichuk Cellular rings and groups of automorphisms ofgraphs In Investigations in algebraic theory of combinatorial objects volume 84 of Math Appl(Soviet Ser) pages 1ndash152 Kluwer Acad Publ Dordrecht 1994

[10] The GAP Group GAP ndash Groups Algorithms and Programming Version 4412 2008

[11] Chris Godsil and Gordon Royle Algebraic graph theory volume 207 of Graduate Texts in Mathe-matics Springer-Verlag New York 2001

[12] Paul R Hafner On the graphs of Hoffman-Singleton and Higman-Sims Electron J Combin11(1)Research Paper 77 33 pp (electronic) 2004

[13] M Klin C Pech and P-H Zieschang Flag algebras of block designs i initial notions steiner2-designs and generalized quadrangles November 1998

[14] Mikhail Klin Christian Pech Sven Reichard Andrew Woldar and Matan Ziv-Av Examples ofcomputer experimentation in algebraic combinatorics Ars Math Contemp 3(2)237ndash258 2010

[15] Mikhail H Klin and Andrew J Woldar Dale Mesner Higman amp Sims and the strongly regulargraph with parameters (100 22 0 6) Bull Inst Combin Appl 6313ndash35 2011

[16] Martin Macaj and Jozef Siran Search for properties of the missing Moore graph Linear AlgebraAppl 432(9)2381ndash2398 2010

[17] Spyros S Magliveras The subgroup structure of the Higman-Sims simple group Bull AmerMath Soc 77535ndash539 1971

[18] B D McKay nauty userrsquos guide (version 15) 1990

[19] Dale Marsh Mesner An investigation of certain combinatorial properties of partially balancedincomplete block experimental designs and association schemes with a detailed study of designs oflatin square and related types ProQuest LLC Ann Arbor MI 1956 Thesis (PhD)ndashMichiganState University

[20] Dale Marsh Mesner Negative latin square designs Mimeo notes 410 Institute of Statistics UNCNC 1964

[21] George Neil Robertson Graphs minimal under girth valency and connectivity constraints Pro-Quest LLC Ann Arbor MI 1969 Thesis (PhD)ndashUniversity of Waterloo (Canada)

[22] Martin Schonert et al GAP ndash Groups Algorithms and Programming ndash version 3 release 4 patch-level 4 Lehrstuhl D fur Mathematik Rheinisch Westfalische Technische Hochschule AachenGermany 1997

[23] Leonard H Soicher GRAPE a system for computing with graphs and groups In Groups andcomputation (New Brunswick NJ 1991) volume 11 of DIMACS Ser Discrete Math TheoretComput Sci pages 287ndash291 Amer Math Soc Providence RI 1993

[24] Edwin R van Dam Three-class association schemes J Algebraic Combin 10(1)69ndash107 1999

[25] B Weisfeiler On construction and identification of graphs Number 558 in Lecture Notes in MathSpringer Berlin 1976

[26] Robert Wilson Peter Walsh Jonathan Tripp Ibrahim Suleiman Richard Parker Simon NortonSimon Nickerson Steve Linton John Bray and Rachel Abbott Atlas of finite group representa-tions - version 3 httpbrauermathsqmulacukAtlasv3

[27] M Ziv-Av Protocols with computer data related to the investigation of known primitive trangle-free strongly regular graphs httpwwwmathbguacil~zivavmath

[28] M Ziv-Av Results of computer algebra calculations for triangle free strongly regular graphshttpwwwmathbguacil~zivavmatheqpartpdf

120

Triangle-free strongly regular graphs Klin Ziv-Av

A Data about embeddings of tfSRGs inside tfSRGs

Quadrangle edge 2 edges 3 4 5 6Pentagon 0 5 0 0 0 0 0Petersen 0 15 15 5 0 0 0Clebsch 40 40 60 40 10 0 0HoSi 0 175 7875 128625 845250 2170350 1817550

Gewirtz 630 280 15120 245280 1370880 2603664 1643040Mesner 6930 616 55440 1330560 10589040 28961856 24641232NL2(10) 28875 1100 154000 5544000 67452000 301593600 477338400

7 edges 8 9 10 11HoSi 40150 15750 3500 350 0

Gewirtz 104160 7560 1400 112 0Mesner 3664320 166320 30800 2464 0NL2(10) 258192000 14322000 924000 154000 11200

Table 1 Number of imprimitive tfSRGs inside tfSRGs

Quadrangle edge 2 edges 3 4 5 6Pentagon 0 1 0 0 0 0 0Petersen 0 1 1 1 0 0 0Clebsch 1 1 1 1 1 0 0HoSi 0 1 1 4 10 21 15

Gewirtz 1 1 2 9 30 48 36Mesner 1 1 1 7 26 56 50NL2(10) 1 1 1 2 7 14 17

7 edges 8 9 10 11HoSi 8 1 1 1 0

Gewirtz 5 2 2 1 0Mesner 14 2 2 1 0NL2(10) 14 3 2 2 1

Table 2 Number of orbits of imprimitive tfSRGs inside tfSRGs

Pentagon Petersen Clebsch HoSi Gewirtz Mesner NL2(10)Pentagon 1 12 192 1260 8064 88704 443520Petersen 1 16 525 13440 1921920 35481600Clebsch 1 0 0 0 924000HoSi 1 0 0 704

Gewirtz 1 22 1030Mesner 1 100NL2(10) 1

Table 3 Number of primitive tfSRGs inside tfSRGs

121

Triangle-free strongly regular graphs Klin Ziv-Av

Pentagon Petersen Clebsch HoSi Gewirtz Mesner NL2(10)Pentagon 1 1 1 1 1 1 1Petersen 1 1 1 1 9 5Clebsch 1 0 0 0 1HoSi 1 0 0 1

Gewirtz 1 1 1Mesner 1 1NL2(10) 1

Table 4 Number of orbits of primitive tfSRGs inside tfSRGs

B Data about equitable partitions of primitive tfSRGs

Pentagon Petersen Clebsch HoSi Gewirtz Mesner NL2(10)EP 3 11 46 163Aut 3 11 38 89 154 236 607

Table 5 Number of orbits of equitable partitions and of automorphic equitable partitions forknown tfSRGs

Size 1 3 5 TotalEP 1 1 1 3Aut 1 1 1 3

Size 1 2 3 4 5 6 7 10 TotalEP 1 2 2 2 1 1 1 1 11Aut 1 2 2 2 1 1 1 1 11

Size 1 2 3 4 5 6 7 8 9 10 12 16 TotalEP 1 4 6 12 5 7 3 4 1 1 1 1 46Aut 1 4 5 10 3 5 2 4 1 1 1 1 38

Size 1 2 3 4 5 6 7 8 9 10 11EP 1 6 8 16 18 20 19 18 11 11 8Aut 1 4 5 7 6 9 9 11 4 9 4Size 12 13 14 15 16 18 20 28 30 50 TotalEP 7 7 2 2 1 2 3 1 1 1 163Aut 4 4 2 1 1 2 3 1 1 1 89

Table 6 Numbers of EPs and automorphic EPs by size of partition for four small graphs

122

Triangle-free strongly regular graphs Klin Ziv-Av

Size 1 2 3 4 5 6 7 8 9 10 11 12 13Aut 1 5 9 12 12 14 15 16 14 11 7 7 6Size 14 16 17 18 19 20 23 28 31 32 35 56 TotalAut 5 3 3 2 2 4 1 1 1 1 1 1 154

Size 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15Aut 1 3 5 8 11 10 20 14 19 12 18 12 16 9 14Size 16 17 18 19 20 21 23 25 29 33 41 45 49 77 TotalAut 5 12 5 9 1 8 4 8 6 2 1 1 1 1 236

Size 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15Aut 1 6 15 21 28 29 31 42 34 35 37 49 30 31 27Size 16 17 18 19 20 21 22 23 24 25 26 27 28 29Aut 26 18 18 13 26 14 11 7 9 6 6 5 2 1Size 30 31 32 33 34 35 39 40 45 50 53 60 65 100 TotalAut 7 1 3 2 2 3 1 4 1 1 1 1 1 1 607

Table 7 Numbers of automorphic EPs by size of partition for larger graphs

123

Usage of Invariants for Symbolic Verification of

Requirements

Short Paper

Alexander Letichevsky1 Alexander Godlevsky1 Anton Guba1 Alexander

Kolchin1 Oleksandr Letychevskyi1 Vladimir Peschanenko2

1 VM Glushkov Institute of Cybernetics Kiev Ukraineletcyfranet godlissorgua antongubaukrnet kolchin avyahoocom litissorgua

2 Kherson State University Kherson Ukrainevladimiriusgmailcom

The main goal of the paper is finding of pre- and post-invariants for transitions betweensymbolic states in the system that must be verified and use them for verification purposesSystems are specified by basic protocols [1] This specification defines a transition system withtransitions s rarr s

prime where s and sprime are symbolic states b is a basic protocol The main problem

of verification is a reachability problem for given properties expressed in specification logiclanguage

We present double approximation method of verification based on computing invariants Themethod is implemented as an iterative algorithm which solves in parallel reachability problemand computes lower and upper approximations of invariants for basic protocols

Currently there are a lot of significant works devoted to computing invariants which areconsidered for loops in programs Loops are marked explicitly - syntactic constructions likewhile and others When we deal with requirement specifications we do not deal with explicitmarked loops moreover basic protocols provide non-deterministic order Existing methodsusually ignore the conditions of the loops Invariants formulae which is obtained as a resultinclude unreachable states and therefore could be used in verification only in the following wayif a property does not intersect with the invariant formula then it is unreachable if intersectsthen conclusion cannot be done Therefore the problem of modification of existing methodsor to develop a new algorithm that could be applied in practice of requirements verification isactual

Research of problems of automatic program invariants generation for a variety of data al-gebras was performed starting from 70-th years in Institute of Cybernetics of NAS of UkraineTheir main results are presented in [2] Double approximation method is the dynamic iterativemethod of invariants generation and it is based on these results and adapted for requirementsverification The method also can be applied to program verification if a program is consideredas a special case of basic protocol specification The method has been implemented in VRS(Verification of Requirement Specifications) system [3] and IMS (Insertion Modeling System)system [4]

References

[1] A Letichevsky J Kapitonova V Volkov A Letichevsky Jr S Baranov V Kotlyarov T WeigertSystem Specification with Basic Protocols Cybernetics and System Analyses vol 4 2005 p 3-21

[2] Godlevsky AB Kapitonova YV Krivoy SL Letichevsky AA Iterative methods of programanalysis Cybernetics vol 2 1989 9-19

[3] Verification for Requirement Specification (VRS) httpissorguaISSVRStoolhtm lastviewed May 2013

[4] APS and IMS Systems httpapsystemorgua last viewed May 2013

124

Lebesgue Constants and Optimal Node Systems

via Symbolic Computations

Short Paper

Robert Vajda

University of Szeged Szeged Hungaryvajdarmathu-szegedhu

Abstract

Polynomial interpolation is a classical method to approximate continuous functionsby polynomials To measure the correctness of the approximation Lebesgue constantsare introduced For a given node system X(n+1) = x1 lt lt xn+1 (xj isin [a b])the Lebesgue function λn(x) is the sum of the modulus of the Lagrange basis polynomialsbuilt on X(n+1) The Lebesgue constant Λn assigned to the function λn(x) is its maximumover [a b] The Lebesgue constant bounds the interpolation error ie the interpolationpolynomial is at most (1 + Λn) times worse then the best approximation The minimumof the Λnrsquos for fixed n and interval [a b] is called the optimal Lebesgue constant Λlowast

n Forspecific interpolation node systems such as the equidistant system numerical results forthe Lebesgue constants Λn and their asymptotic behavior are known [3 7] However togive explicit symbolic expression for the minimal Lebesgue constant Λlowast

n is computationallydifficult In this work motivated by Rack [5 6] we are interested for expressing the minimalLebesgue constants symbolically on [minus1 1] and we are also looking for the characterizationof the those node systems which realize the minimal Lebesgue constants We exploited theequioscillation property of the Lebesgue function [4] and used quantifier elimination andGroebner Basis as tools [1 2] Most of the computation is done in Mathematica [8]

Acknowledgement The research of the author was partially supported by the HSRF(OTKA) grant number K83219

References

[1] D S Arnon - G E Collins - S McCallum Cylindrical Algebraic Decomposition I The BasicAlgorithm In Caviness-Johnson (eds) Quantifier Elimination and Cylindrical Algebraic Decom-position 136-151 Springer 1998

[2] B Buchberger Ein Algorithmus zum Auffinden der Basiselemente des Restklassenringes nach einemnulldimensionalen Polynomideal (An algorithm for finding the basis elements in the residue classring modulo a zero dimensional polynomial ideal) PhD Thesis Innsbruck 1965

[3] J S Hesthaven From electrostatics to almost optimal nodal sets for polynomial interpolation in asimplex SIAM J Numer Anal Vol 35 No 2 655-676 1998

[4] T A Kilgore A characterization of the Lagrange interpolating projection with minimal Tchebycheffnorm J Approx Theory 24 (1978) no 4 273-288

[5] H-J Rack An example of optimal nodes for interpolation International Journal of MathematicalEducation in Science and Technology 15 (3) 355-357 1984

[6] H-J Rack An example of optimal nodes for interpolation revisited Advances in Applied Mathe-matics and Approximation Theory Springer Proceedings in Mathematics amp Statistics Volume 41117-120 2013

[7] S J Simon Lebesgue constants in polynomial interpolation Annales Mathematicae et Informaticae33 109-123 2006

[8] Wolfram Research Inc Mathematica Version 90 Champaign Illinois 2012

125

Author Index

Alpuente Marıa 4

Ballis Demis 4

Buchberger Bruno 1

Comini Marco 19 31

Frechina Francisco 4

Ghourabi Fadoua 50

Godlevsky Alexander 124

Goto Mizuki 93

Guba Anton 124

Ida Tetsuo 50

Kakutani Yoshihiko 64

Kato Go 64

Kawano Yasuhito 64

Klin Mikhail 108

Kolchin Alexander 124

Kubota Takahiro 64

Letichevsky Alexander 124

Letychevskyi Oleksandr 124

Li Wei 2

Matringe Nadir 81

Moura Arnaldo 81

Neumann Severin 70

Ouaknine Joel 3

Peschanenko Vladimir 124

Rebiha Rachid 81

Sakurada Hideki 64

Sapina Julia 4

Takahashi Kazuko 50 93

Torella Luca 19 31

Vajda Robert 125

Yoshimaru Shizuo 93

Ziv-Av Matan 108

Keyword Index

algebraic number 125

automated verification 64

BB84 64

bottom-up semantics 31

computational model 93

computational origami 50

computer algebra 108

debugging 4

Distributed 70

elecronic cash protocol 93

equitable partitions 108

F4 70

formal methods 64

geometrical constraint solving 50

Groebner basis 125

Grobner Basis 70

induction scheme 93

invariants 124

knot fold 50

Lebesgue constant 125

Linear Algebra 81

maude 4

MPI 70

Parallel 70

polynomial interpolation 125

process calculi 64

program animation 4

property-oriented specifications 19

quantifier elimination 125

quantum cryptography 64

requirements specification 124

resultant 125

rewriting logic 4

semantics-based inference methods 19

slicing 4

Static Analysis 81

stepping 4

strongly regular graphs 108

symbolic verification 124

term rewriting 31

Term Rewriting Systems 19 31

Termination Analysis 81

theorem proving 50

theorem proving methods 93

  • Introduction
  • Preliminaries
  • Rewriting Modulo Equational Theories
  • Exploring the Computation Tree
    • Expanding a Program State
    • Computing a Fragment of the Computation Tree
      • Particularizing the Exploration
        • Interactive Stepper
        • Forward Trace Slicer
          • Implementation
          • Conclusions
          • Introduction
            • Notations
              • Many notions of equivalence
              • Deriving specifications from TRSs
                • An effective instance of the presented method
                  • Conclusions and future work
                  • Introduction
                  • Preliminaries
                  • Modeling the small-step rewriting behavior
                    • The semantic domain
                      • Linearizing Narrowing
                        • Operational denotations of TRSs
                          • Evaluation Function
                          • Properties of the TRS operational denotation
                            • Fixpoint denotations of TRSs
                              • Properties of the TRS fixpoint denotation
                                  • Conclusions
                                  • Technical Proofs
                                  • Introduction
                                  • Notations
                                  • Origami Geometrical Construction
                                    • Huzitas Fold Operations
                                    • Extensions
                                      • Knot Fold
                                        • Geometrical Properties
                                        • Geometrical Constraint Solving Approach
                                          • Regular Heptagon by the Knot Fold
                                            • Geometrical Constraints
                                            • Construction by Eos
                                            • Algebraic Interpretation
                                              • Proof
                                                • Theorem to Prove
                                                • Proof by Eos
                                                • Proof Results
                                                  • Conclusion
                                                    • Acknowledgments
                                                      • Introduction
                                                      • The Verifier
                                                      • Application to Shor and Preskills Security Proof
                                                      • Conclusions
                                                      • Introduction
                                                      • Notations
                                                      • Preliminaries
                                                      • Matrix Distribution
                                                      • Simplifying the F4 Algorithm
                                                      • Benchmarks
                                                      • Conclusion
                                                      • Introduction
                                                      • Linear Algebra and Linear Loop Programs
                                                      • Asymptotically Non-terminant Variable Values
                                                      • Automated generation of ANT loci
                                                        • The regular case
                                                        • The general case handling linear diagonalizable programs
                                                          • Discussions
                                                          • Conclusion
                                                          • Introduction
                                                          • Data Conversion Formalization
                                                            • Problem
                                                            • Solution
                                                              • Conversion from BS to BTREE
                                                              • Conversion from NAT to BS
                                                              • Conversion from NAT to BTREE
                                                                  • Modeling of an Electronic Cash Protocol
                                                                    • Ideal Electronic Cash
                                                                    • Definition of money
                                                                    • Creation of money from a natural number
                                                                    • Calculation of the amount of money
                                                                    • Payment
                                                                      • Proof of Properties
                                                                        • Well-definedness of cash
                                                                        • Well-definedness of pay
                                                                        • Divisibility
                                                                          • Discussion
                                                                          • Conclusion
                                                                          • Introduction
                                                                          • Strongly regular graphs a brief survey
                                                                          • Computer algebra tools in AGT
                                                                          • The seven known primitive triangle-free strongly regular graphs
                                                                          • Embeddings of tfSRGs into known primitive tfSRGs
                                                                          • Equitable partitions
                                                                          • Search for equitable partitions
                                                                          • Quadrangle and Atkinson EPs of NL2(10)
                                                                          • Some modifications of Robertson model
                                                                          • A few more models
                                                                          • Concluding comments
                                                                          • Data about embeddings of tfSRGs inside tfSRGs
                                                                          • Data about equitable partitions of primitive tfSRGs
Page 6: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,

Table of Contents

Invited Papers

Mathematics of 21st Century A Personal View 1

Bruno Buchberger

A Semantic Framework for Program Debugging 2

Wei Li

Decision Problems for Linear Recurrence Sequences 3

Joel Ouaknine

Regular Papers

Parametric Exploration of Rewriting Logic Computations 4

Marıa Alpuente Demis Ballis Francisco Frechina and Julia

Sapina

Automatic Inference of Term Equivalence in Term Rewriting

Systems 19

Marco Comini and Luca Torella

A Condensed Goal-Independent Fixpoint Semantics Modeling

the Small-Step Behavior of Rewriting 31

Marco Comini and Luca Torella

Logical and Algebraic Views of a Knot Fold of a Regular

Heptagon 50

Fadoua Ghourabi Tetsuo Ida and Kazuko Takahashi

Automated Verification of Equivalence on Quantum

Cryptographic Protocols 64

Takahiro Kubota Yoshihiko Kakutani Go Kato Yasuhito

Kawano and Hideki Sakurada

A modified parallel F4 algorithm for shared and distributed

memory architectures 70

Severin Neumann

Generating Asymptotically Non-terminant Initial Variable

Values for Linear Diagonalizable Programs 81

Rachid Rebiha Nadir Matringe and Arnaldo Moura

Data Conversion Method between a Natural Number and a

Binay Tree for an Inductive Proof and Its Application 93

Kazuko Takahashi Shizuo Yoshimaru and Mizuki Goto

Computer algebra investigation of known primitive

triangle-free strongly regular graphs 108

Matan Ziv-Av and Mikhail Klin

Short Papers

Usage of Invariants for Symbolic Verification of Requirements 124

Alexander Letichevsky Alexander Godlevsky Anton Guba

Alexander Kolchin Oleksandr Letychevskyi and Vladimir

Peschanenko

Lebesgue Constants and Optimal Node Systems via Symbolic

Computations 125

Robert Vajda

Mathematics of 21st Century

A Personal View

Bruno Buchberger

Research Institute for Symbolic Computation - RISC

Johannes Kepler University Linz Austria

BrunoBuchbergerriscuni-linzacat

Extended Abstract

Mathematics of 19th century and before was rich in content intuition strong ideas motivationfrom natural sciences and had a coherent view of all fields of mathematics (geometry algebraanalysis number theory )

Mathematics of 20th century added three important aspects mathematical logic as themathematical meta-theory of mathematics formalism and abstractness and reduction to firstprinciples (ldquoBourbakismrdquo) and the notion of computing (both as an exact mathematicalnotion and as the foundation of the revolutionary device rdquoprogrammable computerrdquo) In factthe three aspects have a lot to do with each other and are fundamentally interrelated Howeverin practice the three aspects were (and still are) pursued by three different communities Thedeep insights of logicians on the nature of mathematics are hardly used in ever-day practiceof ldquoworking mathematiciansrdquo ldquopure mathematiciansrdquo are often proud that they do not touchthe computer except for writing e-mails typing in LaTeX and using web search and computerscientists often think that what they are doing does not need mathematics or even is oppositeto mathematics

In my view as indicated by trends in late 20th century in 21st century mathematics willevolve as - or return to be - a unified body of mathematical logic abstract structural math-ematics and computer mathematics with no boundaries between the three aspects ldquoWorkingmathematiciansrdquo will have to master the three aspects equally well and integrate them in theirdaily work More specifically working in mathematics will proceed on the ldquoobject levelrdquo ofdeveloping new mathematical content (abstract knowledge and computational methods) andat the same time on the ldquometa-levelrdquo of developing automated reasoning methods for support-ing research on the object level This ldquomassage of the mathematical brainrdquo by jumping backand forth between the object and the meta-level will guide mathematics onto a new level ofsophistication

Symbolic computation is just a way of expressing this general view of mathematics of the21st century and it also should be clear that software science is just another way of expressingthe algorithmic aspect of this view

In the talk we will exemplify the spirit of this new type of mathematics by a report onthe Theorema system being developed in the speakerrsquos research group Theorema is both alogic and a software frame for doing mathematics in the way sketched above On the objectlevel Theorema allows to prove and program within the same logical frame and on the meta-level it allows to formulate reasoning techniques that help proving and programming on theobject level In particular we will show how this type of doing mathematics allows to mimicthe invention process behind the speakerrsquos theory of Grobner bases which provides a generalmethod for dealing with multivariate nonlinear polynomial systems

1

A Semantic Framework for Program Debugging

Wei Li

State Key Laboratory of Software Development Environment

School of Computer Science and Engineering

Beihang University China

liweinlsdebuaaeducn

Abstract

This work aims to build a semantic framework for automated debugging A debugging pro-

cess consists of tracing locating and fixing processes consecutively The first two processes

are accomplished by a tracing procedure and a locating procedure respectively The tracing

procedure reproduces the execution of a failed test case with well-designed data structures and

saves necessary information for locating bugs The locating procedure will use the informa-

tion obtained from the tracing procedure to locate ill-designed statements and to generate a

fix-equation the solution of which is a function that will be used to fix the bugs A structural

operational semantics is given to define the functions of the tracing and locating procedure

Both procedures are proved to terminate and produces one fix-equation The main task of

fixing process is to solve the fix-equation It turns out that for a given failed test case there

exist three different types of solutions 1 the bug is solvable there exists a solution of the

fix-equation and the program can be repaired 2 There exists a non-linear error in the pro-

gram the fix-equation generated at each round of the locating procedure is solvable but a new

bug will arise when the old bug is being fixed 3 There exists a logical design error and the

fix-equation is not solvable

2

Decision Problems for Linear Recurrence

Sequences

Joel Ouaknine

Department of Computer Science

Oxford University United Kingdom

JoelOuakninecsoxacuk

Abstract

Linear recurrence sequences (LRS) such as the Fibonacci numbers permeate vast areas ofmathematics and computer science In this talk we consider three natural decision problemsfor LRS namely the Skolem Problem (does a given LRS have a zero) the Positivity Problem

(are all terms of a given LRS positive) and the Ultimate Positivity Problem (are all but finitelymany terms of a given LRS positive) Such problems (and assorted variants) have applicationsin a wide array of scientific areas such as theoretical biology (analysis of L-systems pop-ulation dynamics) economics (stability of supply-and-demand equilibria in cyclical marketsmultiplier-accelerator models) software verification (termination of linear programs) proba-bilistic model checking (reachability and approximation in Markov chains stochastic logics)quantum computing (threshold problems for quantum automata) discrete linear dynamicalsystems (reachability and invariance problems) as well as combinatorics statistical physicsterm rewriting formal languages cellular automata generating functions etc

We shall see that these problems have deep and fascinating connections to rich mathematicalconcepts and conjectures particularly in the fields of analytic and algebraic number theorydiophantine geometry and approximation real algebraic geometry mathematical logic andcomplexity theory

3

Parametric Exploration of

Rewriting Logic Computations lowast

M Alpuente1 D Ballis2 F Frechina1 and J Sapina1

1 DSIC-ELP Universitat Politecnica de ValenciaCamino de Vera sn Apdo 22012 46071 Valencia Spain

alpuenteffrechinajsapinadsicupves2 DIMI Universita degli Studi di Udine

Via delle Scienze 206 33100 Udine Italy demisballisuniudit

Abstract

This paper presents a parameterized technique for the inspection of Rewriting Logiccomputations that allows the non-deterministic execution of a given rewrite theory to befollowed up in different ways Starting from a selected state in the computation tree theexploration is driven by a user-defined inspection criterion that specifies the explorationmode By selecting different inspection criteria one can automatically derive useful debug-ging facilities such as program steppers and more sophisticated dynamic trace slicers thatfacilitate the detection of control and data dependencies across the computation tree Ourmethodology which is implemented in the Anima graphical tool allows users to capture theimpact of a given criterion validate input data and detect improper program behaviors

1 Introduction

Program animation or stepping refers to the very common debugging technique of executingcode one step at a time allowing the user to inspect the program state and related databefore and after the execution step This allows the user to evaluate the effects of a givenstatement or instruction in isolation and thereby gain insight into the program behavior (ormisbehavior) Nearly all modern IDEs debuggers and testing tools currently support this modeof execution optionally where animation is achieved either by forcing execution breakpointscode instrumentation or instruction simulation

Rewriting Logic (RWL) is a very general logical and semantic framework which is particu-larly suitable for formalizing highly concurrent complex systems (eg biological systems [7] andWeb systems [2 6]) RWL is efficiently implemented in the high-performance system Maude [9]Roughly speaking a rewriting logic theory seamlessly combines a term rewriting system (TRS)together with an equational theory that may include equations and axioms (ie algebraic lawssuch as commutativity associativity and unity) so that rewrite steps are performed modulo theequations and axioms

In recent years debugging and optimization techniques based on RWL have received growingattention [1 13 16 17] but to the best of our knowledge no practical animation tool forRWLMaude has been formally developed To debug Maude programs Maude has a basictracing facility that allows the user to advance through the program execution letting himherselect the statements to be traced except for the application of algebraic axioms that are not

lowastThis work has been partially supported by the EU (FEDER) and the Spanish MEC project ref TIN2010-21062-C02-02 and by Generalitat Valenciana ref PROMETEO2011052 This work was carried out during thetenure of D Ballisrsquo ERCIM lsquoAlain Bensoussanrdquo Postdoctoral Fellowship The research leading to these resultshas received funding from the European Union Seventh Framework Programme (FP72007-2013) under grantagreement n 246016 F Frechina was supported by FPU-ME grant AP2010-5681

4

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

under user control and are never recorded as execution steps in the trace All rewrite steps thatare obtained by applying the equations or rules for the selected function symbols are shown inthe output trace so that the only way to simplify the displayed view of the trace is by manuallyfixing the traceable equations or rules Thus the trace is typically huge and incomplete andwhen the user detects an erroneous intermediate result it is difficult to determine where theincorrect inference started Moreover this trace is either directly displayed or written to afile (in both cases in plain text format) thus only being amenable for manual inspection bythe user This is in contrast with the enriched traces described below which are complete (allexecution steps are recorded by default) and can be sliced automatically so that they can bedramatically simplified in order to facilitate a specific analysis Also the trace can be directlydisplayed or delivered in its meta-level representation which is very useful for further automatedmanipulation

Contributions This paper presents the first parametric (forward) exploration technique forRWL computations Our technique is based on a generic animation algorithm that can be tunedto work with different modalities including incremental stepping and automated forward slicingThe algorithm is fully general and can be applied for debugging as well as for optimizing anyRWL-based tool that manipulates RWL computations Our formulation takes into account theprecise way in which Maude mechanizes the rewriting process and revisits all those rewrite stepsin an instrumented fine-grained way where each small step corresponds to the application ofan equation equational axiom or rule This allows us to explain the input execution trace withregard to the set of symbols of interest (input symbols) by tracing them along the executiontrace so that in the case of the forward slicing modality all data that are not descendants ofthe observed symbols are simply discarded

Related Work Program animators have existed since the early years of programmingAlthough several steppers have been implemented in the functional programming community(see [10] for references) none of these systems applies to the animation and forward slicing ofMaude computations An algebraic stepper for Scheme is defined and formally proved in [10]which is included in the DrScheme programming environment The stepper reduces Schemeprograms to values (according to the reduction semantics of Scheme) and is useful for explainingthe semantics of linguistic facilities and for studying the behavior of small programs It explainsa programrsquos execution as a sequence of reduction steps based on the ordinary laws of algebra forthe functional core of the language and more general algebraic laws for the rest of the languageIn order to discover all of the steps that occur during the program evaluation the stepperrewrites (or rdquoinstrumentsrdquo) the code The inserted code uses a mechanism called ldquocontinuationmarksrdquo to store information about the programrsquos execution as it is running and makes calls tothe stepper before after and during the evaluation of each program expression Continuationmarks allow the stepper to reuse the underlying Scheme implementation without having to re-implement the evaluator The stepperrsquos implementation technique also applies to both ML andHaskell since it supports states continuations multiple threads of control and lazy evaluation[10]

In [4 5] an incremental backward trace slicer was presented that generates a trace slice ofan execution trace T by tracing back a set of symbols of interest along (an instrumented versionof) T while data that are not required to produce the target symbols are simply discarded Thiscan be very helpful in debugging since any information that is not strictly needed to delivera critical part of the result is discarded which helps answer the question of what programcomponents might affect a lsquoselected computationrdquo However for the dual problem of ldquowhatprogram components might be affected by a selected computationrdquo a kind of forward expansionis needed which has been overlooked to date

5

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

Plan of the paper Section 2 recalls some fundamental notions of RWL and Section 3summarizes the rewriting modulo equational theories defined in Maude Section 4 formulatesthe exploration as a parameterized procedure that is completely controlled by the user whileSection 5 formalizes three different inspection techniques that are obtained as an instance ofthe generic scheme Finally Section 6 reports on a prototypical implementation of the proposedtechniques and Section 7 concludes

2 Preliminaries

Let us recall some important notions that are relevant to this work We assume some basicknowledge of term rewriting [18] and Rewriting Logic [14] Some familiarity with the Maudelanguage [9] is also required

We consider an order-sorted signature Σ with a finite poset of sorts (Slt) that models theusual subsort relation [9] We assume an S-sorted family V = VssisinS of disjoint variable setsτ(ΣV)s and τ(Σ)s are the sets of terms and ground terms of sort s respectively We writeτ(ΣV) and τ(Σ) for the corresponding term algebras The set of variables that occur in a termt is denoted by Var(t) In order to simplify the presentation we often disregard sorts when noconfusion can arise

A position w in a term t is represented by a sequence of natural numbers that addressesa subterm of t (Λ denotes the empty sequence ie the root position) By notation w1w2we denote the concatenation of positions (sequences) w1 and w2 Positions are ordered by theprefix ordering that is given the positions w1 and w2 w1 le w2 if there exists a position u suchthat w1u = w2

Given a term t we let Pos(t) denote the set of positions of t By t|w we denote the subtermof t at position w and t[s]w specifies the result of replacing the subterm t|w by the term s

A substitution σ equiv x1t1 x2t2 is a mapping from the set of variables V to the set ofterms τ(ΣV) which is equal to the identity almost everywhere except over a set of variablesx1 xn The domain of σ is the set Dom(σ) = x isin V | xσ 6= x By id we denote theidentity substitution The application of a substitution σ to a term t denoted tσ is defined byinduction on the structure of terms

tσ =

xσ if t = x x isin V

f(t1σ tnσ) if t = f(t1 tn) n ge 0

For any substitution σ and set of variables V σ |V denotes the substitution obtained from σby restricting its domain to V (ie σ |V (x) = xσ if x isin V otherwise σ |V (x) = x) Given twoterms s and t a substitution σ is a matcher of t in s if sσ = t The term t is an instance ofthe term s iff there exists a matcher σ of t in s By matchs(t) we denote the function thatreturns a matcher of t in s if such a matcher exists

A (labelled) equation is an expression of the form [l] λ = ρ where λ ρ isin τ(ΣV) V ar(ρ) subeV ar(λ) and l is a label ie a name that identifies the equation A (labelled) rewrite rule isan expression of the form [l] λ rarr ρ where λ ρ isin τ(ΣV) V ar(ρ) sube V ar(λ) and l is a labelWhen no confusion can arise rule and equation labels are often omitted The term λ (resp ρ)is called left-hand side (resp right-hand side) of the rule λrarr ρ (resp equation λ = ρ)

6

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

3 Rewriting Modulo Equational Theories

An order-sorted equational theory is a pair E = (Σ∆cupB) where Σ is an order-sorted signature∆ is a collection of (oriented) equations and B is a collection of equational axioms (ie algebraiclaws such as associativity commutativity and unity) that can be associated with any binaryoperator of Σ The equational theory E induces a congruence relation on the term algebraτ(ΣV) which is denoted by =E A rewrite theory is a triple R = (Σ∆ cup BR) where(Σ∆ cupB) is an order-sorted equational theory and R is a set of rewrite rules

Example 31The following rewrite theory encoded in Maude specifies a close variant of the fault-tolerantclient-server communication protocol of [15]

mod CLIENT-SERVER-TRANSF is inc INT + QID sorts Content State Msg Cli Serv Addressee

Sender Data CliName ServName Question Answer subsort Msg Cli Serv lt State subsort Addressee Sender CliName ServName lt Qid subsort Question Answer Data lt Nat

ops Srv Srv-A Srv-B Cli Cli-A Cli-B -gt Qid op null -gt State op _amp_ State State -gt State [assoc comm id null] op _lt-_ Addressee Content -gt Msg op __ Sender Data -gt Content op [____] CliName ServName Question Answer -gt Cli op na -gt Answer op [_] ServName -gt Serv [ctor] op f ServName CliName Data -gt Data

vars C S Addr Qid vars Q D A Nat var CNT [Content]

eq [succ] f(S C Q) = s(Q)

rl [req] [C S Q na] =gt[C S Q na] amp S lt- C Q

rl [reply] S lt- C Q amp [S] =gt[S] amp C lt- S f(S C Q)

rl [rec] C lt- S D amp [C S Q A] =gt[C S Q A]

rl [dupl] (Addr lt- CNT) =gt(Addr lt- CNT) amp (Addr lt- CNT)

rl [loss] (Addr lt- CNT) =gt null endm

The specification models an environment where several clients and servers coexist Eachserver can serve many clients while for the sake of simplicity we assume that each clientcommunicates with a single server

The names of clients and servers belong to the sort Qid Clients are represented as 4-tuplesof the form [C S Q D] where C is the clientrsquos name S is the name of the server it wants tocommunicate with Q is a natural number that identifies a client request and D is either a naturalnumber that represents the server response or the constant value na (not available) when theresponse has not been yet received Servers are stateless and are represented as structures [S]with S being the serverrsquos name All messages are represented as pairs of the form Addr lt- CNTwhere Addr is the addresseersquos name and CNT stands for the message contents Such contentsare pairs AddrN with Addr being the senderrsquos name and N being a number that representseither a request or a response

The server S uses a function f (only known to the server itself) that given a question Q

from client C the call f(S C Q) computes the answer s(Q) where s(Q) is the successor of Q Thisfunction is specified by means of the equation succ

Program states are formalized as a soup (multiset) of clients servers and messages whereasthe system behavior is formalized through five rewrite rules that model a faulty communicationenvironment in which messages can arrive out of order can be duplicated and can be lostSpecifically the rule req allows a client C to send a message with request Q to the server SThe rule reply lets the server S consume the client request Q and send a response messagethat is computed by means of the function f The rule rec specifies the client reception of aserver response D that should be stored in the client data structure Indeed the right-handside [C S Q A] of the rule includes an intentional barely perceptible bug that does not let theclient structure be correctly updated with the incoming response D The correct right-hand sideshould be [C S Q D] Finally the rules dupl and loss model the faulty environment and have

7

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

the obvious meaning messages can either be duplicated or lost

Given a rewrite theory (Σ ER) with E = ∆ cup B the rewriting modulo E relation (insymbols rarrRE) can be defined by lifting the usual rewrite relation on terms [12] to the E-congruence classes [t]E on the term algebra τ(ΣV) that are induced by =E [8] that is [t]Eis the class of all terms that are equal to t modulo E Unfortunately rarrRE is in generalundecidable since a rewrite step t rarrRE tprime involves searching through the possibly infiniteequivalence classes [t]E and [tprime]E

The exploration technique formalized in this work is formulated by considering the preciseway in which Maude proves the rewrite steps (see Section 52 in [9]) Actually the Maudeinterpreter implements rewriting modulo E by means of two much simpler relations namelyrarr∆B and rarrRB These allow rewrite rules and equations to be intermixed in the rewritingprocess by simply using an algorithm of matching modulo B We define rarrRcup∆B as rarrRB

cup rarr∆B Roughly speaking the relation rarr∆B uses the equations of ∆ (oriented from leftto right) as simplification rules thus for any term t by repeatedly applying the equations assimplification rules we eventually reach a normalized term tdarr∆ to which no further equationscan be applied The term t darr∆ is called a canonical form of t wrt ∆ On the other handthe relation rarrRB implements rewriting with the rules of R which might be non-terminatingand non-confluent whereas ∆ is required to be terminating and Church-Rosser modulo B inorder to guarantee the existence and unicity (modulo B) of a canonical form wrt ∆ for anyterm [9]

Formally rarrRB and rarr∆B are defined as follows given a rewrite rule r = (λ rarr ρ) isin R(resp an equation e = (λ = ρ) isin ∆) a substitution σ a term t and a position w of t

trσwrarrRB tprime (resp t

eσwrarr∆B tprime) iff λσ =B t|w and tprime = t[ρσ]w When no confusion can arise we

simply write trarrRB tprime (resp trarr∆Btprime) instead of t

rσwrarrRB tprime (resp t

eσwrarr∆B tprime)

Under appropriate conditions on the rewrite theory a rewrite step modulo E on a term t canbe implemented without loss of completeness by applying the following rewrite strategy [11](i) reduce t wrt rarr∆B until the canonical form t darr∆ is reached (ii) rewrite t darr∆ wrt rarrRB

A computation C in the rewrite theory (Σ∆ cupBR) is a rewrite sequence

s0 rarrlowast∆B s0darr∆ rarrRB s1 rarrlowast

∆B s1darr∆

that interleaves rarr∆B rewrite steps and rarrRB rewrite steps following the strategy mentionedabove Terms that appear in computations are also called (program) states

A computation tree TR(s) for a term s and a rewrite theory R is a tree-like representationof all the possible computations in R that originate from the initial state s More preciselyTR(s) is a labelled tree whose root node label identifies the initial state s and whose edges arelabelled with rewrite steps of the form t rarrRcup∆B tprime so that any node in TR(s) represents aprogram state of a computation stemming from s

Example 32

Consider the rewrite theory of Example 31 together with the initial state [Srv-A] amp [Cli-A

Srv-A7na] amp [Cli-BSrv-A17na] In this case the computation tree consists of severalinfinite computations that start from the considered initial state and model interactions betweenclients Cli-A and Cli-B and server Srv-A The computed tree is depicted in the following picturewhere for the sake of simplicity we only display the equations and rules that have been appliedat each rewrite step while other information such as the computed substitution and the rewrite

8

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

position are omitted in the depicted tree

Query Go

Go

Go

Go

Go

Go

GoGoBack

Back

Back

Back

Back

Back

BackBack Anima

[Srv-A] amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]s0

req[Srv-A] amp (Srv-A lt- Cli-A7) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s1 req[Srv-A] amp (Srv-A lt- Cli-B17) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s2

reply[Srv-A] amp (Cli-A lt- Srv-Af(Serv-ACli-A7)) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s3 reqdupl[Srv-A] amp (Srv-A lt- Cli-A7) amp (Srv-A lt- Cli-A7) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s4 req[Srv-A] amp (Srv-A lt- Cli-A7) amp (Srv-A lt- Cli-B17) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s5 loss[Srv-A] amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s6

succ[Srv-A] amp (Cli-A lt- Srv-A8) amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

s7

Options

Given a computation C it is always possible to expand C in an instrumented computationCinst in which each application of the matching modulo B algorithm is mimicked by the explicitapplication of a suitable equational axiom which is also oriented as a rewrite rule [3]

Also typically hidden inside the B-matching algorithms some flatunflat transformationsallow terms that contain operators that obey associative-commutative axioms to be rewrittenThese transformations allow terms to be reordered and correctly parenthesized in order toenable subsequent rewrite steps Basically this is achieved by producing a single auxiliaryrepresentative of their AC congruence class [3] For example consider a binary AC operatorf together with the standard lexicographic ordering over symbols Given the B-equivalencef(b f(f(b a) c)) =B f(f(b c) f(a b)) we can represent it by using the ldquointernal sequencerdquo

of transformations f(b f(f(b a) c))flatminusrarr lowast

Bf(a b b c)unflatminusrarr lowast

Bf(f(b c) f(a b)) where the firstsubsequence corresponds to a flattening transformation sequence that obtains the AC canonicalform while the second one corresponds to the inverse unflattening transformation This wayany given instrumented computation consists of a sequence of (standard) rewrites using theequations (rarr∆) rewrite rules (rarrR) equational axioms and flatunflat transformations (rarrB)By abuse of notation since equations and axioms are both interpreted as rewrite rules in ourformulation we often abuse the notation λrarr ρ to denote rules as well as (oriented) equationsand axioms Given an instrumented computation Cinst by |Cinst| we denote its length mdashthat isthe number of rewrite steps that occur in Cinst We use the functions head(Cinst) and tail(Cinst)to respectively select the first rewrite step in Cinst and the instrumented computation yieldedby removing the first rewrite step from Cinst In the sequel we also assume the existence of afunction instrument(C) which takes a computation C and delivers its instrumented counterpart

Example 33Consider the rewrite theory of Example 31 together with the following computation

C = [Cli Srv 7 na] amp [Srv] amp Cli lt- Srv f(Srv Cli 7) rarr∆B

[Cli Srv 7 na]amp [Srv] amp Cli lt- Srv 8 rarrRB

[Cli Srv 7 7] amp [Srv]

The corresponding instrumented computation Cinst which is produced by instrument(C) isgiven by 1) suitably parenthesizing states by means of flatteningunflattening transformations

9

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

when needed and 2) making commutative ldquostepsrdquo explicit by using the (oriented) equationalaxiom (X amp Y rarr Y amp X) in B that models the commutativity property of the (juxtaposition)operator amp Note these transformations are needed to enable the application of the rule rec

(of R) to the seventh state

Cinst = [Cli Srv 7 na] amp [Srv] amp Cli lt- Srv f(Srv Cli 7)succminusrarr∆

[Cli Srv 7 na] amp [Srv] amp Cli lt- Srv 8unflatminusrarrB

[Cli Srv 7 na] amp ([Srv] amp Cli lt- Srv 8)commminusrarrB

[Cli Srv 7 na] amp (Cli lt- Srv 8 amp [Srv])flatminusrarrB

[Cli Srv 7 na] amp Cli lt- Srv 8 amp [Srv]unflatminusrarrB

([Cli Srv 7 na] amp Cli lt- Srv 8) amp [Srv]commminusrarrB

(Cli lt- Srv 8 amp [Cli Srv 7 na]) amp [Srv]recminusrarrR

[Cli Srv 7 7] amp [Srv]

4 Exploring the Computation Tree

Computation trees are typically large and complex objects to deal with because of the highly-concurrent nondeterministic nature of rewrite theories Also their complete generation andinspection are generally not feasible since some of their branches may be infinite as they encodenonterminating computations

However one may still be interested in analysing a fragment of a given computation tree fordebugging or program comprehension purposes This section presents an exploration techniquethat allows the user to incrementally generate and inspect a portion T bull

R(sbull) of a computationtree TR(s) by expanding (fragments of) its program states into their descendants starting fromthe root node The exploration is an interactive procedure that is completely controlled by theuser who is free to choose the program state fragments to be expanded

41 Expanding a Program State

A state fragment of a state s is a term sbull that hides part of the information in s that is theirrelevant data in s are simply replaced by special bull-variables of appropriate sort denoted bybulli with i = 0 1 2 Given a state fragment sbull a meaningful position p of sbull is a positionp isin Pos(sbull) such that sbull|p 6= bulli for all i = 0 1 By MPos(sbull) we denote the set thatcontains all the meaningful positions of sbull Symbols that occur at meaningful positions of astate fragment are called meaningful symbols By Varbull(exp) we define the set of all bull-variablesthat occur in the expression exp

Basically a state fragment records just the information the user wants to observe of a givenprogram state

The next auxiliary definition formalizes the function fragment(t P ) that allows a statefragment of t to be constructed wrt a set of positions P of t The function fragment relies onthe function freshbull whose invocation returns a (fresh) variable bulli of appropriate sort which isdistinct from any previously generated variable bullj

Definition 41 Let t isin τ(ΣV) be a state and let P be a set of positions st P sube Pos(t)Then the function fragment(t P ) is defined as follows

fragment(t P ) = recfrag(t PΛ) where

10

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

function inspect(sbull Cinstr I)1 if |Cinstr | = 1 then2 return I(sbull Cinstr )3 elseif |Cinstr | gt 14 if I(sbull head(Cinstr ))= nil then5 return inspect(I(sbull head(Cinstr ))

tail(Cinstr ) I)6 else7 return nil8 end9 endendf

function expand(sbull sR I)1 Ebull

R = empty

2 for each srσwrarrRcup∆B t

with w isin MPos(sbull)

3 Cinst = instrument(srσwrarrRcup∆B t)

4 tbull = inspect(sbull Cinst I)

5 if tbull 6= nil then EbullR = Ebull

R cup sbullrrarr tbull

6 end7 return Ebull

R

endf

Figure 1 The inspect function Figure 2 The expand function

recfrag(t P p) =

f(recfrag(t1 P p1) recfrag(tn P pn))

if t=f(t1 tn) and p isin P

t if t isin V and p isin P

freshbull otherwise

and P = u | u le p and p isin P is the prefix closure of P

Roughly speaking fragment(t P ) yields a state fragment of t wrt a set of positions P thatincludes all symbols of t that occur within the paths from the root to any position in P whileeach maximal subterm t|p with p 6isin P is replaced by means of a freshly generated bull-variable

Example 42Let t = d(f(g(a h(b)) c) a) be a state and let P = 11 12 be a set of positions of t Byapplying Definition 41 we get the state fragment tbull = fragment(t P ) = d(f(g(bull1 bull2) c) bull3)and the set of meaningful positions MPos(tbull) = Λ 1 11 12

An inspection criterion is a function I(sbull srσwrarrK t) that given a rewrite step s

rσwrarrK t with

K isin ∆ RB and a state fragment sbull of s computes a state fragment tbull of the state t Roughlyspeaking an inspection criterion controls the information content conveyed by term fragmentsresulting from the execution of standard rewrite steps Hence distinct implementations of the

inspection criteria I(sbull srσwrarrK t) may produce distinct fragments sbull

rrarr tbull of the considered

rewrite step We assume that the special value nil is returned by the inspection criterionwhenever no fragment tbull can be delivered Several examples of inspection criteria are shown inSection 5

The function inspect of Figure 1 allows an inspection criterion I to be sequentially appliedalong an instrumented computation Cinstr in order to generate the fragment of the last stateof the computation Specifically given an instrumented computation s0 rarrK s1 rarrK rarr snn gt 0 the computation is traversed and the inspection criterion I is recursively applied oneach rewrite step si rarrK si+1 wrt the input fragment sbulli to generate the next fragment sbulli+1

The expansion of a single program state is specified by the function expand(sbull sR I) ofFigure 2 which takes as input a state s and its fragment sbull to be expanded wrt a rewritetheory R and an inspection criterion I Basically expand unfolds the state fragment sbull wrt

all the possible rewrite steps srσwrarrRcup∆B t that occur at the meaningful positions of sbull and

stores the corresponding fragments of sbullrrarr tbull in the set Ebull Note that to compute the state

11

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

fragment tbull for a rewrite step srσwrarrRcup∆B t and a state fragment sbull expand first generates the

instrumented computation Cinst of the considered step and then applies the inspection criterionI over C by using the inspect function

42 Computing a Fragment of the Computation Tree

The construction of a fragment T bullR(sbull0) of a computation tree TR(s0) is specified by the function

explore given in Figure 3 Essentially explore formalizes an interactive procedure that startsfrom a tree fragment (built using the auxiliary function createTree) which only consists of theroot node sbull0 and repeatedly uses the function expand to compute rewrite step fragments thatcorrespond to the visited tree edges wrt a given inspection criterion The tree T bull

R(sbull0) is builtby choosing at each loop iteration of the algorithm the tree node that represents the statefragment to be expanded by means of the auxiliary function pickLeaf (T bull

R(sbull0)) which allowsthe user to freely select a node sbull from the frontier of the current tree T bull

R(sbull0) Then T bullR(sbull0)

is augmented by calling addChildren(T bullR(sbull0) s

bull expand(sbull sR I)) This function call adds allthe edges sbull rarr tbull which are obtained by expanding sbull to the tree T bull

R(sbull0)The special value EoE (End of Exploration) is used to terminate the inspection process

when the function pickLeaf (T bullR(sbull0)) is equal to EoE no state to be expanded is selected and

the exploration terminates delivering the computed fragment T bullR(sbull0)

function explore(sbull0 s0R I)1 T bull

R(sbull0) = createTree(sbull0)2 while(sbull = pickLeaf (T bull

R(sbull0)) 6= EoE) do3 T bull

R(sbull0) = addChildren(T bullR(sbull0) s

bull expand(sbull sR I))4 od5 return T bull

R(sbull0)endf

Figure 3 The explore function

5 Particularizing the Exploration

The methodology given in Section 4 provides a generic scheme for the exploration of com-putation trees wrt a given inspection criterion I that must be provided by the user Inthis section we show three implementations of the criterion I that produce three distinct ex-ploration strategies In the first case the considered criterion allows an interactive programstepper to be derived in which rewriting logic computations of interest can be animated Inthe second case we implement a partial stepper that allows computations with partial inputsto be animated Finally in the last example the chosen inspection criterion implements anautomated forward slicing technique that allows relevant control and data information to beextracted from computation trees

51 Interactive Stepper

Given a computation tree TR(s0) for an initial state s0 and a rewrite theory R the stepwiseinspection of the computation tree can be directly implemented by instantiating the explorationscheme of Section 4 with the inspection criterion

Istep(sbull s

rσwrarr K t) = t

12

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

that always returns the reduced state t of the rewrite step srσwrarr K t with K isin ∆ RB

This way by starting the exploration from a state fragment that corresponds to the wholeinitial state s0 (ie sbull0 = s0) the call explore(s0R Istep) generates a fragment T bull

R(sbull0) of thecomputation tree TR(s0) whose topology depends on the program states that the user decidesto expand during the exploration process

Example 51Consider the rewrite theoryR in Example 31 and the computation tree in Example 32 Assumethe user starts the exploration by calling explore(s0R Istep) which allows the first level of thecomputation tree to be unfolded by expanding the initial state s0 wrt the inspection criterion

Istep This generates the tree TbullR(s0) containing the edges s0

reqrarr s1 s0

reqrarr s2 Now if the user

carries on with the exploration of program state s1 and then quits s1 will be expanded and thetree T bull

R(s0) will be augmented accordingly Specifically the resulting T bullR(s0) will include the

following edges s0reqrarr s1 s0

reqrarr s2 s1

succrarr s3 s1

reqrarr s4 s1

duplrarr s4 s1

reqrarr s5 s1

lossrarr s6

It is worth noting that all the program state fragments produced by the program stepperdefined above are ldquoconcreterdquo (ie state fragments that do not include bull-variables) Howeversometimes it may be useful to work with partial information and hence with state fragmentsthat abstract ldquoconcreterdquo program states by using bull-variables This approach may help to focususerrsquos attention on the parts of the program states that the user wants to observe disregardingunwanted information and useless rewrite steps

Example 52Consider the following two rewrite rules [r1] f(x b) rarr g(x) and [r2] f(a y) rarr h(y) togetherwith the initial state f(a b) Then the computation tree in this case is finite and only contains

the tree edges f(a b)r1xaΛ

rarr g(a) and f(a b)r2ybΛ

rarr h(b) Now consider the state fragmentf(bull1 b) where only the second input argument is relevant If we decided to expand the initialstate fragment f(bull1 b) we would get the tree fragment represented by the single rewrite step

f(bull1 b)r1rarr g(bull1) since the partial input encoded into f(bull1 b) cannot be rewritten via r2

In light of Example 52 and our previous considerations we define the following inspectioncriterion

Ipstep(sbull s

rσwrarr K t) = if sbull

rσbullwrarr K tbull then return tbull else return nil

Roughly speaking given a rewrite step micro srσwrarr K t with K isin ∆ RB the criterion

Ipstep returns a state fragment tbull of the reduced state t whenever sbull can be rewritten to tbull

using the very same rule r and position w that occur in microThe particularization of the exploration scheme with the criterion Ipstep allows an interac-

tive partial stepper to be derived in which the user can work with state information of interestthereby producing more compact and focused representations of the visited fragments of thecomputation trees

52 Forward Trace Slicer

Forward trace slicing is a program analysis technique that allows computations to be simplifiedwrt a selected fragment of their initial state More precisely given a computation C withinitial state s0 and a state fragment sbull0 of s0 forward slicing yields a simplified view Cbull of Cin which each state s of the original computation is replaced by a state fragment sbull that only

13

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

function Islice(sbull s

λrarrρσwrarr t)

1 if w isin MPos(sbull) then2 θ = xfreshbull | x isin V ar(λ)3 λbull = fragment(λMPos(Varbull(sbull|w)) cap Pos(λ))

4 ψλ = 〈|θmatchλbull(sbull|w)|〉

5 tbull = sbull[ρψλ]w6 else7 tbull = nil8 fi9 return tbull

endf

Figure 4 Inspection criterion that models forward slicing of a rewrite step

records the information that depends on the meaningful symbols of sbull0 while unrelated dataare simply pruned away

In the following we define an inspection criterion Islice that implements the forward slicingof a single rewrite step The considered criterion takes two parameters as input namely a

rewrite step micro = (srσwrarr K t) (with r = λ rarr ρ and K isin ∆ RB) and a state fragment

sbull of a state s It delivers the state fragment tbull which includes only those data that arerelated to the meaningful symbols of sbull Intuitively the state fragment tbull is obtained fromsbull by ldquorewritingrdquo sbull at position w with the rule r and a suitable substitution that abstractsunwanted information of the computed substitution with bull-variables A rigorous formalizationof the inspection criterion Islice is provided by the algorithm in Figure 4

Note that by adopting the inspection criterion Islice the exploration scheme of Section 4automatically turns into an interactive forward trace slicer that expands program states usingthe slicing methodology encoded into the inspection criterion Islice In other words given acomputation tree TR(s0) and a user-defined state fragment sbull0 of the initial state s0 any branchsbull0 rarr sbull1 rarr sbulln in the tree T bull

R(sbull0) which is computed by the explore function is the slicedcounterpart of a computation s0 rarrRcup∆B s1 rarrRcup∆B sn (wrt the state fragment sbull0) thatappears in the computation tree TR(s0)

Roughly speaking the inspection criterion Islice works as follows When the rewrite stepmicro occurs at a position w that is not a meaningful position of sbull (in symbols w 6isin MPos(sbull))trivially micro does not contribute to producing the meaningful symbols of tbull This amounts tosaying that no relevant information descends from the state fragment sbull and hence the functionreturns the nil value

On the other hand when w isin MPos(sbull) the computation of tbull involves a more in-depthanalysis of the rewrite step which is based on a refinement process that allows the descendantsof sbull in tbull to be computed The following definition is auxiliary

Definition 53 (substitution update) Let σ1 and σ2 be two substitutions The update ofσ1 wrt σ2 is defined by the operator 〈| |〉 as follows

〈|σ1 σ2|〉 = σ|Dom(σ1) where

xσ =

xσ2 if x isin Dom(σ1) capDom(σ2)xσ1 otherwise

The operator 〈|σ1 σ2|〉 updates (overrides) a substitution σ1 with a substitution σ2 where bothσ1 and σ2 may contain bull-variables The main idea behind 〈| |〉 is that for the slicing of the

14

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

rewrite step micro all variables in the applied rewrite rule r are naıvely assumed to be initiallybound to irrelevant data bull and the bindings are incrementally updated as we apply the rule r

More specifically we initially define the substitution θ = xfreshbull | x isin V ar(ρ) thatbinds each variable in λ rarr ρ to a fresh bull-variable This corresponds to assuming that all theinformation in micro which is introduced by the substitution σ can be marked as irrelevant Thenθ is refined as follows

We first compute the state fragment λbull = fragment(λMPos(Varbull(sbull|w))capPos(λ)) that onlyrecords the meaningful symbols of the left-hand side λ of the rule r wrt the set of meaningfulpositions of sbull|w Then by matching λbull with sbull|w we generate a matcher matchλbull(sbull|w) thatextracts the meaningful symbols from sbull|w Such a matcher is then used to compute ψλ which

is an update of θ wrt matchλbull(sbull|w) containing the meaningful information to be trackedFinally the state fragment tbull is computed from sbull by replacing its subterm at position w withthe instance ρψλ of the right-hand side of the applied rule r This way we can transfer all therelevant information marked in sbull into the fragment of the resulting state tbull

Example 54Consider the computation tree of Example 32 whose initial state is

s0 = [Srv-A] amp [Cli-ASrv-A7na] amp [Cli-BSrv-A17na]

Let sbull0 = bull amp [Cli-Abull7 bull ] amp bull be a state fragment1 of s0 where only request 7 of ClientCli-A is considered of interest By sequentially expanding the nodes sbull0 s

bull1 s

bull3 and s

bull5 wrt

the inspection criterion Islice we get the following fragment of the given computation tree

Query Go

Go

Go

Go

Go

Go

GoGoBack

Back

Back

Back

Back

Back

BackBack AnimaOptions

bull amp [Cli-Abull7bull] amp bullsbull0

reqbull amp (bull lt- Cli-A7) amp [Cli-Abull7na] amp bullsbull1

reqduplbull amp (bull lt- Cli-A7) amp (bull lt- Cli-A7) amp [Cli-Abull7na] amp bull

sbull2 reply[bull] amp (Cli-A lt- bullf(bullCli-A7)) amp [Cli-Abull7na] amp bull

sbull3 lossbull amp [Cli-Abull7na] amp bullsbull4

succ[bull] amp (Cli-A lt- bull8) amp [Cli-Abull7na] amp bullsbull5

req[bull] amp (bull lt- Cli-A7) amp(Cli-A lt- bull8) amp [Cli-Abull7na] amp bull

sbull6 dupl[bull] amp (Cli-A lt- bull8) amp(Cli-A lt- bull8) amp [Cli-Abull7na] amp bull

sbull7 loss[bull] amp [Cli-Abull7na] amp bullsbull8 rec

[bull] amp [Cli-Abull77] amp bullsbull9

Note that the slicing process automatically computes a tree fragment that represents apartial view of the protocol interactions from client Cli-Arsquos perspective Actually irrelevantinformation is hidden and rules applied on irrelevant positions are directly ignored whichallows a simplified fragment to be obtained favoring its inspection for debugging and analysispurposes In fact if we observe the highlighted computation in the tree we can easily detectthe wrong behaviour of the rule rec Specifically by inspecting the state fragment sbull9 = ([bull]amp [Climinus A bull 7 7] amp bull) which is generated by an application of the rule rec we immediatelyrealize that the response 8 produced in the parent state sbull5 has not been stored in sbull9 whichclearly indicates a buggy implementation of the considered rule

1Throughout the example we omit indices from the considered bull-variables to keep notation lighter andimprove readability So any variable bulli i = 0 1 is simply denoted by bull

15

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

Finally it is worth noting that the forward trace slicer implemented via the criterion Islicediffers from the partial stepper given at the end of Section 51 Given a state fragment sbull and

a rewrite steprσwrarrK t Islice always yields a fragment tbull when the rewrite occurs at a meaningful

position By contrast the inspection criterion Ipstep encoded in the partial stepper may fail toprovide a computed fragment tbull when sbull does not rewrite to tbull

Example 55

Consider the same rewrite rules and initial state f(bull1 b) of Example 52 By expanding f(bull1 b)wrt the inspection criterion Islice we get the computation tree fragment with tree edgesf(bull1 b)

r1rarr g(bull1) and f(bull1 b)r2rarr h(b) whereas the partial stepper only computes the tree edge

f(bull1 b)r1rarr g(bull1) as shown in Example 52

6 Implementation

The exploration methodology developed in this paper has been implemented in the Anima

tool which is publicly available at httpsafe-toolsdsicupvesanima The underlyingrewriting machinery of Anima is written in Maude and consists of about 150 Maude functiondefinitions (approximately 1600 lines of source code)

Anima also comes with an intuitive Web user inter-

Database

Anima Client

JAX-RS API

Initial State Rewriting LogicSpecification Animation

Anima Web Service

Anima Core

Figure 5 Anima architecture

face based on AJAX technology which allows usersto graphically display and animate computation treefragments The core exploration engine is specified asa RESTful Web service by means of the Jersey JAX-RS API

The architecture of Anima is depicted in Figure 5and consists of five main components Anima ClientJAX-RS API AnimaWeb Service Database and An-ima Core The Anima Client is purely implementedin HTML5 and JSP It represents the front-end layerof our tool and provides an intuitive versatile Webuser interface which interacts with the Anima Web Service to invoke the capabilities of theAnima Core and save partial results in the Database component

A screenshot that shows the Anima tool at work on the case study that is described inExample 54 is given in Figure 6

These are the main features provided by Anima

1 Inspection strategies The tool implements the three inspection strategies described inSection 5 As shown in Figure 6 the user can select a strategy by using the selectorprovided in the option pane

2 ExpandingFolding program states The user can expand or fold states by right-clicking onthem with the mouse and by selecting the ExpandFold Node options from the contextualmenu For instance in Figure 6 a state fragment on the frontier of the computed treehas been selected and is ready to be expanded through the Expand Node option

3 Selecting meaningful symbols State fragments can be specified by highlighting the statesymbols of interest either directly on the tree or in the detailed information window

16

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

GoGoGoGoGoBackBackBackBackBack Anima

Options

View

Rule Labels

State Labels

Zoom 100

- +

Interactive StepperInteractive StepperInteractive StepperInteractive StepperInteractive Stepper

Simple Advanced

ON OFF

ON Transition information from state to sbull1 sbull2

Rule

rl [reply] S lt- C Q amp [S] =gt [S] amp C lt- S f(S C Q)

amp [Cli-Abull7na]

bull amp [Cli-Abull7bull] amp bull

sbull0

req

bull amp (bull lt- Cli-A7) amp [Cli-Abull7na] amp bull

sbull1

reqdupl

bull amp (bull lt- Cli-A7) amp (bull

lt- Cli-A7) amp [Cli-Abull

7na] amp bull

sbull2 reply

[bull] amp (Cli-A lt- bullf(bullCl

i-A7))

amp bull

sbull3 loss

bull amp [Cli-Abull7na] amp bull

sbull4

Expand node

Fold node

Show full information

Show transition information

Expand view

Collapse view

Figure 6 Anima at work

4 Search mechanism The search facility implements a pattern language that allows stateinformation of interest to be searched on huge states and complex computation trees Theuser only has to provide a filtering pattern (the query) that specifies the set of symbols thatheshe wants to search for and then all the states matching the query are automaticallyhighlighted in the computation tree

5 Transition information Anima facilitates the inspection of a selected rewrite step s rarr tthat occurs in the computation tree by underlining its redex in s and the reduced subtermin t Some additional transition information is also displayed in the transition informa-tion window (eg the ruleequation applied the rewrite position and the computedsubstitution of the considered rewrite step) by right-clicking on the corresponding option

7 Conclusions

The analysis of execution traces plays a fundamental role in many program analysis approachessuch as runtime verification monitoring testing and specification mining We have presenteda parametrized exploration technique that can be applied to the inspection of rewriting logiccomputations and that can work in different ways Three instances of the parameterized ex-ploration scheme (an incremental stepper an incremental partial stepper and a forward traceslicer) have been formalized and implemented in the Anima tool which is a novel program an-imator for RWL The tool is useful for Maude programmers in two ways First it concretelydemonstrates the semantics of the language allowing the evaluation rules to be observed inaction Secondly it can be used as a debugging tool allowing the users to step forward andbackward while slicing the trace in order to validate input data or locate programming mis-takes

17

Parametric Exploration of Rewriting Logic Computations M Alpuente et al

References

[1] M Alpuente D Ballis M Baggi and M Falaschi A FoldUnfold Transformation Frameworkfor Rewrite Theories extended to CCT In Proc 2010 ACM SIGPLAN Workshop on PartialEvaluation and Program Manipulation PEPM 2010 pages 43ndash52 ACM 2010

[2] M Alpuente D Ballis J Espert and D Romero Model-checking Web Applications with Web-TLR In Proc of 8th Intrsquol Symposium on Automated Technology for Verification and Analysis(ATVA 2010) volume 6252 of LNCS pages 341ndash346 Springer-Verlag 2010

[3] M Alpuente D Ballis J Espert and D Romero Backward Trace Slicing for Rewriting LogicTheories In Proc CADE 2011 volume 6803 of LNCSLNAI pages 34ndash48 Springer-Verlag 2011

[4] M Alpuente D Ballis F Frechina and D Romero Backward Trace Slicing for ConditionalRewrite Theories In Proc LPAR-18 volume 7180 of LNCS pages 62ndash76 Springer-Verlag 2012

[5] M Alpuente D Ballis F Frechina and J Sapina Slicing-Based Trace Analysis of RewritingLogic Specifications with iJulienne In Matthias Felleisen and Philippa Gardner editors Procof 22nd European Symposium on Programming ESOP 2013 volume 7792 of Lecture Notes inComputer Science pages 121ndash124 Springer 2013

[6] M Alpuente D Ballis and D Romero Specification and Verification of Web Applications inRewriting Logic In Formal Methods Second World Congress FM 2009 volume 5850 of LNCSpages 790ndash805 Springer-Verlag 2009

[7] M Baggi D Ballis and M Falaschi Quantitative Pathway Logic for Computational Biology InProc of 7th Intrsquol Conference on Computational Methods in Systems Biology (CMSB rsquo09) volume5688 of LNCS pages 68ndash82 Springer-Verlag 2009

[8] R Bruni and J Meseguer Semantic Foundations for Generalized Rewrite Theories TheoreticalComputer Science 360(1ndash3)386ndash414 2006

[9] M Clavel F Duran S Eker P Lincoln N Martı-Oliet J Meseguer and C Talcott MaudeManual (Version 26) Technical report SRI Intrsquol Computer Science Laboratory 2011 Availableat httpmaudecsuiucedumaude2-manual

[10] J Clements M Flatt and M Felleisen Modeling an Algebraic Stepper In Proc 10th EuropeanSymposium on Programming volume 2028 of LNCS pages 320ndash334 Springer-Verlag 2001

[11] F Duran and J Meseguer A Maude Coherence Checker Tool for Conditional Order-SortedRewrite Theories In Proc of 8th International Workshop on Rewriting Logic and Its Applications(WRLArsquo10) number 6381 in LNCS pages 86ndash103 Springer-Verlag 2010

[12] JW Klop Term Rewriting Systems In S Abramsky D Gabbay and T Maibaum editorsHandbook of Logic in Computer Science volume I pages 1ndash112 Oxford University Press 1992

[13] N Martı-Oliet and J Meseguer Rewriting Logic Roadmap and Bibliography Theoretical Com-puter Science 285(2)121ndash154 2002

[14] J Meseguer Conditional Rewriting Logic as a Unified Model of Concurrency Theoretical Com-puter Science 96(1)73ndash155 1992

[15] J Meseguer The Temporal Logic of Rewriting A Gentle Introduction In Concurrency Graphsand Models Essays Dedicated to Ugo Montanari on the Occasion of his 65th Birthday volume5065 pages 354ndash382 Berlin Heidelberg 2008 Springer-Verlag

[16] A Riesco A Verdejo R Caballero and N Martı-Oliet Declarative Debugging of RewritingLogic Specifications In Recent Trends in Algebraic Development Techniques 19th Intrsquol WorkshopWADT 2008 volume 5486 of LNCS pages 308ndash325 Springer-Verlag 2009

[17] A Riesco A Verdejo and N Martı-Oliet Declarative Debugging of Missing Answers for MaudeIn 21st Intrsquol Conference on Rewriting Techniques and Applications RTA 2010 volume 6 of LIPIcspages 277ndash294 Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik 2010

[18] TeReSe editor Term Rewriting Systems Cambridge University Press Cambridge UK 2003

18

Automatic Inference of Term Equivalence in

Term Rewriting Systems

Marco Comini1 and Luca Torella2

1 DIMI University of Udine Italymarcocominiuniudit

2 DIISM University of Siena Italylucatorellaunisiit

Abstract

In this paper we propose a method to automatically infer algebraic property-orientedspecifications from Term Rewriting Systems Namely having three semantics with suitableproperties given the source code of a TRS we infer a specification which consists of a setof most general equations relating terms that rewrite for all possible instantiations to thesame set of constructor terms

The semantic-based inference method that we propose can cope with non-constructor-based TRSs and considers non-ground terms Particular emphasis is put on avoiding thegeneration of ldquoredundantrdquo equations that can be a logical consequence of other ones

1 Introduction

In the last years there has been a growing interest in the research on automatic inference ofhigh-level specifications from an executable or the source code of a system This is probablydue to the fact that the size of software systems is growing over time and certainly one cangreatly benefit from the use of automatic tools There are several proposals like [1 7 6] whichhave proven to be very helpful

Specifications have been classified by their characteristics [8] It is common to distin-guish between property-oriented specifications and model-oriented or functional specificationsProperty-oriented specifications are of higher description level than other kinds of specificationsthey consist of an indirect definition of the systemrsquos behavior by stating a set of propertiesusually in the form of axioms that the system must satisfy [11 10] In other words a specifi-cation does not represent the functionality of the program (the output of the system) but itsproperties in terms of relations among the operations that can be invoked in the program (ieidentifies different calls that have the same behavior when executed) This kind of specifica-tions is particularly well suited for program understanding the user can realize non-evidentinformation about the behavior of a given function by observing its relation to other functionsMoreover the inferred properties can manifest potential symptoms of program errors which canbe used as input for (formal) validation and verification purposes

We can identify two mainstream approaches to perform the inference of specifications glass-box and black-box The glass-box approach [1] assumes that the source code of the programis available In this context the goal of inferring a specification is mainly applied to documentthe code or to understand it Therefore the specification must be more succinct and compre-hensible than the source code itself The inferred specification can also be used to automatethe testing process of the program or to verify that a given property holds [1] The black-boxapproach [7 6] works only by running the executable This means that the only informationused during the inference process is the input-output behavior of the program In this setting

19

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

the inferred specification is often used to discover the functionality of the system (or services ina network) [6] Although black-box approaches work without any restriction on the consideredlanguage ndash which is rarely the case in a glass-box approach ndash in general they cannot guaranteethe correctness of the results (whereas indeed semantics-based glass-box approaches can)

For this work we developed a (glass-box) semantic-based algebraic specification synthesismethod for the Term Rewriting Systems formalism that is completely automatic ie needsonly the source TRS to run Moreover the outcomes are very intuitive since specifications aresets of equations of the form e1 = e2 where e1 e2 are generic TRS expressions so the userdoes not need any kind of extra knowledge to interpret the results The underpinnings of ourproposal are radically different from other works for functional programming since the presenceof non-confluence or non-constructor-based TRSs poses several additional problems

11 Notations

We assume that the reader is familiar with the basic notions of term rewriting For a thoroughdiscussion of these topics see [9] In the paper we use the following notations V denotes a(fixed) countably infinite set of variables and T (ΣV) denotes the terms built over signatureΣ and variables V T (Σempty) are ground terms Substitutions over T (Σempty) are called groundsubstitutions Σ is partitioned in D the defined symbols and C the constructor symbols

T (CV) are constructor terms Substitutions over T (CV) are said constructor substitutionsC[t1 tn] denotes the replacement of t1 tn in context C A TRS R is a set of rules l rarr r

where l = f(t1 tn) l r isin T (ΣV) var(r) sube var(l) and f isin D t1 tn are the argumentpatterns of l rarr r and need not necessarily be in T (CV) unlike in functional programmingwhere only constructor-based TRSs are considered (with ti isin T (CV))

2 Many notions of equivalence

In the functional programming paradigm an equation e1 = e2 is typically interpreted as aproperty that holds for any well-typed constructor ground instance of the variables occurringin the equation Namely for all bindings of variables with well-typed (constructor ground)terms ϑ the constructor term computed for the calls e1ϑ and e2ϑ is the same In functionalprogramming we can consider only constructor instances because by having constructor-basedconfluent TRSs the set of values for non-constructor instances is the same as for constructorones

Differently from the functional programming case the TRS formalism admits variables ininitial terms and defined symbols in the patterns of the rules moreover rules are evaluatednon-deterministically and can rewrite to many constructor terms Thus an equation can beinterpreted in many different ways We will discuss the key points of the problem by means ofa (very simple) illustrative example

Example 21 Consider the following (non constructor based) TRS R where we provide a prettystandard definition of the arithmetic operations + - and (modulo)

0 + x -gt x x - 0 -gt x x s(y) -gt (x - s(y)) s(y)

s(x) + y -gt s(x+y) s(x) - s(y) -gt x - y (0 - s(x)) s(y) -gt y - x

Note that since the TRS formalism is untyped a term like 0 + a is admissible and is evaluatedto constructor term a

20

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

For this TRS one could expect to have in its property-oriented specification equations like

(x + y) + z = x + (y + z) (21)

x - (y + z) = (x - y) - z (22)

(x - y) - z = (x - z) - y (23)

0 + x = x (24)

x + 0 = x (25)

x + y = y + x (26)

These equations of the form e1 = e2 can be read as the (observable) outcomes of e1 are thesame of e2 The first essential thing is to formalize the meaning of ldquoobservable outcomesrdquo ofthe evaluation of an expression e (which contains variables) In the TRS formalism we haveseveral possible combinations First it is technically possible to literally interpret variables ine and decide to observe either the set of normal forms of e or the set of constructor terms ofe However as can be quickly verified only (24) is valid in either of these forms Indeedconsider for example terms x - (y + z) and (x - y) - z For both terms no rule can beapplied hence they are both (non constructor) normal forms and thus (22) is not literally validClearly this is quite a radical choice An interesting alternative would be to request that forany possible interpretation of variables with any term the expressions rewrite to the same setof constructor terms Formally by defining the rewriting behavior of a term t as

BJtRK ∶= ϑ sdot s∣ tϑETHrarrR

lowast s s isin T (CV) ϑ∶V rarr T (ΣV) dom(ϑ) sube var(t) (27)

we can interpret e1 = e2 as e1 =RB e2 ∶lArrrArr BJe1RK = BJe2RK In the following we call thisequivalence rewriting behavior equivalence Actually eqs (21) to (24) are valid wrt =RB

Note that if we would have chosen to use normal forms instead of constructor terms in (27)(ie s rarr instead of s isin T (CV)) then we would still have the same situation described beforewhere only (24) holds

The other equations (eqs (25) and (26)) are not valid in this sense For instance BJx + 0K =xt sdot si(0)∣tETHrarrlowast si(0) 1 while BJxK = xt sdot v∣tETHrarr

R

lowast v v isin T (CV) (and then ε sdot x isin BJxK ∖

BJx + 0K) These equations are not valid essentially because we have variables which cannotbe instantiated but if we consider ground constructor instancies which ldquotriggerrdquo in either terman evaluation to constructor terms then we actually obtain the same constructor terms Forexample for t1 = x and t2 = x + 0 for all ϑi = xsi(0) we have BJt1ϑiK = BJt2ϑiK = ε sdot si(0)∣Thus (25) holds in this sense

Decidedly also this notion of equivalence is interesting for the user We can formalize it ast1 =G t2 ∶lArrrArr forallϑ ground constructor BJt1ϑK cupBJt2ϑK sube ε sdot t∣t isin T (CV)rArr BJt1ϑK = BJt2ϑK Wewill call it ground constructor equivalence Note that =G is the only possible notion in the purefunctional paradigm where we can just have evaluations of ground terms and where we haveonly confluent constructor-based TRSs In this case the latter definition boils down to twoexpressions are equivalent if all its ground constructor instances rewrite to the same constructorterm This fact allows one to have an intuition of the reason why the problem of specificationsynthesis is definitively more complex in the full TRS paradigm

Since we do not consider only constructor-based TRSs there is another very relevant differ-ence wrt the pure functional case For instance let us consider the TRS Q obtained by addingthe rule g((x - y) - z) -gt x - (y + z) to TRS R of Example 21 Let t1 = x - (y + z)

1Here by si(0) we mean i repeated applications of s to 0 including the degenerate case for i = 0

21

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

and t2 = (x-y)-z We have BJt1QK = BJt2QK = x0 y0 z0 sdot 0xs(0) y0 z0 sdot s(0)xs(0) ys(0) z0 sdot 0xs(0) y0 zs(0) sdot 0 ∣ While the term g(t2) has this same be-havior BJg(t1)QK = empty

In general in the case of the TRS formalism terms embedded within a context do notnecessarily manifest the same behavior Thus it is also interesting to additionally ask to theequivalence notion =RB that the behaviors must be the same also when the two terms areembedded within any context Namely e1 =C e2 ∶lArrrArr forall contextC BJC[e1]RK = BJC[e2]RKWe call this equivalence contextual equivalence We can see that =C is (obviously) strongerthan =RB which is in turn stronger than =G Actually they are strictly stronger Indeed onlyeqs (21) and (24) are valid wrt =C (while eqs (22) and (23) are not)

We believe that all these notions are interesting for the user thus we formalize our notionof (algebraic) specification as follows

Definition 22 A specification S is a set of (sequences of) equations of the form t1 =K t2 =K =K tn with K isin CRB G and t1 t2 tn isin T (ΣV)

Thus for TRS Q we would get the following (partial) specification

(x + y) + z =C x + (y + z) 0 + x =C x

x - (y + z) =RB (x - y) - z (x - y) - z =RB (x - z) - y

x + y =G y + x x + 0 =G x

(x + y) z =G ((x z) + (y z)) z (x + y) y =G x y

(x - y) z =G (((x + z) z) - (y z)) z

In the following we present a first proposal of a semantics-based method that infers such spec-ifications for TRSs and tackles the presented issues (and discuss about its limitations) It isan adaptation for the TRS paradigm of ideas from [2] for the Functional Logic paradigm Thisadaptation is not straightforward since the Functional Logic paradigm is quite similar to theFunctional paradigm but considerably different from the TRS paradigm Moreover this worksignificantly extends the inference process by tackling equations like f(x y) = f(y x) which arereally important

3 Deriving specifications from TRSs

The methodology we are about to present is parametric wrt three semantics evaluation func-tions which need to enjoy some properties Namely

ERBJt RK gives the rewriting behavior (RB) semantics of term t with (definitions from) TRSR This semantics has to be fully abstract wrt rewriting behavior equivalence Namelywe require that ERBJt1 RK = ERBJt2 RK lArrrArr t1 =RB t2

EC Jt RK gives the contextual (C) semantics of the term t with the TRS R This semantics hasto be fully abstract wrt contextual equivalence Namely EC Jt1 RK = EC Jt2 RK lArrrArrt1 =C t2

EGJt RK gives the ground (G) semantics of the term t with the TRS R This semanticshas to be fully abstract wrt ground constructor equivalence Namely EGJt1 RK =EGJt2 RK lArrrArr t1 =G t2

22

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

The idea underlying the process of inferring specifications is that of computing the semanticsof various terms and then identify all terms which have the same semantics However not allequivalences are as important as others given the fact that many equivalences are simplelogical consequences of others For example if ti =C si then for all constructor contexts CC[t1 tn] =C C[s1 sn] thus the latter derived equivalences are uninteresting and shouldbe omitted Indeed it would be desirable to synthesize the minimal set of equations from whichby deduction all valid equalities can be derived This is certainly a complex issue in testingapproaches With a semantics-based approach it is fairly natural to produce just the relevantequations The (high level) idea is to proceed bottom-up by starting from the evaluation ofsimpler terms and then newer terms are constructed (and evaluated) by using only semanticallydifferent arguments Thus by construction only non-redundant equations are produced

There is also another source of redundancy due to the inclusion of relations =K For examplesince =C is the finer relation t =C s implies t =RB s and t =G s To avoid the generation of coarserredundant equations a simple solution is that of starting with =C equivalences and once theseare all settled to proceed only with the evaluation of the =RB equivalences of non =C equivalentterms Thereafter we can evaluate the =G equivalences of non =RB equivalent terms

Clearly the full computation of a programsrsquo semantics is not feasible in general For themoment for the sake of comprehension we prefer to present the conceptual framework leavingout of the picture the issues related to decidability We will show a possible decidable instanceof the method in Section 31

Let us describe in more detail the specification inference process The input of the processconsists of a TRS to be analyzed and two additional parameters a relevant API Σr and amaximum term size max size The relevant API allows the user to choose the operations inthe program that will be present in the inferred specification whereas the maximum term sizelimits the size of the terms in the specification As a consequence these two parameters tunethe granularity of the specification both making the process terminating and allowing the userto keep the specification concise and easy to understand

The output consists of a set of equations represented by equivalence classes of terms (withdistinct variables) Note that inferred equations may differ for the same program dependingon the considered API and on the maximum term size Similarly to other property-orientedapproaches the computed specification is complete up to terms of size max size ie it includesall the properties (relations) that hold between the operations in the relevant API and that areexpressible by terms of size less or equal than max size

Terms are classified by their semantics into a data structure which we call classificationconsisting (conceptually) of a set of equivalence classes (ec) formed by

bull sem(ec) the semantics of (all) the terms in that classbull rep(ec) the representative term of the class (rep(ec) isin terms(ec))bull terms(ec) the set of terms belonging to that equivalence classbull epoch(ec) an integer to record the moment of introduction of that equivalence class

The representative term is the term which is used in the construction of nested expressionswhen the equivalence class is considered To output smaller equations it is better to choose thesmallest term in the class (wrt the function size) but any element of terms(ec) can be used

The inference process consists of successive phases one for each kind of equality (in orderof discriminating power ie C RB G) as depicted in Figure 1

Computation of the initial classification (epochs 0 and 1) The first phase of the algo-rithm is the computation of the initial classification that is needed to compute the classificationwrt =C We initially create a classification which contains

23

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

Inference Process

Computation of the initial classification

Generation of =C -classification

Generation of =RB -classification

Generation of =G -classification

Generation of =C -equations

Generation of =RB -equations

Generation of =G -equations

Specification

TRS

Program

API

max size

Figure 1 A general view of the inference process

bull one class for a free (logical) variable ⟨EC JxK x x 0⟩bull the classes for any constructor symbol ie for all cn

2 isin C and x1 xn distinct variables

⟨EC JtK t t 0⟩ where t = c(x1 xn)

Then for all symbols fn of the relevant API Σr and distinct variables x1 xn we add

to classification the term t = f(x1 xn) with semantics s = EC Jt RK and epoch m = 1This operation denoted addEC (t sm) is the most delicate part of the method If we wouldnot consider the generation of ldquopermutedrdquo equations like f(x y) = f(y x) then the wholeactivity would just boil down to look for the presence of s in some equivalence class and thenupdating the classification accordingly (like in [2]) Handling of permutations cannot be done bynaıvely adding all (different) permutations of s In this way we would generate many redundantequations Consider for instance the TRS Q

f(abc) -gt 0

f(bac) -gt 0

f(acb) -gt 0

f(bca) -gt 0

f(cab) -gt 0

f(cba) -gt 0

From the minimal set f(x y z) =C f(y x z) =C f(x z y) we can generate all other valid per-mutations like f(x y z) =C f(y z x) =C f(z x y) Thus in this case we should only generatepermutated equations where we just swap two variables However for the TRS R

f(abc) -gt 0 f(bca) -gt 0 f(cab) -gt 0

f(x y z) neC f(y x z) neC f(x z y) but f(x y z) =C f(y z x) Moreover f(x y z) =C f(z x y)can be deduced by this Thus in this case we should only generate permutated equations witha rotation of three variables since all other rotations of three variables are just a consequence

Thus not all permutations have to be considered while adding a semantics to a classificationand it is not necessary to look for all permutations within the semantics already present in theclassification To generate only a minimal set of necessary permutated equations we need toconsider for each k variables a set Πn

k of generators of the permutations of n variables whichdo not move n minus k variables (note that Πn

1 = id ) Then for a term t = f(x1 xn) westart sequentially for i from 1 to n and look if for some π isin Πn

i we have an equivalence classec in the current classification whose semantics coincides with sπ (ie ec = ⟨sπ tprime T mprime⟩) Ifit is found then the term tπminus1 is added to the set of terms in ec (ie ec is transformed inecprime = ⟨sπ tprime T cup tπminus1 mprime⟩) and we stop Otherwise we iterate with next i If all fails a newequivalence class ⟨s t T m⟩ has to be created but we have to determine the right term set

2Following the standard notation fn denotes a function f of arity n

24

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

T (to possibly generate equations like f(x y) = f(y x)) We initially start with T = t andj = n and sequentially for i from 2 to j we check if for some π isin Πj

i we have s = sπ If wefind it we add tπ to T and decrement j by i minus 1 (i variables are now used in a valid equationand thus from this moment on i minus 1 variables have no longer to be considered) Otherwise wecontinue with next i The final T is used for the new equivalence class

For example for t = f(x y z) in TRS Q we start with variables x y z and T = t Nowconsider for instance π = (xy) isin Π3

2 Since EC JtK = EC JtπK then T = f(x y z) f(y x z)and then we drop x and remain with variables y z Now we have only πprime = (y z) isin Π2

2 andsince EC JtK = EC JtπprimeK then T = f(x y z) f(y x z) f(x z y) we drop y and (thus) finishInstead for t = f(x y z) in TRS R we start with variables x y z and T = t Now considerfor instance π1 = (xy) isin Π3

2 Since EC JtK ne EC Jtπ1K then we consider π2 = (y z) isin Π3

2 and sinceEC JtK ne EC Jtπ2K we increase i Now we have only π3 = (xy z) isin Π3

3 and since EC JtK = EC Jtπ3Kthen T = f(x y z) f(y z x) we drop x y and (thus) finish

Generation of =C classification (epochs 2 and above) The second phase of the algo-rithm is the (iterative) computation of the successive epochs until we complete the constructionof the classification of terms wrt =C At each iteration (with epoch k) for all symbols fnof the relevant API Σr we select from the current classification all possible combinations of nequivalence classes ec1 ecn such that at least one eci was newly produced in the previousiteration (ie whose epoch is k minus 1) We build the term t = f(rep(ec1) rep(ecn)) whichby construction has surely not been considered yet Then if size(t) le max size we computethe semantics s = EC Jt RK and update the current classification by adding to classification theterm t and its semantics s (addEC (t s k)) as described before

If we have produced new equivalence classes then we continue to iterate This phase eventu-ally terminates because at each iteration we consider by construction terms which are differentfrom those already existing in the classification and whose size is strictly greater than the sizeof its subterms (but the size is bounded by max size)

The following example illustrates how the iterative process works

Example 31 Let us use the program R of Example 21 and choose as relevant API the func-tions + - and In the first step the terms

t11 = x + y t12 = x - y t13 = x y

are built Since (all permutations of) the semantics of all these terms are different and differentfrom the other semantics already in the initial classification three new classes are added to theinitial classification

During the second iteration the following two terms (among others) are built

bull the term t21 = (xrsquo + yrsquo) + y is built as the instantiation of x in t11 with (a renamedapart variant of) t11 and

bull the term t22 = x + (xrsquo + yrsquo) as the instantiation of y in t11 with t11

The semantics of these two terms is the same s but it is different from the semantics of theexisting equivalence classes Thus during this iteration (at least) the new equivalence classecprime ∶= ⟨s t21 t21 t22 n⟩ is computed Hereafter only the representative of the class will beused for constructing new terms Since we have chosen t21 instead of t22 as the representativeterms like (x + (xrsquo + yrsquo)) z will never be built

Thanks to the closedness wrt context of the semantics this strategy for generating terms issafe In other words when we avoid to build a term it is because it is not able to produce a

25

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

behavior different from the behaviors already included by the existing terms thus we are notlosing completeness

Generation of the =C specification Since by construction we have avoided much redun-dancy thanks to the strategy used to generate the equivalence classes we now have only to takeeach equivalence class with more than one term and generate equations for these terms

Generation of =RB equations The third phase of the algorithm works on the former clas-sification by first transforming each equivalence class ec by replacing the C-semantics sem(ec)with ERBJrep(ec) RK and terms(ec) with the (singleton) set rep(ec) After the transforma-tion some of the previous equivalence classes which had different semantic constructor termsmay now have the same RB -semantics and then we merge them making the union of the termsets terms(ec)

Thanks to the fact that before merging all equivalence classes were made of just singletonterm sets we cannot generate (again) equations t1 =RB t2 when an equation t1 =C t2 had beenalready issued Let us clarify this phase by an example

Example 32 Assume we have a classification consisting of three equivalence classes with C-semantics s1 s2 and s3 and representative terms t11 t22 and t31

ec1 = ⟨s1 t11t11 t12 t13⟩ ec2 = ⟨s2 t22t21 t22⟩ ec3 = ⟨s3 t31t31⟩

We generate equations t11 =C t12 =C t13 and t21 =C t22Now assume that ERBJt11K = w0 and ERBJt22K = ERBJt31K = w1 Then (since t12 t13 and

t21 are removed) we obtain the new classification

ec4 = ⟨w0 t11 t11 n⟩ ec5 = ⟨w1 t22 t22 t31 n⟩

Hence the only new equation is t22 =RB t31 Indeed equation t11 =RB t12 is uninterestingsince we already know t11 =C t12 and equation t21 =RB t31 is redundant (because t21 =C t22 andt22 =RB t31)

The resulting (coarser) classification is then used to produce the =RB equations as donebefore by generating equations for all non-singletons term sets

Generation of the =G equations In the last phase we transform again the classificationby replacing the RB -semantics with the G-semantics (and terms(ec) with the set rep(ec))Then we merge eventual equivalence classes with the same semantics and finally we generate=G equations for non singleton term sets

Theorem 33 (Correctness) For all equations e1 = e2 generated in the second third andforth phase we have that e1 =C e2 e1 =RB e2 and e1 =G e2 respectively

Proof By construction of equivalence classes in the second phase an equation t1 = t2 isgenerated if and only if the semantics EC Jt1 RK = EC Jt2 RK Then since EC Jt1 RK =EC Jt2 RK lArrrArr t1 =C t2 the first part of thesis follows immediately Then by the succes-sive trasformation and reclassification in the third phase we issue an equation t1 = t2 if andonly if ERBJt1 RK = ERBJt2 RK Then since ERBJt1 RK = ERBJt2 RK lArrrArr t1 =RB t2 we havethe second part of thesis The proof of the third part of thesis since EGJt1 RK = EGJt2 RK lArrrArrt1 =G t2 is analogous

26

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

Example 34 Let us recall (again) the programR of Example 21 The terms x + y and y + xbefore the transformation belong to two different equivalence classes (since their rewritingbehavior is different) Anyway after the transformation the two classes are merged since theirG-semantics is the same namely x0 y0 sdot 0xs(0) y0 sdot s(0)x0 ys(0) sdot s(0) ∣

We now present some examples to show how our proposal deals with non-contructor basedor non-confluent TRS plus some to show that we can infer several non-trivial equations

Example 35 Consider the definition for the boolean data type with constructor terms trueand false and boolean operations and or not and imp

and(true x) -gt x

and(false x) -gt false

or(true x) -gt true

or(false x) -gt x

not(true) -gt false

not(false) -gt true

imp(false x) -gt true

imp(true x) -gt x

This is a pretty standard ldquoshort-cutrdquo definition of boolean connectives With our method weget the following equations

not(or(xy)) =C and(not(x)not(y)) imp(xy) =C or(not(x)y)

not(and(xy)) =C or(not(x)not(y)) not(not(x)) =G x

and(xand(yz)) =C and(and(xy)z) and(xy) =G and(yx)

Example 36 Let us consider the following non-constructor based TRS implementing someoperations over the naturals in Peano notation

x - 0 -gt x

s(x) - s(y) -gt x - y

g(x) -gt chk(x - s(x))

chk(0) -gt 0

chk(s(x)) -gt s(x)

chk(0 - s(x)) -gt err

The definition of - is a standard definition of the minus operation over naturals The chk

function simply returns the natural passed as argument or returns err if the argument is anot defined subtraction It is easy to see that the TRS is not constructor-based because ofthe presence of the - in the pattern of a rule The artificial function g which checks if thesubtraction of a number by its successor is a natural number is doomed to return err Withour classification we actually derive equation g(x) =C err

Example 37 Let us consider the following (artificial) non-orthogonal TRS

coin -gt 0

coin -gt 1

d(x) -gt g(xx)

g(01) -gt true

t(x) -gt k(xxx)

k(101) -gt true

The coin function can return both 0 and 1 The functions d and t call an auxiliary functionduplicating and triplicating (respectively) the variable received as argument Functions f andg require a specific combination of 0 and 1 to return the constructor term true Notice thatto reach the constructor term true from d and t respectively it is necessary to use a nondeterministic function able to rewrite to both 0 and 1 Some of the inferred equations for thisTRS are t(x) =C d(x) and t(coin) =C g(coincoin) =C k(coincoincoin) =C d(coin)

27

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

Example 38 Let us consider the following TRS that computes the double of numbers inPeano notation

double (0) -gt 0

double(s(x)) -gt s(s(double(x)))

dbl(x) -gt plus(xx)

plus(0y) -gt y

plus(s(x)y) -gt s(plus(xy))

Some of the inferred equations for the TRS are

dbl(dbl(double(x))) =G dbl(double(dbl(x))) (31)

double(x) =G dbl(x) (32)

dbl(dbl(x)) =G dbl(double(x))=Gdouble(dbl(x)) =G double(double(x)) (33)

plus(double(x)y) =G plus(dbl(x)y) (34)

We can observe that all equations hold with the =G relation and not with the =RB relationThis is due to the fact that the two functions dbl and dbl even if at a first sight could seemto evaluate the same constructor terms can behave differently For instance if we add to theTRS the two rules coin -gt 0 and coin -gt s(0) we can notice that the terms double(coin)and dbl(coin) return different constructor terms This is due to the non determinism ofthe coin function that exploits the right non-linearity of function dbl While double(coin)

evaluates to 0 and s(s(0)) the term dbl(coin) can be reduced even to s(0) (by dbl(coin)

rarr plus(coincoin) rarr2 plus(0s(0)) rarr s(0))This characteristic of the program is not easy to realize by just looking at the code

Example 39 Let us consider the following TRS defining two functions over an extension ofthe Peano notation able to handle negative integers

abs(-(x)) -gt abs(x)

abs(s(x)) -gt s(x)

abs(0) -gt 0

f(-(-(x))) -gt f(x)

f(0) -gt 0

f(s(x)) -gt s(x)

f(-(s(x))) -gt 0

Function abs is a standard definition of the absolute value function f returns its input if it isa positive number and 0 if it is not Some of the inferred equations are f(f(x)) =C abs(f(x))

and f(abs(x)) =C abs(abs(x))

Example 310 Let us consider the following program which implements a two-sided queue in a(non-trivial) efficient way The queue is implemented as two lists where the first list correspondsto the first part of the queue and the second list is the second part of the queue reversed Theinl function adds the new element to the head of the first list whereas the inr function addsthe new element to the head of the second list (the last element of the queue) The outl (outr)function drops one element from the left (right) list unless the list is empty in which case itreverses the other list and then swaps the two lists before removal

new -gt Q(Nil Nil)

inl(xQ(xs ys)) -gt Q((xxs)ys)

inr(xQ(xs ys)) -gt Q(xs (xys))

outl(Q(Nil ys)) -gt

Q(tail(rev(ys))Nil)

outl(Q((xxs)ys)) -gt Q(xsys)

outr(Q(xs Nil)) -gt

Q(Nil tail(rev(xs)))

outr(Q(xs (yys))) -gt Q(xsys)

null(Q((xxs)ys)) -gt False

null(Q(Nil (xxs))) -gt False

null(Q(Nil Nil)) -gt True

28

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

tail ((xxs)) -gt xs

rev(xs) -gt rv rsquo(xs Nil)

rv rsquo(Nil ys) -gt ys

rv rsquo((xxs)ys) -gt rv rsquo(xs (xys))

With our method (amongst others) we derive

null(new) =C True (35)

new =C outl(inl(xnew)) =C outr(inr(xnew)) (36)

outl(inl(xq)) =C outr(inr(xq)) (37)

inr(xinl(yq)) =C inl(yinr(xq)) (38)

inl(xoutl(inl(yq))) =C outr(inl(xinr(yq))) (39)

null(inl(xnew)) =C null(inr(xnew)) =C False (310)

We can see different kinds of non-trivial equations eqs (36) and (37) state that adding andremoving one element produces always the same result independently from the side in which weadd and remove it Equations (38) and (39) show a sort of restricted commutativity betweenfunctions

31 An effective instance of the presented method

In a semantics-based approach one of the main problems to be tackled is effectiveness Thesemantics of a program is in general infinite and thus some approximation has to be used inorder to have a terminating method To experiment on the validity of our proposal we startedby using a novel (condensed) fixpoint semantics which we have developed for left-linear TRSsthat is fully abstract wrt =C

3 Such semantics is defined as the fixpoint of an immediateconsequences operator P JRK We have opted for this semantics because it has some propertieswhich are very important from a pragmatical point of view

bull it is condensed meaning that denotations are the smallest possible (between all thosesemantics which induce the same program equivalence) This is a very relevant (if notessential) feature to develop a semantic-based tool which has to compute the semantics

bull The semantics ERB can be obtained directly by transforming the EC semantics concretelyjust by loosing internal structure Therefore no (costly) computation of ERB is needed

We have implemented the basic functionality of the proposed methodology in a prototype writ-ten in Haskell TRSynth available at httpsafe-toolsdsicupvestrsynth (for a detaileddescription see [4]) The implementation of =G equality is still ongoing work because we arelacking of a suitable implementation of the G-semantics

To achieve termination the prototype computes a fixed number k of steps of P JRK Thenit proceeds with the classification as described in Section 3 Clearly in presence of terms withinfinite solutions with such a rough approximation we may loose both correctness (by mis-takenly equating terms which become semantically different after k iterates) and completeness(by mistakenly not equating terms which will become semantically equivalent) Neverthelessthe results are encouraging For instance TRSynth detects all =C and =RB which we showed inexamples (except of Example 38 because of a bug in the computation of the semantics)

3The writing of articles related to the formal definition of this semantics is in progress [3]

29

Automatic Inference of Term Equivalence in Term Rewriting Systems Comini and Torella

4 Conclusions and future work

This paper discusses about the issues that arise for the automatic inference of high-levelproperty-oriented (algebraic) specifications because of non-confluent or non-constructor basedTRS Then a first proposal which overcomes these issues is presented

Our method computes a concise specification of program properties from the source code ofa TRS We hope to have convinced the reader (with all examples) that we reached our maingoal that is to get a concise and clear specification (that is useful for the programmer in orderto discover unseen properties or detect possible errors)

We have developed a prototype that implements the basic functionality of the approach Weare aware that many other attempts to guarantee termination could be used in other instanciesof the presented method Certainly given our know-how in the future we will experiment withabstractions obtained by abstract interpretation [5] (our novel semantics itself has been obtainedas an abstract interpretation) Actually we already have an ongoing work to implement thedepth(k) abstract version of our semantics In the depth(k) abstraction terms (occurring in thenodes of the semantic trees) are ldquocutrdquo at depth k by replacing them with cut variables distinctfrom program variables Hence for a given signature Σ the universe of abstract semantic treesis finite (although it increases exponentially wrt k) Therefore the finite convergence of thecomputation of the abstract semantics is guaranteed

References

[1] G Ammons R Bodık and J R Larus Mining specifications In 29th ACM SIGPLAN-SIGACTsymposium on Principles of programming languages (POPLrsquo02) pages 4ndash16 New York NY USA2002 Acm

[2] G Bacci M Comini M A Feliu and A Villanueva Automatic Synthesis of Specifications forFirst Order Curry Programs In Proceedings of the 14th symposium on Principles and practice ofdeclarative programming pages 25ndash34 New York NY USA 2012 ACM

[3] M Comini and L Torella A Condensed Goal-Independent Fixpoint Semantics Modeling theSmall-Step Behavior of Rewriting Technical Report DIMI-UD012013RR Dipartimento diMatematica e Informatica Universita di Udine 2013

[4] M Comini and L Torella TRSynth a Tool for Automatic Inference of Term Equivalence inLeft-linear Term Rewriting Systems In E Albert and S-C Mu editors PEPM rsquo13 Proceedingsof the ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation pages 67ndash70Acm 2013

[5] P Cousot and R Cousot Abstract Interpretation A Unified Lattice Model for Static Analysisof Programs by Construction or Approximation of Fixpoints In Proceedings of the 4th ACMSIGACT-SIGPLAN symposium on Principles of programming languages Los Angeles CaliforniaJanuary 17ndash19 pages 238ndash252 New York NY USA 1977 ACM Press

[6] C Ghezzi A Mocci and M Monga Synthesizing intensional behavior models by graph trans-formation In 31st International Conference on Software Engineering (ICSErsquo09) pages 430ndash4402009

[7] J Henkel C Reichenbach and A Diwan Discovering Documentation for Java Container ClassesIEEE Transactions on Software Engineering 33(8)526ndash542 2007

[8] A A Khwaja and J E Urban A property based specification formalism classification TheJournal of Systems and Software 832344ndash2362 2010

[9] TeReSe editor Term Rewriting Systems Cambridge University Press Cambridge UK 2003

[10] H van Vliet Software EngineeringndashPrinciples and Practice John Wiley 1993

[11] J M Wing A specifierrsquos introduction to formal methods Computer 23(9)10ndash24 1990

30

A Condensed Goal-Independent Fixpoint

Semantics Modeling the Small-Step Behavior of

Rewriting

Marco Comini1 and Luca Torella2

1 DIMI University of Udine Italy mdash marcocominiuniudit

2 DIISM University of Siena Italy mdash lucatorellaunisiit

Abstract

In this paper we present a novel condensed narrowing-like semantics that contains theminimal information which is needed to describe compositionally all possible rewritings ofa term rewriting system We provide its goal-dependent top-down definition and moreimportantly an equivalent goal-independent bottom-up fixpoint characterization

We prove soundness and completeness wrt the small-step behavior of rewriting forthe full class of term rewriting systems

1 Introduction

Nowadays the formalism of Term Rewriting Systems (TRSs) is used besides for functionalprogramming also for many other applications (like specification of communication protocolsto mention one) There has been a lot of research on the development of tools for the formalverification and (in general) automatic treatmentmanipulation of TRSs Within the proposalsthere are semantics-based approaches which can guarantee correctness by construction How-ever they cannot employ directly the construction of the semantics since in general it is infiniteThus some kind of approximation has to be used

Given the potentiality of application of the TRS formalism we have turned our attentiontoward the development of semantics-based TRS manipulation tools with the intention to useAbstract Interpretation theory as fundament to devise semantics approximations correct byconstruction However as also noted by [9] defining a suitable (concrete) semantics is usuallythe first crucial step in adapting the general methodology of Abstract Interpretation to thesemantic framework of the programming language at hand When a concrete semantics isused to define via abstract interpretation abstract (approximate) semantics to be employedto develop semantics-based manipulation tools it is particularly relevant if it is condensedand defined compositionally In the literature a semantics is said to be condensing when thesemantics of an instance of an expression (term goal call) can be obtained with a semanticoperation directly from the semantics of the (un-instantiated) expression In such a situationonly the semantics for most general expressions can be maintained in denotations We saythat a semantics is condensed when the denotations themselves do not contain redundancy iewhen it is not possible to semantically derive the components of a denotation from the othercomponents Indeed the abstract semantics operations which are obtained from a condensedconcrete semantics involve the use of the join operation (of the abstract domain) at each iterationin parallel onto all components of rules instead of using several subsequent applications for allcomponents This has a twofold benefit On one side it speeds up convergence of the abstractfixpoint computation On the other side it considerably improves precision

In [2] we developed an automatic debugging methodology for the TRS formalism based onabstract interpretation of the big-step rewriting semantics that is most commonly considered

31

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

in functional programming ie the set of constructor termsnormal forms However theresulting tool was inefficient The main reason for this inefficiency is because the chosen concretesemantics is not condensing and thus because of its accidental high redundancy it causes thealgorithms to use and produce much redundant information at each stage In contrast thesame methodology gave good results in [5] because it was applied to a condensed semantics

The constructor termsnormal forms semantics is not condensed because it contains allpossible rewritings but there are many possible rewritings which can be obtained by someother ones since rewriting is closed under substitution (stability) and replacement (t ETHrarr

R

lowast s

implies C[t]p ETHrarrR

lowast C[s]p) Thus in [1] we tried to directly devise a semantics fully abstract

wrt the big-step rewriting semantics with the specific objective to avoid all redundancy whilestill characterizing the rewritings of any term In particular we searched a semantics which

bull has a compositional goal-independent definitionbull is the fixpoint of a bottom-up constructionbull is as condensed as possible

Unfortunately (in [1]) we just partially achieved this goal since the semantics is defined only forsome classes of TRSs In the meantime for a (quite) different language in [4 3] we obtainedmdashfor the full languagemdasha semantics with the mentioned characteristics by following a differentapproach

1 Define a denotation fully abstract wrt the small-step behavior of evaluation of expres-sions which enjoys the mentioned properties

2 Obtain by abstraction of this small-step semantics a denotation (which enjoys the men-tioned properties) correct wrt the big-step behavior

This approach has the additional advantage that the small-step semantics can be reused alsoto develop other semantics more concrete than the big-step one (for instance semantics whichcan model functional dependencies that are suitable to develop pre-post verification methods)

Unfortunately in the case of the TRS formalism we do not have a suitable small-step se-mantics to start with For Curry we defined the small-step semantics by collecting just themost general traces of the small-step operational semantics which correspond (in our case) tothe rewriting derivations of the terms f(x1 xn) The problem is that we cannot obtainjust from the traces of all f(x1 xn) the rewriting derivations of all (nested) terms withoutusing again (directly or indirectly) the rewriting mechanism In fact usually f(x1 xn) isimmediately a normal form because we cannot instantiate variables however there are manyinstances which can trigger the rules Narrowing [7] can seem a possible solution to this prob-lem but we have an issue related to the interference of non-confluence (ie non-determinism)with non-linearity as shown by this example

Example 11Let us consider the following TRS R

coin rarr Tail Head ne Tail rarr True diff (x)rarr x ne xcoin rarrHead Tail ne Head rarr True

We have rewriting derivations diff (x) ETHrarr x ne x ↛ diff (Head) ETHrarr Head ne Head ↛ diff (Tail) ETHrarrTail ne Tail ↛ while diff (coin)ETHrarrlowast True Moreover we have the narrowing derivation diff (x) ε

x ne x 32

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

Narrowing can instantiate variables (according to rules) but a variable is instantiated with thesame term in all of its occurrences (it would make little sense to do differently for a top-downresolution mechanism) However Example 11 shows that it is not possible to retrieve thatdiff (coin) ETHrarrlowast True from all possible narrowing derivations of diff (x) since the only narrowingderivation (of diff (x)) does not reach True

In this paper we define a variation of narrowing (linearizing narrowing) which admits dif-ferent instances of variables with multiple occurrences With linearizing narrowing we definea denotation fully abstract wrt the small-step behavior of rewriting which enjoys the men-tioned properties for generic TRSs without restrictions The outline to achieve this is thefollowing

bull We gather all linearizing narrowing derivations into trees (Definition 310)bull We show that all possible rewritings can be reconstructed from linearizing narrowing trees(Theorem 314)

bull We define top-down condensed denotations OJRK by collecting just the linearizing nar-rowing trees of most general terms (f(ETHrarrxn)) and we prove that with a suitable semanticevaluation function E we can reconstruct any linearizing narrowing tree starting from

OJRK (Theorem 323)bull By using E we define a (bottom-up) immediate consequence operator whose least fixpointF JRK is equal to OJRK (Theorem 330) Thus from F JRK we can reconstruct all possiblerewritings of R and we have full abstraction wrt the rewriting behavior (Corollary 331)

Note that the proofs of all results are in the appendix

2 Preliminaries

We assume that the reader is familiar with the basic notions of term rewriting For a thoroughdiscussion of these topics see [10] In the paper we use the following notions and notations

We writeETHrarron for the list of syntactic objects o1 on Given a monotonic function F ∶ Lrarr Lover lattice L whose bottom is and lub is ⊔ by F uarrk we denote function λxF k(x) and byF uarrω function λx⊔F k(x)∣k isin N By lfp(F ) we denote the least fixed point of F (and recallthat for a continuos F lfp(F ) = F uarrω)Terms and Substitutions

Σ denotes a signature and V denotes a (fixed) countably infinite set of variables T (ΣV)denotes the terms built over signature Σ and variables V Σ is partitioned in D the definedsymbols (also called operations) and C the constructor symbols (also called data constructors)

T (CV) are called constructor terms The set of variables occurring in a term t is denoted byvar(t) while the sequence (in order) of variables occurring in a term t is denoted by ETHrarrvar(t) Aterm is linear if it does not contain multiple occurrences of any variable LT (ΣV) denotes theset of linear terms

t∣p denotes the subterm of t at position p and t[s]p denotes the result of replacing thesubterm t∣p by the term s

Given a substitution ϑ = x1t1 xntn we denote by dom(σ) and range(σ) the domainset x1 xn and the range set ⋃n

i=1 var(ti) respectively The identity substitution is denotedby ε By tσ we denote the application of σ to t σV denotes the restriction of substitution σto set V sube V σϑ denotes the composition of ϑ and σ ie the substitution st x(σϑ) = (xσ)ϑfor any x isin V Given two substitutions ϑ1 and ϑ2 and two terms t1 and t2 we say that ϑ1

33

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

(respectively t1) is more general than ϑ2 (respectively t2) denoted ϑ1 ⪯ ϑ2 (respectively t1 ⪯ t2)if and only if there exists a substitution σ st ϑ1σ = ϑ2 (respectively t1σ = t2) We denote by≃ the induced equivalence ie ϑ ≃ σ if and only if there exists a renaming ρ st ϑρ = σ (andσρminus1 = ϑ) With σ uarr σprime we indicate the lub (wrt ⪯) of σ and σprime

A substitution ϑ is an unifier for terms t and s if tϑ = sϑ t and s unifyare unifiable whenthere exists a unifier A unifier σ for t and s is a most general unifier denoted as σ =mgu(t s)when σ ⪯ ϑ for any unifier ϑ of t and s

Rewriting

A term rewriting system (TRS for short) R is a set of rules l rarr r where l r isin T (ΣV) var(r) subevar(l) l = f(t1 tn) and f isin D t1 tn are the argument patterns of l rarr r and neednot necessarily be in T (CV) unlike in functional programming where only constructor-basedTRSs are considered (ie with ti isin T (CV)) We denote by RΣ the set of all TRSs defined onsignature Σ

Given TRS R a rewrite step tpETHrarrR

tprime is defined if there are a position p in t l rarr r isin R and

a substitution η with dom(η) sube var(l) such that t∣p = lη and tprime = t[rη]p As usual we omit towrite position p when it is not relevant and omit R when is clear from the context Moreoverwe use ETHrarrlowast to denote the transitive and reflexive closure of the rewriting relation ETHrarr

A term t is called a normal form denoted by t↛ if there is no term s such that tETHrarrlowast sA substitution x1t1 xntn is R-normalized (wrt a TRS R) if all ti are normal forms

(which trivially includes the case when ti isin T (CV))Full Narrowing

In the paper with s≪X we denote a renamed apart variant s of an element belonging to a setof syntactic objects X ie a renaming of variable names of some x isin X that does not containvariables that appear in the context of the definition where s ≪ X is used (this is also calledldquousing fresh variables names in srdquo)

The combination of variable instantiation and rewriting is called narrowing [7] Formally a

(full) narrowing step tσp

Rtprime is defined if there is a position p in t l rarr r ≪R and σ =mgu(t∣p l)

such that t∣p notin V and tprime = (t[r]p)σ In such a case we have that tσpETHrarrR

tprime Again we omit to

write position p when it is not relevant and omit R when is clear from the contextt denotes that there is no term s such that t s

3 Modeling the small-step rewriting behavior

In this section we introduce the concrete semantics which is suitable to model the small-steprewriting behavior In order to formally state such relationship we first need to formally definethe concept of small-step rewriting behavior

Definition 31 (Rewriting behavior) Given t0 isin T (ΣV) and R isin RΣ the small-step rewrit-ing behavior of t0 in R is

BssJt0 in RK ∶= t0 ETHrarrR

t1 ETHrarrR⋯ETHrarrR

tnminus1 ETHrarrR

tn∣forallti isin T (ΣV) (31)

and the small-step rewriting behavior of R is BssJRK ∶= ⋃tisinT (ΣV)BssJt in RK

34

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

This notion of observable behavior induces the definition of TRS equivalence

forallR1 R2 isin RΣR1 asympss R2 ∶lArrrArr BssJR1 K = BssJR2 K (32)

Thanks to the following property we can restrain the check of Bss equivalence of two TRSs tolinear terms Moreover in the sequel we will also restrict our attention only to denotations forlinear terms

Proposition 32 Let R1 R2 isin RΣ Then R1 asympss R2 lArrrArr R1 is a variant of R2 lArrrArr forallt isinLT (ΣV) BssJt in R1 K = BssJt in R2 K

31 The semantic domain

We now define a notion of ldquohypothetical rewritingrdquo which resembles full narrowing [7] butit ldquodecouplesrdquo multiple occurrences of variables This way we maintain the potentiality tochoose different evolutions of the rewritings of redexes once variables are instantiated with nonconstructor terms

The semantic domain of our semantics will be made of trees with all possible derivations ofthis variation of narrowing

311 Linearizing Narrowing

Definition 33 (Term Linearization) Let t isin T (ΣV) r isin LT (ΣV) and σ∶ V rarr V We saythat (r σ) is a linearization of t denoted (r σ) = lin(t) if rσ = t and var(t) sube var(r) Thesubstitution σ will be called delinearizator

If a term is linear then lin(t) = (t ε) while for non-linear terms we can have different possibilities(for instance lin(f(xx)) = (f(x y)yx) = (f(z x)zx) = ) However the followingconstructions which involve linearization are actually independent upon the particular choiceof linearization in the sense that all possible different results are variants (analogously to whathappens for the choice of different mgursquos)

It may be useful to note that a delinearizer σ has one binding for each (further) multipleoccurrence of a variable

Definition 34 (Linearizing Narrowing Derivation) Let t s isin LT (ΣV) and R isin RΣ There

exists a linearizing narrowing step tθp

OcircrArrσR

s if there exist a position p of t l rarr r ≪ R

θprime =mgu(t∣p l) and σ∶ V rarr V such that

t∣p notin V (s σ) = lin(t[rθprime]p) θ = θprimevar(t)We omit to write position p when it is not relevant and omit R when is clear from the context

A sequence t0θ1

OcircrArrσ1

t1 θn

OcircrArrσn

tn is called linearizing narrowing derivation With t0θ

OcircrArrσ

lowast tn we

denote the existence of a linearizing narrowing derivation such that θ = θ1⋯θn and σ = σ1⋯σnNote that in linearizing narrowing derivations we do not apply mgu θ to all reduct (t[r]p)θ asnarrowing does This would not make any difference since terms are kept linear by constructionand thus θ cannot alter the context outside positions being reduced

Linearizing narrowing is correct wrt rewriting (as narrowing is) as proven by the followingtheorem which is the analogous of Theorem 38 of [8] (Theorem 1 of [7]) where we use linearizing

35

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

narrowing instead of narrowing Actually linearizing narrowing is more general than narrowingin the sense that when we have a narrowing derivation then we will surely have a linearizingnarrowing derivation which possibly compute more general instances (in case there are non-linear terms)

Theorem 35 Let R isin RΣ s0 isin LT (ΣV) t0 isin T (ΣV) η0 an R-normalized substitution suchthat t0 = s0η0 and V sub V such that var(s0) cup dom(η0) sube V If t0 ETHrarrlowast tn then there exist a termsn isin LT (ΣV) and substitutions ηn θ σ such that

s0θ

OcircrArrσ

lowast sn tn = snσηn (θηn)V = η0V ηn is R-normalized

where s0θ

OcircrArrσ

lowast sn and t0 ETHrarrlowast tn employ the same rewrite rules at the same positions

Note that while it is always possible to transform rewrite derivations into linearizing narrowingderivations (in the sense of Theorem 35) the opposite does not hold in general as we will showin Example 37 As anticipated we gather all linearizing narrowing derivations (of the sameterm t) into a tree

Definition 36 (Linearizing Narrowing Trees) Let t isin LT (ΣV) A linearizing narrowingtree T for t is a (not necessarily finite) labelled tree which is rooted in t and where

1 paths are linearizing narrowing derivations2 sibling subtrees have the same root terms if and only if their incoming arcs have different

substitutions

We denote with LNTΣ (or simply LNT when clear from the context) the set of all thelinearizing narrowing trees (over Σ) Moreover for any t isin LT (ΣV) we denote with LNTt theset of all linearizing narrowing trees for t

Point 2 ensures that all sibling steps in a linearizing tree are pairwise distinct and thus that wecannot have two different paths of the tree with the same terms and labels

Example 37Consider TRS R of Example 11 The linearizing narrowing tree starting from term diff (x) is

diff (x) x ne x1True

xHead x1Tailε

TruexTa

il x1Head

εε

x1x

This linearizing narrowing derivation diff (x) xHeadx1Tail

OcircOcircOcircOcircOcircOcircrArrx1x

lowast True can be read as if there is a

term t that can rewrite both to Head and Tail then diff (t) rewrites to True Indeed diff (coin)does rewrite to True (a possible rewriting derivation is diff (coin) ETHrarr coin ne coin ETHrarr Head necoin ETHrarr Head ne Tail ETHrarr True)

In this case is not possible to transform these linearizing narrowing derivations into rewritederivations (since diff (x)ETHrarr x ne x↛ as well as diff (t)ETHrarr t ne t↛ for all t isin T (CV))

This example also shows that linearizing narrowing can have longer derivations wrt (stan-dard) narrowing since diff (x) ε

x ne x

36

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

Definition 38 (Variance on LNT) Let t isin LT (ΣV) and T1 T2 isin LNTt We say that T1 andT2 are local variants if there exists a renaming ρ such that T1ρ = T2Two linearizing narrowing trees are local variants if and only if they have the same root t andtheir steps are equal up to renaming of variables which do not occur in t

Note Since the actual choices of local variable names is completely irrelevant from now onwith an abuse of notation by LNT we will actually indicate its quotient wrt localvariance Moreover all linearizing narrowing trees presented in the sequel will actuallybe an arbitrary representative of an equivalence class

Definition 39 (Order on LNT) Let denote with paths(T ) the set of all the paths of T start-ing from the root

Given T1 T2 isin LNT we define T1 ⊑ T2 if and only if paths(T1) sube paths(T2)Given a set T sube LNTt the least upper bound ⊔T is the tree whose paths are ⋃T isinT paths(T )

Dually for the greatest lower bound ⊓It is worth noticing that for any t isin LT (ΣV) LNTt is a complete lattice

By Point 2 of Definition 36 paths is injective thus it establishes an order preserving iso-

morphism (LNTt ⊑) minusminusminusminusminusminusminusminusminusrarrETHrarrlarrlarrETHminusminusminusminusminusminusminusminusminuspaths

prfxtree (paths(LNTt) sube) where the adjoint of paths prfxtree builds

a tree from a set of paths (by merging all common prefixes) So we have two isomorphic rep-resentations of linearizing narrowing trees and in the sequel we can simply write d isin T ford isin paths(T ) The set representation is very convenient for technical definitions while forexamples the tree representation is better suited

Definition 310 (Linearizing Narrowing Tree of a term) Let t isin LT (ΣV) and R isin RΣA linearizing narrowing tree NJt in RK for term t in TRS R is

NJt in RK ∶= d isin LNTt∣d uses rules from RIntuitively NJt in RK denotes the linearizing narrowing behavior of linear term t in TRS Rmodulo local variance (ie local variables are up to renaming)

Example 311Given the following TRS R

m(H (x))rarr d(xK(x)) d(C (x)K (E(y)))rarr f(xx y y)f (A x y F)rarr B(y y) f (E(x) y AA)rarrK(E(y))

The linearizing narrowing tree NJm(x) in RK is

m(x) d(x1K(x2)) f(x3 x4 y y1)B(y y2)

x3Ay1Fy2y

K(E(x4))x3E(x5)

yAy1A

ε

x1C(x3)x2E(y)

x4x3 y1y

xH(x1)

x2x1

Linearizing narrowing trees ldquocapturerdquo the behavioral TRS equivalence asympss since the TRSequivalence induced by N coincides with asympss

Theorem 312 Let R1 R2 isin RΣ Then R1 asympss R2 if and only if for every t isin LT (ΣV)NJt in R1 K =NJt in R2 K

37

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

Even more from linearizing narrowing trees we can completely reconstruct the small-steprewriting behavior To formally prove this we need to introduce the following operation to buildrewriting derivations from linearizing narrowing derivations

Definition 313 Let R isin RΣ and d = s0 θ1OcircrArrσ1

s1θ2OcircrArrσ2

θnOcircrArrσn

sn be a linearizing narrowing deriva-

tion The linear narrowing to rewriting operator is defined as

lfloordrfloor ∶= t0 ETHrarr t1 ETHrarr tk ∣ ξ is an R-normalized substitution 0 le k le nη = θ1 uarr σ1 uarr uarr θk uarr σk forall0 le i le k ti = siηξ (33)

We abuse notation and lift lfloorsdotrfloor also to sets as lfloorSrfloor ∶= ⋃disinSlfloordrfloorIntuitively this operation takes a prefix d of a linear narrowing derivation and if it can simulta-neously satisfy all its computed answers and delinearizators with substitution η then it buildsa rewriting sequence by applying ηξ to all terms of d for any R-normalized substitution ξ

Theorem 314 Let R isin RΣ and t isin LT (ΣV) Then BssJt in RK = lfloorNJt in RKrfloorHence NJt inRK is indeed a condensed representation of BssJt inRK Now the next step for theconstruction of a semantics with the desired characteristics is to achieve compositionality Todo so we should look for a denotation for most general terms f (ETHrarrxn) (of a TRS R) which couldbe used to retrieve with suitable semantic operations NJt in RK for any t isin LT (ΣV)32 Operational denotations of TRSs

The operational denotation of a TRS can be defined as an interpretation giving meaning to thedefined symbols over linearizing narrowing trees ldquomodulo variancerdquo Essentially we define thesemantics of each function in D over formal parameters (whose names are actually irrelevant)

Definition 315 (Interpretations) Let MGTD ∶= f (ETHrarrxn) ∣ fn isin D ETHrarrxn are distinct variablesTwo functions I J ∶MGTD rarr LNTΣ are (global) variants denoted by I cong J if for each

π isinMGTD there exists a renaming ρ such that (I(π))ρ = J(πρ)An interpretation is a function I ∶MGTD rarr LNTΣ modulo variance2 such that for every

π isinMGTD I(π) is a linearizing narrowing tree for πThe semantic domain IΣ (or simply I when clear from the context) is the set of all inter-

pretations ordered by the pointwise extension of ⊑The partial order on I formalizes the evolution of the computation process (I ⊑) is a completelattice and its least upper bound and greatest lower bound are the pointwise extension of ⊔and ⊓ respectively In the sequel we abuse the notations for LNT for I as well The bottomelement of I is I ∶= λππ (for each π isin MGTD) In the sequel we abuse the notations forLNT for I as well

It is important to note that MGTD (modulo variance) has the same cardinality of D (andis then finite) and thus each interpretation is a finite collection (of possibly infinite elements)Hence we will often explicitly write interpretations by cases like

I ∶=⎧⎪⎪⎪⎪⎨⎪⎪⎪⎪⎩

π1 ↦ T1

πn ↦ Tn

for

I(π1) ∶= T1⋮

I(πn) ∶= Tn2ie a family of elements of LNTΣ indexed by MGTD modulo variance

38

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

In the following any I isin I is implicitly considered as an arbitrary function MGT rarr LNT

obtained by choosing an arbitrary representative of the elements of I in the equivalence classgenerated by cong Actually in the sequel all the operators that we use on I are also independentof the choice of the representative Therefore we can define any operator on I in terms of itscounterpart defined on functions MGT rarr LNT

Moreover we also implicitly assume that the application of an interpretation I to a specificπ isin MGT denoted by I(π) is the application I(π) of any representative I of I which is

defined exactly on π For example if I = (λf (x y) f(x y) xc(z)

OcircOcircOcircrArrε

c(y z))congthen I(f(u v)) =

f(u v) uc(z)

OcircOcircOcircrArrε

c(v z)While defined symbols have to be interpreted according to TRS rules constructor symbols

are meant to be interpreted as themselves In order to treat them as a generic case of functionapplication we assume that any interpretation I is also implicitly extended on constructors asI(c(ETHrarrxn)) ∶= c(ETHrarrxn) In the sequel we will use ϕ when we refer to a generic (either constructoror defined) symbol whence f for defined symbols and c for constructor ones

Definition 316 (Operational denotation of TRSs) Let R isin RΣ Then the operationaldenotation of R is

OJRK ∶= (λf (ETHrarrxn) NJf(ETHrarrxn) in RK)cong

(34)

Intuitively O collects the linearizing narrowing tree of each f (ETHrarrxn) in R abstracting from theparticular choice of the variable names ETHrarrxn

Example 317The operational denotation of TRS R of Example 11 is

OJRK =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

coin ↦ coin

Tail

Head

εεεε

x ne y ↦ x ne yTrue

True

xTail yH

ead

εxHead yTailε

diff (x)↦ diff (x) x ne x1True

True

ε

x1x

xHead x1T

ail

εxTail x

1Headε

The (small-step) rewriting behavior of any term t can be ldquoreconstructedrdquo from OJRK bymeans of the following evaluation function E 321 Evaluation Function

When we have the interpretation with the linearizing narrowing tree of f (ETHrarrxn) we can easily

reconstruct the rewriting behavior of any f (ETHrarrtn) for (renamed apart)

ETHrarrtn isin LT (CV) by sim-

ply replacing the most general bindings along a derivation with constructor terms ti (clearly

39

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

pruning branches with inconsistent instances) However with non-constructor nested termsthings gets more involved In practice we have an interleaving of parts of all sub-derivationscorresponding to the evaluation of arguments leaded by the derivation of f (ETHrarrxn) Intuitively thebasic building block of our proposal is the definition of a semantics embedding operation thatmimics parameter passing Namely taken two linearizing narrowing trees T1 T2 and a variablex of (the root of) T1 the tree-embedding operation T1[xT2] transforms T1 by modifying itssteps accordingly to steps of T2 which provides specific actual parameter values to x in placeswhere x in T1 was originally ldquofreelyrdquo instantiated

In order to define T1[xT2] we need to introduce an auxiliary (technical) relation whichworks on single derivations Note that in the sequel to shorten definitions when we adornlinearizing narrowing derivations or trees with a term s like ds or Ts we mean that the headof ds or the root of Ts is term s

Definition 318 Let π isin LT (ΣV) dg be a linearizing narrowing derivation with head g andTb isin LNTb Then dgπTb ⊢ d is the least relation that satisfies the rules

dtπTs ⊢ tmicromicro = larrETHETHmgu(s π) (35a)

dtπTsprime ⊢ d

dtπTs ⊢ tmicroθq

OcircrArrσ

dmicro = larrETHETHmgu(s π) s

θp

OcircrArrσ

Tsprime isin Ts existq s∣p = tmicro∣q (35b)

dt0 π0Ts0 ⊢ dt1 dtn πnTsn ⊢ dtn+1

(t θp

OcircrArrσ

dt0)πTs0 ⊢ tmicro θprimep

OcircrArrσprimeprime

dtn+1

micro = larrETHETHmgu(s0 π)θprime = larrETHETHmgu(tmicro tθ)var(tmicro) x1y1 xnyn = proj (var(πθ) σ)Ts1 Tsn ≪ Ts0

π0 = πθ foralli isin 1 n πi = π0yixiforallj isin 0 n ETHrarrvj =ETHrarrvar(sj)

σprimeprime = (σ cup

n

⋃i=1

ETHrarrvi ETHrarrv0)var(tn+1)

(35c)

where

bull proj (Vσ) = xy isin σ ∣ y isin V bulllarrETHETHmgu(t s) is an mgu θ of t and s such that forallx isin var(t) xθ isin V

Broadly speaking the role of π in a statement dtπTs ⊢ d is that of the ldquoparameter patternrdquoresponsible to constrain ldquofreelyrdquo instantiated formal parameters in dt to the actual parametersvalues which are actually ldquocomingrdquo from Ts More specifically Rules 35 govern the inlaying ofthe steps of a linearizing narrowing tree Ts into a derivation dt In particular

bull The axiom 35a stops any further possible inlayingbull The rule 35b considers the case when we want to proceed with an inner linearizingnarrowing step employing a step coming from Ts In this case t plays the role of contextand the inner step is done accordingly to the one chosen from Ts Note that is it possibleto do the step only if exists q such that s∣p = tmicro∣q Namely the defined symbol over whichthe step is done needs to be ldquovisiblerdquo in tmicro

bull The rule 35c considers the case when we want to do an outermost step First the stephas to be compatible with the way we instantiated t so far namely exists mgu(tmicro tθ)Then we choose from σ only the delinearizers that depend on the variable from whichwe started the embedding Each of these delinearizer comes from the linearization of amultiple occurrence of a same variable z Thus for each rename zprime of z we sequentiallyembed into zprime a (possibly different) sub-derivation coming from a renamed apart variant of

40

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

Ts Note that if we would not have multiple occurrences of z (ie proj (var(πθ) σ) = empty)the rule would simply be

dt0 π0Ts0 ⊢ dt1(t θpOcircrArr

σ

dt0)πTs0 ⊢ tmicro θprimepOcircrArrσ

dt1

micro = larrETHETHmgu(s0 π) θprime = larrETHETHmgu(tmicro tθ)var(tmicro)

π0 = πθ

Note that in Rules 35 we use a selected form of mgu (ie larrETHETHmgu which does not rename variablesin the left argument) in order to avoid to change variable names along the way

Example 319Consider OJRK of Example 317 Let Tcoin ∶= OJRK(coin) and d0 ∶= diff (x) ε

OcircOcircrArrx1x

d1 isinOJRK(diff (x)) where d1 = x ne x1 xHeadx1Tail

OcircOcircOcircOcircOcircOcircOcircrArrε

True

Let us build a proof tree to find a derivation d such that d0xTcoin ⊢ d We have to startwith an application of rule (35c) which (in this case) has two premises since the delinearizatorx1x in the first step of d0 has one binding The first subtree which embeds the Head branchof Tcoin into x is

(35a)TrueHead Head ⊢ True

(35c)d1xHead ⊢ Head ne x1 x1Tail

OcircOcircOcircrArrε

True(35b)

d1xTcoin ⊢ coin ne x1 ε

OcircrArrε

Head ne x1 x1Tail

OcircOcircOcircrArrε

True

acutesup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1cedilsup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1sup1parad3

(PT)

Now we can build the full proof tree (by building the second subtree which starting from d3can finish to embed the Tail branch of Tcoin into x1)

(PT)

(35a)TrueTail Tail ⊢ True

(35c)d2 x1Tail ⊢ Head ne Tail ε

OcircrArrε

True(35b)

d2 x1Tcoin ⊢ Head ne coin ε

OcircrArrε

Head ne Tail ε

OcircrArrε

True(35c)

d3 x1Tcoin ⊢ coin ne coin ε

OcircrArrε

Head ne coin ε

OcircrArrε

Head ne Tail ε

OcircrArrε

True(35c)

d xTcoin ⊢ diff (coin) ε

OcircrArrε

coin ne coin ε

OcircrArrε

Head ne coin ε

OcircrArrε

Head ne Tail ε

OcircrArrε

True

We have analogous proof tree for d xTcoin ⊢ diff (coin) ε

OcircrArrε

coin ne coin ε

OcircrArrε

Tail ne coin ε

OcircrArrε

Tail neHead

ε

OcircrArrε

True In total we have ten possible proof trees four of whom that have derivations

which reach True

Tree-embedding is simply defined by collecting all contributes of dxT ⊢ dprime

Definition 320 (Tree-embedding) Let Tg isin LNTg and Tb isin LNTg such that

1 Tg and Tb do not share any local variable2 x is a variable which does not occur in Tb

Then the tree-embedding operation Tg[xTb] is defined as Tg[xTb] ∶= d∣dg isin Tg dgxTb ⊢ d41

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

The evaluation function is obtained by repeated application of tree-embedding

Definition 321 (Evaluation Function) Let t isin LT (ΣV) and I isin I The evaluation of twrt I denoted E JtKI is defined by induction on the structure of t as follows

E JxKI ∶= x (36a)

E Jϕ(ETHrarrtn)KI ∶= I(ϕ(ETHrarrxn))[x1 E Jt1KI ] [xn E JtnKI ] ETHrarrxn renamed apart distinct (36b)

Example 322Consider OJRK of Example 317 The evaluation of E Jdiff (coin)KOJRK is

E Jdiff (coin)KOJRK = [ by Equation (36b) with n = 1 ]OJRK(diff (x))[x E JcoinKOJRK] = [ by Equation (36b) with n = 0 ]OJRK(diff (x))[xOJRK(coin)]

Then by completing what shown in Example 319 we have that E Jdiff (coin)KOJRK is

diff (coin)

diff (Head)Head ne Head

εεε

ε

coin ne coin

Head ne coinHead ne Head

εε

Head ne Tail Trueεεε

ε

εε

Tail ne coinTail ne Head True

εε

εε

Tail ne Tailεε

εε

coin ne HeadHead ne Head

εε

Tail ne Head Trueεεε

ε

εε

coin ne TailHead ne Tail True

εε

εε

Tail ne Tailεε

εε

εε

diff (Tail)Tail ne Tail

εε

εε

322 Properties of the TRS operational denotation

The following result states formally that from OJRK the evaluation function E can reconstructthe linearizing narrowing tree of any linear term

Theorem 323 For all R isin RΣ and t isin LT (ΣV) E JtKOJRK =NJt in RK

A straightforward consequence of Theorems 323 and 312 is

Corollary 324 For all R1 R2 isin RΣ OJR1 K = OJR2 K if and only if R1 asympss R2

Thus semantics O is fully abstract wrt asympss

33 Fixpoint denotations of TRSs

We will now define a bottom-up goal-independent denotation which is equivalent to O and thus(by Corollary 324) adequate to characterize the small-step behavior for TRSs It is definedas the fixpoint of an abstract immediate operator over interpretations P JRK This operatoris essentially given in terms of evaluation E of right hand sides of rules Namely given aninterpretation I it essentially consists in

42

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

bull building an initial linearizing narrowing step for a most general term according to rulesrsquoleft hand side

bull applying the evaluation operator E to the right hand side of the rule over I Definition 325 Let R isin RΣ P JRK∶ I rarr I is defined for all f isin D (of arity n) as

P JRKI (f(ETHrarrxn)) ∶=⊔f(ETHrarrxn) θ

OcircrArrσ

E JrprimeKI ∣ f(ETHrarrxn)θ rarr r ≪R

(rprime σ) = lin(r) (37)

Moreover we define our fixpoint semantics as F JRK ∶= lfp P JRK

F JRK is well defined since P JRK is continuous

Proposition 326 Let R isin RΣ Then P JRK is continuous

Example 327Let us consider the (artificial) TRS R ∶= g rarr f(h(a)) h(a) rarr h(b) f (h(b)) rarr a taken from[1] which is neither constructor-based nor confluent The evaluation of the right hand sidesof all rules is E Jf(h(a))KI = I(f(x))[x E Jh(a)KI ] = f(x)[xh(a)] = f(h(a)) E Jh(b)KI =h(x)[xb] = h(b) and E JaKI = a Hence

I1∶= P JRKuarr1 =

⎧⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎩

g ↦ g f(h(a))εε

h(x)↦ h(x) h(b)xa

ε

f(x)↦ f(x) axh(b)

ε

In the next iteration we have to evaluate E Jf(h(a))KI1= I

1(f(x))[x E Jh(a)KI

1] Since E Jh(a)KI

1=

I1(h(x))[x E JaKI

1] = h(a) ε

OcircrArrε

h(b) we have

P JRKuarr2 =⎧⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎩

g ↦ g f(h(a)) f(h(b)) aεε

εε

εε

h(x)↦ h(x) h(b)xa

ε

f(x)↦ f(x) axh(b)

ε

Now since P JRKuarr3 = P JRKuarr2 this is also the fixpoint F JRK

Example 328Consider TRS R of Example 11 The iterates of P JRK are

P JRKuarr1 =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

coin ↦ coin

Tail

Head

εεεε

x ne y ↦ x ne yTrue

True

xTail yH

ead

εxHead yTailε

diff (x)↦ diff (x) x ne x1ε

x1x

43

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

P JRKuarr2 =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

coin ↦ coin

Tail

Head

εεεε

x ne y ↦ x ne yTrue

True

xTail yH

ead

εxHead yTailε

diff (x)↦ diff (x) x ne x1True

True

ε

x1x

xHead x1T

ail

εxTail x

1Headε

Now since P JRKuarr3 = P JRKuarr2 this is also the fixpoint F JRK

Example 329Let us consider the TRS R ∶= zeros rarr ∶(0 zeros) take(0 x) rarr nil take(s(n) ∶(y z))) rarr∶(y take(n z)) f (n)rarr take(n zeros) The first two iterates of P JRK are

P JRKuarr1 =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

zeros ↦ zeros ∶(0 zeros)εε

take(x1 y1)↦ take(x1 y1 )

nil

x10

ε ∶(y0 take(x0 z))

x1s(x

0)y1 ∶(y

0 z)ε

f(x0)↦ f(x0) take(x0 zeros)εε

P JRKuarr2 =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

zeros ↦ zeros ∶(0 zeros) ∶(0 ∶(0 zeros))εε

εε

take(x2 y2)↦ take(x2 y2 )

nil

x20

ε ∶(y1 take(x1 z1))∶(y1nil)

εε ∶(y1 ∶(y0 take(x0 z0)))

x1s(x

0)z1 ∶(y

0 z0)

ε

x2s(x

1)y2 ∶(y

1 z1)ε

f(x1)↦ f(x1)

take(x1 zeros)

nil

x10

ε

take(x1 ∶(0 zeros))

nil

x10

ε

∶(0 take(x0 zeros))x

1s(x0)

ε

εε

εε

Note that to highlight the construction order of the various subtrees we used indices in variablesnames that respect the order of introduction and boxed the subtrees which correspond to the

44

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

previous iterate By continuing the computation of the iterates we obtain

F JRK =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

zeros ↦ zeros ∶(0 zeros) ∶(0 ∶(0 zeros))εε

εε

take(x y)↦ take(x y)

nil

x0

ε ∶(yprime take(xprime z))∶(yprimenil)

εε ∶(yprime ∶(yprimeprime take(xprimeprime zprime)))

x primes(x primeprime)z ∶(y primeprime z prime)ε

xs(x prime)y ∶(y prime z)ε

f(x)↦ f(x)

take(x zeros)

nil

x0

ε

take(x ∶(0 zeros))nil

x0

ε

take(x ∶(0 ∶(0 zeros)))εε ∶(0 take(xprime zeros))

∶(0nil)xprime 0

ε

∶(0 take(xprimeprime ∶(0 zeros)))

x primes(x primeprime)

ε

xs(x prime)ε

εε

εε

We can observe that since terms in R are linear the linearizing narrowing trees have justε as delinearizers and actually they are isomorphic to full narrowing trees

331 Properties of the TRS fixpoint denotation

The top-down goal-dependent denotation O and the bottom-up goal-independent denotationF are actually equivalent

Theorem 330 (Equivalence of denotations) Let R isin RΣ Then OJRK = F JRK

A straightforward consequence of Theorem 330 and Corollary 324 is

Corollary 331 (Correctness and full abstraction of F ) Let R1 R2 isin RΣ Then F JR1 K =F JR2 K if and only if R1 asympss R2

4 Conclusions

We have presented a condensed compositional bottom-up semantics for the full class of termrewriting systems which is fully abstract wrt the small-step behavior of rewriting

We are going to use this semantics to define by abstraction a condensed bottom-up se-mantics for the full class of term rewriting systems which is fully abstract wrt the big-stepbehavior of rewriting and thus suitable for semantic-based program manipulation tools Actu-ally we have developed a first proposal of such a semantics (by following this approach) but

45

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

restricted to the class of left-linear TRSs We already used it to develop a semantics-basedautomatic specification synthesis prototype [6] which is giving promising results

However we believe that our notion of linearized narrowing which differently from nar-rowing represents faithfully the small-step behavior of rewriting (in a compact way) could beinteresting for other applications as well

References

[1] M Alpuente M Comini S Escobar M Falaschi and J Iborra A Compact Fixpoint Semanticsfor Term Rewriting Systems Theoretical Computer Science 411(37)3348ndash3371 2010

[2] M Alpuente M Comini S Escobar M Falaschi and S Lucas Abstract Diagnosis of FunctionalPrograms In M Leuschel editor Logic Based Program Synthesis and Transformation ndash 12th

International Workshop LOPSTR 2002 Revised Selected Papers volume 2664 of Lecture Notes

in Computer Science pages 1ndash16 Berlin 2003 Springer-Verlag

[3] G Bacci An Abstract Interpretation Framework for Semantics and Diagnosis of Lazy Functional-

Logic Languages PhD thesis Dipartimento di matematica e Informatica Universita di Udine2011

[4] G Bacci and M Comini A Fully-Abstract Condensed Goal-Independent Bottom-Up FixpointModeling of the Behaviour of First Order Curry Submitted for Publication 2012

[5] M Comini G Levi M C Meo and G Vitiello Abstract Diagnosis Journal of Logic Program-

ming 39(1-3)43ndash93 1999

[6] M Comini and L Torella TRSynth a Tool for Automatic Inference of Term Equivalence inLeft-linear Term Rewriting Systems In E Albert and S-C Mu editors PEPM rsquo13 Proceedings

of the ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation pages 67ndash70Acm 2013

[7] J-M Hullot Canonical Forms and Unification In Proceedings of the 5th International Conference

on Automated Deduction volume 87 of Lecture Notes in Computer Science pages 318ndash334 Berlin1980 Springer-Verlag

[8] A Middeldorp and E Hamoen Completeness results for basic narrowing Applicable Algebra in

Engineering Communication and Computing 5213ndash253 1994 101007BF01190830

[9] H R Nielson and F Nielson Infinitary Control Flow Analysis a Collecting Semantics for ClosureAnalysis In Symposium on Principles of Programming Languages pages 332ndash345 1997

[10] TeReSe editor Term Rewriting Systems Cambridge University Press Cambridge UK 2003

A Technical Proofs

Proof of Proposition 32

Point 1 Implication lArrOcirc is straightforward We prove OcircrArr by reduction to absurd Supposethat R1 asympss R2 and R1 is not a variant of R2 Then there is at least one rule which isdifferent in R1 wrt R2 (or vice versa) Thus by Equation (31) we can have rewritingsteps which employ that rule in BssJR1 K which cannot be in BssJR2 K which is absurd

Point 2 Similarly to previous point but restricting to initial linear terms

In the sequel we use the following results

46

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

Proposition A1 ([8]) Suppose we have substitutions θ ρ ρprime and sets A B of variables suchthat (B minus dom(θ)) cup range(θ) sube A If ρA = ρprimeA then (θρ)A = (θρprime)AProposition A2 ([8]) Let R be a TRS and suppose we have substitutions θ ρ ρprime and setsA B of variables such that the following conditions are satisfied

ρA R-normalized θρprimeA = ρA B sube (A minus dom(θ)) cup range(θA)Then ρprimeB is also R-normalized

Proof of Theorem 35 We prove the thesis by induction on the length of the rewriting derivationfrom t0 to tn The case of length zero is straightforward

Suppose t0 ETHrarr t1 ETHrarr ETHrarr tn is a rewriting derivation of length n gt 0 We may assumewithout loss of generality that var(l) cap V = empty We have (s0η0)∣p = s0∣pη0 = τ l for somesubstitution τ with dom(τ) sube var(l) Let micro ∶= τ cup η0 We have s0∣pmicro = s0∣pη0 = lτ = lmicro so s0∣pand l are unifiable Let θprime

1∶= mgu(s0∣p l) and θ1 ∶= θprime1var(s0∣p) Clearly dom(θ1) cup range(θ1) sube

var(s0∣p) cup var(l) Moreover there exists a substitution ψ such that

θ1ψ = micro (1)

Now let (s1 σ1) ∶= lin(s0[rθprime1]p) By Definition 34

s0θ1p

OcircOcircrArrσ1 lrarrr

s1 (2)

Let V1 ∶= (V minus dom(θ1)) cup range(θ1) cup dom(σ1) andη1 ∶= (σ1ψ)V1

(3)

Clearly dom(η1) sube V1 We have var(s1) = dom(σ1)cup var(s0[rθ1]p) sube dom(σ1)cup var(s0[lθ1]p) =dom(σ1) cup var(s0θ1) sube V1 Therefore var(s1) cup dom(θ1) sube V1 By (1) and (3) we have s1σ1η1 =s1σ1ψ = s0[rθ1]pψ = s0[r]pθ1ψ = s0[r]pmicro = s0micro[rmicro]p Since V cap dom(τ) = empty we have

microV = η0V (4)

Likewise microvar(r) = η0var(r) Hence s0micro[rmicro]p = s0η0[rτ]p = t0[rτ]p = t1 Thust1 = s1σ1η1 (5)

Next we have to verify that (θ1η1)V = η0V By (3) and by Proposition A1 we have that(θ1η1)V = (θ1σ1ψ)V By (1) and (4) (θ1η1)V = (θ1σ1ψ)V Since dom(σ1) notin V we havethat (θ1σ1ψ)V = (θ1ψ)V = microV = η0V Thus

(θ1η1)V = η0V (6)

Now we show that η1 is R-normalized Since dom(η1) sube V1 it suffices to show that η1V1isR-normalized Let B ∶= (V minusdom(θ1))cuprange(θ1V ) Proposition A2 yields the normalization

of η1B Recall that range(θ1) sube var(s0∣p) cup var(l) Let x isin range(θ1) since θ1 is idempotentclearly x notin dom(θ1) If x isin var(s0∣p) sube V then x isin V minus dom(θ1) sube B If x isin var(l) thenx isin var(lθ1) = var(s0∣pθ1) thus x isin range(θ1V ) sube B Thus range(θ1) sube B and then V1 =B cup dom(σ1) By this and (3) since η1B is R-normalized η1V1

is R-normalized as well

47

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

By inductive hypothesis we have a term sn and substitutions θprime σprime and ηn such that

s1θprimeOcircrArrσprime

lowast sn (7)

tn = snσprimeηn (8)

(θprimeηn)V1= η1V1

(9)

ηn is R-normalized (10)

Moreover s1θprimeOcircOcircrArr

σprimeR

lowast sn and t1 ETHrarrR

lowast tn apply the same rewrite rules at the same positions

Let θ ∶= θ1θprime and σ = σ1σprime By (2) and (7) we obtain s0θ

OcircrArrσ

lowast sn By construction this

narrowing derivation makes use of the same rewriting rules at the same positions as the rewritingderivation t0 ETHrarr

R

lowast tn It remains to show that (θηn)V = η0V By (9) and Proposition A1

(θ1θprimeηn)V = (θ1η1)V Therefore by (6) (θηn)V = (θ1η1)V = η0V Proof of Theorem 312 We prove OcircrArr by reduction to absurd Suppose that R1 asympss R2 andexistt isin LT (ΣV) NJt in R1 K neNJt in R2 K This means that there is at least one derivation whichbelongs to NJt in R1 K and not to NJt in R2 K (or vice versa) Hence there is at least a rulewhich is not in common to the two programs Thus R1 asympss R2 which is absurd

We prove lArrOcirc by reduction to absurd Suppose that forallt isin LT (ΣV) NJt inR1 K =NJt inR2 Kand R1 asympss R2 Then there is at least one rule which is different in R1 wrt R2 Thus byEquation (31) and Theorem 35 NJt in R1 K neNJt in R2 K which is absurd

Proof of Theorem 314 We prove the two inclusions separately Inclusion supe is immediate byDefinition 313

Inclusion sube is proved by reduction to absurd Assume that there exists a derivation t0 ETHrarrR

lowast tn

such that it does not belong to lfloorNJt0 inRKrfloor Then by Theorem 35 taken η0 = ε there exists arelaxed narrowing derivation of the form s0

θ1

OcircrArrσ1

θn

OcircrArrσn

sn Note that for each i isin 1n θi andσi are just renaming ηi = ε and ti = siσi σ0 Let η ∶= η0 = ε It is easy to see that there existsηprime such that ηprime = θ1 uarr σ1 uarr uarr θn uarr σn By Definition 313 there exists a rewriting derivationtprime0ETHrarrR

lowast tprimen where tprimei = siηprime for each i isin 1n Moreover dom(σk) isin var(si) for each k isin i+ 1nand θi = (σj)dom(θi) or θi = (σj)dom(θi) for some j Hence siη

prime = siσi σ0 Thus tprimei = ti foreach i isin 1n which is absurd

Lemma A3 Let R a TRS x isin V and t s isin T (ΣV) such that they do not share variables andx isin t x isin s Then NJt in RK[xNJs in RK] =NJtxs in RK

Proof It is sufficient to prove that given dt isin NJt in RK and Ts = NJs in RK if dtxTs ⊢ dthen d isin NJtxs in RK To this aim we will prove a stronger result let π isin T (CV) letTs = NJs in RK and for any dt isin NJt in RK such that dtπTs ⊢ d then d isin NJtη in RK whereη =larrETHETHmgu(s π) We proceed by structural induction on the proof tree

rule 35a) straightforward

rule 35b) By inductive hypothesis dtπTsprime ⊢ dtmicro lArrrArr dtmicro isinNJtmicro inRK If it exists dtmicro then

tmicro∣p = s∣p Moreover existmicroprime such that microprime = larrETHETHmgu(sprime π) and tmicroprime∣p = sprime∣p Thus tmicroθp

OcircrArrσ

dtmicro isinNJtmicro in RK

48

A Semantics Modeling the Small-Step Behavior of Rewriting Comini and Torella

rule 35c) By inductive hypothesis we have that dt0 π0Ts0 ⊢ dt1 lArrrArr dt1 isin NJtmicro0 inRK dtn πnTsn ⊢ dtn+1 lArrrArr dtn+1 isin NJtmicron in RK where micro0 = larrETHETHmgu(s0 π0) micron =larrETHETHmgu(sn πn) We know that exists a linearizing narrowing step t

θp

OcircrArrσ

t0 where θ2 =mgu(t∣p l) θ = θ2var(t) (s σ) = lin(rθ2) tmicro = t[s]p We need to prove that it exists the

linearizing narrowing step tmicroθprimep

OcircrArrσprimeprime

tn+1 Since it exists mgu(t∣p l) and mgu(tmicro tθ) thenit exists θ3 such that θ3 = mgu((tmicro)∣p l) Now let θprime ∶= θ3var(tmicro) and (sprime σprime) = lin(rθ3)then tmicro[sprime]p = t Let us observe that t1 = t0micro0 t2 = t0micro0micro1 tn+1 = t0micro0 micron wheremicro0 =larrETHETHmgu(s0 π0) micron =larrETHETHmgu(sn πn) Let microlowast = micro0 micron then tn+1 = t0microlowast = tmicrolowast[smicrolowast]p =tmicro[smicrolowast]p = t

Proof of Theorem 323 We proceed by structural induction on term t

t = x Immediate by Equation (36a)

t = ϕ(ETHrarrtn)

E Jϕ(ETHrarrtn)KOJRK =[ by Equation (36b) ]

= OJRK(ϕ(ETHrarrxn))[x1 E Jt1KOJRK] [xn E JtnKOJRK] =[ by inductive hypothesis ]

=NJϕ(ETHrarrxn) in RK[x1NJt1 in RK] [xnNJtn in RK] =[ by Lemma A3 ]

=NJϕ(ETHrarrtn) in RK

Proof of Proposition 326 It is straightforward to prove that P JP K is monotone and finitarythus it is continuous

Proof of Theorem 330 We prove the two inclusions separately

⊑) Let indicate with Ok all derivations of OJRK with length le k by induction we prove thatforallk Ok ⊑ P JRKuarrk

k = 0) immediate

k gt 0) foralld isin Ok we have that d = f(x) θΛ

OcircrArrσ

dprime such that (by Theorem 323) dprimet isin E JtKOkminus1

Thus by monotonicity of E we have that dprimet isin E JtKP JRKuarrkminus1 By the definition of P d isin P JP KP JRKuarrkminus1 = P JRKuarrk

Thus by Proposition 326 OJRK = ⊔kge0Ok ⊑ ⊔kge0P JRKuarrk = F JRK

⊒) We need to prove that f(ETHrarrxn) θΛ

OcircrArrσ

E JrprimeKOJRK ⊑NJf(ETHrarrxn) inRK By Theorem 323 E JrprimeKOJRK

is a linearizing narrowing tree Since θ = mgu(f(ETHrarrxn l))ETHrarrxnand (σ rprime) = lin(r) we can

conclude that f(ETHrarrxn) θΛ

OcircrArrσ

E JrprimeKOJRK ⊑NJf(ETHrarrxn) in RK

49

Logical and Algebraic Views of a Knot Fold of a

Regular Heptagon

Fadoua Ghourabi1 Tetsuo Ida2 and Kazuko Takahashi1

1 Kwansei Gakuin University Japanghourabikwanseiacjp ktkakwanseiacjp

2 University of Tsukuba Japanidai-eosorg

Abstract

Making a knot on a rectangular origami or more generally on a tape of a finite lengthgives rise to a regular polygon We present an automated algebraic proof that makingtwo knots leads to a regular heptagon Knot fold is regarded as a double fold operationcoupled with Huzitarsquos fold operations We specify the construction by describing thegeometrical constraints on the fold lines to be used for the construction of a knot Thealgebraic interpretation of the logical formulas allows us to solve the problem of howto find the fold operations ie to find concrete fold lines The logical and algebraicframework incorporated in a system called Eos (e-origami system) is used to simulate theknot construction as well as to prove the correctness of the construction based on algebraicproof methods

1 Introduction

From the early history of mathematics the correspondence between geometry and algebra hasbeen recognized and has been the subject of constant study In some sense ancient geometrywas a mother of algebra In particular solving algebraic equations has been related to therealm of Euclidean geometry Early mathematicians notably Khawarizmi and Khayyam gavegeometrical meanings to the solutions of equations Khayyamrsquos insight was that solutions ofcertain cubic equations are points of intersections of conic sections [1] Seven centuries laterafter freeing algebra from geometrical thinking Wantzel proved that solving cubic solutionsis impossible by Euclidean tools ie compass and straightedge [2] Further tools have beeninvented and used to perform constructions that are impossible by Euclidean tools

Paper folding ie origami allows solving cubic equations and hence geometrical construc-tions such as trisection of an arbitrary angle or a regular heptagon are realizable Given anorigami paper what we can do by hand is to construct creases and points The creases areconstructed by folding the paper along the lines which we call fold lines The points are con-structed by the intersection of lines Huzita presented a set of fold operations (known also asHuzitarsquos axioms in literature) with which he showed how to obtain fold lines [3] Huzitarsquos foldoperations are simple to perform by hand but powerful enough to solve cubic equations [4]

The geometrical construction of a regular heptagon has a unique history in that it belongsto the famous classical impossible problems by Euclidean tools Using paper folding the con-struction was shown to be possible In this paper we show another method of constructing aregular heptagon based on an extension of Huzitarsquos fold operations by introducing knottingThe constructions of regular n-gons (in particular of regular pentagon and heptagon) by makingknots have not been rigorously specified and the observation that their constructions purportto problems of solving geometrical constraints is missing

50

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

We investigate the geometrical constraints of the knot fold towards constructions of regu-lar polygons and proofs of the correctness of these constructions The knot fold operation isspecified by an existentially quantified formula of the first-order predicate logic The formulais then translated into a set of algebraic equalities and disequalities which then are solved byspecialized solvers based on Grobner basis theory andor CAD (Cylindrical Algebraic Decom-position) We have developed a computational origami system called Eos [5] using computeralgebra system Mathematica In brief it is an e-origami system which allows us to do virtualorigami It has capabilities of constructing and visualizing origami geometrical objects alge-braically analyzing origami folds and proving the correctness of origami constructions Eos

supports Huzitarsquos fold operations and has been extended to include multi-fold operations Weuse Eos to assist us with our mathematical study of the knot fold

The rest of the paper is organized as follows In Sect 2 we give the notations that we useIn Sect 3 we present Huzitarsquos fold operations and their extensions In Sect 4 we explain thegeometrical properties of the knot fold The construction of regular heptagon by Eos is shownin Sect 5 and its formal and algebraic proof is discussed in Sect 6 In Sect 7 we summarizeour results and point out a direction of further research

2 Notations

In this paper we restrict the use of geometrical objects to points segments and lines Pointsare denoted by a single capital letter of the Latin alphabet eg A B C D X Y etc Linesare denoted by m n t u and v Let X and Y be two points then XY denotes the line passingthrough points X and Y For brevity we often write XY to refer to the line passing through Xand Y We use the same notation to denote the segment between points X and Y Althoughthe meaning of the notation XY should be clear from the context we precede the notation XYwith either the word ldquosegmentrdquo or the word ldquolinerdquo to emphasize which objects we are working

with We also useminusminusrarrXY to denote a vector from point X to point Y The distance between two

points X and Y is denoted by |XY |Since we use Cartesian coordinate system in this paper a line is represented by a linear

equation ax+ by+ c = 0 in variables x and y The sets of all points and lines are denoted by Πand L respectively Abusing the set notation we use X isin m to mean that point X is incidentto line m and X1 Xp sub m to mean that all the points X1 Xp are incident to m

When an origami is folded along a line m some of the points are moved to superpose withtheir reflections across m We denote by Xm the reflection of point X across line m

A simple knot is denoted by K Ki denotes the ith knot The notation K = 〈mn t〉 meansthat the knot K is defined by 3 fold lines (to be explained in Sect 4)m n and t and furthermoreK is obtained by folding along the lines following the order of their appearance in 〈mn t〉

3 Origami Geometrical Construction

31 Huzitarsquos Fold Operations

By O we denote an origami An origami O is supposed to represent a square sheet of paperwith four points on the corners and four edges that is subject to folding1 We call A B Cand D the points on the corner Some intersections of lines may not fit on the square paper

1We could take O to be any convex polygon that can be constructed from a square sheet of paper Howeverthis could be an unnecessary generalization in our study

51

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

As we want to work with these points we consider O to be a sufficiently large (bounded) 2Dplane so that all the points and lines of interest are on O Huzita observed that the degreeof freedom of paper fold by fold lines can be made finite by specifying how certain points andlines are superposed Then he gave the following operations (O1) sim (O6) which serve as basicoperations in the geometrical construction of origamis Operation (O7) was added later byJustin [6] We call collectively (O1) sim (O7) Huzitarsquos fold operations

(O1) Given two distinct points P and Q fold O along the unique line that passes through Pand Q

(O2) Given two distinct points P and Q fold O along the unique line to superpose P and Q

(O3) Given two distinct lines m and n fold O along a line to superpose m and n

(O4) Given a line m and a point P fold O along the unique line passing through P to superposem onto itself

(O5) Given a line m a point P not on m and a point Q fold O along a line passing throughQ to superpose P and m

(O6) Given two lines m and n a point P not on m and a point Q not on n where m and n aredistinct or P and Q are distinct fold O along a line to superpose P and m and Q and n

(O7) Given two linesm and n and a point P not onm fold O along the unique line to superposeP and m and n onto itself

We note that the above statements are slightly different from the original ones To formalizethe above statements with the view to rigorous geometrical construction we restate Huzitarsquosoperations by carefully adding and removing side conditions of degeneracy and incidence [7]In essence treating origamis with a program requires rigorous specification of these operations

Huzitarsquos fold operations determine fold lines by specifying superpositions of constructedpoints and lines In Eos these specifications are formulas in a language of many-sorted first-order predicate logic By the algebraic interpretation of the formulas we derive polynomialequalities The problem of finding fold line(s) is therefore reduced to solving constraints ex-pressed in multi-variate polynomials of degree 3 over the field of origami constructible numbers[8 5]

32 Extensions

The contribution of Huzitarsquos fold operations is powerful enough to perform relevant geometri-cal constructions by way of solving algebraic equations of degree up to 3 Examples of suchconstructions are trisecting an arbitrary angle constructing a regular heptagon etc Somestudies have explored possible extensions of Huzitarsquos fold operations in an attempt to increasethe power of paper folding ie to solve higher degree equations

Alperin and Lang proposed multi-fold method where the origami is folded along more thanone fold line simultaneously [9] The idea is to find fold lines that are mutually dependentThe multi-fold construction allows solving higher degree equations We presented a construc-tion method of angle trisection using 2-fold operation [5] and angle quintisection using 4-foldoperation [10] Although the p-fold method generates an arbitrarily high degree polynomialaccurately folding an origami by p lines simultaneously would be difficult to do by hand evenfor p = 2

52

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

Folding polygonal knots has been traditionally used in Japan For example folding a broadsash for a kimono by a pentagon is a common practice of daily life However it is unknownwhen the knot fold was first mathematically studied The earliest contributions of which weare aware are those of Cundy and Rollett [11] Brunton [12] and Sakaguchi [13] Cundy andRollett showed models of knots that make some regular polygons Brunton elaborated themathematical study of the knot fold and showed that the number of necessary knots dependson the number of the edges of the polygon

4 Knot Fold

In order to determine the geometrical constraints of knot fold we first analyze key geometricalproperties of a knot

41 Geometrical Properties

(a) (b) (c)

Figure 1 Knot-fold of regular pentagon FEIHG

Let us examine the operation of knotting in Fig 1 We make one simple knot by tyingtogether the two ends of the origami tape in Fig 1(a) Note that we use a rectangular shapeof an origami When the height of the tape ie |AD| and |BC| is infinitesimal and both endsof the paper are connected the tape becomes a curve ie an object of study in knot theoryThe knot with 3 crossings is the most basic one in knot theory When we bring the height backto the original without distorting the tape except for folds we obtain the polygonal knot Awell fastened and well flattened knot becomes a polygonal shape as depicted in Fig 1(c) Theobtained polygonal shape exhibits a regular pentagonal form As it is inferred from the knottheory making the knot in Fig 1(c) requires 3 folds along the lines m n and t that extend theedges FE GH and IEn respectively2 The knot K = 〈mn t〉 is the one in Fig 1(c)

When the knot is entirely unfolded we obtain the tape with the creases and the generatedpoints as shown in Fig 2 We note the following geometrical properties The vertices E H andI are lined up on the edge CD whereas vertices F and G are incident to the edge AB The foldalong m passes through F and superposes point H and line AB Point E is the intersectionof m and CD Similarly the fold line n passes through G and the fold along n superposespoint E and line AB Point H is the intersection of n and CD Note that fold lines m and nare mutually defined The fold is a 2-fold operation where m and n are defined simultaneouslyLine t can be determined by applying operation (O5) of Huzitarsquos fold operation set Namely

2Recall that En is the reflection point of E across line n as defined in Sect 2

53

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

Figure 2 Unknotted tape

line t passes through I and superposes G and CD Note that the parameters of (O5) points IG and line CD are considered with respect to the configuration before the fold Refer to Fig 2The origami after the the 2-fold (ie along m and n) is shown in Fig 1(b) The purposes ofthe fold along t is first to construct the vertex I and second to fasten and lock the knot

A purely geometrical proof that the knot fold creates a regular polygon is sketched in [14]In the following we present a formal and automated algebraic proof that uses properties of theoperation of folding such as preservation of some of distances parallelism etc

42 Geometrical Constraint Solving Approach

The question now becomes how to determine the fold lines m n and t such that the knot isa regular pentagon The proof that the knot fold gives rise to regular pentagons shows thateach of the fold line makes angles 2α = 2π

5 with the edges [14] where α = ∡GEH = ∡EHF In origami geometry construction of angles using Huzitarsquos fold operations is not trivial Theproblem of constructing angles is boiled down to a sequence of fold steps which makes theconstruction tedious where the number of intermediate points and lines is prone to increaseFurthermore not all angles are constructible by Huzitarsquos fold operations The construction ofa regular 11-gon whose interior angles are equal to 9π

11 is shown to be impossible by Huzitarsquosfold operations [15] Hence we carefully choose a specification of the knot fold that couldbe extended towards the construction of regular n-gons where n ge 7 We are led to avoidconstruction of angles in order to solve the knot fold construction problem We consider theknot fold construction as a geometrical constraint solving problem without use of angles

Example Regular pentagon

Our method of constructing a regular pentagon by the knot fold uses a multi-fold togetherwith Huzitarsquos fold operations We consider the example in Fig 1 where we make a knotK = 〈mn t〉 We try to define the geometrical properties of K in a systematic way so thatwe can generalize it to the knot fold of regular n-gons where n ge 7 We observe the followinggeometrical properties on m n t E F G H and I

bull Points E and F are incident to mbull Points G and H are incident to nbull Points E H and I are incident to CDbull Points F and G are incident to ABbull The fold line m superposes H and AB ie Hm isin ABbull The fold line n superposes E and AB ie En isin ABbull The fold line t passes through I and superposes G and CD ie I isin t and Gt isin CDbull The distances |EF | |FG| and |GH| are equal

54

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

The above properties are described by the following first order logical formula φK

φK equiv existmn t isin L existEFGH I isin Π

EF sub m and GH sub n and EH I sub CD and FG sub ABand

Hm isin AB and En isin AB and I isin t andGt isin CD and |EF | = |FG| = |GH|

(1)

We used Eos to construct the regular pentagon in Fig 1 It is possible to determine t indepen-dently from m and n We consider the formula (2) that defines the 2-fold operation to solvelines m and n first

φprimeK equiv existmn isin L existEFGH isin Π

EF sub m and GH sub n and EH sub CD and FG sub ABand

Hm isin AB and En isin AB and |EF | = |FG| = |GH|

(2)

The fold line t is obtained by applying operation (O5) Namely line t passes through pointI and superposes point H and line AB

We can prove automatically that the generated shape is a regular pentagon based on Grobnerbases theory We will omit the proof of the correctness of the pentagon knot construction Inthe next sections we will discuss the construction and the proof of a regular heptagon by theknot fold in details

5 Regular Heptagon by the Knot Fold

Brunton studied the construction of regular n-gons where n ge 3 [12] He showed that the

number of necessary knots is Φ(n)2 minus 1 in order to construct a regular n-gon where Φ(n) is

Eulerrsquos totient function Hence to construct a regular heptagon we perform 2 knots K1 andK2 We explained in Sect 4 that a knot can be decomposed into 3-fold operations along threefold lines In the case of regular heptagon we need 5 fold lines m n t u and v whereK1 = 〈mn t〉 and K2 = 〈v um〉 Let EKJIHGF be the constructed regular heptagonFigure 3 exhibits the vertices of the regular heptagon after unfolding K1 and K2 The foldlines are extensions of edges of EKJIHGF as follows Lines m n and t are the extension ofsegment EF IJ and GFn respectively Lines v and u are extensions of segments KEu andHIm respectively Figure 4 shows a sketch of a regular heptagon with the lines m n t u andv

51 Geometrical Constraints

Figure 3 Unfolded regular heptagon EKJIHGF

Lines m and n of the knot K1 = 〈mn t〉 are defined by the following properties on m n tE F I J G and H

55

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

tn

mu

vE

F

G

H

I

J

K

Figure 4 Sketch of a regular heptagon EKJIHGF and lines m n t u and v

bull Points E and F are incident to mbull Points I and J are incident to nbull Points E and J are incident to CDbull Points F I G and H are incident to ABbull The fold line m superposes I and CD ie Im isin CDbull The fold line n superposes F and CD ie Fn isin CDbull The distances |EF | |IJ | |FGn| |IHm| and |GnHm| are equal3

We write formula φK1in a similar fashion to the formula (1)

φK1equiv existmn t isin L existEF I JGH isin Π

EF sub m and I J sub n and F IGH sub AB and E J sub CDand

Im isin CD and Fn isin CD andG isin t and J t isin ABand

|EF | = |IJ | = |FGn| = |IHm| = |GnHm|

(3)

Similarly to our discussion in Sect 42 line t can be constructed independently from lines mand n We therefore can separate the construction t and use φprime

K1in (4) to solve for m and n

first

φprimeK1

equiv existmn existEF I JGH isin Π

EF sub m and I J sub n and F IGH sub AB and E J sub CDand

Im isin CD and Fn isin CDand

|EF | = |IJ | = |FGn| = |IHm| = |GnHm|

(4)

Knot K2 = 〈v um〉 is defined by the following properties on v u m K X H Y Z and F bull Points K and X are on vbull Points H and Y are on ubull Points K and Y are on CDbull Points Z H F and X are on ABbull The fold line v superposes H and CD ie Hv isin CD

3Refering to Fig 3 distances |GFn| and |FGn| are equal due to the fact that reflection across line n preservesthe distances Similarly distances |HIm| and |IHm| are equal

56

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

bull The fold line u superposes X and CD ie Xu isin CDbull The fold line m passes through F and superposes Y and AB ie Y m isin ABbull The distances |KX| |HY | |XFu| |HZv| and |FuZv| are equal

φK2equiv existv um isin L existKXH Y Z F isin Π

KX sub v and HY sub u and KY sub CD and XHZ F sub ABand

Hv isin CD andXu isin CD and F isin m and Y m isin ABand

|KX| = |HY | = |XFu| = |HZv| = |FuZv|

(5)

However referring to Fig 3 points X Y and Z are equal to points Eu Im and ((((Gn)m)u)v)From formula φprime

K1 E I and G are obtained It is possible to determine the fold lines that

make K2 in an easier way than solving constraints in formula (5) as we explain in the nextsub-section

52 Construction by Eos

We first assume that the initial origami is a rectangle ABCD We work with the Cartesiancoordinate system and the coordinates of points A B C and D are (0 0) (wd 0) (wd ht)and (0 ht) respectively The width wd and the height ht can be taken arbitrary Of coursewd is sufficiently larger than ht so that the knot construction is feasible For concreteness ofour presentation using Eos we set wd = 900 and ht = 60 Furthermore let E be an arbitrarybut fixed point on segment CD Let the coordinates of E be (400 ht) for simplicity and clarityof the construction Our objective is to construct a regular heptagon EKJIHGF by the knotfold Recall that the construction requires a 2-fold operation prior to Huzitarsquos fold operations(see Sect 41) The first folding step is the crucial one ie the 2-fold operation

In Eos Huzitarsquos fold operations can be performed using function HO The extension to themulti-fold is natural as HO is implemented with the generality that allows the specification oflogical formulas describing the multi-fold Multi-fold is realized by the call of the followingMathematica function

HO [ H Constraint rarr φ ]

H is a list of points on the origami which determine the faces to be moved φ is a formula in thefirst-order predicate logic The formula φ specifies the constraints that the geometrical objectsconcerned have to satisfy In our example the geometrical constraints that specify the 2-foldoperation are expressed by formula φprime

K1in (4) We write φprime

K1in the language of Eos and call

HO as follows

HO[C A Constraint rarr existmmLineexistnnLineexistff PointexistiiPointexistjjPointexistggPointexisthhPoint

(E f sub m and i j sub n and f i g h sub AB and j isin CDand

im isin CD and fn isin CDand

SqDistance[E f ] == SqDistance[i j] == SqDistance[f gn] ==

SqDistance[i hm] == SqDistance[gn hm])]

(6)

The term SqDistance[XY ] is the square of the distance between X and Y (ie |XY |2)Notations like ldquoexistmmLinerdquo ldquoE f sub mrdquo ldquoimrdquo ldquoim isin CDrdquo are Eos extension of Mathematicasyntax

The evaluation of (6) generates 24 distinct cases of possible configurations of points F GH I and J and lines m and n We deduce that the algebraic interpretation of the constraintsas defined by φprime

K1 is a well constrained system of equations since we obtained finite number of

solutions However not all of the 24 cases are relevant to our construction problem They may

57

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

(a) Case 1 (b) Case 2

(c) Case 3 (d) Case 4

(e) Case 5 (f) Case 6

Figure 5 6 possible cases for lines m and n

correspond to degenerate cases that lead to failure of the proof by Grobner bases In order toeliminate the degenerate cases and also to get a reasonable number of cases we further narrowthe search space of the configuration of points and lines For that we add the following extraconstraints

E isin nandj isin mandSqDistance[E i] == SqDistance[j f ] == SqDistance[E h] == SqDistance[j g]

The sub-formula E isin n and j isin m eliminates the degenerate cases where E and j are equalSub-formula SqDistance[E i] == SqDistance[j f ] == SqDistance[E h] == SqDistance[j g]specifies further conditions on points E F G H I and J We evaluate the following HO call

HO[C A Constraint rarr existmmLineexistnnLineexistff PointexistiiPointexistjjPointexistggPointexisthhPoint

(E f sub m and i j sub n and f i g h sub AB and j isin CDand

im isin CD and fn isin CD and

SqDistance[E f ] == SqDistance[i j] == SqDistance[f gn] ==

SqDistance[i hm] == SqDistance[gn hm]and

E isin n and j isin m and SqDistance[E i] == SqDistance[j f ] == SqDistance[E h] == SqDistance[j g])

MarkPointAt rarr F I J G H]

(7)

Consequently we obtain 6 cases as shown in Fig 5 Two of them namely those in Fig 5(a) andin Fig 5(f) lead to the construction of a regular heptagon Eos allows the user to interactivelychoose the suitable case to proceed with the construction Keyword MarkPointAt tells the Eoshow to label the existentially quantified points f i j g and h The outcome of folding in thecase 6 is shown in Fig 6

Next we apply two operations (O1) to fold along the line FGn and IHm in Fig 6 by callingHO with suitable arguments The lines FGn and IHm are the fold lines t and u respectivelyThe results are shown in Fig 7(a) and 7(b) Finally given the origami of Fig 7(b) we constructthe remaining vertex K We apply operation (O6) to obtain v which brings H and G onto ICand HB respectively Point K is the intersection of IC and line v We obtain the heptagonEKJIHGF in Fig 7(c)

58

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

Figure 6 Step 1 Folds along lines m and n

53 Algebraic Interpretation

This algebraic interpretation is used to ldquoevaluaterdquo the function calls of HO as well as the auto-mated proof of the correctness of the construction We take HO in (7) as an example To obtaingeometrical objects m n F G H I and J the formula in (7) is transformed into a set ofalgebraic equalities Further details of the algebraic interpretation are explained in [8] and [5]

Let the coordinates of A B D and E be (0 0) (900 0) (0 60) and (400 60) respectivelyFor an atomic formula φ let [[φ]] denote the set of polynomial relations that are the algebraicmeaning of φ An atomic formula is interpreted as a set of polynomial relations (equalities orinequalities) and a term is given as a rational function The set of (non-simplified) polynomialequalities (8) ndash (14) is the algebraic interpretation of formula in (7)

400a5+ 60b6+ c7 == 0 c7+ a5x11+ b6y12 == 0 c10+ a8x13+ b9y14 == 0

c10+ a8x15+ b9y16 == 0minus900y12 == 0minus900y14 == 0

minus900y20 == 0minus900y18 == 0minus54000 + 900y16 == 0 (8)

minus54000 +900

(

minus2b6(c7+ a5x13) + a52y14minus b62y14)

a52 + b62== 0 (9)

minus54000 +900

(

minus2b9(c10+ a8x11) + a82y12minus b92y12)

a82 + b92== 0 (10)

(400minus x11)2 + (60minus y12)2 == (x13minus x15)2 + (y14minus y16)2 ==(

y12minusminus2b9(c10+ a8x17) + a82y18minus b92y18

a82 + b92

)2

+

(

x11minusminusa82x17+ b92x17minus 2a8(c10+ b9y18)

a82 + b92

)2

==

(

y14minusminus2b6(c7+ a5x19) + a52y20minus b62y20

a52 + b62

)2

+

(

x13minusminusa52x19+ b62x19minus 2a5(c7+ b6y20)

a52 + b62

)2

==

(

minus2b9(c10+ a8x17) + a82y18minus b92y18

a82 + b92minus

minus2b6(c7+ a5x19) + a52y20minus b62y20

a52 + b62

)2

+

(

minusa82x17+ b92x17minus 2a8(c10+ b9y18)

a82 + b92minus

minusa52x19+ b62x19minus 2a5(c7+ b6y20)

a52 + b62

)2

(11)

59

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

400a8+ 60b9+ c10 6= 0 c7+ a5x15+ b6y16 6= 0 (12)

(minus400 + x13)2 + (minus60 + y14)2 ==

(x11minus x15)2 + (y12minus y16)2 == (minus400 + x19)2 + (minus60 + y20)2 ==

(x15minus x17)2 + (y16minus y18)2 (13)

(minus1 + b9)b9 == 0 (minus1 + a8)(minus1 + b9) == 0 1 + a82 6= 0 (minus1 + b6)b6 == 0

(minus1 + a5)(minus1 + b6) == 0 1 + a52 6= 0 (14)

A line a x + b y + c = 0 is represented by (a b c) together with the constraint (minus1 + b)b =0 and (minus1 + a)(minus1 + b) = 0 and a2 + 1 6= 0 Lines m and n are represented by (a5 b6 c7) and(a8 b9 c10) respectively Hence we have the equalities and disequalities in (14)

The equalities in (8) are the algebraic interpretation of the sub-formula E f sub mandi j subnand f i g h sub AB and j isin CD The first equation 400a5+ 60b6+ c7 == 0 means that point Eat (400 60) is incident to m defined by the equation a5x+ b6y + c7 = 0 Similarly the rest ofthe equations in (8) are interpretations of f at (x11 y12) is on m i at (x13 y14) is on n j at(x15 y16) is on n f is on AB i is on AB h at (x19 y20) is on AB g at (x17 y18) is on ABand j is on CD respectively

The reflection of point i at (x13 y14) across line m is the point im whose coordinates are

(minusa52x13 + b62x13minus 2a5(c7 + b6y14)

a52 + b62minus2b6(c7 + a5x13) + a52y14minus b62y14

a52 + b62)

Equation (9) states that im is incident to CD represented by (0 1 -60) Similarly equation(10) is the algebraic interpretation of fn isin CD Eos transforms rational form p

q== 0 to

p == 0 Note that in (9)ndash(11) q comes from coefficient of lines and q 6= 0 is deduced from (14)The disequalities of (12) states that the coordinates of point E and j do not satisfy the

equation of lines n and m respectively Eos changes the disequalities into equalities by addingslack variables introduced by Rabinowitch trick

Now we examine the equalities (11) and (13) [[SqDistance[E f ]==SqDistance[i j]]] givesrise to the first equality in (11) namely (400minusx11)2+(60minusy12)2 == (x13minusx15)2+(y14minusy16)2where E at (400 60) f at (x11 y12) i at (x13 y14) and j at (x15 y16) The rest of theequalities in (11) and equalities in (13) are obtained in the same way

By solving the above set of polynomial equalities for the coefficients of m and n and coor-dinates of f i j g and h we obtain the 6 cases in Fig 5

6 Proof

61 Theorem to Prove

We prove the following theorem

Theorem 61 Given the origami in Fig 7(c) we have(a) |EF | = |FG| = |GH| = |HI| = |IJ | = |JK| = |KE| and(b) ∡EOF = ∡FOG = ∡GOH = ∡HOI = ∡IOJ = ∡JOK = ∡KOE = 2π

7 where O is thecenter of EKJIHGF

Let θ = ∡EOF and α = eiθ VectorminusminusrarrFG is the rotation of

minusminusrarrEF through θ around center O

To prove the theorem 61 we show that the rotations ofminusminusrarrEF through angles 2θ 3θ 4θ 5θ and

60

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

(a) (b) (c)

Figure 7 Construction of (a) the edge GF (step 2) (b) the edge IH (step 3) and (c) vertex Kand final heptagon EKJIHG (step 4)

6θ givesminusminusrarrGH

minusrarrHI

minusrarrIJ

minusminusrarrJK and

minusminusrarrKE respectively and furthermore that θ = 2π

7 We show thatafter the construction the following holds

forallα isin C (αminusminusrarrEF minus

minusminusrarrFG = 0 rArr

α2minusminusrarrEF minusminusminusrarrGH = 0 and α3minusminusrarrEF minus

minusrarrHI = 0 and α4minusminusrarrEF minus

minusrarrIJ = 0and

α5minusminusrarrEF minusminusminusrarrJK = 0 and α6minusminusrarrEF minus

minusminusrarrKE = 0 and α7 minus 1 = 0)

(15)

Let P be the geometrical constraints accumulated during the construction Let C equiv forallα isinC (C1 rArr C2 and C3 and C4 and C5 and C6 and C7) be the formula (15) P and C form the premise andconclusion of the proposition (16) that we want to prove

P rArr forallα isin C (C1 rArr C2 and C3 and C4 and C5 and C6 and C7) (16)

Formula (16) is semantically equivalent to the conjunctions of the formulas (17)ndash(22)

P rArr forallα isin C (C1 rArr C2) (17)

P rArr forallα isin C (C1 rArr C3) (18)

P rArr forallα isin C (C1 rArr C4) (19)

P rArr forallα isin C (C1 rArr C5) (20)

P rArr forallα isin C (C1 rArr C6) (21)

P rArr forallα isin C (C1 rArr C7) (22)

62 Proof by Eos

We show how the validity of (17) is proved and the rest is achieved in a similar way We addthe conclusion forallα isin C C1 rArr C2 by calling Eos function Goal as follows

Goal[forallααisinComplexes(VectorToComplex[αminusminusrarrEF minus

minusminusrarrFG]==0 rArr

(VectorToComplex[α2minusminusrarrEF minusminusminusrarrGH]==0))]

(23)

Expressions C1 equiv αminusminusrarrEF minus

minusminusrarrFG = 0 and C2 equiv α2minusminusrarrEF minus

minusminusrarrGH = 0 written in the language of

Eos are VectorToComplex[αminusminusrarrEF minus

minusminusrarrFG] and VectorToComplex[α2minusminusrarrEF minus

minusminusrarrGH]==0 respectively

61

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

Function Goal adds the negation of the conclusion to the premise By calling Goal we obtainP and not(forallα isin C (C1 rArr C2)) In order to translate P and not(forallα isin C (C1 rArr C2)) into algebraic formwe fix the coordinate system to be Cartesian with points A B C D and E as follows

map = DefMapping[A Point[0-wd]B Point[wd0]

C Point[wd ht] D Point[0 ht] E Point[0 ht] ]amp(24)

Without loss of generality we set the size of the initial origami to be 2wdtimesht where the widthwd is taken to be arbitrary and the height ht is equal to 1 The point E is fixed at location(0 ht) Finally we check whether the reduced Grobner basis of the algebraic interpretation ofP and not(forallα isin C (C1 rArr C2)) is 1 by calling function Prove

Prove[ldquoKnot Heptagonrdquo Mapping rarr map GroebnerBasis rarr

CoefficientDomain rarr RationalFunctions

MonomialOrder rarr DegreeReverseLexicographic]

(25)

The above call of function Prove tells Eos to compute Grobner basis of the polynomial set[[P and not(forallα isin C (C1 rArr C2))]] Let V be the set of variables in [[P and not(forallα isin C (C1 rArr C2))]] TheGrobner basis computation is carried out in the domain of polynomials whose variables are inV wd and whose coefficients are in functions of Q(wd) Eos computes Grobner basis andgenerates a proof document (whose title is given by the first argument of the call of Prove) [16]

63 Proof Results

The proofs of (17)ndash(22) are successful The CPU time used for Grobner basis computation onMac OS X (Intel Core i7 8G 24GHz) machine varies from 69236984 seconds (for proving (17))to 1994889588 seconds (for proving (20))

7 Conclusion

We presented the construction of a regular heptagon using the knot fold Our method consistsin applying 2-fold operation coupled with Huzitarsquos fold operations The fold lines that makethe knot fold are determined by solving geometrical constraints We further showed the proofof the correctness of the construction of a regular heptagon based on Grobner bases

Note that using Huzitarsquos fold operations (O1) sim (O7) a regular heptagon is constructibleWith Eos we need 9 Huzitarsquos fold operations and more than 10 auxiliary operations such asunfolding and marking supporting points Further investigation of the geometrical constraintsby the knot fold is required to construct regular 11-gon which is impossible by Huzitarsquos foldoperations

Another issue that should be investigated in the future research is the rigidity of the knotfold We need to define the notion of rigidity in mathematical terms in this knot fold as wellas in more general origami that may involve 3D constructions

71 Acknowledgments

We thank Stephen Watt of Western Ontario University for drawing our attention to the knotfold This work is supported by JSPS KAKENHI Grant No 25330007 The first author of thispaper is supported by a postdoctoral fellowship at Kwansei Gakuin University

62

Knot Fold of a Regular Heptagon F Ghourabi T Ida and K Takahashi

References

[1] D S Kasir The Algebra of Omar Khayyam (English translation of Khayyamrsquos original workAl-Jabr Wrsquoal Muqabalah) Teachers College Press 1931

[2] P L Wantzel Recherches sur les moyens de connaıtre si un probleme de geometrie peut se resoudreavec la regle et le compas Journal de Mathematiques Pures et Appliquees pages 366ndash372 1837

[3] H Huzita Axiomatic Development of Origami Geometry In Proceedings of the First InternationalMeeting of Origami Science and Technology pages 143ndash158 1989

[4] R C Alperin A Mathematical Theory of Origami Constructions and Numbers New York Journalof Mathematics 6119ndash133 2000

[5] T Ida A Kasem F Ghourabi and H Takahashi Morleyrsquos Theorem Revisited Origami Con-struction and Automated Proof Journal of Symbolic Computation 46(5)571 ndash 583 2011

[6] J Justin Resolution par le pliage de lrsquoequation du troisieme degre et applications geometriques InProceedings of the First International Meeting of Origami Science and Technology pages 251ndash2611989

[7] F Ghourabi A Kasem and C Kaliszyk Algebraic Analysis of Huzitarsquos Origami Operations andtheir Extensions In Automated Deduction in Geometry LNAILNCS Springer 2013 (to appear)

[8] F Ghourabi T Ida H Takahashi M Marin and A Kasem Logical and Algebraic View ofHuzitarsquos Origami Axioms with Applications to Computational Origami In Proceedings of the22nd ACM Symposium on Applied Computing (SACrsquo07) pages 767ndash772 Seoul Korea 2007

[9] R C Alperin and R J Lang One- Two and Multi-fold Origami Axioms In Origami4 Pro-ceedings of the Fourth International Meeting of Origami Science Mathematics and Education(4OSME) pages 371ndash393 2009

[10] F Ghourabi T Ida and H Takahashi Computational Origami of Angle Quintisection InProceedings of the Workshop in Symbolic Computation in Software Science (SCSS2008) RISCTechnical Report Series 08-08 pages 57ndash68 2008

[11] H M Cundy and A P Rollett Mathematical Models Oxford University Press 1961

[12] J K Brunton Polygonal Knots The Mathematical Gazette 45(354)299ndash301 1961

[13] K Sakaguchi On Polygons Made by Knotting Slips of Paper Technical Report of ResearchInstitute of Education Nara University of Education 1855ndash58 1982

[14] J Maekawa Introduction of the study of knot tape In Origami5 Proceedings of the FourthInternational Meeting of Origami Science Mathematics and Education (5OSME) pages 395ndash403 2011

[15] D A Cox Galois Theory Wiley-Interscience 2004

[16] F Ghourabi T Ida and A Kasem Proof Documents for Automated Origami Theorem ProvingIn Automated Deduction in Geometry volume 6877 of LNCS pages 78ndash97 Springer 2011

63

Automated Verification of Equivalence on

Quantum Cryptographic Protocols

Takahiro Kubota1 Yoshihiko Kakutani1 Go Kato2

Yasuhito Kawano2 and Hideki Sakurada2

1 The University of Tokyo Tokyo Japantakahirok11 30kakutaniissu-tokyoacjp

2 NTT Communication Science Laboratories Kanagawa Japankatogokawanoyasuhitosakuradahidekilabnttcojp

Abstract

It is recognized that security verification of cryptographic protocols tends to be difficultand in fact some flaws on protocol designs or security proofs were found after they had beenpresented The use of formal methods is a way to deal with such complexity Especiallyprocess calculi are suitable to describe parallel systems Bisimilarity which denotes thattwo processes behave indistinguishably from the outside is a key notion in process calculiHowever by-hand verification of bisimilarity is often tedious when the processes have manylong branches in their transitions We developed a software tool to automatically verifybisimulation relation in a quantum process calculus qCCS and applied it to Shor andPreskillrsquos security proof of BB84 The tool succeeds to verify the equivalence of BB84 andan EDP-based protocol which are discussed in their proof

1 Introduction

Security proofs of cryptographic protocols tend to be complex and difficult to verify Thisfact has been recognized in the classical cryptography and there is a line of researches to dealwith the complexity of verification [1 2] Since by-hand proofs are prone to human error andtime consumption efforts have been put into automating security proofs and verification in theclassical cryptography Security proofs are also complex in the quantum cryptography where wemust also consider attacks using entanglements The first security proof of BB84 quantum keydistribution (QKD) protocol by Mayers [3] is about 50 pages long After that paper researchershave been seeking simpler proofs [4 5] Since QKD is one of the closest application to practicein the quantum information field it is important to examine QKD systemsrsquo security formallyand make it machine-checkable

There are several formal frameworks for quantum protocols Feng et al developed a processcalculus qCCS [6] In this calculus a protocol is formalized as a configuration A configurationis a pair of a process and a quantum state corresponding to quantum variables Weak openbisimulation relation on qCCS configurations is defined Weakly open bisimilar configurationshave the same transitions up to internal ones and reveal the identical quantum states to theoutsider (adversary) in each step The relation is proven to be closed by parallel composition ofprocesses A use case of a process calculus for formal verification is to prove weak bisimilarityof implementation and specification described as configurations qCCS has been applied toquantum teleportation superdense coding and BB84 protocols

To extend application of formal methods to security proofs we applied qCCS to Shor andPreskillrsquos security proof of BB84 [4] in the previous paper [7] In Shor and Preskillrsquos securityproof security of BB84 is proven to be equivalent to that of another protocol based on anentanglement distillation protocol (EDP) and then the latter is proven to be secure We

64

Automated Verification of Equivalence on Quantum Cryptographic Protocols Kubota et al

formalized BB84 and the EDP-based protocol as configurations and proved their bisimilarityby hand However by-hand verification of bisimilarity is often tedious when configurationshave many long branches in their transitions In this paper we present a software tool to verifybisimilarity of given two qCCS configurations There are two main contributions of our work

First we implemented a software tool that formally verifies bisimilarity of qCCS configu-rations without recursive structures A protocol possibly takes security parameters for variouspurposes As for BB84 it takes two parameters one determines the length of qubits whichAlice sends to Bob in the first quantum communication and the other is for tolerated error-ratein the eavesdropping detection step Such parameters are passed to the verifier as symbols andare interpreted appropriately In our verifierrsquos framework quantum states and operations aredescribed as symbols Since attacks from the adversary are also treated as symbols our verifiercan deal with unspecified attacks To examine the behavioural equivalence adversaryrsquos viewsdenoted by partial traces must be checked to be equal in each step of a protocol The verifierautomatically checks the equality using user-defined equations

Second we applied our verifier to Shor and Preskillrsquos security proof of BB84 [4] The verifiertakes as input two configurations denoting BB84 and the EDP-based protocol and equationsabout the properties of error-correcting codes and measurement of the halves of EPR pairsThe verifier succeeds to verify the bisimilarity of the configurations of the two protocols

The package of the verifier is available from httphagiissu-tokyoacjp~tkqccs

verifiertargz It includes a user manual and and example scripts in the folders doc andscriptsRelated Work The authors of qCCS presented the notion of symbolic bisimulation for quan-tum processes [8] A purpose is to verify bisimilarity algorithmically They proved the strong(internal actions should be simulated) symbolic bisimilarity is equivalent to the strong openbisimilarity and actually presented an algorithm to verify symbolic ground (outsiders do notperform quantum operations adaptively) bisimilarity Since our purpose is to apply a pro-cess calculus to security proofs where adversarial interference must be taken into account weimplemented a tool that verifies weak open bisimilarity on the basis of the original qCCS [6]

2 The Verifier

Formal Framework The verifier employs a sublanguage of qCCS where the syntax of recur-sion and the use of classical data are restricted The framework is still expressive because ourtarget protocols do not need recursion and classical probability distributions can be representedas quantum states denoted by diagonal operators The syntax of the processes in the verifier isas follows

P = discard(q) | cqP | cqP | meas b then P saem | op[q]P | P ||P | PL

Intuitively discard(q)means termination of a process keeping a sequence of quantum variablesq secret cqP sends a quantum variable q to a channel c and then executes P cqP receivesquantum data to a variable q from a channel c and then executes P meas b then P saem

measures a quantum bit b and executes P if the outcome is 0 or terminates if the outcome is1 op[q]P performs a superoperator op to quantum variables q and then executes P P ||P prime

executes P and P prime in parallel PL where L is a set of channels executes P keeping channelsin L private Let qv(P ) be the set of quantum variables that occur in a process P cqP meas b then P saem op[q]P and P ||P prime are defined only if q isin qv(P ) b isin qv(P ) q sub qv(P )and qv(P ) cap qv(P prime) = empty respectively In our verifier each quantum variable is defined with its

65

Automated Verification of Equivalence on Quantum Cryptographic Protocols Kubota et al

qubit-length that is indicated by a natural number symbol declared beforehand The adoptionof natural number symbols is important to treat security parameters in the verifier Quantumstates are represented as character strings called environments The syntax of the environmentsis given as follows

ρ = X[q] | op[q](ρ) | ρ ρ | proji[b](ρ) | Tr[q](ρ)

Let qv(ρ) be the set of quantum variables that occur in an environment ρ X[q] meansthat quantum variables q are in a quantum state X op[q](ρ) is a quantum state after theapplication of operation op to quantum variables q in an environment ρ ρ ρprime represents thetensor product of ρ and ρprime but ρ ρprime and ρprime ρ are identified in the verifier ρ ρprime is definedonly if qv(ρ) cap qv(ρprime) = empty proji[b](ρ) means the reduced density operator |i〉〈i|bρ|i〉〈i|b withi isin 0 1 Tr[q](ρ) means the partial trace of ρ by q We call a pair 〈P ρ〉 of a process Pand an environment ρ a configuration only if qv(P ) sub qv(ρ) because quantum states of qubitsoccurring in P must be defined in ρ For example an agent that sends the halves of n EPR pairsto the outside is formalized as a configuration 〈cqdiscard(r) EPR[qr]ANY[s]〉 where thequantum variables q r are of the qubit length n and the quantum variable s is defined with anarbitrary qubit-length EPR[qr] is interpreted to (|00〉〈00|+ |00〉〈11|+ |11〉〈00|+ |11〉〈11|)otimesn

qr

and ANY[s] is arbitrarily for adversaryrsquos density operatorsA labelled transition system based on the original one [6] is implemented in the verifier

Transitions are interpreted as interactions between configurations and the adversary For exam-

ple the configuration above performs a transition 〈cqdiscard(r) EPR[qr]ANY[s]〉cqminusminusrarr

〈discard(r) EPR[qr]ANY[s]〉 where the adversary can recognize that the quantum vari-able q is sent through the channel c Transitions caused by internal actions such as quantumoperations internal communications and conditional branches are labelled τ The label τ intu-itively means that the action is invisible from the outside The transition rules of conditionalbranch are 〈meas b then P saem ρ〉

τminusrarr 〈P proj0[b](ρ)〉 and 〈meas b then P saem ρ〉

τminusrarr

〈discard(qv(P )) proj1[b](ρ)〉 These may decrease the trace of the density operator de-noting a quantum state Since the trace indicates the probability to reach to a configurationwe can restore the probability from configurations to conditional branches We identify thebranches that are evoked by an identical quantum variable Eventually probability is absorbedin quantum states and excluded from the transition system

The transition system of the original qCCS is probabilistic which is caused by the mea-surement construction M [qx] in the syntax [6] It measures an observable M of a quantumvariable q and stores the result in a classical variable x There are two ways to formalize quan-tum measurement since one can be also formalized as a superoperator Because only M [qx]evokes a probabilistic branch processes with different formalization of measurement are notbisimilar in general We proposed a criteria how to select the way in our previous work [7] weshould use M [qx] if a process behaves differently according to the measurement For examplethe case where a process performs different labeled transitions is typical Otherwise we shouldformalize measurement by a superoperator In our verifierrsquos framework M [qx] cannot be writ-ten independently Instead the syntax meas b then P saem is the composition of M [qx] andthe conditional branch in the original qCCS This restriction and the conditions on quantumvariables prevent the situation where two configurations with the different ways of formalizationof measurement are not bisimilarProcedure to Check Bisimulation Weak bisimulation relation [6] is defined on qCCS con-figurations Roughly speaking weakly bisimilar configurations (1) perform identical labelledtransitions up to τ transitions and (2) reveal identical density operators whatever operations theadversary performs to her quantum variables The adversaryrsquos view is denoted by the partial

66

Automated Verification of Equivalence on Quantum Cryptographic Protocols Kubota et al

trace Tr[q](ρ) when the global quantum state is ρ and q are the quantum variables that arenot revealed to the adversary The verifier takes as input two configurations and user-definedequations on environments and returns true or false It is designed to be sound with respectto the original qCCS that is two configurations are bisimilar if the verifier returns true withthem and some valid equations This is because

Reqs = (CD) |The verifier returns true given CD and eqs

is a bisimulation relation for all valid equations eqs Precisely Reqs is converted accordinglybecause meas b then P saem is decomposed to M [bx] and a conditional branch which performsa two-step transition in the branch with x = 0 The recursive procedure to verify bisimilarityis as follows Since the transitions of the processes written in our sublanguage are finite theprocedure always terminates

1 The procedure takes as input two configurations 〈P0 ρ0〉 〈Q0 σ0〉 and user-defined equa-tions on environments

2 If P0 and Q0 can perform any τ -transitions of superoperator applications they are allperformed at this point Let 〈P ρ〉 and 〈Q σ〉 be the obtained configurations

3 Whether qv(P ) = qv(Q) is checked If it does not hold the procedure returns false

4 Whether Tr[qv(P )](ρ) = Tr[qv(Q)](σ) is checked with user-defined equations Theprocedure to check the equality of quantum states are described in the next subsectionIf it does not hold the procedure returns false

5 A new superoperator symbol E[qv(ρ)minus qv(P )] that stands for an adversarial operationis generated

6 For each 〈P prime ρprime〉 such that 〈P E[qv(ρ) minus qv(P )](ρ)〉αminusrarr 〈P prime ρprime〉 the procedure checks

whether there exists 〈Qprime σprime〉 such that 〈Q E[qv(σ) minus qv(Q)](σ)〉τlowastminusrarr

αminusrarr

τlowastminusrarr 〈Qprime σprime〉 and

the procedure returns true with the input 〈P prime ρprime〉 and 〈Qprime σprime〉 If there exists it goes tothe next step 7 Otherwise it returns false

7 For each 〈Qprime σprime〉 such that 〈Q E[qv(σ) minus qv(Q)](σ)〉αminusrarr 〈Qprime σprime〉 the procedure checks

whether there exists 〈P prime ρprime〉 such that 〈P E[qv(ρ) minus qv(P )](ρ)〉τlowastminusrarr

αminusrarr

τlowastminusrarr 〈P prime ρprime〉 and

the procedure returns true with the input 〈Qprime σprime〉 and 〈P prime ρprime〉 If there exists it returnstrue Otherwise it returns false

The step 2 prominently reduces the search space Indeed 〈op1[q]P ||op

2[r]Q ρ〉 and

〈P ||QF rop2

(E qop1

(ρ))〉 are bisimilar and F rop2

(E qop1

(ρ)) = E qop1

(F rop2

(ρ)) holds because q cap r = emptyholds Therefore superoperators that can originally cause τ transitions are disposedEquality Test of Quantum States To test the equality of given two environments the verifierchecks whether they are transformed to the same form There are two kinds of transformationstrace out and application of user-defined rules

Partial trace is significant to test the equality of quantum states For example two differentquantum states op1[q](X[q]Y[r]Z[s]) and op2[r](U[q]V[r]Z[s]) have the same par-tial trace Z[s] under Tr[qr] for arbitrary interpretation of the superoperators op1 op2 andthe quantum states X Y Z U V The verifier eliminates symbols of superoperators and quantumstates according to the partial trace rules below

Tr[q](E[r](ρ)) = Tr[q](ρ) if r sub q (1) Tr[q](ρ) = Tr[r](Tr[s](ρ)) if q = r cup s (2)

Tr[q](E[r](ρ)) = E[r](Tr[q](ρ)) if q cap r = empty (3) Tr[q](ρ lowast ρq lowast σ) = ρ lowast σ (4)

67

Automated Verification of Equivalence on Quantum Cryptographic Protocols Kubota et al

If r sub q holds Tr[q](E[r](ρ)) is rewritten to Tr[q](ρ) eliminating E[r] by the rule (1)otherwise by the rules (2) and (3) the trace-out symbol with quantum variables that are disjointto targets of superoperator goes inside of itrsquos application After eliminating superoperatorsquantum states are traced out by the rule (4)

If an objective quantum state has a part that matches to the left-hand side of a user-defined equation the part is rewritten to the right-hand side To apply a user-definedequation the verifier automatically solves commutativity of superoperators or partial tracesthat are applied to disjoint sets of quantum variables For example if the objectivequantum state is Tr[q](hadamard[s] (EPR[qr]X[s])) and a user defines an equationTr[q](EPR[qr])=Tr[q](PROB [qr]) (E1) the application goes as follows

Tr[q](hadamard[s](EPR[qr]X[s])) = hadamards[s](Tr[q](EPR[qr]X[s])) (by 5)

= hadamard[s](Tr[q](PROB[qr]X[s])) (by E1)

Since the trace-out rules may have become applicable after applications of user-defined rulesthe trace-out procedure is applied again In each opportunity to test the equality of quantumstates each user-defined equation is applied only once This guarantees whatever rules a userdefines the equality test terminates

3 Application to Shor and Preskillrsquos Security Proof

The two protocols BB84 and the EDP-based protocol [4] are formalized as qCCS configurationson the basis of our previous work [7] Readers can find the script scriptsshor-preskillscrin the package The interpretations of the symbols of the quantum states and the superoperatorsthat are used in the formalization are also included as docshor-preskill symbolspdfOn Channels As in general QKD protocols three kinds of channels are used public quantumchannels private classical channels and public no-interpolate classical channels Since thesyntax has channel restriction PL formalization of private channels is straightforward Publicno-interpolate classical channels are realized by copying the data If a quantum variable q wherea classical value is assigned is sent through a public no-interpolate channel c this is formalizedas copy[qQ]cqdQ c where Q is a new quantum variable a superoperatorcopy copies the value of q to Q and d is a new non-restricted channel q will securely sentthrough the restricted channel c and an adversary obtains the same value accessing Q througha public channel d Note that the value of q can be copied because it is classicalEquations for the Proof We defined 10 equations in the verifier Equations are interpretedto those on density operators and proven correct For example the equation below tells theverifier that the halves of EPR pairs are indistinguishable from the uniform distribution Thisis used to check that the adversaryrsquos views are identical in the EDP-based protocol and BB84before Alice in the EDP-based protocol measures her halves of the check qubits

equation E7

Tr[q1_A](EPR[q1_Aq2_A]) = Tr[q1_A](PROB[q1_Aq2_A])

end

The user-defined rule above is interpreted to an equation trq1 A(|00〉〈00|+ |00〉〈11|+ |11〉〈00|+

|11〉〈11|)otimesnq1 Aq2 A = trq1 A(|00〉〈00|+ |11〉〈11|)otimesn

q1 Aq2 A The other rules are related to CSS codespartial traces and measurement of quantum states We obtained them by formalizing theequality of quantum states that are discussed in the original proof [4]

It is actually natural to express quantum states as symbols with some equations in inputs Incryptographic protocols the dimension of quantum states and superoperators cannot be fixed

68

Automated Verification of Equivalence on Quantum Cryptographic Protocols Kubota et al

as a certain number as they depend on security parameters In addition qubits going throughpublic channels are potentially interpolated by the adversary Since arbitrary computationby the adversary must be considered it should be described as an unspecified superoperatorTherefore quantum states are difficult to be expressed as concrete matrices which can benumerically analyzed Although quantum states are treated symbolically automatic calculationof partial traces is still possible focusing on occurrence of quantum variables in environmentsExperiment Result We ran the verifier with the input of shor-preskillscr We used anote PC with Intel Core i5 CPU M 460 253GHz and 1GB memory The transition tree ofthe EDP-based protocol has 621 nodes and 165 paths and that of BB84 has 588 nodes and 165paths The verifier checked the bisimilarity of the two protocols in 1598 seconds The recursiveprocedure was called 951 times

4 Conclusions

We presented a software tool to check bisimulation of qCCS configurations and applied it to asecurity proof of BB84 [4] In security proofs equivalence on protocols is often discussed Itcan be described as bisimulation relation but it is nearly impossible to check by hand if statetransitions of processes have many long branches In addition the equality of an adversaryrsquosview between two protocols has to be checked in each step An adversaryrsquos view is calculatedfrom a global quantum states which is possibly denoted by a huge matrix The verifier doesexhausting parts of proofs of behavioral equivalence namely it checks the correspondence ofall state transitions up to invisible ones and an adversaryrsquos view up to equations On the otherhand a user only have to examine the correctness of formalization of protocols and validityof equations that he defines It could be difficult to find all appropriate equations for a proofimmediately The verifier is also able to show environments andor processes when the checkprocedure returns false With the information a user can modify equations to inputFuture WorkWe plan to define probabilistic bisimilarity which denotes that configurations be-have indistinguishably up to some probability This will be helpful to prove ldquoindistinguishabilityup to negligible probabilityrdquo of protocols It is quite common argument in the cryptography

References

[1] S Halevi A plausible approach to computer-aided cryptographic proofs Cryptology ePrint ArchiveReport 2005181 2005

[2] B Blanchet A D Jaggard A Scedrov and J-K Tsay Computationally sound mechanized proofsfor basic and public-key kerberos In Proceedings of the 2008 ACM symposium on Informationcomputer and communications security pages 87ndash99 2008

[3] D Mayers Unconditional security in quantum cryptography J ACM 48351ndash406 May 2001

[4] P W Shor and J Preskill Simple proof of security of the bb84 quantum key distribution protocolPhys Rev Lett 85(2)441ndash444 Jul 2000

[5] H-K Lo and H F Chau Unconditional security of quantum key distribution over arbitrarily longdistances Phys Rev Lett 283(5410)2050ndash2056 Mar 1999

[6] Y Deng and Y Feng Open bisimulation for quantum processes In Theoretical Computer Sciencevolume 7604 of LNCS pages 119ndash133 2012

[7] T Kubota Y Kakutani G Kato Y Kawano and H Sakurada Application of a process calculusto security proofs of quantum protocols In Proceedings of WORLDCOMPFCS2012 Jul 2012

[8] Y Feng Y Deng and M Ying Symbolic bisimulation for quantum processes arXiv preprintarXiv12023484 2012

69

A Modified Parallel F4 Algorithm for Shared

and Distributed Memory Architectures

Severin Neumann

Fakultat fur Mathematik und InformatikUniversitat Passau D-94030 Passau Germany

neumansfimuni-passaude

Abstract

In applications of symbolic computation an often required but complex procedure is findingGrobner bases for polynomial ideals Hence it is obvious to realize parallel algorithms tocompute them There are already flavours of the F4 algorithm like [4] and [13] using thespecial structure of the occurring matrices to speed up the reductions on parallel architec-tures with shared memory In this paper we start from these and present modificationsallowing efficient computations of Grobner bases on systems with distributed memory Toachieve this we concentrate on the following objectives decreasing the memory consump-tion and avoiding communication overhead We remove not required steps of the reductionsplit the columns of the matrix in blocks for distribution and review the effectiveness of theSIMPLIFY function Finally we evaluate benchmarks with up to 256 distributed threads ofan implementation being available at httpsgithubcomsvrnmparallelGBC

1 Introduction

Parallelization is one of the most used methods to improve the performance of existing softwareBut it should be introduced systematically One chooses the most time-consuming segments ofa program and tries to improve these first In applications of symbolic computation an oftenrequired but complex procedure is finding Grobner bases for polynomial ideals Therefore itis obvious to realize parallel versions of algorithms to compute them Although it is possibleto use Buchbergerrsquos algorithm [14] we favour Faugerersquos algorithm F4 [3] since the reduction isdone due to matrix transformation which is known for being well parallelizable

There are already parallel flavours of F4 like [4] and [13] using the special structure ofthe occurring matrices to speed up the reduction Both approaches have been developed formulticore and multiprocessor systems with shared memory For these systems the number ofparallel processing units is limited and currently there are not many platforms serving morethan 64 processors Compared with that clusters of several suchlike computers can have antheoretical unlimited number of processors This advantage comes with the downside of dis-tributed memory realizing algorithms requires to consider that data has to be transfered Bythat memory duplication and communication overhead are introduced

In the following we start from the mentioned developments for shared memory systemsand present modifications which will finally allow efficient computation of Grobner bases alsofor systems with distributed memory To achieve this we have concentrated on the followingobjectives reducing the memory consumption and avoiding communication overhead Weremove needless steps of the reduction split the columns of the matrix in blocks for distributionand review the effectiveness of the SIMPLIFY function

At the end we will evaluate benchmarks of an implementation using eight distributed nodeshaving 32 processor cores each The source code is available at httpsgithubcomsvrnmparallelGBC

70

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

2 Notations

In the following we will use the notation of [11] Hence K denotes a field and K[x1 xn] thepolynomial ring over K in n indeterminantes Tn is defined as the set of all terms xα1

1 middot middotxαnn

σ is a term ordering on this set For a polynomial f isin K[x1 xn] with f =summ

i=1 ci middot tiwhere ci isin K and ti isin T

n for all i we call the set Supp(f) = t1 tm support of f Thenthe leading term of f is defined as LTσ(f) = tk = maxσ(Supp(f)) and the leading coefficientis LCσ(f) = ck

Let F = f1 fs isin K[x1 xn] 0 be a set of polynomials Then I = 〈F〉 is theideal generated by F The elements of the set B = (i j) | 1 le i lt j lt s are called criticalpairs For each critical pair exists an S-polynomial Sij = 1

LCσ(fi)middot tij middot fi minus

1LCσ(fj)

middot tji middot fj

with tij =lcm(LTσ(fi)LTσ(fj))

LTσ(fi)and tji =

lcm(LTσ(fj)LTσ(fi))LTσ(fj)

The set F is a σ-Grobner basis of I if for all critical pairs the S-polynomials can be reducedto zero by the elements of F with respect to σ

If not stated otherwise we will use the degree reverse lexicographic termordering (DegRevLex)and the finite field with 32003 elements (F32003) for examples and benchmarks

3 Preliminaries

The F4 algorithm was introduced by Faugere in 1999 [3] By using the special structure ofthe matrix and column-based parallelism Faugere and Lachartre introduced a parallelizationimproving the performance remarkable [4] We have presented another modification [13] for F4speeding up the computation by row-based parallelization

In the following we give a quick summary about Grobner bases computation and the men-tioned developments For a given set of polynomials F = f1 fs isin K[x1 xn] 0generating an ideal I = 〈F〉 a σ-Grobner basis G = g1 gt isin K[x1 xn] can be com-puted using the F4 algorithm by the following four steps

1 Create and update the set of critical pairs B using Gebauerrsquos and Mollerrsquos UPDATE func-tion [6] This function guarantees that the leading terms tij middot fi = tji middot fj of the minuendand subtrahend of the S-polynomial is unique among the critical pairs

2 Select a subset of all critical pairs for reduction using the normal or the sugar cubestrategy [7] At this point the details are not relevant For our benchmarks we chose thesugar cube strategy Although we have to mention that our implementation supports thenormal strategy and for some of the polynomial systems we used as example this strategymight perform better

3 Symbolic preprocess the selected pairs to obtain a coefficient matrix representing theS-polynomials The matrix is additionally filled with rows representing reduction polyno-mials for each term which can be reduced using elements of the partial computed Grobnerbasis G The SIMPLIFY method can be applied to reuse results of previous reductions

4 Reduce the generated matrix until row-echelon form This is equivalent to top-reducingthe S-polynomials All non-zero rows of this matrix having leading terms which are notdivisible by any element of G are inserted into G As long as new elements are found thealgorithm continues with step 1

The most time-consuming step is the reduction of the coefficient matrix The mentioned par-allelizations of Lachartre and Faugere as well as our own approach concentrate on speeding

71

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

up this step We want to show how to use these improvements also for distributed parallelarchitectures therefore we have to review them

Starting after symbolic preprocessing we obtain a coefficient matrix M which has to bereduced to a row-echelon form M has n rows and m columns with m ge n and can bedecomposed in submatrices

1 Submatrices S1 and S2 arise from the subtrahends and minuends of the S-polynomialsSince the UPDATE function guarantees that all polynomials have distinct leading terms therepresenting rows have unique pivot columns Therefore S1 and S2 are upper-triangular

2 Submatrix R represents the reduction polynomials They were computed during symbolicpreprocessing For each reducible term there is only one reduction polynomial Becauseof that R is upper-triangular

3 Finally these submatrices can be split up in pivot and non-pivot columns The pivots of Rand S1 are forming the submatrix A and the non-pivots the submatrix B The submatrixS2 is split into C containing its pivots and D containing the non-pivot columns Thisnotation was introduced in [4]

The following example demonstrates the construction of a matrix occurring during Grobnerbases computations

Example 1 Let K = K32003 P = K[x1 x2 x3] and let the polynomials g1 = x21 + x2

2g2 = x1 middot x2 + x2

2 + x2 middot x3 and g3 = x22 + x2

3 + x3 form the ideal I = 〈g1 g2 g3〉 for which aGrobner basis with respect to DegRevLex should be computed Using UPDATE we get the criticalpairs (2 3) and (1 2) They have the same sugar degree sugar(g2 g3) = 3 = sugar(g1 g2) Sowe reduce the following polynomials

f12 =(x21 + x2

2) middot x2 = x21 middot x2 + x3

2

f21 =(x1 middot x2 + x22 + x2 middot x3) middot x1 = x2

1 middot x2 + x1 middot x22 + x1 middot x2 middot x3

f23 =(x1 middot x2 + x22 + x2 middot x3) middot x2 = x1 middot x

22 + x3

2 + x22 middot x3

f32 =(x22 + x2

3 + x3) middot x1 = x1 middot x22 + x1 middot x

23 + x1 middot x3

and as set of reduction polynomials we obtain

r1 =g3 middot x2 = x32 + x2 middot x

23 + x2 middot x3

r2 =g2 middot x3 = x1 middot x2 middot x3 + x22 middot x3 + x2 middot x

23

r3 =g3 middot x3 = x22 middot x3 + x3

3 + x23

At the end we get the following matrix M

f12f23r1r2r3f21f32

1 0 1 0 0 0 0 0 0 0 00 1 1 0 1 0 0 0 0 0 00 0 1 0 0 0 1 0 0 1 00 0 0 1 1 0 1 0 0 0 00 0 0 0 1 0 0 1 0 0 11 1 0 1 0 0 0 0 0 0 00 1 0 0 0 1 0 0 1 0 0

One can easily see the mentioned structure of the matrix The upper left submatrix is A andits pivots are highlighted Below is C and the non-pivot columns are forming B and D

72

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

Using this decomposition the (full) reduction of the matrix can be computed using thefollowing algorithm

1 Primary reduction Reduce B to Aminus1 middotB

2 Secondary reduction Reduce D to D minus C middotAminus1 middotB

3 Final reduction Reduce D to its reduced row-echelon form using Gaussian elimination

4 Optional reduction Reduce B using the pivots of D

Especially the primary reduction can be efficiently parallelized since the matrix is in uppertriangular form and so all pivots are known The primary and secondary reduction can becomputed in parallel because a reduced row of B can be applied independently on rows of D

After the final reduction all non-zero rows of D are elements of the Grobner basis andcan be used to compute further critical pairs Matrix (AB) does not contain any requiredelements because by construction the pivots of A are equivalent to leading terms which arealready contained in the Grobner basis Hence the fourth step is optional and only required ifSIMPLIFY is used

There are two different approaches to achieve parallelization Column-based as suggestedby Faugere and Lachatre and row-based as suggested by us Actually these two are not mu-tually exclusive and we will use this property to advance the parallelism on architectures withdistributed memory In the following we will use the row-based approach for shared memoryparallelism but one can easily see that all modifications are also applicable to the column-basedapproach of Faugere and Lachatre

4 Matrix Distribution

In the case of the matrix reduction during Grobner basis computation we have to considerhow to distribute the coefficient matrices with least duplication and communication Like anyother parallel and distributed algorithm for transforming matrices into row echelon form wecan choose between row- and column-based distribution or a combination of both

If row-based or combined distribution is chosen the algorithm scatters rows or blocks amongthe computation nodes and these need to send rows from one to each other if they are requiredfor further reductions To reduce the communication overhead this needs to use a strategywhich decides how the matrix is distributed Since we use rows-based parallelization for theshared memory level and since the column-based distribution does play well with the specialproperties of Grobner basis computations we didnrsquot analyse the effectiveness of the row-basedor combined approach

If column-based distribution is chosen the pivot matricesA and C have to be send to all nodesand the non-pivot matrices B and D can be distributed without duplication Since all pivotsare preset for primary and secondary reduction this approach does only require communicationbefore and after all reductions are done

Furthermore the matrices are sparse and by using appropriate matrix formats the commu-nication overhead can be reduced even more We chose to store the off-diagonal elements of Aand C in a coordinate list ie there is one list storing tuples of row column and value Thisformat allows reordering in parallel executable sets to improve the row-based parallelization aspresented in [13] For B and D a modified list of lists format is used storing pairs of row indexand value for each column This allows to distribute columns independently As suggested in[8 Chapter 6] the columns are distributed round-robin to optimize load balancing Afterwards

73

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

each node can use row-based parallelism on the local shared memory The following shows thedistribution of the matrix constructed in example 1

Example 2 Using two parallel nodes the matrix M of the previous example is decomposedinto one coordinate list and two lists of lists Afterwards the pivots are sent to both nodes andthe two sets of non pivot columns are distributed among the nodes Finally the two nodes areholding the following data

Node 1 Node 2

(A C)(411) (431) (201)(211) (351)(051)(151)(161)

(B D)5 (61)7 (41)9 (43)

(A C)(411) (431) (201)(211) (351)(051)(151)(161)

(B D)6 (21) (31)8 (61) -10 (41) -

Table 1 shows that the final reduction can be computed on a single node because thesubmatrix D consumes only a tiny fraction of the whole matrix One can easily check thatthis is true in general the submatrices S1 and S2 have s rows each and the submatrix R hasr rows There are p pivot columns and n non-pivot columns Hence the coefficient matrix has2 middots+r rows and p+n columns After primary and secondary reduction the final reduction onlyrequires the submatrix D which has s remaining rows and n columns Therefore all reducedcolumns can be gathered on one node which executes the Gaussian elimination on D

Polynomial System Sugar degree primary matrix final matrix ratio ()Gametwo 7 [10] 17 7731 x 5818 2671x2182 13Cyclic 8 [1] 14 3819 x 4244 612x1283 48Cyclic 9 16 70251 x 75040 4014x10605 08

Katsura 12 [9] 9 12141 x 11490 2064x2155 32Katsura 13 9 26063 x 23531 4962x4346 35Eco 12 [12] 9 12547 x 10937 2394x1269 22Eco 13 10 25707 x 24686 2883x2310 10F966 [5] 9 60274 x 63503 4823x9058 11

Table 1 Ratio of primary matrix and final matrix during reduction for selected problems

The optional reduction is an obstacle for the effectiveness of the algorithm since it requiresthat the reduced matrix D has to be distributed again to be applied on B Because of that weexamine if the optional reduction is useful at all Even more we put to test if the SIMPLIFY

method and distributed computation play well together

5 Simplifying the F4 Algorithm

Removing the optional reduction may scale down the required communication overhead andthe reduction time Even more if SIMPLIFY isnrsquot used during symbolic preprocessing the

74

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

distributed matrix has not to be gathered completely since the columns of the reduced matrixB are not required after primary and secondary reduction

Algorithm 1 SIMPLIFY

Input t isin Tn a term f isin K[x1 xn] a polynomial F isin (Fk)k=1dminus1) where Fk is

finite subset of K[x1 xn]Output a non evaluated product ie an element of Tn timesK[x1 xn]foreach u isin list of divisors of t do1

if existj(1 le j lt d) such that (u middot f) isin Fj then2

Fj is the row echelon form of Fj wrt σ 3

there exists a (unique) p isin Fj

+such that LTσ(p) = LTσ(u middot f) 4

if u 6= t then return SIMPLIFY( tu pF) else return (1 p)5

end6

end7

The SIMPLIFY method does not guarantee that a reduction is improved by reusing previousresults Actually SIMPLIFY proves it effectiveness mostly by application Hence we requirea best possible implementation of the method Algorithm 1 is a repetition of the originalSIMPLIFY [3] It leaves some details open and there are some possibilities for optimization

bull Searching through all divisors of t is time consuming regarding the fact that only somedivisors of u will satisfy the condition (u f) isin Fj for j isin (1 le j lt d)

bull To check if there exists a j with (u f) in Fj it is important how Fj is stored A naiveimplementation will require to loop over all rows of Fj until the condition is satisfied

bull This algorithm does not check if there is another jprime 6= j satisfying the condition andprovides a better replacement

To address these issues we propose the following modifications

bull All rows of F1 Fdminus1 are stored in a two-dimensional map The first key is a polynomialf and the second is a term u This allows to update (u f) if a better replacement is foundBy that only one value per pair is stored This will decrease the required memory

bull The first map should provide a fast random access to the value of key f and the secondmap should have an ordering to allow a decreasing iteration of the possible terms In thisway the search space for possible replacements is reduced to the multiples of f only

bull The value of a map element is the reduced form of f middot u

We call this data structure SimplifyDB We can provide an improved version of SIMPLIFY asshown by algorithm 2 Additionally we have to introduce a function to update the SimplifyDB

Therefore after reduction we execute algorithm 3 for each row of Fj

+ The insertion step allows

us to compare candidates for the SimplifyDB In our implementation for two candidates thebetter is the one which has less elements in its support This is equivalent to the first weightedlength function wlen(p) = Supp(p) in [2] At this point we didnrsquot try any other suggestedweighted length function

SIMPLIFY can be improved even more During symbolic preprocessing it is called twiceonce for the selected critical pair (m f) with m isin T

n and f isin G and once to create reduction

75

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

Algorithm 2 SIMPLIFY with SimplifyDB

Input t isin Tn a term f isin K[x1 xn] a polynomial SimplifyDB

Output a non evaluated product ie an element of Tn timesK[x1 xn]foreach u le t isin SimplifyDB[f ] do1

if u divides t then2

p = SimplifyDB[f ][u] 3

if u 6= t then return SIMPLIFY( tu p SimplifyDB) else return (1p) 4

end5

end6

Algorithm 3 Insertion into SimplifyDB

Input t isin Tn a term f p isin K[x1 xn] polynomials SimplifyDB

Output SimplifyDBif existu isin SimplifyDB[f ] t = u then1

Replace SimplifyDB[f ][u] with p if it is better 2

else3

SimplifyDB[f ][t] = p 4

end5

polynomials mprime middot f with mprime isin Tn and f prime isin G As one can easily see the second input parameter

is always an element of G So it stands to reason to restrict SIMPLIFY

SIMPLIFY(t i) where i is the index of gi isin G

Still there is the recursive call of SIMPLIFY taking a polynomial p as parameter which mightnot be an element of G Recall that p was found in the SimplifyDB using f and a term u = t

z

with z isin Tn With the knowledge that f = gi isin G we can write p = f middotuminus r = gi middotuminus r where

r isin K[x1 xn] is the sum of all reductions applied on f during a previous reduction stepThe recursive call is looking for another polynomial pprime which simplifies z middot p = z middot (gi middot u minus r)If such a polynomial pprime exists we can write pprime = z middot (gi middot u minus r) minus rprime = z middot u middot gi minus (z middot r minus rprime)Hence if the SimplifyDB stores pprime at index (gi z middot u) instead of (p z) the recursion is obsoleteand SIMPLIFY can be replaced with algorithm 4 being recursion free

Algorithm 4 New SIMPLIFY algorithm

Input t isin Tn a term i is the index of gi isin G SimplifyDB

Output a non evaluated product ie an element of Tn timesK[x1 xn]foreach u le t isin SimplifyDB[f ] do1

if u divides t then return ( tu SimplifyDB[f ][u]) 2

end3

Before benchmarking different variants of the distributed versions of the algorithm a firstlook at timings using only shared memory will thin out the number of combinations Forthe following computations we used a system with 48 AMD Opteron

TM

6172 cores having64 gigabyte of main memory The implementation of the parallelization for the shared memoryis presented in [13] and in its latest version it is realized using Intel Rcopy Threading Building Blocks(TBB) and Open Multi-Processing (OpenMP) for parallelization

76

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

Table 2 shows that the optional reduction is mostly useless and can be left out duringGrobner basis computation Table 3 shows that our new recursion-free SIMPLIFY is also inpractice faster and even more memory efficient

Finally SIMPLIFY is improving performance by increasing memory usage and so for solvinglarger polynomial systems it might be possible to find a solution within the bounds of availablememory by disabling SIMPLIFY Consequently we will compare computations with and withoutthe improved SIMPLIFY for the distributed parallel implementation in the following section

Polynomial systems without optional reduction with optional reductionmax matrix size runtime max matrix size runtime

Gametwo 7 7808 x 5895 2846 7731 x 5818 2985Cyclic 8 3841 x 4295 1118 3819 x 4244 1215Cyclic 9 70292 x 75080 6067 70251 x 75040 6283

Katsura 12 12142 x 11491 3449 12141 x 11490 3666Katsura 13 26063 x 23531 1522 26063 x 23531 1692Eco 12 12575 x 11349 2522 12547 x 10937 2836Eco 13 25707 x 24686 9176 25707 x 24686 1037F966 60898 x 63942 9832 60274 x 63503 1185

Table 2 Comparison of computations with and without optional reduction The new SIMPLIFY

algorithm was used in both cases

Polynomial with new SIMPLIFY with original SIMPLIFY without SIMPLIFYsystems runtime (s) memory runtime memory runtime memory

Gametwo 7 2846 459MB 2882 721MB 2997 262MBCyclic 8 1118 262MB 1443 393MB 1228 131MBCyclic 9 6067 156GB 6492 240GB 5429 210GB

Katsura 12 3449 655MB 3928 157GB 4374 328MBKatsura 13 1522 256GB 1872 727GB 2071 917MBEco 12 2522 328MB 3875 138GB 5087 262MBEco 13 9176 114GB 1364 577GB 2182 852MBF966 9832 256GB 2182 113GB 2125 125GB

Table 3 Comparison of original and new SIMPLIFY

6 Benchmarks

For the following benchmarks of our distributed implementation we used a cluster of up toeight systems having 16 Intel Rcopy Xeon Rcopy E5-2670 cores with hyperthreading and 64GB of RAMallowing us using up to 256 parallel threads For data distribution we use the Message PassingInterface (MPI) and the BoostMPI wrapper

Table 4 compares once again runtimes for computations with and without SIMPLIFY usingone two or four nodes For all polynomial input systems the computation time goes up andthe distribution has no positive effect However we accomplished to speed-up the reductiontime This is not an inconsistency The overall runtime goes up due to the communication

77

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

overhead and the possibility to improve the performance is limited to decreasing the reductiontime Hence the problem is the small size of the given polynomial systems Figure 1 illustratesthis issue for Cyclic 9

Table 5 adds further and more difficult examples Especially for Katsura 15 and Cyclic 10the distributed parallelization takes effect providing a speed-up of 23 and 27 for the overallcomputation time and 57 and 50 for the reduction using four respectively eight nodes Exclud-ing the Eco 14 system the computation is most effective without SIMPLIFY and in particularfor Cyclic 10 computations were not even possible with it due to memory overflows

Eco 14 is an counterexample because it is not possible to decrease the computation timeusing a distributed system This is caused by the effectiveness of SIMPLIFY for the probleminstance

The crashed computations for Katsura 15 and for Cyclic 10 without SIMPLIFY with twonodes are caused by a not yet solved overflow in the MPI implementation if more than 512 MBhave to be transfered in one operation This does not happen with four or eight nodes becausethe matrix size for each node decreases by factor two respectively four

At the end no distributed computation with SIMPLIFY is faster and hence it should beremoved in further developments of distributed parallel algorithms for Grobner bases compu-tations

Polynomial systems with SIMPLIFY without SIMPLIFY nodes 1 2 4 1 2 4

Gametwo 7 2985 3455 5603 2848 3853 2888(5549) (6709) (6010) (6630) (4607) (3427)

Cyclic 8 7798 1112 9520 7497 1406 2078(1327) (1707) (1953) (1332) (1473) (1168)

Cyclic 9 5060 5182 4947 3306 3617 4276(2222) (1952) (1388) (1499) (1224) (7373)

Katsura 12 4200 4636 5523 2859 3997 6685(6083) (8220) (7762) (6699) (4535) (3362)

Katsura 13 1874 1900 1864 1396 1588 1760(4046) (4661) (3682) (5003) (3107) (1815)

Eco 12 2135 2940 4149 2498 4108 8802(2564) (3760) (3953) (6458) (3664) (3097)

Eco 13 9178 1065 1209 1114 1575 2126(1210) (1632) (1462) (3865) (2310) (1467)

F966 9188 1062 1321 9360 1392 1851(2086) (2629) (2391) (3859) (2632) (1870)

Table 4 Distributed computation (and reduction) times for 12 or 4 nodes

78

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

1woS 2woS 4woS 1wS 2wS 4wS

0

100

200

300

400

500

600

Overhead

Reduction

Prepare

Update

Figure 1 Computation time in detail for Cyclic 9 with and without SIMPLIFY

Poly sys with SIMPLIFY without SIMPLIFY nodes 1 2 4 8 1 2 4 8

Katsura 14 9575 8310 7489 7448 7756 6599 6754 991(3139) (2634) (2012) 1691 (3984) (2244) (1351) (86)

Katsura 15 5719 crashed 3440 3252 5615 3857 3252 3372(2571) (-) 1272 1008 (3781) (1960) (1094) (666)

Cyclic 10 crashed crashed crashed crashed 30400 crashed 13270 11280(-) (-) (-) (-) (25240) (-) (7862) (5010)

Eco 14 5098 5194 5526 626 8005 7870 9967 1660(1106) (1177) (9802) (8938) (4113) (2240) (1277) (7824)

Table 5 Distributed computation (and reduction) times for larger input systems

7 Conclusion

We have shown that the parallelization of the F4 algorithm can be expanded form a sharedmemory system to a cluster of distributed nodes providing a multiple of the computation powerof a single system This was primarily achieved by using column-based parallelism removingthe optional reduction and the SIMPLIFY function It allowed us to solve larger input systemslike Katsura 15 or Cyclic 10 almost three times faster using four or respectively eight distributednodes Some work is still required to optimize the speed-up and the communication of the nodeshas to be improved to make solving of even larger problem instances possible

79

A Modified Parallel F4 Algorithm for Shared and Distributed Memory Architectures Severin Neumann

References

[1] Goran Bjorck and Uffe Haagerup All cyclic p-roots of index 3 found by symmetry-preservingcalculations 2008

[2] Michael Brickenstein Slimgb Grobner bases with slim polynomials Revista Matematica Com-

plutense 23(2)453ndash466 2010

[3] Jean-Charles Faugere A new efficient algorithm for computing Grobner bases (F4) Journal of

Pure and Applied Algebra 139(1ndash3)61ndash88 June 1999

[4] Jean-Charles Faugere and Sylvain Lachartre Parallel Gaussian Elimination for Grobner basescomputations in finite fields In Proceedings of the 4th International Workshop on Parallel and

Symbolic Computation PASCO rsquo10 pages 89ndash97 New York USA July 2010 ACM

[5] Jean-Charles Faugere Moreau Francois De Saint Martin and Fabrice Rouillier Design of regularnonseparable bidimensional wavelets using Groebner basis techniques IEEE Transactions on

Signal Processing 46(4)845ndash856 1998

[6] Rudiger Gebauer and H Michael Moller On an installation of buchbergerrsquos algorithm Journal

of Symbolic Computation 6275ndash286 December 1988

[7] Alessandro Giovini Teo Mora Gianfranco Niesi Lorenzo Robbiano and Carlo Traverso rdquoOnesugar cube pleaserdquo or selection strategies in the buchberger algorithm In Proceedings of the 1991

international symposium on Symbolic and algebraic computation ISSAC rsquo91 pages 49ndash54 NewYork USA 1991 ACM

[8] Gene H Golub and Charles F Van Loan Matrix Computations Johns Hopkins Studies in theMathematical Sciences Johns Hopkins University Press 1996

[9] Shigetoshi Katsura Wataru Fukuda Sakari Inawashiro Nahomi Fujiki and Rudiger GebauerDistribution of effective field in the ising spin glass of the plusmnj model at t = 0 Cell Biochemistry

and Biophysics 11309ndash319 1987

[10] David M Kreps and Robert Wilson Sequential equilibria Econometrica 50(4)863ndash94 July 1982

[11] Martin Kreuzer and Lorenzo Robbiano Computational Commutative Algebra 1 ComputationalCommutative Algebra Springer 2000

[12] Alexander Morgan Solving polynomial systems using continuation for engineering and scientific

problems Classics in applied mathematics SIAM 2009

[13] Severin Neumann Parallel reduction of matrices in Grobner bases computations In Vladimir PGerdt Wolfram Koepf Ernst W Mayr and Evgenii V Vorozhtsov editors Computer Algebra in

Scientific Computing volume 7442 of Lecture Notes in Computer Science pages 260ndash270 SpringerBerlin Heidelberg 2012

[14] Kurt Siegl A parallel factorization tree grobner basis algorithm In Parallel Symbolic Computation

PASCO 1994 Proceedings of the First International Symposium River Edge USA 1994 WorldScientific Publishing Co Inc

80

Generating Asymptotically Non-Terminant

Initial Variable Values for Linear Diagonalizable

Programs

Rachid Rebiha1lowast Nadir Matringe23 and Arnaldo Vieira Moura1

1 Institute of Computing UNICAMP University of Campinas SP Brasilrachidicunicampbr

2 Universit de Poitiers Laboratoire Mathmatiques et Applications France3 Institue de Mathematiques de Jussieu Universite Paris 7-Denis Diderot France

Abstract

We present the key notion of asymptotically non-terminant initial variable values fornon-terminant loop programs We show that those specific values are directly associated toinital variable values for which the corresponding loop program does not terminate Con-sidering linear diagonalizable programs we describe powerful computational methods thatgenerate automatically and symbolically a semi-linear space represented by a linear systemof equalities and inequalities Each element of this space provides us with asymptoticallynon-terminant initial variable values Our approach is based on linear algebraic methodsWe obtain specific conditions using certain basis and matrix encodings related to the loopconditions and instructions

1 Introduction

Research on formal methods for program verification [12 15 8 17] aims at discovering math-ematical techniques and developing their associated algorithms to establish the correctness ofsoftware hardware concurrent systems embedded systems or hybrid systems Static programanalysis [12 15] is used to check that a software is free of defects such as buffer overflows orsegmentation faults which are safety properties or termination and non-termination which areliveness properties Proving termination of while loop programs is necessary for the verificationof liveness properties that any well behaved and engineered system or any safety critical em-bedded system must guarantee We could list here many verification approaches that are onlypractical depending on the facility with which termination can be automatically determinedVerification of temporal properties of infinite state systems [20] is another example

Recent work on automated termination analysis of imperative loop programs has focusedon a partial decision procedure based on the discovery and synthesis of ranking functions Suchfunctions map the loop variable to a well-defined domain where their value decreases furtherat each iteration of the loop [9 10] Several interesting approaches based on the generationof linear ranking functions have been proposed [3 4] for loop programs where the guards andthe instructions can be expressed in a logic supporting linear arithmetic For the generation ofsuch functions there are effective heuristics [14 10] and in some cases there are also completemethods for the synthesis of linear ranking functions [16] On the other hand it is easy togenerate a simple linear terminant loop program that does not have a linear ranking functionAnd in this case such complete synthesis methods [16] fail to provide a conclusion about thetermination or the non termination of such a program

lowastSupported by FAPESP grant 201108947-1 and FAPESP grant BEPE 201304734-9

81

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

In this work we address the non-termination problem for linear while loop programs Inother words we consider the class of loop programs where the loop condition is a conjunc-tion of linear inequalities and the assignments to each of the variables in the loop instructionblock are affine or linear forms In matrix notation linear loop programs will be representedin a general form as while (Bx gt b) x = Ax + c (ie A and B are matrices b and c arevectors of real numbers and that x is a vector of variables) Without loss of generality theterminationnon-termination analysis for such a class of linear programs could be reduced tothe problem of terminationnon-termination for homogeneous linear programs [6 21] Thosebeing programs where linear assignments consist of homogeneous expressions and where thelinear loop condition consists of at most one inequality Concerning effective program trans-formations and simplification techniques non-termination analysis for programs presented in amore complex form can often be reduced to an analysis of a program expressed in this basicaffine form Despite tremendous progress over the years [6 5 7 13 11 2 1] the problem offinding a practical sound and complete methods for determining or analyzing non termina-tion remains very challenging for this class of programs and for all initial variable values Westarted our investigation from our preliminary technical reports [19 18] where we introduced atermination analysis in which algorithms ran in polynomial time complexity Here consideringa non terminating loop we introduce new static analysis methods that compute automaticallyand in polynomial time complexity the set of initial input variable values for which the programdoes not terminate and also a set of initial inputs values for which the program does terminateThis justifies the innovation of our contributions ie none of the other mentioned related workis capable of generating such critical information over non-terminating loops We summarizeour contributions as follows

bull To the best of our knowledge we introduce a new key notion for non-termination and ter-mination analysis for loop programs we identify the important concept of asymptoticallynon-terminant initial variable values ANT for short Any asymptotically non-terminantinitial variable values can be directly related to an initial variable value for which theconsidered program does not terminate

bull Our theoretical contributions provide us with efficient computational methods running inpolynomial time complexity and allowing the exact computation of the set of all asymp-totically non-terminant initial variable values for a given loop program

bull We generate automatically a set of linear equalities and inequalities describing a semi-linear space that represents symbolically the set of all asymptotically non-terminant initialvariable values The set of ANT values contains the set of non-terminant initial variablevalues On the other hand the complementary set of ANT values is a precise under-approximation of the set of terminant inputs for the same program

Example 11 (Motivating Example) Consider the following program depicted below on theleft We show a part of the output of our algorithm below on the right

(i) Pseudo code

while(2x+3y-zgt0)

x= y + z

y= -(12)x+(32)y -(12)z

z=(32)x -(32)y+(12)z

(ii) Output of our prototype

Locus of ANT

[[4u[1]+u[2]+u[3]gt0]

AND[u[1]+4u[2]+4u[3]gt0]

AND[-u[1]+u[2]-u[3]=0]]

OR[[-u[1]+u[2]-u[3]gt0]]

82

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

The semi-linear ANT = u = (u1 u2 u3)⊤ isin E | 4u1 + u2 + u3 gt 0 and u1 + 4u2 + 4u3 gt

0 andminusu1 + u2 minus u3 = 0 cup u = (u1 u2 u3)⊤ isin E | minus u1 + u2 minus u3 gt 0 represents symbolically

all asymptotically initial variable values that are directly associated to initial variable valuesfor which the program does not terminate On the other hand the complementary of this setco-ANT = u = (u1 u2 u3)

⊤ isin E | 4u1 + u2 + u3 le 0 or u1 + 4u2 + 4u3 le 0 orminusu1 + u2 minus u3 6=0 cap u = (u1 u2 u3)

⊤ isin E | minus u1 + u2 minus u3 le 0 is a precise under-approximation of the setof all initial variable values on which the program terminates

The rest of this article is organized as follows Section 2 can be seen as a preliminarysection where we introduce some key notions and results from linear algebra which will be usedto build our computational methods In this section we also present our computational modelfor programs and some further notations Section 3 introduces the new notion of asymptoticallynon-terminant initial variable values Section 4 provides the main theoretical contributionsof this work This section also presents our computational methods that generate a symbolicrepresentation of the asymptotically non-terminant variable values for linear programs Weprovide a complete dicussion in Section 5 Finally Section 6 states our conclusions

2 Linear Algebra and Linear Loop Programs

Here we present key linear algebraic notions and results which are central in the theoretical andalgorithmic development of our methods We denote by M(mnK) the set of mtimes n matriceswith entries in K and simply M(nK) when m = n The Kernel of A also called its nullspacedenoted by Ker(A) is Ker(A) = v isin K

n | A middot v = 0Km In fact when we deal with squarematrices these Kernels are Eigenspaces Let A be a ntimes n square matrix with entries in K Anonzero vector x isin K is an eigenvector for A associated with the eigenvalue λ isin K if A middotx = λxie (A minus λIn) middot x = 0 where In is the n times n identity matrix The nullspace of (A minus λIn) iscalled the eigenspace of A associated with eigenvalue λ Let n be a positive integer we willdenote R

n by E and its canonical basis by Bc = (e1 en) Let A be a square matrix inM(nR) Let us introduce the notation Spec(A) for the set of eigenvalues of A in R and wewill write Spec(A)lowast for the set Spec(A)minus 0 For λ isin Spec(A) we will denote by Eλ(A) thecorresponding eigenspace Throughout the paper we write dλ for the dimension of Eλ(A) Wewill say that A is diagonalizable if E = oplusλisinSpec(A)Eλ(A) Let A be a diagonalizable matrixFor each eigenspace Eλ(A) we will take a basis Bλ = (eλ1 eλdλ

) and we define

B = cupλisinSpec(A)Bλ

as a basis for E

Definition 21 Let x belong to E We denote by xλ its component in Eλ(A) If x admits the

decompositionsum

λisinSpec(A)(sumdλ

i=1 xλieλi) in B we have xλ =sumdλ

i=1 xλieλi

We denote by P the transformation matrix corresponding to B whose columns are the vectorsof B decomposed in Bc Letting di denote the integer dλi

for the ease of notation we recallthe following lemma

Lemma 21 We have Pminus1AP = diag(λ1Id1 λtIdt) We denote by D the matrix Pminus1AP

As we will obtain our results using the decomposition of x in B we recall how one obtains itfrom the decomposition of x in Bc

83

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

Lemma 22 Let x isin E If x =sumn

i=1 xiei = (x1 xn)⊤ isin Bc and x decomposes as

sumtj=1(

sumdj

i=1 xλj ieλj i) in B the coefficients xλj i are those of the column vector Pminus1x in Bc

Throughout the paper we write lt gt for the canonical scalar product on E which is given by lt

x y gt=sumn

i=1 xiyi and recall as it is standard in static program analysis that a primed symbolxprime refers to the next state value of x after a transition is taken Next we present transitionsystems as representations of imperative programs and automata as their computational models

Definition 22 A transition system is given by 〈x L T l0Θ〉 where x = (x1 xn) is a setof variables L is a set of locations and l0 isin L is the initial location A state is given by aninterpretation of the variables in x A transition τ isin T is given by a tuple 〈lpre lpost qτ ρτ 〉where lpre and lpost designate the pre- and post- locations of τ respectively and the transitionrelation ρτ is a first-order assertion over x cup xprime The transition guard qτ is a conjunction ofinequalities over x Θ is the initial condition given as a first-order assertion over x Thetransition system is said to be linear when ρτ is an affine form

We will use the following matrix notations to represent loop programs and their associatedtransitions systems

Definition 23 Let P be a loop program represented by the transition system 〈x =(x1 xn) l0 T = 〈l l qτ ρτ 〉 l0Θ〉 We say that P is a linear loop program if the followingconditions hold

bull Transition guards are conjunctions of linear inequalities We represent the loop conditionin matrix form as V x gt b where V isin M(mnR) and b isin R

m By V x gt b we mean thateach coordinate of vector V x is greater than the corresponding coordinate of vector b

bull Transition relations are affine or linear forms We represent the linear assignments inmatrix form as x = Ax+ c where A isin M(nR) and c isin R

n

The linear loop program P = P (A V b c) will be represented in its most general form aswhile (V x gt b) x = Ax+ c

In this work we use the following linear loop program classifications

Definition 24 We identify the following three types of linear loop programs from the morespecific to the more general form

bull Homogeneous We denote by PH the set of programs where all linear assignments consistof homogeneous expressions and where the linear loop condition consists of at most oneinequality If P is in PH then P will be written in matrix form as while (lt v x gtgt

0) x = Ax where v is a (ntimes 1)-vector corresponding to the loop condition and whereA isin M(nR) is related to the list of assignments in the loop We say that P has ahomogeneous form and it will also be denoted as P (A v)

bull Generalized Condition We denote by PG the set of linear loop programs where the loopcondition is generalized to a conjunction of multiple linear homogeneous inequalities

bull Affine Form We denote by P A the set of loop programs where the inequalities and theassignments are generalized to affine expressions If P is in P A it will be written aswhile (V x gt b) x = Ax+ c for A and V in M(nR) b isin R

m and c isin Rn

84

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

Without lost of generality the static analysis for the class of linear programs P A could bereduced to the problem of terminationnon-termination for homogeneous linear programs inPH In this work we consider programs in PH The generalization to programs in P A canalready be done and it will be reported elsewhere

3 Asymptotically Non-terminant Variable Values

In this section we present the new notion of asymptotically non-terminant variable values Itwill prove to be central in analysis of termination in general Let A be a matrix in M(nR)and v be a vector in E Consider the program P (A v) while (lt v x gtgt 0) x = Ax whichtakes values in E We first give the definition of the termination of such a program

Definition 31 The program P (A v) is said to be terminating on x isin E if and only iflt vAk(x) gt is not positive for some k ge 0

In other words Definition 31 states that if the program P (A v) performs k ge 0 loopiterations from initial variables xin E we obtain x = Ak(x) Thus if lt vAk(x) gtle 0the loop condition is violated and so P (a v) terminates Next we introduce the followingimportant notion

Definition 32 We say that x isin E is an asymptotically non terminating value for P (A v) ifthere exists kx ge 0 such that P (A v) is non terminating on Akx(v) We will write that x isANT for P (A v) or simply x is ANT We will also write that P (A v) is ANT on x

Note that if P (A v) is non terminating on Akx(x) then lt vAk(x) gt is gt 0 for k ge kxThe following result follows directly from the previous definition

Corollary 31 An element x isin E is ANT if and only if lt vAk(x) gt is positive for k largeenough

If the set of ANT points is not empty we say that the program P (A v) is ANT We willalso write NT for non terminant For the programs we study here the following lemma alreadyshows the importance of such a set

Lemma 31 The program P (A v) is NT if and only if it is ANT

Proof It is clear that NT implies ANT (ie NT sube ANT ) as a NT point of P (A v) is ofcourse ANT (with kx = 0) Conversely if P (A v) is ANT call x an ANT point then Akx(x)is a NT point of P (A v) and so P (A v) is NT

As one can easily see the set of NT points is included in the set of ANT points But themost important property of the ANT set remains in the fact that each of its point provides uswith an associated element in NT for the corresponding program In other words each elementx in the ANT set even if it does not necessarily belong to the NT set refers directly to initialvariable values yx = Ak[x](x) for which the program does not terminate ie yx is an NT pointWe can say that there exists a number of loop iterations k[x] departing from the initial variable

values x such that Ak[x](x) correspond to initial variable values for which P (A v) does notterminate But it does not necessarily implies that x is also an NT point for P (A v) In factprogram P (A v) could terminate on the initial variable values x by performing a number of

85

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

loop iterations strictly smaller than k[x] On the other hand the complementary set co-ANT

provides us with a quite precise under approximation of the set of all initial variable values forwhich the program terminates

The set of ANT points of a program is also important to the understanding of the terminationof a program with more than one conditional linear inequality as well as for termination overthe rationals for example This will be reported elsewhere

4 Automated generation of ANT loci

In this section we show how we generate automatically and exactly the ANT Locus ie the setof all ANT points for linear diagonalizable programs over the reals We represent symbolicallythe computed ANT Locus by a semi-linear space defined by linear equalities and inequalitiesConsider the program P (A v) while (lt v x gtgt 0) x = Ax The study of ANT setsdepends on the spectrum of A Recall the introductory discussion and Definition 21 at Section2

Proposition 41 For x in E and k ge 1 the scalar product lt vAk(x) gt is equal to

sum

λisinSpec(A)

λk lt v xλ gt=sum

λisinSpec(A)lowast

λk lt v xλ gt

Proof It is a direct consequence of the equality Ak(xλ) = λkxλ

41 The regular case

We first analyze the situation where A is what we call regular

Definition 41 We say that A is regular if Spec(A) cap[

minus Spec(A)]

is an empty set ie ifλ belongs to Spec(A) then minusλ does not belong to Spec(A)

In this case we make the following observation

Proposition 42 Let micro be the nonzero eigenvalue of largest absolute value if it exists such thatlt v xmicro gt is nonzero For k large the quantity lt vAk(x) gt is equivalent to microk lt v xmicro gt

Proof Indeed we can write lt vAk(x) gt as

microk lt v xmicro gt +sum

λ|λ|lt|micro|

λk lt v xλ gt= microk(lt v xmicro gt +sum

λ|λ|lt|micro|

λk

microklt v xλ gt)

and λk

microk approaches zero when k goes to infinity

We then define the following sets

Definition 42 For micro a positive eigenvalue of A we define Smicro as follows

Smicro = x isin Elt v xmicro gtgt 0 lt v xλ gt= 0 for |λ| gt |micro|

86

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

In order to obtain Smicro for all positive eigenvalues micro of A one needs to calculate lt v xmicro gtand lt v xλ gt for all eigenvalues λ such that |λ| gt |micro| For all eigenvalues λ involved inthe computation of Smicro one also needs to evaluate the coefficients cλi =lt v eλi gt for all

eigenvectors eλi isin B and 1 le i le dλ Thus we have lt v xλ gt=sumdλ

i=1 cλixλi Now we onlyneed to compute the coefficient xλi which are those of the column vector Pminus1x in Bc whereP is the transformation matrix corresponding to B See Lemma 22

We ca now state the following theorem allowing the exact computation of the ANT Locusfor the regular case

Theorem 41 The program P (A v) is ANT on x if and only if x belongs to

microgt0isinSpec(A)

Smicro

Proof Let x belong to E If all lt v xλ gt are zero for λ isin Spec(A) then lt vAk(x) gt= 0and x is not ANT Otherwise let micro be the eigenvalue of largest absolute value such thatlt v xmicro gt is nonzero Then according to Proposition 42 the sign of lt vAk(x) gt is the signof microk lt v xmicro gt for k large If micro is negative this sign will be alternatively positive and negativedepending on the parity of k and x is not ANT If micro is positive this sign will be the sign oflt v xmicro gt hence x will be ANT if and only if lt v xmicro gt is positive This proves the result

Example 41 (Running example) Consider the program P (A v) depicted as follows

(i) Pseudo code

while(x+y-2zgt0)

x= x-4y-4z

y= 8x-11y-8z

z= -8x+8y+5z

(ii) Associated matrices

A =

1 minus4 minus48 minus11 minus8minus8 8 5

and v =

11minus2

Step 1 Diagonalization of the matrix A

P =

1 1 12 1 0minus2 0 1

D =

1 0 00 minus3 00 0 minus3

and Pminus1 =

1 minus1 minus1minus2 3 22 minus2 minus1

Using our notations the obtained eigenvectors (ie the column vectors of P ) are denoted asfollows e11 = (1 2minus2)⊤ eminus31 = (1 1 0)⊤ eminus32 = (1 0 1)⊤

Step 2 We compute Smicro for all positive micro isin Spec(A)lowast

bull We compute first the coefficients cλic11 =lt v e11 gt=lt (1 1minus2)⊤ (1 2minus2)⊤ gt= 7

cminus31 =lt v eminus31 gt=lt (1 1minus2)⊤ (1 1 0)⊤ gt= 2

cminus32 =lt v eminus31 gt=lt (1 1minus2)⊤ (1 0 1)⊤ gt= minus1

bull We compute the coefficient xλi which are those of the column vector Pminus1 middotu in Bc whereu = (u1 u2 u3) is the vector encoding the initial variable values

Pminus1

u1

u2

u3

=

u1 minus u2 minus u3)minus2u1 + 3u2 + 2u3)2u1 minus 2u2 minus u3)

=

x11

xminus31

xminus32

We can now proceed to the generation of the linear constraints defining a semi-linear space

87

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

describing symbolically and exactly Smicrolt v x1 gt= c11x11 = 7(u1 minus u2 minus u3)lt v xminus3 gt= cminus31xminus31 + cminus32xminus32 = minus6u1 + 8u2 + 5u3)Hence we have S1 = u = (u1 u2 u3)

⊤ isin E | (u1minusu2minusu3 gt 0)and(minus6u1+8u2+5u3 = 0)

Step 3 We apply Theorem 41 to generate the ANT Locus It reduces to the semi-linear spaceS1 = u = (u1 u2 u3)

⊤ isin E | (u1 minus u2 minus u3 gt 0) and (minus6u1 + 8u2 + 5u3 = 0)

42 The general case handling linear diagonalizable programs

For the general case in the asymptotic expansion of lt vAk(x) gt one can have compensationsbetween λk lt v xλ gt and (minusλ)k lt v xλ gt as these terms can be zero when k is even forinstance and of a well determined sign when k is odd We thus need to take care of this issueTo this end we introduce the following notation

Definition 43 If λ does not belong to Spec(A) for any x isin E we write xλ = 0

We have the following propositions which give the asymptotic behavior of lt vAk(x) gt

Proposition 43 Let micro be the nonzero eigenvalue of largest absolute value if it exists suchthat lt v x|micro| + xminus|micro| gt is nonzero For k large the quantity lt vA2k(x) gt is equivalent to

|micro|2k(lt v x|micro| + xminus|micro| gt)

Proof Indeed we can write lt vA2k(x) gt as

micro2k(lt v x|micro| gt + lt v xminus|micro| gt) +sum

|λ||λ|lt|micro|

λ2k(lt v x|λ| gt + lt v xminus|λ| gt)

= micro2k(lt v x|micro| gt + lt v xminus|micro| gt) +sum

|λ||λ|lt|micro|

λ2k

micro2k(lt v x|λ| gt + lt v xminus|λ| gt))

and λk

microk approaches to zero when k goes to infinity

Proposition 44 Let micro be the nonzero eigenvalue of largest absolute value if it exists suchthat lt v x|micro| minus xminus|micro| gt is nonzero For k large the quantity lt vA2k+1(x) gt is equivalent to

|micro|2k+1(lt v x|micro| minus xminus|micro| gt)

Proof The proof is similar to the proof of Proposition 43

As in the previous Section we introduce the following relevant sets

Definition 44 For |micro| in |Spec(A)lowast| we define the sets S0|micro| and S1

|micro| as follows

S0|micro| = x isin Elt v x|micro| + xminus|micro| gtgt 0 lt v x|λ| + xminus|λ| gt= 0 for |λ| gt |micro| and

S1|micro| = x isin Elt v x|micro| minus xminus|micro| gtgt 0 lt v x|λ| minus xminus|λ| gt= 0 for |λ| gt |micro|

In order to compute the sets S0|micro| and S1

|micro| we obtain the coefficients cλi =lt v eλi gt for alleigenvalues λ If the λ appearing as index in the coefficient cλi is not an eigenvalue then we fix

cλi = 0 and dλ = 0 (see Definition 43) Thus we have lt v x|λ| + xminus|λ| gt=sumd|λ|

i=1 c|λ|ix|λ|i +sumdminus|λ|

i=1 cminus|λ|ixminus|λ|i and lt v x|λ| minus xminus|λ| gt=sumd|λ|

i=1 c|λ|ix|λ|i minussumdminus|λ|

i=1 cminus|λ|ixminus|λ|iWe finally obtain the following main theorem

88

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

Theorem 42 The program P (A v) is ANT on x if and only if x belongs to the set

(|micro||microprime|)isin|Spec(A)lowast|times|Spec(A)lowast|

S0|micro| cap S1

|microprime|

Proof It is obvious that x is ANT if and only if lt vA2k(x) gt and lt vA2k+1(x) gt are bothpositive for k large Now reasoning as in the proof of Theorem 41 but using Propositions 43and 44 instead of Proposition 42 we obtain that lt vA2k(x) gt is positive for k large if andonly if x belongs to S0

|micro| for some micro isin |Spec(A)lowast| and that lt vA2k+1(x) gt is positive for k

large if and only if x belongs to S1|microprime| for some microprime isin |Spec(A)lowast| The result follows

The following two examples illustrate how Theorem 42 applies to different cases

Example 42 (Running example) Consider the program P (A v) depicted as follows

(i) Pseudo code

while(2x+3y-zgt0)

x=15x+18y-8z+6s-5t

y=5x+3y+z-t-3s

z=-4y+5z-4s-2t

s=-43x-46y+17z-14s+15t

t=26x+30y-12z+8s-10t

(ii) Associated matrices

A =

15 18 minus8 6 minus55 3 1 minus1 minus30 minus4 5 minus4 minus2

minus43 minus46 17 minus14 1526 30 minus12 8 minus10

v =

11231

Step 1 Diagonalization of the matrix A

P =

2 1 minus1 1 1minus1 0 2 0 minus1minus2 0 2 minus1 minus2minus4 minus1 0 minus2 minus12 2 1 2 1

D =

minus3 0 0 0 00 minus1 0 0 00 0 0 0 00 0 0 1 00 0 0 0 2

and Pminus1 =

minus3 minus3 1 minus1 1minus1 minus2 1 0 1minus5 minus4 1 minus1 210 10 minus3 2 minus4minus7 minus6 1 minus1 3

We obtain the following eigenvectors written using our notation e01 = (minus1 2 2 0 1)⊤e11 = (1 0minus1minus2 2)⊤ e21 = (1minus1minus2minus1 1)⊤ eminus11 = (1 0 0minus1 2)⊤ and eminus31 =(2minus1minus2minus4 2)⊤

Step 2 Computing Smicro for all positive micro isin Spec(A)lowast

bull Our algorithm first computes the coefficients cλi We obtain c01 = 6 c11 = minus5c21 = minus6 cminus11 = 0 and cminus31 = minus13

bull Then our algorithm computes the coefficients of the decomposition of the initial vari-able values in B They are those of the column vector Pminus1 middot u in Bc where u =(u1 u2 u3 u4 u5)

⊤ is the vector encoding the initial variable values

Pminus1

u1

u2

u3

u4

u5

=

minus3u1 minus 3u2 + u3 minus u4 + u5

minusu1 minus 2u2 + u3 + u5

minus5u1 minus 4u2 + u3 minus u4 + 2u5

10u1 + 10u2 minus 3u3 + 2u4 minus 4u5

minus7u1 minus 6u2 + u3 minus u4 + 3u5

=

xminus31

xminus11

x01

x11

x21

Now the algorithm obtains all the non-zero terms appearing in the definition of S0|λ| and S1

|λ|

lt v x|1| + xminus|1| gt= c11x11 = minus5(10u1 + 10u2 minus 3u3 + 2u4 minus 4u5)lt v x|2| + xminus|2| gt= c21x21 = minus6(minus7u1 minus 6u2 + u3 minus u4 + 3u5)

89

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

lt v x|minus3| + xminus|minus3| gt= cminus31xminus31 = minus13(minus3u1 minus 3u2 + u3 minus u4 + u5)lt v x|minus3| minus xminus|minus3| gt= minuscminus31xminus31 = 13(minus3u1 minus 3u2 + u3 minus u4 + u5)

All the sets S0|λ| and S1

|λ| can now be computed exactly

S0

|1| = u isin E | 5(10u1 + 10u2 minus 3u3 + 2u4 minus 4u5) gt 0 and minus6(minus7u1 minus 6u2 + u3 minus u4 + 3u5) = 0 and

minus 13(minus3u1 minus 3u2 + u3 minus u4 + u5) = 0

S1

|1| = u isin E|5(10u1 + 10u2 minus 3u3 + 2u4 minus 4u5) gt 0 and minus6(minus7u1 minus 6u2 + u3 minus u4 + 3u5) = 0 and

13(minus3u1 minus 3u2 + u3 minus u4 + u5) = 0

S0

|2| = u isin E| minus 6(minus7u1 minus 6u2 + u3 minus u4 + 3u5) gt 0 and minus13(minus3u1 minus 3u2 + u3 minus u4 + u5) = 0

S0

|2| = u isin E| minus 6(minus7u1 minus 6u2 + u3 minus u4 + 3u5) gt 0 and minus13(minus3u1 minus 3u2 + u3 minus u4 + u5) = 0

S1

|2| = u isin E| minus 6(minus7u1 minus 6u2 + u3 minus u4 + 3u5) gt 0 and 13(minus3u1 minus 3u2 + u3 minus u4 + u5) = 0

S0

|minus3| = u isin E| minus 13(minus3u1 minus 3u2 + u3 minus u4 + u5) gt 0

S1

|minus3| = u isin E| 13(minus3u1 minus 3u2 + u3 minus u4 + u5) gt 0

Step 3 We apply Theorem 42 to generate the ANT LocusThe algorithm computes the following intersections S0

1 capS11 S

01 capS1

2 S01 capS1

3 S02 capS1

1 S02 capS1

2 S02 cap S1

3 S03 cap S1

1 S03 cap S1

2 and S03 cap S1

1 In fact the previous computational step already allows our algorithm to perform implicit sim-plifications For instance it appears that S0

|1| = S1|1| S

0|1| = S1

|1| = S0|minus1| = S1

|minus1| S0|2| = S1

|2|

and that S0|minus3| cap S1

|minus3| is the empty set According to Theorem 42 the ANT locus reduces tothe following semi-linear space

u = (u1 u2 u3 u4 u5)⊤ isin E | minus 10u1 minus 10u2 + 3u3 minus 2u4 + 4u5 gt 0 and

minus 7u1 minus 6u2 + u3 minus u4 + 3u5 = 0 and

minus 3u1 minus 3u2 + u3 minus u4 + u5 = 0⋃

u = (u1 u2 u3 u4 u5)⊤ isin E | minus 10u1 minus 10u2 + 3u3 minus 2u4 + 4u5 gt 0 and

minus 3u1 minus 3u2 + u3 minus u4 + u5) gt 0 and

minus 7u1 minus 6u2 + u3 minus u4 + 3u5 = 0⋃

u = (u1 u2 u3 u4 u5)⊤ isin E | 7u1 + 6u2 minus u3 + u4 minus 3u5 gt 0 and

minus 3u1 minus 3u2 + u3 minus u4 + u5 = 0

5 Discussions

This work is complementary to our previous work [19] which dealt with termination analysisIn [19] we first prove a sufficient condition for the termination of homogeneous linear programsThis statement was conjectured in the important work of [21] where the first attempt toprove this result contains non trivial mistakes As we shown in [19] the actual proof of thissufficient condition requires expertise in several independent mathematical fields Also thenecessary condition proposed in [21] does not apply as expected in practice We then wentto generalize the previous result and to the best of our knowledge we presented the firstnecessary and sufficient condition (NSC for short) for the termination of linear programsIn fact this NSC exhibits a complete decidability result for the class of linear programs on all

90

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

initial values Moreover departing from this NSC we showed the scalability of these approachesby demonstrating that one can directly extract a sound and complete computational methodrunning in polynomial time complexity to determine termination or nontermination for linearprograms On the other hand all other related and previous works mentioned in this paper donot provide any techniques capable of generating automatically the set of initial input variablevalues for which a loop does not terminate The main contributions of this paper remain ona sound and complete computational method to compute the set of input variable values forwhich the programs do not terminate The overall time complexity of our algorithm is also oforder O(n3) As can be seen the main results ie Theorems 41 and 42 provide us with adirect symbolic representation of the ANT set Even if those theorems are rigorously stated andproofs are quite technical they are really easy to apply we only need to compute the explicitterms S0

|micro| and S1|microprime| in order to directly obtain a formula representing exactly and symbolically

the ANT set In a same manner we extended this techniques to linear program not necessarilydiagonalizable and we obtained similar theoretical and practical results As their associatedproofs are more technical they would required more space to be fully expressed and we left themfor an ensuing report In other more recent work on termination static analysis for programsover the rationals or the integers with several conditional linear inequalities we also show thatthe notion ANT remains central

6 Conclusion

We presented the new notion of asymptotically non-terminant initial variable values for linearprograms Considering a linear diagonalizable program our theoretical results provided us withsound complete and fast computational methods allowing the automated generation of the setsof all asymptotically non-terminant initial variable values represented symbolically and exactlyby a semi-linear space eg conjunctions and disjunctions of linear equalities and inequalitiesAlso by taking the complementary set of the semi-linear set of ANT initial variable values weobtain a precise under-approximation of the set of terminant initial variable values for the (non-terminant) program Actually this type of method can be vastly generalized to tackle the ter-mination and non-termination problem of linear programs not necessarily diagonalizable withmore than one conditional linear inequality on rational or integer initial values for instanceWe leave this investigation for an ensuing report

References

[1] Amir M Ben-Amram and Samir Genaim On the linear ranking problem for integer linear-constraint loops In Proceedings of the 40th annual ACM SIGPLAN-SIGACT symposium onPrinciples of programming languages POPL rsquo13 pages 51ndash62 New York NY USA 2013 ACM

[2] Amir M Ben-Amram Samir Genaim and Abu Naser Masud On the termination of integer loopsIn VMCAI pages 72ndash87 2012

[3] Aaron R Bradley Zohar Manna and Henny B Sipma Linear ranking with reachability In InCAV pages 491ndash504 Springer 2005

[4] Aaron R Bradley Zohar Manna and Henny B Sipma Termination analysis of integer linearloops In In CONCUR pages 488ndash502 Springer-Verlag 2005

[5] Aaron R Bradley Zohar Manna and Henny B Sipma Termination of polynomial programsIn In VMCAIrsquo2005 Verification Model Checking and Abstract Interpretation volume 3385 ofLNCS pages 113ndash129 Springer 2005

91

Generating Asymptotically Non-Terminant Initial Variable Values Rebiha Matringe and V Moura

[6] Mark Braverman Termination of integer linear programs In In Proc CAV06 LNCS 4144 pages372ndash385 Springer 2006

[7] Hong Yi Chen Shaked Flur and Supratik Mukhopadhyay Termination proofs for linear simpleloops In Proceedings of the 19th international conference on Static Analysis SASrsquo12 pages 422ndash438 Berlin Heidelberg 2012 Springer-Verlag

[8] Edmund M Clarke Orna Grumberg and Doron Peled Model Checking MIT Press CambridgeMA 2000

[9] Michael Colon and Henny Sipma Synthesis of linear ranking functions In Proceedings of the 7thInternational Conference on Tools and Algorithms for the Construction and Analysis of SystemsTACAS 2001 pages 67ndash81 London UK 2001 Springer-Verlag

[10] Michael A Colon and Henny B Sipma Practical methods for proving program termination InIn CAV2002 Computer Aided Verification volume 2404 of LNCS pages 442ndash454 Springer 2002

[11] Byron Cook Andreas Podelski and Andrey Rybalchenko Termination proofs for systems codeSIGPLAN Not 41(6)415ndash426 June 2006

[12] P Cousot and R Cousot Abstract interpretation and application to logic programs Journal ofLogic Programming 13(2ndash3)103ndash179 1992

[13] Patrick Cousot and Radhia Cousot An abstract interpretation framework for termination SIG-PLAN Not 47(1)245ndash258 January 2012

[14] Dennis Dams Rob Gerth and Orna Grumberg A heuristic for the automatic generation of rankingfunctions In Workshop on Advances in Verification pages 1ndash8 2000

[15] Zohar Manna Mathematical Theory of Computation McGraw-Hill 1974

[16] Andreas Podelski and Andrey Rybalchenko A complete method for the synthesis of linear rankingfunctions In VMCAI pages 239ndash251 2004

[17] Jean-Pierre Queille and Joseph Sifakis Specification and verification of concurrent systems incesar In Proceedings of the 5th International Symposium in Programming pages 337ndash351 LondonUK 1982 Springer-Verlag

[18] Rachid Rebiha Nadir Matringe and Arnaldo V Moura A complete approach for terminationanalysis of linear programs Technical Report IC-13-08 Institute of Computing University ofCampinas February 2013

[19] Rachid Rebiha Nadir Matringe and Arnaldo V Moura Necessary and sufficient condition fortermination of linear programs Technical Report IC-13-07 Institute of Computing University ofCampinas February 2013

[20] Henny B Sipma Tomas E Uribe and Zohar Manna Deductive model checking Form MethodsSyst Des 15(1)49ndash74 July 1999

[21] Ashish Tiwari Termination of linear programs In Rajeev Alur and Doron Peled editors ComputerAided Verification 16th International Conference CAV 2004 Boston MA USA volume 3114 ofLecture Notes in Computer Science pages 70ndash82 Springer 2004

92

Data Conversion Method between a Natural

Number and a Binary Tree for an Inductive

Proof and Its Application

Kazuko Takahashi1 Shizuo Yoshimaru1lowast

and Mizuki Goto1

1 School of Science and Technology Kwansei Gakuin Universityktakakwanseiacjp

2 School of Science and Technology Kwansei Gakuin Universityshizuoyoshimarugmailcom

3 School of Science and Technology Kwansei Gakuin Universitybub85144kwanseiacjp

Abstract

This paper presents modeling of a binary tree that represents a natural number andgives an inductive proof for its properties using theorem provers We define a function forconverting data from a natural number into a binary tree and give an inductive proof forits well-definedness We formalize this method develop a computational model based onit and apply it to an electronic cash protocol We also define the payment function onthe binary tree and go on to prove the divisibility of electronic cash using the theoremprovers IsabelleHOL and Coq respectively Furthermore we discuss the effectiveness ofthis method

1 Introduction

Theorem proving is an important technique to provide a certified system or to ensure bug-free programming Several theorem provers which may be called proof assistants have beendeveloped including ACL2 [11] PVS [19] IsabelleHOL [16] Coq [4] Agda [17] and so onThese tools help users to develop formal proofs either interactively or semi-automaticallytypically using induction as the proof strategy There are numerous applications for suchprovers There are relatively few practical applications of these tools in most fields comparedto their use in pure mathematics although there are some outstanding results in microprocessordesign [10] C compilers [14] operating system kernels [12] security protocols [1] and securecard systems [3 13] To use these provers successfully it is necessary to construct a suitablemodel and then select an appropriate proof strategy In practical applications it may be difficultto form a natural inductive model and so it may be necessary to build a data structure whichcan be difficult for these provers to handle

We have previously attempted to prove the divisibility of an electronic cash protocol [21] Inthis experience we have encountered difficulties in proving the properties regarding the functionthat converts a natural number to a binary tree The binary tree is a complete binary treewhere a Boolean value is attached to each node and the value of which is defined as a sum ofthe value of the left and right subtrees The problem can be reduced to the fact that there existsa function that cannot be defined in a primitive recursive form on an inductively defined datastructure Because a natural number has a linear structure with only one successor whereas a

lowastCurrently Nochu Information System CoLTD

93

Data Conversion Revisited Takahashi Yoshimaru and Goto

binary tree has a branching structure with two successors at each branching point the inductionschemes are different which complicates the proof

To solve this problem we introduced a bit sequence as an intermediate data structure anddefined the function from a natural number to a binary tree as a composition of two recursivefunctions via a bit sequence Specifically the first function describes the mapping from anatural number to an intermediate bit sequence and the second function is the mapping fromthe bit sequence to the binary tree We formalized this model and associated proof method andapplied it to the divisibility of an electronic cash protocol using IsabelleHOL However thisprevious work had several drawbacks First the model was complicated because of an intricatelabeling for the nodes of a tree a simpler and more natural model for this specific binary treehas subsequently been identified Second the proof was incomplete as one of the lemmas thatrelates the bit sequence to the binary tree was left as an axiom Third the effectiveness of themethod was not discussed we did not know whether this method could be applied similarlywith theorem provers other than IsabelleHOL or whether a large number of modificationswould be required In this paper we provide a simplified model give complete proofs of thedivisibility using the theorem provers IsabelleHOL and Coq and discuss the effectiveness ofthe method

The rest of this paper is organized as follows In Section 2 we describe in detail the problemsof data conversion and our solution In Sections 3 and 4 we present a formalization and aninductive proof of the divisibility of an electronic cash protocol In Section 5 we provide adiscussion and in Section 6 we present our conclusions

2 Data Conversion Formalization

21 Problem

First we illustrate the problem of converting between a natural number and a binary treewhich are data structures with different induction schemes

Let NAT and BTREE be a natural number and a binary tree respectively NAT is induc-tively defined with one successor BTREE is inductively defined in such a form that there aretwo successors ie

nat_p(0)

nat_p(n) =gt nat_p(Suc(n))

tree_p(Tip)

tree_p(lt) amp tree_p(rt) =gt tree_p(Node(_ltrt))

where Suc denotes the successor function Node is a constructor for a tree rsquo rsquo denotes ananonymous variable that corresponds to a parent node lt and rt are the left and right subtreesrespectively and T ip is a leaf node The symbols amp and =gt denote conjunction and implicationrespectively

Consider data conversion between NAT and BTREE Let f be a function that maps fromNAT to BTREE and g be a function that maps from BTREE to NAT We assume that thesefunctions are defined inductively in the following form

f NAT --gt BTREE

f(Suc(n)) = c1(f(n))

f(0) = Tip

94

Data Conversion Revisited Takahashi Yoshimaru and Goto

g BTREE --gt NAT

g(Node(_ltrt)) = c2(g(lt) g(rt))

g(Tip) = 0

where c1 is a function from BTREE to BTREE and c2 is a function from NATtimes NAT to NATConsider proving the following relationship between f and g

g(f(n)) = n

We use the following induction scheme IS on NAT to prove it

foralln( (forallnprimenprime lt n =rArr g(f(nprime)) = nprime) =rArr g(f(n)) = n ) [IS]

The proof proceeds by rewriting g(f(n)) in succession as follows

g(f(n)) = g(f(c2(n1 n2)))= g(Node( f(n1) f(n2)))= c2(g(f(n1)) g(f(n2)))= c2(n1 n2)

where c2(n1 n2) = n for a certain n1 n2 lt nThe induction scheme IS is used to proceed from the third line to the fourth line To succeed

in this proof there are two problems to be solved The first is the progression from the first lineto the second line we have to prove the equality f(c2(n1 n2)) = Node( f(n1) f(n2)) Thisproblem is how to divide a natural number into two parts suitably The second and arguablymore challenging problem is that we cannot find c1 that defines f in a recursive form naturallyConsider the function f which maps a natural number to a binary tree The forms of the datastructures f(n) and f(Suc(n)) are considerably different and the differences depend on thevalues of n For example compare the operation of adding a leaf node labeled ldquoTruerdquo to thebinary tree shown in Figure 1 In this figure (a) shows the operation of adding a node to thebinary tree that has two leaf nodes labeled ldquoTruerdquo and (b) shows the operation of adding anode to the binary tree that has three leaf nodes labeled ldquoTruerdquo These operations cannot berepresented uniformly therefore f(n) cannot be uniformly defined for all n Furthermore evenif f is defined the proof over the properties on f is not straightforward

(a)

T F F F

T T

(b)

T T T TT T T F

T

T T T

T T

T T

T

T

Figure 1 Operation on adding a ldquoTruerdquo node to a binary tree

On the other hand the definition of g is simpler because it is a conversion from a data typethat is not totally-ordered to one that is totally-ordered

22 Solution

To solve the problem shown above we introduce the bit sequence BS as an intermediate datastructure between NAT and BTREE

95

Data Conversion Revisited Takahashi Yoshimaru and Goto

221 Conversion from BS to BTREE

First we describe the conversion from BS to BTREE We choose a specific binary tree used inan electronic cash protocol This tree is a complete binary tree and a Boolean value is attachedto each node the value of which is defined as a sum of the values of its left and right subtrees

Let b0b1 bn be a sequence of Boolean values that corresponds to a natural number kThen k = bprime0 middot 2

n + bprime1 middot 2nminus1 + + bprimen middot 20 where bprimei = 10 for bi = TrueFalse (1 le i le n)

respectively We encode bprime0 middot2n as the left tree and the remainder as the right tree The function

from BS to BTREE is defined as follows

bs_to_btree() = (Tipfalse)

bs_to_btree(bbs) = (if b

then Node(true create_btree(truelength(bs)) bs_to_btree(bs) )

else Node(true bs_to_btree(bs) create_btree(falselength(bs)) )

)

where is an operator combining the head and tail of the list T ip indicates a leaf node thefunction create btree(bool nat) creates a binary tree of height nat in which all nodes are labeledwith bool and length(list) denotes the length of list 1 Intuitively when scanning the datafrom the head of BS descending by one bit corresponds to descending one subtree in BTREEThe induction scheme for the bit sequence is that if some property holds on a bit sequence bsit also holds on bbs If b = True (ie k ge 2n) then all nodes in the left subtree are labeledTrue this is referred to as a full tree However if b = False (ie k lt 2n) then none of thenodes in the right tree are labeled True this is referred to as an empty tree Thus the datatypes BS and BTREE are matched in their induction schemes

Let a bit sequence be represented as a list the elements of which are either True or FalseFigure 2 shows the conversion of the bit sequence [True False T rue] into a binary tree Inthis figure the black trees are full trees the white trees are empty trees and the dotted treesare the others

T

T T T

FTFTT

[TrueFalseTrue] [FalseTrue] [True]

Figure 2 The mapping between a bit sequence and a binary tree

Because the binary tree corresponding to [True False T rue] is not an empty tree the rootnode is labeled True Because the first bit in the sequence is True the left tree is a full treeThe tree to the right of it is the tree corresponding to the remaining bit sequence [False T rue]after the first bit has been extracted Now consider the coding of [False T rue] because the

1We can define a mirror tree in which left and right subtrees are exchanged

96

Data Conversion Revisited Takahashi Yoshimaru and Goto

first bit of the sequence is False the right tree must be an empty tree and the left tree isthe tree corresponding to the remaining bit sequence Then we consider the coding of [True]because the first bit of the bit sequence is True the left tree is a full tree and the right tree isthe binary tree corresponding to the remaining bit sequence Finally we obtain a T ip for [ ]

T

T

T

T F

T

T

T T T T T F F F

Figure 3 The binary tree for [True False T rue]

The binary tree obtained from [True False T rue] is thus as follows (Figure 3)

( True

( True ( TrueTrueTrue ) ( TrueTrueTrue ) )

( True ( TrueTrueFalse ) ( FalseFalseFalse ) )

)

The function bs to btree can give an inductive definition that provides for the division of ninto n1 and n2 corresponding to the left and right subtrees respectively in the proof processfor IS in the previous subsection

222 Conversion from NAT to BS

Next we give a definition for the conversion from NAT to BS We show two different modelsone using a general function and one using a primitive recursive function

First we define the general function naive nat to bs This is defined in an iterative formand determines the value of a a bit sequence from the least-significant bit as follows

naive_nat_to_bs(0) = [False]

naive_nat_to_bs(1) = [True]

naive_nat_to_bs(n) = (naive_nat_to_bs(div(n2))) ([mod(n2) = 1])

where is the concatenation operator for lists div(n 2) and mod(n 2) return the result ofdivision of n by 2 and its remainder respectively

Second we define the primitive recursive function nat to bs This is defined in a tail-recursive form and determines the value of a bit sequence from the most-significant bit Thedefinition is more complex than that of the iterative form

nat_to_bs(0) = [false]

nat_to_bs(Suc(n)) = calc(lg(Suc(n))Suc(n))

calc(0m) = [true]

calc(Suc(n)m) = (if 2^n lt= m) then True(calc(nm-2^(Suc(n))))

else False(calc(nm))

lg(n) = (if nlt=1 then 0

else Suc(lg (div(n2))))

97

Data Conversion Revisited Takahashi Yoshimaru and Goto

where lg is a key function that returns the place number of the bit sequence corresponding toa given argument ie the natural number m that satisfies m le log n lt m+ 1 The followingtable shows the relationship of a natural number nat a bit sequence bs and the value of lgNote that when n increases by 1 the location in the bit sequence which is equal to the heightof the tree increases logarithmically

nat bs lg

1 1 02 10 13 11 14 100 25 101 26 110 27 111 28 1000 39 1001 3

223 Conversion from NAT to BTREE

Finally nat to btree is defined as the composition of the two functions naive nat to bs andbs to btree or the composition of nat to bs and bs to btree nat to bs and bs to btree are prim-itive recursive functions whereas naive nat to bs is a recursive function

The definition of nat to bs is more suitable to an induction scheme than that ofnaive nat to bs because induction is typically applied from the head to the tail

In the next two sections we apply this formalization to the electronic cash protocol definedin [18] and prove its divisibility

3 Modeling of an Electronic Cash Protocol

31 Ideal Electronic Cash

An electronic cash (e-cash) protocol is in general a combination of cryptography techniquessuch as zero-knowledge proof and public key encryption We consider the ideal e-cash protocolproposed by Okamoto [18] In this protocol a coin of some monetary value is encoded asa binary tree and a payment function is defined over it This binary tree approach makese-cash efficient and unlinkable and is used in many divisible e-cash schemes [7 8 15 18]We formalize this protocol and prove its divisibility on a data level ie a user can spend acoin in several separate transactions by dividing its value without overspending if and only ifa payment function satisfies the payment rules This is one of the properties that an ideale-cash protocol should satisfy We define the data structure of money and define two primitiverecursive functions of money amount and pay on money The definitions are shown using Coqcode in this section

32 Definition of money

A coin is represented as a binary tree called money Each node of the tree represents a certaindenomination The root node is assigned the monetary value of the money and the values of

98

Data Conversion Revisited Takahashi Yoshimaru and Goto

all other nodes are defined as half the value of their parent nodesMoney is defined as an inductive function It is a binary tree where nodes are labeled with

Boolean values The label True means that a node is usable while False means that it is notFor a given Boolean value b and a natural number n we can create money in which all of thenodes have the label b

Inductive money Type =

| Tip bool -gt money

| Node bool -gt money -gt money -gt money

Fixpoint create_money(b bool)(n nat) money =

match n with

| 0 =gt Tip b

| S nrsquo =gt Node b (create_money b nrsquo) (create_money b nrsquo)

end

33 Creation of money from a natural number

cash is a function that createsmoney corresponding to a given natural number that is defined asa composition of bs to money and naive nat to bs (or nat to bs) bs to money can be definedin a manner similar to that of bs to btree

Definition cash(n nat) money = bs_to_money (naive_nat_to_bs n)

Note that cash is the money that satisfies a specific condition whereas type money al-lows any complete binary tree whose nodes are labeled as Boolean values For exampleNode(false T ip(true) T ip(true)) is an element of money but not a result of a function cash

34 Calculation of the amount of money

The function money amount computes the amount of money that can be used If the rootnode is labeled True the amount of the tree is the sum of that of the left tree and the righttree otherwise the amount is 0

Fixpoint money_amount(m money) nat =

match m with

| Tip true =gt 1

| Tip false =gt 0

| Node true l r =gt money_amount l + money_amount r

| Node false _ _ =gt 0

end

35 Payment

Payment rules are set in [18] as follows when we spend some amount from the coin we searchfor a node (or combination of nodes) whose value is equal to the payment value and then cancelthese nodes at the same time all of the ancestors and all of the descendants are also canceledOverspending is prevented if and only if these rules are satisfied

The function pay corresponds to payment according to the payment rules When we pay nfrom money where n is less than or equal to the amount of money then we pay all of n fromthe left tree and the right tree remains as it is if the amount of the left tree is more than n

99

Data Conversion Revisited Takahashi Yoshimaru and Goto

Otherwise we exhaust the left tree in the payment and pay the remainder from the right treeFor example money amount(pay(cash(13) 4) = 9

In the following code eq nat dec and lt dec are functions on NAT that denote rsquo=rsquo and rsquoltrsquorespectively change false is a function that changes the label of a node to False

Fixpoint pay(m money)(n nat) money =

match m with

| Tip true =gt Tip (if eq_nat_dec n 0 then true else false)

| Node true l r =gt

if lt_dec (money_amount l) n

then Node true (change_false l) (pay r (n - money_amount l))

else Node true (pay l n) r

| _ =gt m

end

4 Proof of Properties

We prove three properties on the divisibility of the e-cash protocol On proving these propertiesinductively we apply the method proposed in Section 2

In this section we only show the outline of the proof focusing on how induction is appliedThe complete Coq proof is shown in the Appendix

First the distribution property over money amount holds

money amount(Node( left right)) =money amount(left) +money amount(right) middot middot middot (1)

This can readily be proved We rewrite the left side of the given equation

41 Well-definedness of cash

The monetary value of money created by cash from a natural number is equal to that valueThis property is represented as follows

forall n (money amount (cash(n)) = n)

and is proved using the properties of the bit sequence Below we show a case in which the firstbit b of the sequence is True When it is False the proof proceeds in the same manner

money amount(cash(n))= money amount(bs to money(bbs)) middot middot middot (2)= money amount( Node(true

bs to money(bs) create money(true length(bs) ) middot middot middot (3)= money amount(bs to money(bs))+

money amount(create money(true (length(bs)))) middot middot middot (4)

Formula (2) is obtained by unfolding cash where nat to bs(n) = bbs formula (3) isobtained by unfolding bs to money and formula (4) is obtained by the distribution propertyof money amount (1)

The first term of formula (4) is transformed as follows

100

Data Conversion Revisited Takahashi Yoshimaru and Goto

money amount(bs to money(bs))= money amount(bs to money(nat to bs(nminus 2lg n))) middot middot middot (5)= money amount(cash(nminus 2lgn)) middot middot middot (6)

Formula (5) is obtained using case split tactics on n property of lg and several other tacticsFormula (6) is obtained by unfolding cash

The second term of formula (4) is transformed as follows

money-amount(create money(true length(bs)))= money amount(cash(2lgn)) (7)

Here we use the following induction scheme of NAT

if forall k k lt n money amount(cash(k)) = kthen money mount(cash(n)) = n holds

We can prove 2lg n le n and nminus 2lg n lt n If 2lg n lt n we apply this type of induction toboth formulas (6) and (7) and so formula (4) is finally transformed into the following form

money amount(cash(2lg n)) +money amount(cash(nminus 2lg n))= 2lg n + (nminus 2lg n)= n

In case 2lg n = n the proof is simpler without using induction

42 Well-definedness of pay

The amount remaining after payment is the difference between the original value and thepayment value This property is represented as follows 2

forall nforall m (money amount(pay(cash(n)m)) = nminusm)

This is derived from the following lemma

forall cforall n (money-amount(pay(c n)) = money-amount(c)minus n

which is proved as follows When we pay n from c if n does not exceed the amount of c wepay m1 from the left subtree as far as possible and pay the remainder m2 from the right treem1 and m2 are determined as follows if n lt money amount(left) then m1 = n and m2 = 0otherwise m1 = money amount(left) and m2 = n minus money amount(left) This is provedusing induction Below we show an inductive case because the proof is simple for the basecase

money amount(pay(cm1 +m2))= money amount(pay(Node( left right)m1 +m2)) middot middot middot (8)= money amount(pay(leftm1)) +money amount(pay(rightm2)) middot middot middot (9)= money amount(left)minusm1 +money amount(right) minus m2 middot middot middot (10)= (money amount(left) + money amount(right)) minus (m1 + m2)= money amount(Node( left right)) minus (m1 +m2) middot middot middot (11)= money amount(c) minus (m1 +m2)

2Note that nminusm = 0 when m gt n

101

Data Conversion Revisited Takahashi Yoshimaru and Goto

Formula (8) is obtained by expanding c Formula (9) is obtained by the distribution propertyofmoney amount and the property of payment onmoney Formula (10) is obtained by applyinginduction tomoney Formula (11) is obtained from the distribution property ofmoney amount

43 Divisibility

Given that ms is a list of values each of which corresponds to a transaction if a user paysfrom the head of this list in succession then the remainder is the correct value This propertyis represented as follows

forallnforallms( n ge listsum(ms)

=rArr money amount (foldl(pay(cash(n)ms))) = n minus listsum(ms) )

Here foldl and listsum are the functions handling a list Let ms be a list [m1 mk]foldl(pay(cms)) is rewritten in the following form

(pay( (pay(cm1) mk)

and listsum(ms) is rewritten in the following form

m1 + + mk

This theorem can be proved using the result of the proofs for the above two properties ofwell-definedness

5 Discussion

Modeling the e-cash protocol and proving the properties described in the previous sections wereperformed using the theorem provers IsabelleHOL and Coq respectively First we comparethese two provers

Both of them are interactive theorem-proving environments based on inductive theoremproving The data types and functions are defined in recursive form and the proof proceeds byconnecting suitable tactics

IsabelleHOL has a more powerful engine for automatic proof than Coq A proof may suc-ceed simply by using the lsquoautorsquo command without connecting multiple lemmas in IsabelleHOLwhereas a user must specify tactics manually in Coq However the proof procedure in Coq iseasier to understand

Both provers are based on typed logics and adopt higher-order functions In Coq type-checking is richer and proof-checking is reduced to type checking It requires the user to provethe termination of a recursive function IsabelleHOL also requires the user to prove thetermination of a recursive function but has a stronger automatic mechanism and user doesnot need to supply much input

We developed a model for an e-cash protocol and set out to prove three properties of themodel using IsabelleHOL and subsequently translated the model into Coq The translationwas basically straightforward The definition of a primitive recursive function using primrec inIsabelleHOL was translated to Fixpoint in Coq the definition of a recursive function usingfun was translated to Function the definition of a non-recursive function using definitionwas translated to Definition In addition we must prove the termination of the functionintroduced via Function

102

Data Conversion Revisited Takahashi Yoshimaru and Goto

The tactics used in the proofs of two provers were quite different Generally more tactics arerequired in Coq however the proof in Coq provides a useful basis from which to make a proofin IsabelleHOL Actually we completed the proof of the unproved lemma in IsabelleHOL byreferring to the proof in Coq From this experience it is expected that similar modeling withother provers is possible and that the existing proofs will be useful as a basis for forming proofsin those other provers All definitions and proofs in IsabelleHOL and Coq are shown in [22]

In the field of protocol verification there are a number of works on the verification ofsecurity protocols using IsabelleHOL (eg[2]) However they mainly proved security or safetyof protocols To the best of our knowledge there exists no research on a proof that focuses onthe divisibility of electronic cash protocols using a theorem-proving approach

Bijection between the set of natural numbers and rooted trees has been discussed in severalworks [5 6 9] In these works prime decomposition of the natural numbers was used toconstruct the corresponding rooted tree They used an incomplete tree in which each primenumber forms an individual branch It appears to be impossible to define this bijection in aninductive manner Attempts to provide the mechanical proof were not made and the correctnessof the methods has not been proved using theorem provers On the other hand we propose amethod for automated theorem proving using a complete binary tree

The data conversion method described here is applicable to conversion from an inductivelydefined data structure with one successor to one with n successors by introducing a list inwhich each element takes n values as an intermediate data structure instead of a bit sequenceFollowing this transformation the proof can proceed in a similar manner to the one shown inthis paper although the number of lemmas would increase Moreover it can be extended todata conversion from data structures with m successors to data structures with n successors bycomposing two data-conversion functions ie one from an inductively defined data structurewith m successors to that with one successor and then a second function from an inductivelydefined data structure with one successor to one with n successors

6 Conclusion

We have described a function for converting data from a natural number to a binary treeand have given an inductive proof for its well-definedness We have described a method ofintroducing a bit sequence as an intermediate data structure to provide a model for inductivelydefined data structures with different induction schemes We formalized this method developeda computational model based on it and applied it to an electronic cash protocol We succeededin proving the properties of divisibility of the protocol using the theorem provers IsabelleHOLand Coq and discussed the effectiveness of the method

In future we would like to investigate other functions andor properties on such a binarytree that is handled here and develop methods of their inductive proof

References

[1] Arsac W Bella G Chantry X and Compagna L Multi-Attacker Protocol Validation J ofAutomated Reasoning 46(3-4)353-388 (2011)

[2] Bella G Massacci B and Paulson L Verifying the SET Purchase Protocols J of AutomatedReasoning 365 37 (2006)

[3] Bella G Inductive Verification of Smart Card Protocols J of Computer Security 11(1)87-132(2003)

103

Data Conversion Revisited Takahashi Yoshimaru and Goto

[4] Bertot Y and Castran P Interactive Theorem Proving and Program Development - CoqrsquoArtThe Calculus of Inductive Constructions Springer Verlag (1998)

[5] Beyer T and Hedetniemi S M Constant Time Generation of Rooted Trees SIAM J Comput9(4)706-712 (1980)

[6] Cappello P A New Bijection between Natural Numbers and Rooted Trees 4th SIAM Conferenceon Discrete Mathematics (1988)

[7] Chan A Frankel Y and Tsiounins Y Easy Come - Easy Go Divisible Cash EUROCRYPT98pp 561-575 (1998)

[8] Canard S and Gouget A Divisible E-Cash Systems Can Be Truly Anonymous EURO-CRYPT2007 pp482-497 (2007)

[9] Gobel F On a 1-1-Correspondence between Rooted Trees and Natural Numbers J of Combina-torial Theory Series B(29)141-143 (1980)

[10] Hardin D S (ed) Design and Verification of Microprocessor Systems for High-Assurance Appli-cations Springer Verlag (2010)

[11] KaufmannM Monolios P and Moore J S Computer-Aided Reasoning An Approach KluwerAcademic Publishers (2000)

[12] Klein G et al seL4 Formal Verification of an Operating-System Kernel Commun ACM 53(6)107-115 (2010)

[13] Kurita T and Nakatsugawa Y The Application of VDM to the Industrial Development ofFirmware for a Smart Card IC Chip Int J of Software and Informatics 3(2-3)343-355 (2009)

[14] Leroy X Formal Verification of a Realistic Compiler Communications of the ACM 52(7)107-115(2009)

[15] Nakanishi T and Sugiyama Y An Efficiently Improvement on an Unlinkable Divisible ElectronicCash System IEICE Trans on Fundamentals E85-A(19)2326-2335 (2002)

[16] Nipkow T Paulson L and Wenzel M IsabelleHOL A Proof Assistant for Higher-Order LogicSpringer Verlag (2002)

[17] Norell U Dependently Typed Programming in Agda Advanced Functional Programming 2008pp230-266 (2008)

[18] Okamoto T An Efficient Divisible Electronic Cash Scheme The proceedings of Cryptorsquo95pp438-451 (1995)

[19] OwreS RushbyJM and ShankarN PVS A Prototype Verification System The proceedingsof CADE-11 pp748-752 (1992)

[20] Sprenger C Zurich E T H Basin D et al Cryptographically Sound Theorem Proving 19thIEEE Computer Security Foundations Workshop (2006)

[21] Takahashi K and Yoshimaru S Formalization of Data Conversion for Inductive Proof Tunisia-Japan Workshop on Symbolic Computation in Software Science (SCSS 2009) pp135-150 (2009)

[22] httpistksckwanseiacjp~ktakaEMONEY

104

Data Conversion Revisited Takahashi Yoshimaru and Goto

Appendix Proof for E-cash protocol in Coq (tail-recursiveversion)

Require Import Omega List Arith Div2 Bool Recdef Wf_nat

Theorem well_definedness_of_pay

forall(m money)(n nat)

n lt= money_amount m

-gt money_amount(pay m n) = money_amount m - n

Proof

intros m

induction m intros n LNM destruct b simpl in try reflexivity

destruct (eq_nat_dec n 0)

rewrite e reflexivity

assert(n = 1) by omega

rewrite H reflexivity

destruct (lt_dec (money_amount m1) n) simpl

rewrite IHm2 try omega

replace (money_amount (change_false m1)) with 0 try omega

destruct m1 simpl reflexivity

rewrite IHm1 omega

Qed

Lemma bit_sequence_distribution

forall(bs list bool)(b bool)

money_amount(bs_to_money(bs ++ (bnil))) =

2 money_amount(bs_to_money bs) + (if b then 1 else 0)

Proof

intros bs b

induction bs simpl in

destruct b reflexivity

assert(forall(bl bool)money_amount (create_money bl (length

(bs ++ b nil))) =

money_amount (create_money bl (length bs)) + money_amount

(create_money bl (length bs)))

intros clear IHbs destruct bl induction bs simpl try omega

destruct a simpl in rewrite IHbs repeat rewrite plus_0_r

repeat rewrite plus_assoc rewrite H omega

Qed

Lemma one_reminder_div2

forall(n nat)

(2 div2 n) + (if one_reminder n then 1 else 0) = n

Proof

intros n

case_eq (one_reminder n) intros induction n using lt_wf_ind

destruct n try discriminate

destruct n try reflexivity

simpl in H

simpl

replace (S (div2 n + S (div2 n + 0) + 1))

with (S (S (2 div2 n + 1)))

105

Data Conversion Revisited Takahashi Yoshimaru and Goto

repeat f_equal

rewrite H0 try reflexivity try omega

apply H

simpl

omega

destruct n try reflexivity

destruct n try discriminate

simpl in H

simpl

replace (S (div2 n + S (div2 n + 0) + 0))

with (S (S (2 div2 n + 0)))

repeat f_equal

rewrite H0 try reflexivity try omega

apply H

simpl

omega

Qed

Theorem well_definedness_of_cash

forall(n nat)

money_amount (cash n) = n

Proof

intros n

induction n using lt_wf_ind

destruct n try (simpl reflexivity)

destruct n try (simpl reflexivity)

unfold cash rewrite bit_sequence_equation

case_eq (one_reminder (S (S n))) intros

rewrite bit_sequence_distribution unfold cash in H rewrite H

try (apply lt_div2 apply lt_0_Sn)

pose (one_reminder_div2 (S (S n)))

rewrite H0 in e apply e

Qed

Definition listsum(ns list nat) nat = fold_right plus 0 ns

Definition payment_amount(m money)(ns list nat) nat =

money_amount (fold_left pay ns m)

Theorem Divisibility

forall(n nat)(ns list nat)

listsum ns lt= n -gt

payment_amount (cash n) ns = n - listsum ns

Proof

intros n ns LSM

induction ns using rev_ind simpl in

rewrite lt- minus_n_O

apply well_definedness_of_cash

unfold payment_amount in

unfold listsum in

rewrite fold_left_app

rewrite fold_right_app in simpl in

rewrite plus_0_r in

106

Data Conversion Revisited Takahashi Yoshimaru and Goto

assert(fold_right plus 0 ns + x lt= n)

generalize n LSM

clear IHns LSM n

induction ns intros simpl in

omega

assert(fold_right plus x ns lt= n - a) by omega

apply IHns in H omega

rewrite well_definedness_of_pay rewrite IHns simpl in try omega

replace (fold_right plus x ns) with ((fold_right plus 0 ns) + x)

omega

clear IHns H LSM

induction ns simpl

reflexivity

rewrite lt- IHns info omega

Qed

107

Computer Algebra Investigation of Known

Primitive Triangle-Free Strongly Regular

Graphs

Mikhail Klin and Matan Ziv-Av

Ben-Gurion University of the Negevklincsbguacil

matansvgaliborg

Abstract

With the aid of computer algebra systems COCO and GAP with its packages we areinvestigating all seven known primitive triangle-free strongly regular graphs on 5 10 1650 56 77 and 100 vertices These graphs are rank 3 graphs having a rich automorphismgroup The embeddings of each graph from this family to other ones are described the au-tomorphic equitable partitions are classified all equitable partitions in the graphs on up to50 vertices are enumerated Basing on the reported computer aided results and using tech-niques of coherent configurations a few new models of these graphs are suggested whichare relying on knowledge of just a small part of symmetries of a graph in consideration

1 Introduction

This paper appears on the edge between computer algebra systems and algebraic graph theory(briefly AGT) and is mainly devoted to the computer aided investigation of the known primitivetriangle free strongly regular graphs

In fact there are 7 such graphs those on 5 10 16 50 56 77 and 100 vertices The largestone denoted by NL2(10) is the universal graph for this family in the sense that all seven graphsare induced subgraphs of NL2(10) We denote by F the family of those 7 graphs

The history of the discovery of the graphs from F and in particular of NL2(10) is quitestriking Indeed the graph NL2(10) was discovered twice once in 1956 by Dale Mesner andsecond time independently in 1968 by D G Higman and C C Sims The details of thishistory are considered in [15] see also a very brief summary in Section 4

The graphs on 5 10 and 50 vertices form a very significant subfamily consisting of theknown Moore graphs One more possible member of this series (see eg [16]) would have 3250vertices its existence is an open problem of a great significance Moore graphs and their naturalgeneralizations are objects of much interest in extremal graph theory they serve as the bestexamples of optimal network topologies Discovery of a new primitive triangle free stronglyregular graph would be a high level sensation in modern mathematics

This text is oriented towards an interdisciplinary audience though its kernel is strictlyrelated to a concrete kind of application of computer algebra in AGT

Section 2 provides in compact form the necessary background about strongly regular graphssee [11] [5] for more details while in section 3 we briefly introduce the tools of computer algebraused in AGT The seven graphs from the family F are presented in section 4

Our first main result is introduced in Section 5 full description of embeddings of (primitiveand imprimitive) triangle free strongly regular graphs into the graphs in F

108

Triangle-free strongly regular graphs Klin Ziv-Av

The next topic of our investigation is related to equitable partitions with a special emphasison automorphic equitable partitions see definitions in Section 6 The search strategy is de-scribed in Section 7 though much more details may be found in [28] We report the completeenumeration of automorphic equitable partitions and partial results for the general case

Sections 8ndash10 reflect our efforts to understand a few of the computer aided results and topresent them in a computer free form (completely or at least relatively)

In Section 8 we deal with the graph NL2(10) and describe it in a sense locally that isvia so-called metric equitable partitions obtained from the embeddings of a quadrangle anda graph K33 without one edge (Atkinson configuration) with 4 and 8 cells respectively Thespectrum of the second partition contains all of the eigenvalues of NL2(10) (the case of fullspectrum) Some modifications of the famous Robertson model (see [21]) appear in Section 9while in Section 10 we present a handful of models for some other graphs in F

It is worthy to mention that for generations of mathematicians the graphs in F appear asa source of ongoing aesthetic admiration see especially the home page of Andries Brouwer [6]We believe that some of our models shed a new light on those graphs

Last but not least is that as a rule the models we suggest rely on a relatively small subgroupof the group Aut(Γ) for Γ isin F In this way we provide promising patterns for those researcherswho wish in future to face a challenge to try to construct new primitive triangle free stronglyregular graphs cf Section 11

2 Strongly regular graphs a brief survey

An undirected graph Γ is called a strongly regular graph (SRG) with parameters (v k λ micro) ifit is a regular graph of order v and valency k and every pair of adjacent vertices has exactly λcommon neighbors while every pair of non-adjacent vertices has exactly micro common neighborsSometimes we use an extended set of parameters (v k l λ micro) where l is the number of non-neighbors of a vertex that is l = v minus k minus 1

If A = A(Γ) is the adjacency matrix of an undirected graph Γ then Γ is strongly regular ifand only if A2 = kI + λA+ micro(J minus I minus A) This implies that (I A J minus I minus A) is the standardbasis of a rank 3 homogeneous coherent algebra In other words (∆ΓΓ) are the basic graphsof a rank 3 symmetric association scheme (here Γ is the complement of Γ while ∆ contains allthe loops) The adjacency matrix of a strongly regular graph has exactly 3 distinct eigenvaluesFor a strongly regular graph we denote by

bull r gt s the two eigenvalues of A(Γ) different from k r is always positive while s is alwaysnegative

bull f g the multiplicity of the eigenvalues r s respectively

A formula for f and g is given by g f = 12

[(v minus 1)plusmn 2k+(vminus1)(λminusmicro)radic

(λminusmicro)2+4(kminusmicro)

]

A quadruple of parameters (v k λ micro) for which f and g as given by the preceding formulasare positive integers is called a feasible set of parameters See [6] for a list of feasible parametersets with some information about known graphs for some of the sets

A strongly regular graph Γ is called primitive if both Γ and its complement Γ are connectedThis is equivalent to primitivity of the related association scheme (∆ΓΓ)

109

Triangle-free strongly regular graphs Klin Ziv-Av

3 Computer algebra tools in AGT

During the last two decades the significance of the use of computer algebra systems in AGTincreased drastically Such systems are exploited in the search for new combinatorial objectsthe enumeration of objects with prescribed parameters and the understanding of algebraic andstructural properties of a given combinatorial object Γ (such as the automorphism group Aut(Γ)its action and orbits on the ingredients of Γ enumeration of substructures of Γ embeddings ofΓ into larger structures etc)

An ideal case is when the computer aided understanding of an object Γ is followed by furthertheoretical generalizations The foremost goal of this paper is to share with the reader manynew interesting properties of the graphs in the family F in order to promote the search for newprimitive tfSRGs

Below are the main tools we use

bull COCO is a set of programs for dealing with coherent configurations including construc-tion enumeration of subschemes and calculation of automorphism groups

Developed in 1990-2 Moscow USSR mainly by Faradzev and Klin [8] [9]

bull WL-stabilization ndash Weisfeiler-Leman stabilization is an efficient algorithm for calcu-lating coherent closure of a given matrix (see [25] [3]) Two implementations of theWL-stabilization are available (see [2])

bull GAP an acronym for ldquoGroups Algorithms and Programmingrdquo is a system for com-putation in discrete abstract algebra [10] [22] It supports easy addition of extensions(packages in gap nomenclature) that are written in the GAP programming languagewhich can add new features to the GAP system

One such package GRAPE [23] is designed for construction and analysis of finite graphsGRAPE itself is dependent on an external program nauty [18] in order to calculate theautomorphism group of a graph Another package is DESIGN used for construction andexamination of block designs

bull COCO v2 ndash The COCO v2 initiative aims to re-implement the algorithms in COCOWL-stabilization and DISCRETA as a GAP package In addition the new package shouldessentially extend abilities of current version basing on new theoretical results obtainedsince the original COCO package was written

We refer to [14] for a more detailed discussion of the ways in which computer algebra systemsare used in AGT for the purpose of experimentation and further theoretical generalizations

4 The seven known primitive triangle-free strongly regu-

lar graphs

A graph Γ is called triangle free if it admits no triangles that is cliques of size 3 If Γ is also astrongly regular graph then it is called a triangle free strongly regular graph (tfSRG for short)A graph is triangle free if any two neighbors have no common neighbors therefore a tfSRG isan SRG with λ = 0

The 7 known primitive tfSRGs with orders from 5 to 100 vertices are

1 Pentagon with parameters (5 2 0 1) Its automorphism group is D5 of order 10

110

Triangle-free strongly regular graphs Klin Ziv-Av

0

1

2 3

4

25

26

27 28

29

10

11

12 13

14

Figure 1 Hoffman-Singleton graph Robertson model

2 Petersen graph with parameters (10 3 0 1) Its automorphism group is isomorphic to S5

of order 120 A simple model has as vertices 2-subsets of a set of size 5 with two verticesadjacent if the subsets are disjoint

3 Clebsch graph with parameters (16 5 0 2) Usually denoted by 5 Its automorphismgroup is isomorphic to (S5 ≀S2)

pos of order 1920 A simple model is 4-dimensional cube Q4

together with long diagonals or Cayley graph CAY (E24 0001 0010 0100 1000 1111)

4 Hoffman-Singleton graph (HoSi) with parameters (50 7 0 1) Its automorphism group isisomorphic to PΣU(3 52) of order 252000 ([4]) The simplest model is Robertson model([21]) 5 pentagons marked P0 P4 and 5 pentagrams marked Q0 Q4 with vertexi of Pj joined to vertex i+ jk (mod 5) of Qk

5 Gewirtz (or Sims-Gewirtz) graph with parameters (56 10 0 2) Its automorphism groupof order 80640 is a non split extension of PSL3(4) by E22 A simple model is as theinduced subgraph of NL2(10) on the common non-neighbors of two adjacent vertices

6 Mesner graph with parameters (77 16 0 4) The automorphism group is of order 887040and is isomorphic to the stabilizer of a point in the automorphism group of NL2(10) Onesimple model is induced subgraph of NL2(10) on non-neighbors of a vertex

7 NL2(10) with parameters (100 22 0 6) also known as the Higman-Sims graph Its auto-morphism group contains Higman-Sims sporadic simple group as a subgroup of index 2We refer to [15] for a detailed presentation of the original construction of this graph byDale Mesner as it appeared on [19] [20]

Recall that the graph NL2(10) on 100 vertices was constructed twice by Dale Mesner inhis Thesis in 1956 [19] and later on by Higman and Sims in 1968 when they discovered anew sporadic simple group Moreover in 1964 Mesner proved its uniqueness We denote thisgraph by NL2(10) following the parametrization for a family of putative graphs introduced byMesner in [20] In [15] the history of this discovery as well as of related events is discussed withmany details A new wave of interest in tfSRGs stimulated by [15] was especially productivefor us It became clear that this is the time to arrange a serious comprehensive investigation ofdiverse structural properties of the graphs in the family F The goal is to attract the attentionof researchers to such an information in order to provide new ideas how efforts for the searchof new tfSRGs should be arranged We also wish to share with the reader some surprising newfeatures of the graphs in the family F observed with the aid of a computer

111

Triangle-free strongly regular graphs Klin Ziv-Av

5 Embeddings of tfSRGs into known primitive tfSRGs

Usually in graph theory a graph ∆ = (V prime Eprime) is called a subgraph of a graph Γ = (VE) if

V prime sube V and Eprime sube E Of special interest are induced subgraphs in this case Eprime = E capV prime

2

whereX2

is the set of all 2-subsets of X

Proposition 1 A subgraph ∆ of diameter 2 of a graph Γ with no triangles is an inducedsubgraph

Proof Assume that ∆ is not induced then there exists an edge uw isin E uw 6isin Eprime withuw isin V prime Since the diameter of ∆ is 2 there exist a v which is adjacent in ∆ (and thereforein Γ) to u w thus u v w is a triangle in Γ which is a contradiction

The enumeration of all tfSRGs inside of known tfSRGs was the first serious computationalchallenge in this project The results of its complete solution are discussed below

A non-empty imprimitive tfSRG is either a complete bipartite graph (Kllsim= 2 Kl) or

a graph s K2 consisting of s edges with no common vertices Note that K22 is simply aquadrangle

Lemma 2 Graph NL2(10) does not contain subgraph K33

Proof Originally we obtained this result with the aid of a computer In fact easy proof followsfrom the non-edge decomposition of Γ = NL2(10) (see eg [15]) without any assumptions aboutits uniqueness Indeed let ∆ be a subgraph of Γ which is isomorphic to K33 Assume thattwo bipartite parts of ∆ consist of subsets a b c d e f of vertices Consider now non-edgedecomposition of Γ with respect to a b then c belongs to the cell of size 60 while d e fbelong to the cell of size 6 thus c has just g = 2 neighbors in the latter cell a contradictionwith the valency of c equal to 3 in ∆

As a corollary we obtain that every known primitive tfSRG does not contain K33 andmoreover does not contain Kll when l ge 3

Another simple theoretical result (see eg [28]) claims that the number of quadrangles in an

SRG with parameters (v k l λ micro) is equal tovk2 (

λ

2)+vl2 (

micro

2)2 When λ = 0 this reduces to vlmicro(microminus1)

8 Similar formula may be obtained for the number of 2K2 The numbers of imprimitive tfSRGsinside of graphs in F are given in Table 1 in the supplement while the number of orbits of suchembeddings (with respect to Aut(Γ) for Γ isin F) are given in Table 2

Note that there is no induced subgraph of NL2(10) isomorphic to 12 K2 so both tablesin Supplement A end with s = 11 for s K2

Similar computer results are presented in Tables 3 and 4 (Supplement A) for the embeddingsof a graph from the family F into a larger graph in F

Here the final picture is less sophisticated There are just two cases where for pair of graphsXY isin F there exist more than one orbit of embeddings (up to action of Aut(Y )) of X intoY Namely in these terms there are 9 embeddings of Petersen graph into Mesner graph and 5embeddings into NL2(10) Computer free understanding of these embeddings remains a quiteinteresting task for future investigations of the links between the graphs in the family F

In all other cases there exists (up to isomorphism) at most one embedding for consideredpair (XY ) For most pairs there is a reasonably clear explanation in literature such as twoHoSi inside NL2(10) see eg [12] as well as Robertson model of HoSi [21] which explainspositions in it for both pentagon and Petersen graph

Beside this there are two more embeddings which are not immediately evident

112

Triangle-free strongly regular graphs Klin Ziv-Av

The first pair is the embedding of the Petersen graph into Gewirtz graph In fact inthis embedding the Petersen graph appears as a subgraph of the second constituent of theGewirtz graph which in turn is a graph ∆ of valency 8 on 45 vertices It turns out thatAut(∆) sim= Aut(S6) This graph ∆ generates a non-Schurian association scheme with threeclasses see eg [24] [13] example W38 The graph ∆ may be also described as the distance2 graph of the distance transitive graph of diameter 4 and valency 4 on 45 vertices akageneralized octagon GO(2 1) aka line graph of Tuttersquos 8-cage (see [5] for more details) Inthis context the task of explanation of the embedding of Petersen graph into ∆ seems to be anice exercise in AGT though out of the framework of this presentation

The second exceptional pair is the embedding of the Clebsch graph 5 into NL2(10) Thispair is of a definite independent interest and thus is considered separately in Section 10

Finally we mention that the classification of cocliques in graphs from F may be regardedas a degenerate case of subject in this section Indeed empty graph is a particular case of animprimitive tfSRG We however disregard this problem referring to information presented onthe home page of Andries Brouwer [6]

6 Equitable partitions

Let Γ = (VE) be a graph A partition τ of the vertex set V τ = V1 Vs is calledequitable partition (briefly EP) if for i j isin 1 s the numbers |Γ(v) cap Vj | are equal for allv isin Vi Here Γ(v) = u isin V |u v isin E Usually an EP τ is accompanied by intersectiondiagram which represents a kind of quotient graph Γτ on which all intersection numbers aredepicted Many such diagrams appear in [5] The quotient graph Γτ is in fact a multigraphIts (collapsed) adjacency matrix B consists of all intersection numbers

Obviously entries of B are non-negative integers and for a regular graph Γ of valency k thesum of each row in B is k

If H is a subgroup of Aut(Γ) then the set of orbits of H is an EP of Γ Such an EP is calledautomorphic (briefly AEP)

Proposition 3 ([11]) Let Γ be a graph A = A(Γ) the adjacency matrix of Γ If a partitionτ is EP of Γ with matrix B then the characteristic polynomial of B divides the characteristicpolynomial of A

In fact there are more necessary conditions for a prescribed matrix B to be the adjacencymatrix of a suitable EP of Γ which are formulated in terms of spectral graph theory see eg[7] They create a solid background for a clever search of potential EPs in a given graph Γ

7 Search for equitable partitions

In this project we distinguished two alternative problems for the complete search of EPs ingraphs of F

First problem is to enumerate all automorphic EPs Here we strongly rely on the level ofgroup theoretical ldquointellectrdquo of GAP Indeed for groups of relatively small order (say up to afew thousands) GAP allows to establish efficiently the structure of a considered group as wellas the lattice of its subgroups

However for four graphs in F the group G = Aut(Γ) has larger order thus with the growingof |G| extra theoretical input is required For example in case of G = Aut(NL2(10)) we wereusing information from the website of the Atlas of Finite Group Representations ([26]) about

113

Triangle-free strongly regular graphs Klin Ziv-Av

the maximal subgroups of G (this information goes back to [17]) This knowledge together withad hoc tricks inside of GAP made it possible to describe all subgroups of G up to equivalencyclasses with respect to EPs The fact that all groups G = Aut(Γ) Γ isin F are subgroups ofAut(NL2(10)) was also quite beneficial

Finally we successfully enumerated all automorphic EPs for all Γ isin FThe second problem is much more sophisticated to enumerate all EPs for all graphs in FFor the smallest three graphs in F the results were achieved via simple brute force see

corresponding tables in Supplement BFor HoSi we used a few complementary strategies in the search for all EPs First we attacked

partitions with ldquolargerdquo number of cells say s gt 5 Here we introduced extra parameter thesize of the smallest cell which varies from 1 to 9 Each such case was considered separately

On the second stage we step by step enumerated cases 2 le s le 5 by enumerating possiblecollapsed adjacency matrices for each case and for any such matrix enumerating all EPs

The description of our computer activities together with detailed discussion of the resultsis presented in [28] An extra advantage of the enumeration in HoSi is that it serves as a kindof a pleasant interaction of a human and a computer Indeed in spite of the fact that the mainpart of computation was fulfilled by GAP a human can follow search explain its logic and stepby step to comprehend all ongoing results

We admit however that the extra advantage of HoSi is that here parameter micro takes itssmallest possible value of 1 (for a primitive SRG) As soon as micro gt 1 and v is growing theproblem is becoming essentially more difficult

This is why already for the Gewirtz graph with v = 56 we only succeeded in enumeration ofall EPs for which the stabilizer has order at least 2 There are 688 such EPs The enumerationof the rigid EPs cannot be completed by a computer in a reasonable time

The full enumeration of all EPs for the largest two graphs in F (on 77 and 100 vertices) atthis stage looks intractable Only modest particular cases may be proceeded efficiently

We refer to Supplement B for Tables 5 6 and 7 which summarize our activities for bothconsidered problems see [28] for more information

As was mentioned in the introduction one of the main goals of this project is to detect anumber of ldquonicerdquo EPs which may serve as a training model for future search of new primitivetfSRGs At this stage this kind of job only partially relies on the support from computer finallya humanrsquos insight still turns out to be very significant Below we report about interestinginterpretations created by us for a handful of detected EPs

8 Quadrangle and Atkinson EPs of NL2(10)

Recall that Γ = NL2(10) has100middot77middot6middot5

8 = 28875 quadrangles This is a simple result obtainedon a combinatorial level without any knowledge of structure of Γ

Provided that Γ and G = Aut(Γ) are known we easily obtain (with the use of a computer)that all quadrangles in Γ form one orbit under G and stabilizer H of a quadrangle in G hasorder 3072 is isomorphic as abstract group to (Z4 times Z2)(Z4 times Z2)) Z2) Z2) Z3) Z2) Z2

and has in action on V (Γ) four orbits of lengths 4 8 24 and 64Thus we may consider an automorphic EP of size s = 4 There is sense to try again

combinatorial arguments in order to determine all invariants of this EP without any priorknowledge of Γ and its group Fortunately this turns out to be possible

Proposition 4 Let τ be a metric decomposition with respect to a prescribed quadrangle Qinside of Γ Then τ is EP s = 4 sizes of cells are 4 8 24 64 and (with respect to this

114

Triangle-free strongly regular graphs Klin Ziv-Av

ordering of cells) B =

2 4 0 162 0 12 80 4 2 161 1 6 14

See proof in [28]In principle next stage should be to describe a model of NL2(10) in terms of the group

H of order 3072 or one of its subgroups which is transitive on all cells of the quadrangle EPNevertheless in this text we are avoiding this task Instead of we prefer to split the quadrangleEP to one with larger number of cells and to proceed with that new one

A note [1] was published before the announcement of CFSG The author considered 13parameter sets for tfSRGs which may be also rank 3 graphs with the number v of verticeswhere 100 lt v le 1000 and proved that such graphs can not be constructed with the aid ofknown 2-transitive permutation groups Part of exposed details is related to consideration of aconfiguration A (graph K33 minus one edge) in putative graph

We got impression that [1] is overseen through a generation of mathematicians and it mightbe helpful to analyze existence of A (we call it Atkinson configuration) in known tfSRGs

It turns out that A appears only in graphs on 77 and 100 vertices Here we analyze itsposition in Γ = NL2(10)

Let us fix at A a quadrangle for example with the vertices a b c f Then two extra ver-tices have two neighbors in the selected quadrangle namely ends of two non-edges respectively

Now we embed A into the considered above quadrangle decomposition splitting in it cell ofsize 8 into two cells of size 2 (exactly our d e) and the remainder This immediately impliessplit of the cell of size 64 into two cells of sizes 16 and 48 The cell of size 24 is forced to besplit into subcells of sizes 12 6 6 depending on the number of neighbors in d e being 1 2and 0 respectively

A more careful analysis (see [28]) shows that we are still getting an EP

Proposition 5 A metrical decomposition τ(A) of a tfSRG with the parameters of NL2(10)with respect to configuration A is EP with s = 8 and cells of sizes 4 2 16 48 6 12 6 6 Ithas collapsed matrix B as follows with Spec(B) = 22 25 (minus8)2

B =

2 1 4 12 3 0 0 02 0 8 0 0 6 6 01 1 2 12 0 3 0 31 0 4 10 1 3 2 12 0 0 8 0 6 2 40 1 4 12 3 2 0 00 2 0 16 2 0 0 20 0 8 8 4 0 2 0

Originally the proof was obtained with the aid of com-puter analysis of Γ = NL2(10) Later on an outline of asimilar proof as for quadrangle configuration was againobtained without prior knowledge of Γ

Further consideration of τ(A) was fulfilled inside ofknown graph Γ and its group Aut(Γ) It turns out thatH = Aut(τ(A)) sim= D4timesS4 is a group of order 192 H hasexactly 8 orbits on the set V (Γ) thus A is an automorphicEP

Describing further stabilizers of H on each of the 8orbits we elaborated the following ad hoc model of Γ

We start from the auxiliary graph ∆ depicted in Figure 2We identify elements of each orbit in τ(A) with suitable sets of structures described with

the aid of ∆ In fact each set of structures appears as orbit of action of the group H Thus itis enough to describe a representative of each orbit

For example the elements in the cell of size 16 are the vertices of ∆ while the elements ofthe cell of size 4 are the four columns of ∆ The most tricky to find was a representation of the7th cell of size 6

115

Triangle-free strongly regular graphs Klin Ziv-Av

12 13 14 15

8 9 10 11

4 5 6 7

0 1 2 3

Figure 2 Auxiliary graph ∆

We think that this piecewise model of Γ appearing from areasonably small solvable group of order 192 may serve as anoptimistic message for those researchers who are hunting for newtfSRGs see also comments in Section 11

9 Some modifications of Robertson

model

The Robertson model of the Hoffman-Singleton graph (see Figure1) partitions the vertices into five pentagons and five pentagramsand describes a simple arithmetic rule for the edges connectingpentagons and pentagrams (see Section 4) Let pij (qij) be vertexj of pentagon (pentagram) i

Since NL2(10) has an EP to two cells of size 50 where theinduced graph on each cell is isomorphic to HoSi this model can be extended to a model ofNL2(10)

In both cases we get an EP with a collapsed adjacency matrix that has a transitive au-tomorphism group (a permutation g isin Sn is an automorphism of a matrix M isin F

ntimesn if thepermutation matrix Mg commutes with M) We are therefore interested in equitable partitionswith this property

In the list of equitable partitions of HoSi we find another such partition with 10 cells of sizefive The collapsed adjacency matrix of this partition isM The spectrum ofM is 7 24 (minus3)5so it has the full spectrum of HoSi

M =

0 2 2 0 0 0 0 1 1 12 0 1 0 1 2 0 0 1 02 1 0 2 0 0 1 0 0 10 0 2 0 1 1 2 0 0 10 1 0 1 0 2 0 1 0 20 2 0 1 2 0 1 0 1 00 0 1 2 0 1 0 1 2 01 0 0 0 1 0 1 0 2 21 1 0 0 0 1 2 2 0 01 0 1 1 2 0 0 2 0 0

The cells of this partition can be de-scribed in the Robertson model of HoSi foreach i isin [1 5] we construct two cellsp11+i p21+i p32+i p44+i p52+iq11+i q21+i q35+i q43+i q55+i

If we consider this matrix M as the adjacencymatrix of a color graph then the basic graph for thecolor 1 is the Petersen graph while the basic graphfor the color 2 is a cycle of length 10 For compar-ison acting similarly with the Robertson partitionwe get a graph K55

The stabilizer of the (ordered) partition inAut(HoSi) is isomorphic to the dihedral group D5

of order 10 as is the automorphism group of M

The coherent closure of the partition (more specifically of the graph with its vertices coloredaccording to the partition) is a Schurian coherent configuration of rank 300 with the stabilizerof the partition as its automorphism group

This EP of HoSi can be extended to an EP of NL2(10) of 20 independent sets of size 5 Inthis case the matrix has spectrum 22 213 (minus8)6 so this EP has full spectrum as well

The automorphism group of this matrix has order 240 and is isomorphic to Z2 times S5 whilethe stabilizer of the ordered partition is again D5 of order 10

The coherent closure of the partition is a Schurian coherent configuration of rank 1200 withthe stabilizer of the partition as its automorphism group

116

Triangle-free strongly regular graphs Klin Ziv-Av

7 7 7

7 7 7

7 74 4

2 2 2

2 2 2

Figure 3 AEP of Gewirtz graph by a semiregular subgroup of order 7

10 A few more models

The calculated data both about embeddings of tfSRGs inside tfSRGs and about EPs can beused to present new models and constructions for tfSRGs Here we offer a few examples withoutgoing into a lot of details

Example 1 (Two Wagner graphs in Clebsch graph) Wagner graph also known as Mobiusladder of order 8 denoted by M8 is a cubic graph on 8 vertices A simple model for it is aCay(Z8 1minus1 4) The spectrum is 3 12minus1 and Aut(M8) = D8

In one of the three EPs of 5 into two cells of size 8 the induced subgraph on each cell isthe Wagner graph The stabilizer of ordered partition inside Aut(5) is D8

Example 2 (Non-automorphic EP of HoSi) We can construct an EP of HoSi into two cellsby taking one of the cells to be the 20 vertices of two Petersen graphs (any two pentagons andtwo pentagrams in Robertson model) The stabilizer of this partition is D10 of order 20 so itis not automorphic

Example 3 (Inside Gewirtz graph six 7-cycles) There is one automorphic partition of Gewirtzgraph into 8 cells of size 7 The induced graph on 6 of the cells is a cycle of length 7 while theinduced graph on the other two cells has no edges

From the intersection diagram (Figure 3) we see that this partition can be merged to an

equitable partition with 2 cells of sizes 42 and 14 with adjacency matrix

(8 26 4

)

The induced graph on the cell of size 42 of valency 8 is a coherent graph Its coherent closureis a rank 6 imprimitive non-Schurian association scheme This graph is not a rational graphwith spectrum 8 222 (minus1)7 (1 +

radic2)6 (1minus

radic2)6

The induced graph on the cell of size 14 is a bipartite graph with two parts of size 7 It isthe co-Heawood graph that is the bipartite complement to the Heawood graph the Levi graph ofFano plane This is by necessity true since a regular bipartite graph of valency 4 and order 14in which every vertex belongs to exactly one quadrangle is the co-Heawood graph

A Brouwer ([6]) notes that this co-Heawood graph is a subgraph of the Gewirtz graph

Example 4 (Gewirtz graph inside of Mesner graph through the group Z7) We start witha semiregular subgroup Z7 of order 7 this time inside of the automorphism group of Mesnergraph We get an AEP with 11 cells of size 7 the collapsed matrix N of order 11 is presentedin [28] It turns out that Aut(N) sim= S2 ≀ S3 (the wreath product) is a group of order 72 withorbits of sizes 6 2 13 There are three non-equivalent possibilities to merge from this AEP a

117

Triangle-free strongly regular graphs Klin Ziv-Av

non-automorphic EP with 3 cells of sizes 14 21 42 and a collapsed matrix

4 6 6

4 0 12

2 6 8

which

has full spectrumEach of the cases provides also an EP for the Gewirtz graph with two cells of sizes 14 and

42 Thus as a by product we obtain other (cf Example 3) embeddings of the co-Heawoodgraph into the Gewirtz graph This example demonstrates ldquoirregularitiesrdquo which may causeinteresting EPs unpredictable from the first sight

Example 5 (Clebsch graph inside NL2(10)) Recall that up to the automorphism group ofΓ = NL2(10) there is one embedding of 5 into Γ The equitable partition resulting from thisembedding allows us to describe another model for NL2(10)

We start from a group H2 = Z4 times S4 of order 96 with orbits of lengths 16 16 48 128 The collapsed adjacency matrix of the corresponding automorphic equitable partition is Bprimeprime(shown below) Clearly the induced graph on the first cell of the partition is isomorphic to 5

In principle one may try as in previous sections to reconstruct the corresponding matrix Bfrom scratch not relying on knowledge of the graph Γ and its group A promising starting pointwould be justification of existence of a coclique of size 8 and its adjacency with the induced 5

We however prefer to exploit at this stage another possibility Namely it turns out thatthe stabilizers of A and 5 inside of Γ have maximal possible intersection K = Z4timesS3 of order24 K defines an AEP with 11 cells of sizes 2 4 4 6 6 6 12 12 12 12 24 and matrix Bprime

Bprime =

0 2 2 0 0 6 0 6 0 6 01 2 1 3 0 0 3 3 3 0 61 1 2 0 3 0 3 0 3 3 60 2 0 0 4 2 2 0 2 6 40 0 2 4 0 2 2 6 2 0 42 0 0 2 2 0 4 0 4 0 80 1 1 1 1 2 4 3 2 3 41 1 0 0 3 0 3 2 3 3 60 1 1 1 1 2 2 3 4 3 41 0 1 3 0 0 3 3 3 2 60 1 1 1 1 2 2 3 2 3 6

Bprimeprime =

5 4 9 3 14 2 12 0 43 4 11 3 14 0 12 2 42 8 6 6 0

It is easy to recognize how Bprime is split from the matrix B of the metric EP of the configurationA Then we merge the Bprime into Bprimeprime

The cell of size 48 is a merging of the last 3 cells the cell of size 8 is merging of cell of sizes2 and 6 (5th cell) while the cell of size 12 is a merging of two remaining cells of size 6 Eachcell of size 16 is a merging of cells of sizes 4 and 12

Example 6 (Reconstruction of NL2(10) from a subgroup of order 2) Using information inthe atlas [26] (or direct calculation using GAP) we see that G = Aut(NL2(10)) containsone conjugacy class of involutions with no fixed points From such an involution i we getan AEP into 50 cells of size 2 We investigated the quotient graph Γ of this AEP and itscollapsed adjacency matrix denoted by B The structure of Γ may be recovered by consideringthe centralizer CG(i) However we prefer to rely on information of combinatorial nature The

graph Γ has a natural EP into cells of sizes 20 and 30 (representing edges and non-edges inNL2(10))

The induced (color) graph on 20 vertices is the graph K1010 from which a 1-factor is removedThe induced graph on 30 vertices is the incidence graph of generalized quadrangle of order

2 GQ(2)

118

Triangle-free strongly regular graphs Klin Ziv-Av

This equitable partition corresponds to an equitable partition of Γ = NL2(10) into two cellsof sizes 40 and 60

11 Concluding comments

The presentation in this extended abstract is a tip of iceberg Much more concrete informationmay be found in [28] while [27] subject of ongoing polishing and development will reflect alldetected computer data about the graphs from family F We see also more potential to returnagain to construction of further models for graphs in F in particular relying on non-automorphicEPs The new attempts to achieve at least in part enumeration of all EPs of restricted size ofcells for graphs on 77 and 100 vertices are also on agenda The paper [16] as well as a numberof private communications of M Macaj to author MK create a background to attack in nearestfuture the problem of existence of new tfSRGs with relatively small parameters The parameterset on 162 vertices seems to be first interesting and realistic target

It should be mentioned that the results in [16] as well as in numerous private communica-tions of M Macaj to the author MK show that a putative new primitive triangle free stronglyregular graph Γ with prescribed parameters will have a relatively small automorphism groupAut(Γ) very concrete restrictions on the cycle structure of elements in Aut(Γ) are typicallyavailable Transformation of those restrictions to the language of equitable partitions may beregarded as a reasonable starting platform for attempts to construct a new tfSRG

Note however that many experts in AGT do not believe at all that a new tfSRG existsNeedless to say that this question creates a great challenge for the modern scientific community

Acknowledgments

We thank Andy Woldar for ongoing collaboration in this project We acknowledge Sven Re-ichard and Christian Pech for sharing with us their draft versions of COCO II Ongoing com-munication with Martin Macaj is very helpful and stimulative We also are pleased to thankPeter Cameron and Jozef Siran for interest expressed to the topic of our research

References

[1] M D Atkinson On rank 3 groups having λ = 0 Canad J Math 29(4)845ndash847 1977

[2] L Babel S Baumann and M Luedecke Stabcol An efficient implementation of the weisfeiler-leman algorithm Technical Report TUM-M9611 Technical University Munich 1996

[3] L Babel I V Chuvaeva M Klin and D V Pasechnik Algebraic combinatorics in mathematicalchemistry methods and algorithms ii program implementation of the weisfeiler-leman algorithmTechnical Report TUM-M9701 Fakultat fur Mathematik TU Munc 1997 httpwww-litmatumdeveroeffhtml96068019html

[4] C T Benson and N E Losey On a graph of Hoffman and Singleton J Combinatorial TheorySer B 1167ndash79 1971

[5] A E Brouwer A M Cohen and A Neumaier Distance-regular graphs volume 18 of Ergeb-nisse der Mathematik und ihrer Grenzgebiete (3) [Results in Mathematics and Related Areas (3)]Springer-Verlag Berlin 1989

[6] AE Brouwer httpwwwwintuenl~aebgraphs

119

Triangle-free strongly regular graphs Klin Ziv-Av

[7] Dragos Cvetkovic Peter Rowlinson and Slobodan Simic An introduction to the theory of graphspectra volume 75 of London Mathematical Society Student Texts Cambridge University PressCambridge 2010

[8] I A Faradzev and M H Klin Computer package for computations with coherent configurationsIn Proc ISSAC pages 219ndash223 Bonn 1991 ACM Press

[9] I A Faradzev M H Klin and M E Muzichuk Cellular rings and groups of automorphisms ofgraphs In Investigations in algebraic theory of combinatorial objects volume 84 of Math Appl(Soviet Ser) pages 1ndash152 Kluwer Acad Publ Dordrecht 1994

[10] The GAP Group GAP ndash Groups Algorithms and Programming Version 4412 2008

[11] Chris Godsil and Gordon Royle Algebraic graph theory volume 207 of Graduate Texts in Mathe-matics Springer-Verlag New York 2001

[12] Paul R Hafner On the graphs of Hoffman-Singleton and Higman-Sims Electron J Combin11(1)Research Paper 77 33 pp (electronic) 2004

[13] M Klin C Pech and P-H Zieschang Flag algebras of block designs i initial notions steiner2-designs and generalized quadrangles November 1998

[14] Mikhail Klin Christian Pech Sven Reichard Andrew Woldar and Matan Ziv-Av Examples ofcomputer experimentation in algebraic combinatorics Ars Math Contemp 3(2)237ndash258 2010

[15] Mikhail H Klin and Andrew J Woldar Dale Mesner Higman amp Sims and the strongly regulargraph with parameters (100 22 0 6) Bull Inst Combin Appl 6313ndash35 2011

[16] Martin Macaj and Jozef Siran Search for properties of the missing Moore graph Linear AlgebraAppl 432(9)2381ndash2398 2010

[17] Spyros S Magliveras The subgroup structure of the Higman-Sims simple group Bull AmerMath Soc 77535ndash539 1971

[18] B D McKay nauty userrsquos guide (version 15) 1990

[19] Dale Marsh Mesner An investigation of certain combinatorial properties of partially balancedincomplete block experimental designs and association schemes with a detailed study of designs oflatin square and related types ProQuest LLC Ann Arbor MI 1956 Thesis (PhD)ndashMichiganState University

[20] Dale Marsh Mesner Negative latin square designs Mimeo notes 410 Institute of Statistics UNCNC 1964

[21] George Neil Robertson Graphs minimal under girth valency and connectivity constraints Pro-Quest LLC Ann Arbor MI 1969 Thesis (PhD)ndashUniversity of Waterloo (Canada)

[22] Martin Schonert et al GAP ndash Groups Algorithms and Programming ndash version 3 release 4 patch-level 4 Lehrstuhl D fur Mathematik Rheinisch Westfalische Technische Hochschule AachenGermany 1997

[23] Leonard H Soicher GRAPE a system for computing with graphs and groups In Groups andcomputation (New Brunswick NJ 1991) volume 11 of DIMACS Ser Discrete Math TheoretComput Sci pages 287ndash291 Amer Math Soc Providence RI 1993

[24] Edwin R van Dam Three-class association schemes J Algebraic Combin 10(1)69ndash107 1999

[25] B Weisfeiler On construction and identification of graphs Number 558 in Lecture Notes in MathSpringer Berlin 1976

[26] Robert Wilson Peter Walsh Jonathan Tripp Ibrahim Suleiman Richard Parker Simon NortonSimon Nickerson Steve Linton John Bray and Rachel Abbott Atlas of finite group representa-tions - version 3 httpbrauermathsqmulacukAtlasv3

[27] M Ziv-Av Protocols with computer data related to the investigation of known primitive trangle-free strongly regular graphs httpwwwmathbguacil~zivavmath

[28] M Ziv-Av Results of computer algebra calculations for triangle free strongly regular graphshttpwwwmathbguacil~zivavmatheqpartpdf

120

Triangle-free strongly regular graphs Klin Ziv-Av

A Data about embeddings of tfSRGs inside tfSRGs

Quadrangle edge 2 edges 3 4 5 6Pentagon 0 5 0 0 0 0 0Petersen 0 15 15 5 0 0 0Clebsch 40 40 60 40 10 0 0HoSi 0 175 7875 128625 845250 2170350 1817550

Gewirtz 630 280 15120 245280 1370880 2603664 1643040Mesner 6930 616 55440 1330560 10589040 28961856 24641232NL2(10) 28875 1100 154000 5544000 67452000 301593600 477338400

7 edges 8 9 10 11HoSi 40150 15750 3500 350 0

Gewirtz 104160 7560 1400 112 0Mesner 3664320 166320 30800 2464 0NL2(10) 258192000 14322000 924000 154000 11200

Table 1 Number of imprimitive tfSRGs inside tfSRGs

Quadrangle edge 2 edges 3 4 5 6Pentagon 0 1 0 0 0 0 0Petersen 0 1 1 1 0 0 0Clebsch 1 1 1 1 1 0 0HoSi 0 1 1 4 10 21 15

Gewirtz 1 1 2 9 30 48 36Mesner 1 1 1 7 26 56 50NL2(10) 1 1 1 2 7 14 17

7 edges 8 9 10 11HoSi 8 1 1 1 0

Gewirtz 5 2 2 1 0Mesner 14 2 2 1 0NL2(10) 14 3 2 2 1

Table 2 Number of orbits of imprimitive tfSRGs inside tfSRGs

Pentagon Petersen Clebsch HoSi Gewirtz Mesner NL2(10)Pentagon 1 12 192 1260 8064 88704 443520Petersen 1 16 525 13440 1921920 35481600Clebsch 1 0 0 0 924000HoSi 1 0 0 704

Gewirtz 1 22 1030Mesner 1 100NL2(10) 1

Table 3 Number of primitive tfSRGs inside tfSRGs

121

Triangle-free strongly regular graphs Klin Ziv-Av

Pentagon Petersen Clebsch HoSi Gewirtz Mesner NL2(10)Pentagon 1 1 1 1 1 1 1Petersen 1 1 1 1 9 5Clebsch 1 0 0 0 1HoSi 1 0 0 1

Gewirtz 1 1 1Mesner 1 1NL2(10) 1

Table 4 Number of orbits of primitive tfSRGs inside tfSRGs

B Data about equitable partitions of primitive tfSRGs

Pentagon Petersen Clebsch HoSi Gewirtz Mesner NL2(10)EP 3 11 46 163Aut 3 11 38 89 154 236 607

Table 5 Number of orbits of equitable partitions and of automorphic equitable partitions forknown tfSRGs

Size 1 3 5 TotalEP 1 1 1 3Aut 1 1 1 3

Size 1 2 3 4 5 6 7 10 TotalEP 1 2 2 2 1 1 1 1 11Aut 1 2 2 2 1 1 1 1 11

Size 1 2 3 4 5 6 7 8 9 10 12 16 TotalEP 1 4 6 12 5 7 3 4 1 1 1 1 46Aut 1 4 5 10 3 5 2 4 1 1 1 1 38

Size 1 2 3 4 5 6 7 8 9 10 11EP 1 6 8 16 18 20 19 18 11 11 8Aut 1 4 5 7 6 9 9 11 4 9 4Size 12 13 14 15 16 18 20 28 30 50 TotalEP 7 7 2 2 1 2 3 1 1 1 163Aut 4 4 2 1 1 2 3 1 1 1 89

Table 6 Numbers of EPs and automorphic EPs by size of partition for four small graphs

122

Triangle-free strongly regular graphs Klin Ziv-Av

Size 1 2 3 4 5 6 7 8 9 10 11 12 13Aut 1 5 9 12 12 14 15 16 14 11 7 7 6Size 14 16 17 18 19 20 23 28 31 32 35 56 TotalAut 5 3 3 2 2 4 1 1 1 1 1 1 154

Size 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15Aut 1 3 5 8 11 10 20 14 19 12 18 12 16 9 14Size 16 17 18 19 20 21 23 25 29 33 41 45 49 77 TotalAut 5 12 5 9 1 8 4 8 6 2 1 1 1 1 236

Size 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15Aut 1 6 15 21 28 29 31 42 34 35 37 49 30 31 27Size 16 17 18 19 20 21 22 23 24 25 26 27 28 29Aut 26 18 18 13 26 14 11 7 9 6 6 5 2 1Size 30 31 32 33 34 35 39 40 45 50 53 60 65 100 TotalAut 7 1 3 2 2 3 1 4 1 1 1 1 1 1 607

Table 7 Numbers of automorphic EPs by size of partition for larger graphs

123

Usage of Invariants for Symbolic Verification of

Requirements

Short Paper

Alexander Letichevsky1 Alexander Godlevsky1 Anton Guba1 Alexander

Kolchin1 Oleksandr Letychevskyi1 Vladimir Peschanenko2

1 VM Glushkov Institute of Cybernetics Kiev Ukraineletcyfranet godlissorgua antongubaukrnet kolchin avyahoocom litissorgua

2 Kherson State University Kherson Ukrainevladimiriusgmailcom

The main goal of the paper is finding of pre- and post-invariants for transitions betweensymbolic states in the system that must be verified and use them for verification purposesSystems are specified by basic protocols [1] This specification defines a transition system withtransitions s rarr s

prime where s and sprime are symbolic states b is a basic protocol The main problem

of verification is a reachability problem for given properties expressed in specification logiclanguage

We present double approximation method of verification based on computing invariants Themethod is implemented as an iterative algorithm which solves in parallel reachability problemand computes lower and upper approximations of invariants for basic protocols

Currently there are a lot of significant works devoted to computing invariants which areconsidered for loops in programs Loops are marked explicitly - syntactic constructions likewhile and others When we deal with requirement specifications we do not deal with explicitmarked loops moreover basic protocols provide non-deterministic order Existing methodsusually ignore the conditions of the loops Invariants formulae which is obtained as a resultinclude unreachable states and therefore could be used in verification only in the following wayif a property does not intersect with the invariant formula then it is unreachable if intersectsthen conclusion cannot be done Therefore the problem of modification of existing methodsor to develop a new algorithm that could be applied in practice of requirements verification isactual

Research of problems of automatic program invariants generation for a variety of data al-gebras was performed starting from 70-th years in Institute of Cybernetics of NAS of UkraineTheir main results are presented in [2] Double approximation method is the dynamic iterativemethod of invariants generation and it is based on these results and adapted for requirementsverification The method also can be applied to program verification if a program is consideredas a special case of basic protocol specification The method has been implemented in VRS(Verification of Requirement Specifications) system [3] and IMS (Insertion Modeling System)system [4]

References

[1] A Letichevsky J Kapitonova V Volkov A Letichevsky Jr S Baranov V Kotlyarov T WeigertSystem Specification with Basic Protocols Cybernetics and System Analyses vol 4 2005 p 3-21

[2] Godlevsky AB Kapitonova YV Krivoy SL Letichevsky AA Iterative methods of programanalysis Cybernetics vol 2 1989 9-19

[3] Verification for Requirement Specification (VRS) httpissorguaISSVRStoolhtm lastviewed May 2013

[4] APS and IMS Systems httpapsystemorgua last viewed May 2013

124

Lebesgue Constants and Optimal Node Systems

via Symbolic Computations

Short Paper

Robert Vajda

University of Szeged Szeged Hungaryvajdarmathu-szegedhu

Abstract

Polynomial interpolation is a classical method to approximate continuous functionsby polynomials To measure the correctness of the approximation Lebesgue constantsare introduced For a given node system X(n+1) = x1 lt lt xn+1 (xj isin [a b])the Lebesgue function λn(x) is the sum of the modulus of the Lagrange basis polynomialsbuilt on X(n+1) The Lebesgue constant Λn assigned to the function λn(x) is its maximumover [a b] The Lebesgue constant bounds the interpolation error ie the interpolationpolynomial is at most (1 + Λn) times worse then the best approximation The minimumof the Λnrsquos for fixed n and interval [a b] is called the optimal Lebesgue constant Λlowast

n Forspecific interpolation node systems such as the equidistant system numerical results forthe Lebesgue constants Λn and their asymptotic behavior are known [3 7] However togive explicit symbolic expression for the minimal Lebesgue constant Λlowast

n is computationallydifficult In this work motivated by Rack [5 6] we are interested for expressing the minimalLebesgue constants symbolically on [minus1 1] and we are also looking for the characterizationof the those node systems which realize the minimal Lebesgue constants We exploited theequioscillation property of the Lebesgue function [4] and used quantifier elimination andGroebner Basis as tools [1 2] Most of the computation is done in Mathematica [8]

Acknowledgement The research of the author was partially supported by the HSRF(OTKA) grant number K83219

References

[1] D S Arnon - G E Collins - S McCallum Cylindrical Algebraic Decomposition I The BasicAlgorithm In Caviness-Johnson (eds) Quantifier Elimination and Cylindrical Algebraic Decom-position 136-151 Springer 1998

[2] B Buchberger Ein Algorithmus zum Auffinden der Basiselemente des Restklassenringes nach einemnulldimensionalen Polynomideal (An algorithm for finding the basis elements in the residue classring modulo a zero dimensional polynomial ideal) PhD Thesis Innsbruck 1965

[3] J S Hesthaven From electrostatics to almost optimal nodal sets for polynomial interpolation in asimplex SIAM J Numer Anal Vol 35 No 2 655-676 1998

[4] T A Kilgore A characterization of the Lagrange interpolating projection with minimal Tchebycheffnorm J Approx Theory 24 (1978) no 4 273-288

[5] H-J Rack An example of optimal nodes for interpolation International Journal of MathematicalEducation in Science and Technology 15 (3) 355-357 1984

[6] H-J Rack An example of optimal nodes for interpolation revisited Advances in Applied Mathe-matics and Approximation Theory Springer Proceedings in Mathematics amp Statistics Volume 41117-120 2013

[7] S J Simon Lebesgue constants in polynomial interpolation Annales Mathematicae et Informaticae33 109-123 2006

[8] Wolfram Research Inc Mathematica Version 90 Champaign Illinois 2012

125

Author Index

Alpuente Marıa 4

Ballis Demis 4

Buchberger Bruno 1

Comini Marco 19 31

Frechina Francisco 4

Ghourabi Fadoua 50

Godlevsky Alexander 124

Goto Mizuki 93

Guba Anton 124

Ida Tetsuo 50

Kakutani Yoshihiko 64

Kato Go 64

Kawano Yasuhito 64

Klin Mikhail 108

Kolchin Alexander 124

Kubota Takahiro 64

Letichevsky Alexander 124

Letychevskyi Oleksandr 124

Li Wei 2

Matringe Nadir 81

Moura Arnaldo 81

Neumann Severin 70

Ouaknine Joel 3

Peschanenko Vladimir 124

Rebiha Rachid 81

Sakurada Hideki 64

Sapina Julia 4

Takahashi Kazuko 50 93

Torella Luca 19 31

Vajda Robert 125

Yoshimaru Shizuo 93

Ziv-Av Matan 108

Keyword Index

algebraic number 125

automated verification 64

BB84 64

bottom-up semantics 31

computational model 93

computational origami 50

computer algebra 108

debugging 4

Distributed 70

elecronic cash protocol 93

equitable partitions 108

F4 70

formal methods 64

geometrical constraint solving 50

Groebner basis 125

Grobner Basis 70

induction scheme 93

invariants 124

knot fold 50

Lebesgue constant 125

Linear Algebra 81

maude 4

MPI 70

Parallel 70

polynomial interpolation 125

process calculi 64

program animation 4

property-oriented specifications 19

quantifier elimination 125

quantum cryptography 64

requirements specification 124

resultant 125

rewriting logic 4

semantics-based inference methods 19

slicing 4

Static Analysis 81

stepping 4

strongly regular graphs 108

symbolic verification 124

term rewriting 31

Term Rewriting Systems 19 31

Termination Analysis 81

theorem proving 50

theorem proving methods 93

  • Introduction
  • Preliminaries
  • Rewriting Modulo Equational Theories
  • Exploring the Computation Tree
    • Expanding a Program State
    • Computing a Fragment of the Computation Tree
      • Particularizing the Exploration
        • Interactive Stepper
        • Forward Trace Slicer
          • Implementation
          • Conclusions
          • Introduction
            • Notations
              • Many notions of equivalence
              • Deriving specifications from TRSs
                • An effective instance of the presented method
                  • Conclusions and future work
                  • Introduction
                  • Preliminaries
                  • Modeling the small-step rewriting behavior
                    • The semantic domain
                      • Linearizing Narrowing
                        • Operational denotations of TRSs
                          • Evaluation Function
                          • Properties of the TRS operational denotation
                            • Fixpoint denotations of TRSs
                              • Properties of the TRS fixpoint denotation
                                  • Conclusions
                                  • Technical Proofs
                                  • Introduction
                                  • Notations
                                  • Origami Geometrical Construction
                                    • Huzitas Fold Operations
                                    • Extensions
                                      • Knot Fold
                                        • Geometrical Properties
                                        • Geometrical Constraint Solving Approach
                                          • Regular Heptagon by the Knot Fold
                                            • Geometrical Constraints
                                            • Construction by Eos
                                            • Algebraic Interpretation
                                              • Proof
                                                • Theorem to Prove
                                                • Proof by Eos
                                                • Proof Results
                                                  • Conclusion
                                                    • Acknowledgments
                                                      • Introduction
                                                      • The Verifier
                                                      • Application to Shor and Preskills Security Proof
                                                      • Conclusions
                                                      • Introduction
                                                      • Notations
                                                      • Preliminaries
                                                      • Matrix Distribution
                                                      • Simplifying the F4 Algorithm
                                                      • Benchmarks
                                                      • Conclusion
                                                      • Introduction
                                                      • Linear Algebra and Linear Loop Programs
                                                      • Asymptotically Non-terminant Variable Values
                                                      • Automated generation of ANT loci
                                                        • The regular case
                                                        • The general case handling linear diagonalizable programs
                                                          • Discussions
                                                          • Conclusion
                                                          • Introduction
                                                          • Data Conversion Formalization
                                                            • Problem
                                                            • Solution
                                                              • Conversion from BS to BTREE
                                                              • Conversion from NAT to BS
                                                              • Conversion from NAT to BTREE
                                                                  • Modeling of an Electronic Cash Protocol
                                                                    • Ideal Electronic Cash
                                                                    • Definition of money
                                                                    • Creation of money from a natural number
                                                                    • Calculation of the amount of money
                                                                    • Payment
                                                                      • Proof of Properties
                                                                        • Well-definedness of cash
                                                                        • Well-definedness of pay
                                                                        • Divisibility
                                                                          • Discussion
                                                                          • Conclusion
                                                                          • Introduction
                                                                          • Strongly regular graphs a brief survey
                                                                          • Computer algebra tools in AGT
                                                                          • The seven known primitive triangle-free strongly regular graphs
                                                                          • Embeddings of tfSRGs into known primitive tfSRGs
                                                                          • Equitable partitions
                                                                          • Search for equitable partitions
                                                                          • Quadrangle and Atkinson EPs of NL2(10)
                                                                          • Some modifications of Robertson model
                                                                          • A few more models
                                                                          • Concluding comments
                                                                          • Data about embeddings of tfSRGs inside tfSRGs
                                                                          • Data about equitable partitions of primitive tfSRGs
Page 7: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 8: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 9: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 10: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 11: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 12: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 13: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 14: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 15: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 16: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 17: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 18: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 19: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 20: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 21: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 22: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 23: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 24: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 25: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 26: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 27: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 28: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 29: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 30: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 31: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 32: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 33: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 34: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 35: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 36: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 37: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 38: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 39: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 40: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 41: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 42: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 43: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 44: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 45: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 46: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 47: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 48: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 49: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 50: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 51: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 52: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 53: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 54: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 55: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 56: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 57: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 58: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 59: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 60: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 61: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 62: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 63: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 64: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 65: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 66: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 67: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 68: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 69: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 70: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 71: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 72: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 73: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 74: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 75: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 76: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 77: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 78: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 79: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 80: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 81: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 82: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 83: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 84: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 85: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 86: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 87: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 88: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 89: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 90: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 91: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 92: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 93: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 94: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 95: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 96: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 97: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 98: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 99: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 100: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 101: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 102: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 103: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 104: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 105: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 106: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 107: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 108: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 109: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 110: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 111: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 112: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 113: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 114: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 115: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 116: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 117: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 118: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 119: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 120: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 121: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 122: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 123: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 124: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 125: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 126: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 127: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 128: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 129: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 130: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 131: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 132: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 133: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 134: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 135: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,
Page 136: Symbolic Computation in SoftwareScience · 2013. 7. 1. · Iliano Cervesato Carnegie Mellon University - Qatar Cam-pus, Qatar Horatiu Cirstea Loria, France Ju¨rgen Giesl RWTH Aachen,