Lambda the Ultimate - Theory
http://lambda-the-ultimate.org/taxonomy/term/19/0
enLatent Effects for Reusable Language Components
http://lambda-the-ultimate.org/node/5640
<p >Latent Effects for Reusable Language Components, by Birthe van den Berg, Tom Schrijvers, Casper Bach Poulsen, Nicolas Wu:</p>
<blockquote ><p >The development of programming languages can be quite complicated and costly. Hence, much effort has been devoted to the modular definition of language features that can be reused in various combinations to define new languages and experiment with their semantics. A notable outcome of these efforts is the algebra-based "datatypes "a la carte" (DTC) approach. When combined with algebraic effects, DTC can model a wide range of common language features. Unfortunately, the<br >
current state of the art does not cover modular definitions of advanced control-flow mechanisms that defer execution to an appropriate point, such as call-by-name and call-by-need evaluation, as well as (multi-)staging. This paper defines latent effects, a generic class of such control-flow mechanisms. We demonstrate how function abstractions, lazy computations and a MetaML-like staging can all be expressed in a modular fashion using latent effects, and how they can be combined in various ways to obtain complex semantics. We provide a full Haskell implementation of our effects and handlers with a range of examples.</p></blockquote>
<p >Looks like a nice generalization of the basic approach taken by algebraic effects to more subtle contexts. Algebraic effects <a href="https://duckduckgo.com/?q=site%3Alambda-the-ultimate.org%2F+algebraic+effects&atb=v213-1&ia=web">have been discussed here on LtU many times</a>. I think this description from section 2.3 is a pretty good overview of their approach:</p>
<blockquote ><p >LE&H is based on a different, more sophisticated structure than AE&H’s free monad. This structure supports non-atomic operations (e.g., function abstraction, thunking, quoting) that contain or delimit computations whose execution may be deferred. Also, the layered handling is different. The idea is still the same, to replace bit by bit the structure of the tree by its meaning. Yet, while AE&H grows the meaning around the shrinking tree, LE&H grows little "pockets of meaning" around the individual nodes remaining in the tree, and not just around the root. The latter supports deferred effects because later handlers can still re-arrange the semantic pockets created by earlier handlers.</p></blockquote>EffectsFunctionalTheory2021年10月14日 14:02:48 +0000The Left Hand of Equals
http://lambda-the-ultimate.org/node/5509
<p ><a href="http://web.cecs.pdx.edu/~black/publications/egal.pdf">The Left Hand of Equals</a>, by James Noble, Andrew P. Black, Kim B. Bruce, Michael Homer, Mark S. Miller:</p>
<blockquote ><p >When is one object equal to another object? While object identity is fundamental to object-oriented systems, object equality, although tightly intertwined with identity, is harder to pin down. The distinction between identity and equality is reflected in object-oriented languages, almost all of which provide two variants of "equality", while some provide many more. Programmers can usually override at least one of these forms of equality, and can always define their own methods to distinguish their own objects.</p>
<p >This essay takes a reflexive journey through fifty years of identity and equality in object-oriented languages, and ends somewhere we did not expect: a "left-handed" equality relying on trust and grace.</p></blockquote>
<p >This covers a lot of ground, not only historical, but conceptual, like the meaning of equality and objects. For instance, they consider Ralph Johnson on what object oriented programming means:</p>
<blockquote ><p >I explain three views of OO programming. The Scandinavian view is that an OO system is one whose creators realise that programming is modelling. The mystical view is that an OO system is one that is built out of objects that communicate by sending messages to each other, and computation is the messages flying from object to object. The software engineering view is that an OO system is one that supports data abstraction, polymorphism by late-binding of function calls, and inheritance.</p></blockquote>
<p >And constrast with William Cook's autognosis/procedural-abstraction view, which we've <a href="http://lambda-the-ultimate.org/node/3668">discussed</a> here <a href="http://lambda-the-ultimate.org/node/4468">before</a>.</p>
<p >The paper's goal then becomes clear: "What can we do to provide an equality operator for a pure, autognostic object-oriented language?" They answer this question in the context of the <a href="http://gracelang.org/applications/">Grace programming language</a>. As you might expect from some of the authors, security and trust are important considerations.</p>OOPTheory2018年3月07日 17:56:44 +0000The Syntax and Semantics of Quantitative Type Theory
http://lambda-the-ultimate.org/node/5453
<p ><a href="http://bentnib.org/quantitative-type-theory.html">The Syntax and Semantics of Quantitative Type Theory</a> by Robert Atkey:</p>
<blockquote ><p >Type Theory offers a tantalising promise: that we can program and reason within a single unified system. However, this promise slips away when we try to produce efficient programs. Type Theory offers little control over the intensional aspect of programs: how are computational resources used, and when can they be reused. Tracking resource usage via types has a long history, starting with Girard's Linear Logic and culminating with recent work in contextual effects, coeffects, and quantitative type theories. However, there is conflict with full dependent Type Theory when accounting for the difference between usages in types and terms. Recently, McBride has proposed a system that resolves this conflict by treating usage in types as a zero usage, so that it doesn't affect the usage in terms. This leads to a simple expressive system, which we have named Quantitative Type Theory (QTT).</p>
<p >McBride presented a syntax and typing rules for the system, as well as an erasure property that exploits the difference between "not used" and "used", but does not do anything with the finer usage information. In this paper, we present present a semantic interpretation of a variant of McBride's system, where we fully exploit the usage information. We interpret terms simultaneously as having extensional (compile-time) content and intensional (runtime) content. In our example models, extensional content is set-theoretic functions, representing the compile-time or type-level content of a type-theoretic construction. Intensional content is given by realisers for the extensional content. We use Abramsky et al.'s Linear Combinatory Algebras as realisers, yield a large range of potential models from Geometry of Interaction, graph models, and syntactic models. Read constructively, our models provide a resource sensitive compilation method for QTT.</p>
<p >To rigorously define the structure required for models of QTT, we introduce the concept of a Quantitative Category with Families, a generalisation of the standard Category with Families class of models of Type Theory, and show that this class of models soundly interprets Quantitative Type Theory.</p></blockquote>
<p >Resource-aware programming is a hot topic these days, with Rust exploiting affine and ownership types to scope and track resource usage, and with <a href="http://lambda-the-ultimate.org/node/5003">Ethereum</a> requiring programs to spend "gas" to execute. Combining linear and dependent types has proven difficult though, so making it easier to track and reason about resource usage in dependent type theories would then be a huge benefit to making verification more practical in domains where resources are limited.</p>SemanticsTheoryType Theory2017年7月25日 17:28:17 +0000Co-hygiene and quantum gravity
http://lambda-the-ultimate.org/node/5441
<p ><b ><a href="http://fexpr.blogspot.com/2017/06/co-hygiene-and-quantum-gravity.html">Co-hygiene and quantum gravity</a></b>. <span title=":P">Some light weekend reading by John Shutt.</span></p>
<p >The post starts with a dazzling proposition:</p>
<blockquote ><p >Gravity corresponds to pure function-application, and the other fundamental forces correspond to side-effects. ... quantum non-locality ("spooky action at a distance") is part of the analog to side-effects ...</p></blockquote>
<p >I can't do it justice here, so if you're interested in John's fascinating take on the relationship between lambda calculus and quantum physics, hop on over!</p>FunHistoryParadigmsTheory2017年6月17日 15:11:24 +0000Fully Abstract Compilation via Universal Embedding
http://lambda-the-ultimate.org/node/5364
<p ><a href="https://www.williamjbowman.com/resources/fabcc-paper.pdf">Fully Abstract Compilation via Universal Embedding</a> by Max S. New, William J. Bowman, and Amal Ahmed:</p>
<blockquote ><p >A <em >fully abstract</em> compiler guarantees that two source components are observationally equivalent in the source language if and only if their translations are observationally equivalent in the target. Full abstraction implies the translation is secure: target-language attackers can make no more observations of a compiled component than a source-language attacker interacting with the original source component. Proving full abstraction for realistic compilers is challenging because realistic target languages contain features (such as control effects) unavailable in the source, while proofs of full abstraction require showing that every target context to which a compiled component may be linked can be back-translated to a behaviorally equivalent source context.</p>
<p >We prove the first full abstraction result for a translation whose target language contains exceptions, but the source does not. Our translation—specifically, closure conversion of simply typed λ-calculus with recursive types—uses types at the target level to ensure that a compiled component is never linked with attackers that have more distinguishing power than source-level attackers. We present a new back-translation technique based on a deep embedding of the target language into the source language at a dynamic type. Then boundaries are inserted that mediate terms between the untyped embedding and the strongly-typed source. This technique allows back-translating non-terminating programs, target features that are untypeable in the source, and well-bracketed effects.</p></blockquote>
<p >Potentially a promising step forward to secure multilanguage runtimes. We've previously discussed security vulnerabilities caused by full abstraction failures <a href="http://lambda-the-ultimate.org/node/3830">here</a> and <a href="http://lambda-the-ultimate.org/node/1588">here</a>. The paper also provides a comprehensive review of associated literature, like various means of protection, back translations, embeddings, etc.</p>Lambda CalculusSemanticsTheoryType Theory2016年7月27日 15:57:02 +0000Simon Peyton Jones elected into the Royal Society Fellowship
http://lambda-the-ultimate.org/node/5332
<p ><A href='http://research.microsoft.com/en-us/people/simonpj/'>Simon Peyton Jones</A> has been <A href="https://royalsociety.org/fellows/fellows-directory/#?earliestelectedyear=2016">elected</A> as a <A href='https://royalsociety.org/people/simon-peyton-jones-12889/'>Fellow of the Royal Society</A>. The Royal Society biography reads:<BLOCKQUOTE ><br >
Simon's main research interest is in functional programming languages, their implementation, and their application. He was a key contributor to the design of the now-standard functional language Haskell, and is the lead designer of the widely-used Glasgow Haskell Compiler (GHC). He has written two textbooks about the implementation of functional languages.</p>
<p >More generally, Simon is interested in language design, rich type systems, compiler technology, code generation, runtime systems, virtual machines, and garbage collection. He is particularly motivated by direct use of principled theory to practical language design and implementation -- that is one reason he loves functional programming so much.</p>
<p >Simon is also chair of Computing at School, the grass-roots organisation that was at the epicentre of the 2014 reform of the English computing curriculum.<br >
</BLOCKQUOTE></p>
<p >Congratulations SPJ!</p>FunctionalGeneralImplementationParadigmsSemanticsSoftware EngineeringSpotlightTeaching & LearningTheory2016年4月30日 19:44:24 +0000Type Checking Modular Multiple Dispatch with Parametric Polymorphism and Multiple Inheritance
http://lambda-the-ultimate.org/node/5322
<p ><a href="http://www.mpi-sws.org/~skilpat/papers/multipoly.pdf">Type Checking Modular Multiple Dispatch with Parametric Polymorphism and Multiple Inheritance</a> by Eric Allen, Justin Hilburn, Scott Kilpatrick, Victor Luchangco, Sukyoung Ryu, David Chase, Guy L. Steele Jr.:</p>
<blockquote ><p >
In previous work, we presented rules for defining overloaded functions that ensure type safety under symmetric multiple dispatch in an object-oriented language with multiple inheritance, and we showed how to check these rules without requiring the entire type hierarchy to be known, thus supporting modularity and extensibility. In this work, we extend these rules to a language that supports parametric polymorphism on both classes and functions.</p>
<p >In a multiple-inheritance language in which any type may be extended by types in other modules, some overloaded functions that might seem valid are correctly rejected by our rules. We explain how these functions can be permitted in a language that additionally supports an exclusion relation among types, allowing programmers to declare "nominal exclusions" and also implicitly imposing exclusion among different instances of each polymorphic type. We give rules for computing the exclusion relation, deriving many type exclusions from declared and implicit ones.</p>
<p >We also show how to check our rules for ensuring the safety of overloaded functions. In particular, we reduce the problem of handling parametric polymorphism to one of determining subtyping relationships among universal and existential types. Our system has been implemented as part of the open-source Fortress compiler.
</p></blockquote>
<p ><a href="http://lambda-the-ultimate.org/node/4570">Fortress</a> was briefly covered here a couple of times, as were multimethods and <a href="http://lambda-the-ultimate.org/node/3061">multiple dispatch</a>, but this paper really generalizes and nicely summarizes <a href="http://web.cs.ucla.edu/~todd/research/iandc.pdf">previous work</a> on statically typed modular multimethods, and does a good job explaining the typing rules in an accessible way. The integration with parametric polymorphism I think is key to applying multimethods in other domains which may want modular multimethods, but not multiple inheritance.</p>
<p >The <a href="http://www.cs.yale.edu/homes/jieung/Publication/cpp_paper.pdf">Formalization in COQ</a> might also be of interest to some.</p>
<p >Also, another interesting point is Fortress' use of second-class intersection and union types to simplify type checking.</p>Object-FunctionalTheoryType Theory2016年4月01日 01:25:22 +0000Breaking Through the Normalization Barrier: A Self-Interpreter for F-omega
http://lambda-the-ultimate.org/node/5276
<p ><a href="http://compilers.cs.ucla.edu/popl16/popl16-full.pdf">Breaking Through the Normalization Barrier: A Self-Interpreter for F-omega</a>, by Matt Brown and Jens Palsberg:</p>
<blockquote ><p >According to conventional wisdom, a self-interpreter for a strongly normalizing λ-calculus is impossible. We call this the normalization barrier. The normalization barrier stems from a theorem in computability theory that says that a total universal function for the total computable functions is impossible. In this paper we break through the normalization barrier and define a self-interpreter for System Fω, a strongly normalizing λ-calculus. After a careful analysis of the classical theorem, we show that static type checking in Fω can exclude the proof’s diagonalization gadget, leaving open the possibility for a self-interpreter. Along with the self-interpreter, we program four other operations in Fω, including a continuation-passing style transformation. Our operations rely on a new approach to program representation that may be useful in theorem provers and compilers.</p></blockquote>
<p >I haven't gone through the whole paper, but their claims are compelling. They have created self-interpreters in System F, System Fω and System Fω+, which are all strongly normalizing typed languages. Previously, the only instance of this for a typed language was <a href="http://lambda-the-ultimate.org/node/5176">Girard's System U</a>, which is not strongly normalizing. The key lynchpin appears in this paragraph on page 2:</p>
<blockquote ><p >Our result breaks through the normalization barrier. The conventional wisdom underlying the normalization barrier makes an implicit assumption that all representations will behave like their counterpart in the computability theorem, and therefore the theorem must apply to them as well. This assumption excludes other notions of representation, about which the theorem says nothing. Thus, our result does not contradict the theorem, but shows that the theorem is less far-reaching than previously thought.</p></blockquote>
<p >Pretty cool if this isn't too complicated in any given language. Could let one move some previously non-typesafe runtime features, into type safe libraries.</p>FunctionalTheoryType Theory2015年11月10日 14:23:32 +0000Dependent Types for Low-Level Programming
http://lambda-the-ultimate.org/node/5256
<p ><a href="http://www.cs.berkeley.edu/~necula/Papers/deputy-esop07.pdf">Dependent Types for Low-Level Programming</a> by Jeremy Condit, Matthew Harren, Zachary Anderson, David Gay, and George C. Necula:</p>
<blockquote ><p >In this paper, we describe the key principles of a dependent type system for low-level imperative languages. The major contributions of this work are (1) a sound type system that combines dependent types and mutation for variables and for heap-allocated structures in a more flexible way than before and (2) a technique for automatically inferring dependent types for local variables. We have applied these general principles to design Deputy, a dependent type system for C that allows the user to describe bounded pointers and tagged unions. Deputy has been used to annotate and check a number of real-world C programs.</p></blockquote>
<p >A conceptually simple approach to verifying the safety of C programs, which proceeeds in 3 phases: 1. infer locals that hold pointer bounds, 2. flow-insensitive checking introduces runtime assertions using these locals, 3. flow-sensitive optimization that removes the assertions that it can prove always hold.</p>
<p >You're left with a program that ensures runtime safety with as few runtime checks as possible, and the resulting C program is compiled with gcc which can perform its own optimizations.</p>
<p >This work is from 2007, and the project grew into the <a href="http://ivy.cs.berkeley.edu/ivywiki/index.php/Main/HomePage">Ivy language</a>, which is a C dialect that is fully backwards compatible with C if you #include a small header file that includes the extensions.</p>
<p >It's application to C probably won't get much uptake at this point, but I can see this as a useful compiler plugin to verify unsafe Rust code.</p>TheoryType Theory2015年9月28日 13:58:58 +0000Freer Monads, More Extensible Effects
http://lambda-the-ultimate.org/node/5244
<p ><a href="http://okmij.org/ftp/Haskell/extensible/more.pdf">Freer Monads, More Extensible Effects</a>, by Oleg Kiselyov and Hiromi Ishii:</p>
<blockquote ><p >We present a rational reconstruction of extensible effects, the recently proposed alternative to monad transformers, as the confluence of efforts to make effectful computations compose. Free monads and then extensible effects emerge from the straightforward term representation of an effectful computation, as more and more boilerplate is abstracted away. The generalization process further leads to freer monads, constructed without the Functor constraint.</p>
<p >The continuation exposed in freer monads can then be represented as an efficient type-aligned data structure. The end result is the algorithmically efficient extensible effects library, which is not only more comprehensible but also faster than earlier implementations. As an illustration of the new library, we show three surprisingly simple applications: non-determinism with committed choice (LogicT), catching IO exceptions in the presence of other effects, and the semi-automatic management of file handles and other resources through monadic regions.</p>
<p >We extensively use and promote the new sort of ‘laziness’, which underlies the left Kan extension: instead of performing an operation, keep its operands and pretend it is done.</p></blockquote>
<p >This looks very promising, and includes some benchmarks comparing the heavily optimized and special-cased monad transformers against this new formulation of extensible effects using Freer monads.</p>
<p >See also the <a href="https://www.reddit.com/r/haskell/comments/3joxd7/freer_monads_more_extensible_effects/">reddit discussion</a>.</p>FunctionalTheoryType Theory2015年9月05日 14:30:02 +0000Cakes, Custard, and Category Theory
http://lambda-the-ultimate.org/node/5200
<p ><A href="http://www.eugeniacheng.com/">Eugenia Cheng</A>'s new popular coscience book is out, in the U.K. under the title <A href="http://www.amazon.co.uk/Cakes-Custard-Category Theory-understanding/dp/1781252874/ref=sr_1_1?ie=UTF8&qid=1422244697&sr=8-1&keywords=eugenia+cheng">Cakes, Custard and Category Theory: Easy recipes for understanding complex maths</A>, and in the U.S. under the title <A href="http://www.amazon.com/How-Bake-Pi-Exploration-Mathematics/dp/0465051715/ref=sr_1_1?ie=UTF8&qid=1419352340&sr=8-1keywords=eugenia+cheng">How to Bake Pi: An Edible Exploration of the Mathematics of Mathematics</A>:</p>
<blockquote ><p >
Most people imagine maths is something like a slow cooker: very useful, but pretty limited in what it can do. Maths, though, isn't just a tool for solving a specific problem - and it's definitely not something to be afraid of. Whether you're a maths glutton or have forgotten how long division works (or never really knew in the first place), the chances are you've missed what really makes maths exciting. Calling on a baker's dozen of entertaining, puzzling examples and mathematically illuminating culinary analogies - including chocolate brownies, iterated Battenberg cakes, sandwich sandwiches, Yorkshire puddings and Möbius bagels - brilliant young academic and mathematical crusader Eugenia Cheng is here to tell us why we should all love maths.</p>
<p >From simple numeracy to category theory ('the mathematics of mathematics'), Cheng takes us through the joys of the mathematical world. Packed with recipes, puzzles to surprise and delight even the innumerate, Cake, Custard & Category Theory will whet the appetite of maths whizzes and arithmophobes alike. (Not to mention aspiring cooks: did you know you can use that slow cooker to make clotted cream?) This is maths at its absolute tastiest.<br >
</BLOCKQUOTE></p>
<p >Cheng, one of <A href="https://www.youtube.com/user/TheCatsters">the Catsters</A>, gives a guided tour of mathematical thinking and research activities, and through the core philosophy underlying category theory. This is the kind of book you can give to your grandma and grandpa so they can boast to their friends what her grandchildren are doing (and bake you a nice dessert when you come and visit :) ). A pleasant weekend reading.</p>Category TheoryCritiquesFunGeneralSemanticsTheory2015年7月17日 16:47:21 +0000Self-Representation in Girard’s System U
http://lambda-the-ultimate.org/node/5176
<p ><a href="http://compilers.cs.ucla.edu/popl15/popl15-full.pdf">Self-Representation in Girard’s System U</a>, by Matt Brown and Jens Palsberg:</p>
<blockquote ><p >In 1991, Pfenning and Lee studied whether System F could support a typed self-interpreter. They concluded that typed self-representation for System F "seems to be impossible", but were able to represent System F in Fω. Further, they found that the representation of Fω requires kind polymorphism, which is outside Fω. In 2009, Rendel, Ostermann and Hofer conjectured that the representation of kind-polymorphic terms would require another, higher form of polymorphism. Is this a case of infinite regress?</p>
<p >We show that it is not and present a typed self-representation for Girard’s System U, the first for a λ-calculus with decidable type checking. System U extends System Fω with kind polymorphic terms and types. We show that kind polymorphic types (i.e. types that depend on kinds) are sufficient to "tie the knot" – they enable representations of kind polymorphic terms without introducing another form of polymorphism. Our self-representation supports operations that iterate over a term, each of which can be applied to a representation of itself. We present three typed self-applicable operations: a self-interpreter that recovers a term from its representation, a predicate that tests the intensional structure of a term, and a typed continuation-passing-style (CPS) transformation – the first typed self-applicable CPS transformation. Our techniques could have applications from verifiably type-preserving metaprograms, to growable typed languages, to more efficient self-interpreters.</p></blockquote>
<p >Typed self-representation has <a href="http://lambda-the-ultimate.org/node/2438#comment-47966">come up</a> here on LtU <a href="http://lambda-the-ultimate.org/node/4785#comment-76876">in the past</a>. I believe the best self-interpreter available prior to this work was a variant of <a href="http://lambda-the-ultimate.org/node/3993">Barry Jay's SF-calculus</a>, covered in the paper <a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.225.1765">Typed Self-Interpretation by Pattern Matching</a> (and more fully developed in <a href="http://www0.cs.ucl.ac.uk/staff/R.Rowe/docs/arb10.pdf">Structural Types for the Factorisation Calculus</a>). These covered statically typed self-interpreters without resorting to undecidable type:type rules.</p>
<p >However, being combinator calculi, they're not very similar to most of our programming languages, and so self-interpretation was still an active problem. Enter Girard's System U, which features a more familiar type system with only kind * and kind-polymorphic types. However, System U is not strongly normalizing and is inconsistent as a logic. Whether self-interpretation can be achieved in a strongly normalizing language with decidable type checking is still an open problem.</p>FunctionalLambda CalculusTheoryType Theory2015年6月11日 18:45:11 +0000The Next Stage of Staging
http://lambda-the-ultimate.org/node/5127
<p ><a href="http://okmij.org/ftp/meta-programming/StagingNG.pdf">The Next Stage of Staging</a>, by Jun Inoue, Oleg Kiselyov, Yukiyoshi Kameyama:</p>
<blockquote ><p >This position paper argues for type-level metaprogramming, wherein types and type declarations are generated in addition to program terms. Term-level metaprogramming, which allows manipulating expressions only, has been extensively studied in the form of staging, which ensures static type safety with a clean semantics with hygiene (lexical scoping). However, the corresponding development is absent for type manipulation. We propose extensions to staging to cover ML-style module generation and show the possibilities they open up for type specialization and overhead-free parametrization of data types equipped with operations. We outline the challenges our proposed extensions pose for semantics and type safety, hence offering a starting point for a long-term program in the next stage of staging research. The key observation is that type declarations do not obey scoping rules as variables do, and that in metaprogramming, types are naturally prone to escaping the lexical environment in which they were declared. This sets next-stage staging apart from dependent types, whose benefits and implementation mechanisms overlap with our proposal, but which does not deal with type-declaration generation. Furthermore, it leads to an interesting connection between staging and the logic of definitions, adding to the study’s theoretical significance.</p></blockquote>
<p >A position paper describing the next logical progression of staging to metaprogramming over types. Now with the true first-class modules of <a href="http://lambda-the-ultimate.org/node/5121">1ML</a>, perhaps there's a clearer way forward.</p>FunctionalMeta-ProgrammingTheoryType Theory2015年3月29日 13:34:48 +0000Conservation laws for free!
http://lambda-the-ultimate.org/node/5078
<p >In this year's <A href="http://popl.mpi-sws.org/2014/">POPL</A>, <A href="bentnib.org">Bob Atkey</A> made a splash by showing how to get <A href="http://bentnib.org/conservation-laws.pdf">from parametricity to conservation laws, via Noether's theorem</A>:</p>
<blockquote ><p >
Invariance is of paramount importance in programming languages and in physics. In programming languages, John Reynolds’ theory of relational parametricity demonstrates that parametric polymorphic programs are invariant under change of data representation, a property that yields "free" theorems about programs just from their types. In physics, Emmy Noether showed that if the action of a physical system is invariant under change of coordinates, then the physical system has a conserved quantity: a quantity that remains constant for all time. Knowledge of conserved quantities can reveal deep properties of physical systems. For example, the conservation of energy, which by Noether’s theorem is a consequence of a system’s invariance under time-shifting.</p>
<p > In this paper, we link Reynolds’ relational parametricity with Noether’s theorem for deriving conserved quantities. We propose an extension of System Fω with new kinds, types and term constants for writing programs that describe classical mechanical systems in terms of their Lagrangians. We show, by constructing a relationally parametric model of our extension of Fω, that relational parametricity is enough to satisfy the hypotheses of Noether’s theorem, and so to derive conserved quantities for free, directly from the polymorphic types of Lagrangians expressed in our system.
</p></blockquote>Category TheoryFunFunctionalLambda CalculusScientific ProgrammingSemanticsTheoryType Theory2014年10月28日 07:52:46 +0000Seemingly impossible programs
http://lambda-the-ultimate.org/node/5074
<p >In case this one went under the radar, at <A href="http://www.cse.psu.edu/popl/12/">POPL'12</A>, <A href="http://www.cs.bham.ac.uk/~mhe/">Martín Escardó</A> gave a tutorial on <A href="http://www.cs.bham.ac.uk/~mhe/.talks/popl2012/escardo-popl2012.pdf">seemingly impossible functional programs</A>:</p>
<blockquote ><p >
Programming language semantics is typically applied to<br >
prove compiler correctness and allow (manual or automatic) program<br >
verification. Certain kinds of semantics can also be applied to<br >
discover programs that one wouldn't have otherwise thought of. This is<br >
the case, in particular, for semantics that incorporate topological<br >
ingredients (limits, continuity, openness, compactness). For example,<br >
it turns out that some function types (X -> Y) with X infinite (but<br >
compact) do have decidable equality, contradicting perhaps popular<br >
belief, but certainly not (higher-type) computability theory. More<br >
generally, one can often check infinitely many cases in finite time.</p>
<p >I will show you such programs, run them fast in surprising instances,<br >
and introduce the theory behind their derivation and working. In<br >
particular, I will study a single (very high type) program that (i)<br >
optimally plays sequential games of unbounded length, (ii) implements<br >
the Tychonoff Theorem from topology (and builds finite-time search<br >
functions for infinite sets), (iii) realizes the double-negation shift<br >
from proof theory (and allows us to extract programs from classical<br >
proofs that use the axiom of countable choice). There will be several<br >
examples in the languages Haskell and Agda.
</p></blockquote>
<p >A <A href="http://math.andrej.com/2007/09/28/seemingly-impossible-functional-programs/">shorter version</A> (coded in Haskell) appears in Andrej Bauer's blog.</p>Category TheoryFunFunctionalParadigmsSemanticsTheory2014年10月22日 09:57:47 +0000