Nils Anders Danielsson

dblp:82/6336 · DBLP profile ↗
← Back
13ranked-venue papers
9as first author
4since 2021 · last 2026
0000-0001-8688-0333ORCID · corroborated

Domains — the database's venue-derived domains; a paper can count in several

Software engineering, systems software and programming languages · 9 · 6 first-author · 3 since 2021Theory of computation · 5 · 3 first-author · 1 since 2021
YearPublicationVenuePosition
2026 Normalisation for First-Class Universe Levels
abstract
Various mechanisms are available for managing universe levels in proof assistants based on type theory. The Agda proof assistant implements a strong form of universe polymorphism in which universe levels are internalised as a type, making levels first-class objects and permitting higher-rank quantification via ordinary Π-types. We prove normalisation and decidability of equality and type-checking for a type theory with first-class universe levels inspired by Agda. We also show that level primitives can safely be erased in extracted programs. Our development is formalised in Agda itself and builds upon previous work which uses logical relations on extrinsically typed syntax.
Nils Anders Danielsson, Naïm Camille Favier, Ondrej Kubánek
Proc. ACM Program. Lang.1
2026 On Recursion in Graded Modal Type Theory
abstract
We present a graded modal type theory with recursion over natural numbers and prove formally in Agda that it handles resources correctly, in the sense that an abstract machine accesses resources the "correct" number of times. The theory is parametrized, and can for instance be instantiated with grades for erasure, linear types, or affine types. The correctness proof shows that our usage counting is sound. Our eliminator for natural numbers is flexible as it enables different resource-usage patterns and practical in the sense that it can be used both to define functions with expected usage counts for the arguments. Further, it can be used to encode other data types, using large elimination. Finally, we adapt our resource correctness proof to show correctness also for grades tracking information flow, in the form of a non-interference property.
Oskar Eriksson, Andreas Abel 0001, Nils Anders Danielsson
Proc. ACM Program. Lang.3
2023 A Graded Modal Dependent Type Theory with a Universe and Erasure, Formalized
abstract
We present a graded modal type theory, a dependent type theory with grades that can be used to enforce various properties of the code. The theory has Π-types, weak and strong Σ-types, natural numbers, an empty type, and a universe, and we also extend the theory with a unit type and graded Σ-types. The theory is parameterized by a modality, a kind of partially ordered semiring, whose elements (grades) are used to track the usage of variables in terms and types. Different modalities are possible. We focus mainly on quantitative properties, in particular erasure: with the erasure modality one can mark function arguments as erasable. The theory is fully formalized in Agda. The formalization, which uses a syntactic Kripke logical relation at its core and is based on earlier work, establishes major meta-theoretic properties such as subject reduction, consistency, normalization, and decidability of definitional equality. We also prove a substitution theorem for grade assignment, and preservation of grades under reduction. Furthermore we study an extraction function that translates terms to an untyped λ-calculus and removes erasable content, in particular function arguments with the “erasable” grade. For a certain class of modalities we prove that extraction is sound, in the sense that programs of natural number type have the same value before and after extraction. Soundness of extraction holds also for open programs, as long as all variables in the context are erasable, the context is consistent, and erased matches are not allowed for weak Σ-types.
Andreas Abel 0001, Nils Anders Danielsson, Oskar Eriksson
Proc. ACM Program. Lang.2
2021 Higher Lenses
Paolo Capriotti, Nils Anders Danielsson, Andrea Vezzosi
LICS2
2018 Up-to techniques using sized types
abstract
Up-to techniques are used to make it easier—or feasible—to construct, for instance, proofs of bisimilarity. This text shows how many up-to techniques can be framed as size-preserving functions , using sized types to keep track of sizes. Through a number of examples it is argued that this approach to up-to techniques is often convenient to use in practice. Some examples of functions that cannot be made size-preserving are also included, in order to illustrate the limits of the approach. On the more theoretical side a class of up-to techniques intended to capture a natural mode of use of size-preserving functions is defined. This class turns out to correspond closely to "functions below the companion", a notion recently introduced by Pous.
Nils Anders Danielsson
Proc. ACM Program. Lang.1
2017 Partiality, Revisited - The Partiality Monad as a Quotient Inductive-Inductive Type
Thorsten Altenkirch, Nils Anders Danielsson, Nicolai Kraus
FoSSaCS2
2012 Operational semantics using the partiality monad
abstract
The operational semantics of a partial, functional language is often given as a relation rather than as a function. The latter approach is arguably more natural: if the language is functional, why not take advantage of this when defining the semantics? One can immediately see that a functional semantics is deterministic and, in a constructive setting, computable.
Nils Anders Danielsson
ICFP1
2012 Bag Equivalence via a Proof-Relevant Membership Relation
Nils Anders Danielsson
ITP1
2010 Total parser combinators
abstract
A monadic parser combinator library which guarantees termination of parsing, while still allowing many forms of left recursion, is described. The library's interface is similar to those of many other parser combinator libraries, with two important differences: one is that the interface clearly specifies which parts of the constructed parsers may be infinite, and which parts have to be finite, using dependent types and a combination of induction and coinduction; and the other is that the parser type is unusually informative.
Nils Anders Danielsson
ICFP1
2010 Subtyping, Declaratively
Nils Anders Danielsson, Thorsten Altenkirch
MPC1
2008 Lightweight semiformal time complexity analysis for purely functional data structures
abstract
Okasaki and others have demonstrated how purely functional data structures that are efficient even in the presence of persistence can be constructed. To achieve good time bounds essential use is often made of laziness. The associated complexity analysis is frequently subtle, requiring careful attention to detail, and hence formalising it is valuable. This paper describes a simple library which can be used to make the analysis of a class of purely functional data structures and algorithms almost fully formal. The basic idea is to use the type system to annotate every function with the time required to compute its result. An annotated monad is used to combine time complexity annotations. The library has been used to analyse some existing data structures, for instance the deque operations of Hinze and Paterson's finger trees.
Nils Anders Danielsson
POPL1
2006 Fast and loose reasoning is morally correct
abstract
Functional programmers often reason about programs as if they were written in a total language, expecting the results to carry over to non-total (partial) languages. We justify such reasoning.Two languages are defined, one total and one partial, with identical syntax. The semantics of the partial language includes partial and infinite values, and all types are lifted, including the function spaces. A partial equivalence relation (PER) is then defined, the domain of which is the total subset of the partial language. For types not containing function spaces the PER relates equal values, and functions are related if they map related values to related values.It is proved that if two closed terms have the same semantics in the total language, then they have related semantics in the partial language. It is also shown that the PER gives rise to a bicartesian closed category which can be used to reason about values in the domain of the relation.
Nils Anders Danielsson, John Hughes 0001, Patrik Jansson, Jeremy Gibbons
POPL1
2004 Chasing Bottoms: A Case Study in Program Verification in the Presence of Partial and Infinite Values
Nils Anders Danielsson, Patrik Jansson
MPC1