Symbolic and automatic differentiation of languages
-
Published:2021-08-22
Issue:ICFP
Volume:5
Page:1-18
-
ISSN:2475-1421
-
Container-title:Proceedings of the ACM on Programming Languages
-
language:en
-
Short-container-title:Proc. ACM Program. Lang.
Abstract
Formal languages are usually defined in terms of set theory. Choosing type theory instead gives us languages as type-level predicates over strings. Applying a language to a string yields a type whose elements are language membership proofs describing
how
a string parses in the language. The usual building blocks of languages (including union, concatenation, and Kleene closure) have precise and compelling specifications uncomplicated by operational strategies and are easily generalized to a few general domain-transforming and codomain-transforming operations on predicates.
A simple characterization of languages (and indeed functions from lists to any type) captures the essential idea behind language “differentiation” as used for recognizing languages, leading to a collection of lemmas about type-level predicates. These lemmas are the heart of two dual parsing implementations—using (inductive) regular expressions and (coinductive) tries—each containing the same code but in dual arrangements (with representation and primitive operations trading places). The regular expression version corresponds to symbolic differentiation, while the trie version corresponds to automatic differentiation.
The relatively easy-to-prove properties of type-level languages transfer almost effortlessly to the decidable implementations. In particular, despite the inductive and coinductive nature of regular expressions and tries respectively, we need neither inductive nor coinductive/bisimulation arguments to prove algebraic properties.
Publisher
Association for Computing Machinery (ACM)
Subject
Safety, Risk, Reliability and Quality,Software
Reference41 articles.
1. Andreas Abel. 2016. Equational reasoning about formal languages in coalgebraic style. http://www.cse.chalmers.se/~abela/jlamp17.pdf draft. Andreas Abel. 2016. Equational reasoning about formal languages in coalgebraic style. http://www.cse.chalmers.se/~abela/jlamp17.pdf draft.
2. Copatterns
3. Agda Team. 2020. The Agda standard library. https://github.com/agda/agda-stdlib Agda Team. 2020. The Agda standard library. https://github.com/agda/agda-stdlib
Cited by
4 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Forward- or reverse-mode automatic differentiation: What's the difference?;Science of Computer Programming;2024-01
2. Timely Computation;Proceedings of the ACM on Programming Languages;2023-08-30
3. Combinatory Adjoints and Differentiation;Electronic Proceedings in Theoretical Computer Science;2022-06-30
4. Calculating Datastructures;Lecture Notes in Computer Science;2022