-
Notifications
You must be signed in to change notification settings - Fork 6
Abstracts.2021.NbE
by Carlos Tomé Cortiñas
In this talk I will present the technique of Normalization by Evaluation through the somewhat simple example of normalization for the theory of free monoids. Below you can find a detailed outline of the talk.
-
Examples of normal forms:
- Multiplication on natural numbers with variables:
x2^2 * (x3^1 * (x58^4 * (x102^1 * 57)))
- Disjunctive normal forms of classical propositional
logic:
(A ∧ B) ∨ ((¬A ∧ B) ∨ (¬A ∧ ¬B))
(full) or¬A ∨ B
(prime) - Natural deduction for noncommutative multiplicative conjunction
⊗
of linear propositional logic - Simply-typed lambda calculus/Natural deduction for intuitionistic propositional logic
- Multiplication on natural numbers with variables:
-
The unityped theory of free monoids, i.e. the unityped theory of monoids with constants (but no additional equations)
-
Normal forms: either unit or a right-associated nonempty list of constants; alternatively: left-associative, or nonempty lists of constants ending with unit
-
Normalization by evaluation (Haskell)
- Observation: normal forms support/are closed under the monoid operations
- Interpretation of the syntax/language of monoids in an arbitrary monoid
- Putting things together: a normalization function for formal monoid expressions
- Haskell code
In a programming language of your choice, implement normalization by evaluation for:
- Free monoids using difference lists
- Free commutative monoids
- Free monoids with variables
- Simple arithmetic expressions with variables
- Free Boolean algebras
- Ayberk's extension suggestion: normalize up to equisatisfiability instead of (logical) equivalence
- Andreas' extension suggestion: normalize to (acyclic directed) graphs that are not necessarily trees to allow for sharing of subterms
In case it might be helpful, here's again the template that the talk followed: First of all pick
- your choice of theory
T
(perhaps redo the one from the talk, or give one of the exercises a try)
then start with
- the type class of models of
T
(given by sorts, operations and equations; note that the theories from the talk and the exercises actually talk about just a single sort*
) - the data type of terms of
T
(generated by the operations) - the evaluation function
eval
of terms in a given a model
and continue with
- your data type of normal forms (perhaps skip this step on the first attempt),
- your model
𝒩
, - your reification function
reify
of elements in𝒩
to normal forms (or to arbitrary terms if step 4 was skipped on this attempt) - your normalization function
norm = reify ∘ eval
before ending with
- your proof of correctness, i.e.
∀ t, u. t =T u ⟺ norm(t) = norm(u)
(perhaps skip this step on the first and second attempt, it was not presented in detail and should be split up into smaller steps)
- Nachiappan Valliappan, Reduction-based Normalization
- Joachim Lambek. Deductive Systems and Categories I. Syntactic Calculus and Residuated Categories. Math. Syst. Theory 2(4), pp. 287-318, 1968.
- Michael Hedberg. Normalising the Associative Law: An Experiment with Martin-Löf's Type Theory. Formal Aspects Comput. 3(3), pp. 218-252, 1991.
- Ilya Beylin, Peter Dybjer. Extracting a Proof of Coherence for Monoidal Categories from a Proof of Normalization for Monoids. TYPES 1995, pp. 47-61, 1995.
- Thorsten Altenkirch, Martin Hofmann, Thomas Streicher. Categorical Reconstruction of a Reduction Free Normalization Proof. Category Theory and Computer Science 1995, pp. 182-199, 1995.
- Peter Dybjer. Normalization by Evaluation. Notes: Slides for a course at Midlands Graduate School in the Foundations of Computing Science (MGS) 2009, Leicester, UK.