Structural and semantic pattern matching analysis in Haskell

09/09/2019
by   Pavel Kalvoda, et al.
0

Haskell functions are defined as a series of clauses consisting of patterns that are matched against the arguments in the order of definition. In case an input is not matched by any of the clauses, an error occurs. Therefore it is desirable to statically prove that the function is defined for all well-typed inputs. Conversely, a clause that can never be matched also indicates a likely defect. Analyzing these properties is challenging due to presence of GADT and guards as well as due to Haskell's lazy evaluation. We implement a recently proposed algorithm that unifies and extends the related analyses implemented in version 7 of the Glasgow Haskell Compiler. By using an SMT solver to handle the semantic constraints arising from pattern guards, we achieve a further improvement in precision over the existing GHC 8.0.1 implementation. We present a tool that uses the analysis to give sound, more precise, and actionable warnings about program defects.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
11/07/2018

Unification in Matching Logic - Extended Version

Matching Logic is a framework for specifying programming language semant...
research
11/07/2018

Unification in Matching Logic

Matching Logic is a framework for specifying programming language semant...
research
05/23/2019

Set Constraints, Pattern Match Analysis, and SMT

Set constraints provide a highly general way to formulate program analys...
research
02/05/2022

Source Matching and Rewriting

A typical compiler flow relies on a uni-directional sequence of translat...
research
05/10/2021

Identifying Overly Restrictive Matching Patterns in SMT-based Program Verifiers

Universal quantifiers occur frequently in proof obligations produced by ...
research
10/10/2018

Smtlink 2.0

Smtlink is an extension of ACL2 with Satisfiability Modulo Theories (SMT...
research
06/01/2020

Nonlinear observability algorithms with known and unknown inputs: analysis and implementation

The observability of a dynamical system is affected by the presence of e...

Please sign up or login with your details

Forgot password? Click here to reset