The view from the left

2004 ◽  
Vol 14 (1) ◽  
pp. 69-111 ◽  
Author(s):  
CONOR MCBRIDE ◽  
JAMES MCKINNA

Pattern matching has proved an extremely powerful and durable notion in functional programming. This paper contributes a new programming notation for type theory which elaborates the notion in various ways. First, as is by now quite well-known in the type theory community, definition by pattern matching becomes a more discriminating tool in the presence of dependent types, since it refines the explanation of types as well as values. This becomes all the more true in the presence of the rich class of datatypes known as inductive families (Dybjer, 1991). Secondly, as proposed by Peyton Jones (1997) for Haskell, and independently rediscovered by us, subsidiary case analyses on the results of intermediate computations, which commonly take place on the right-hand side of definitions by pattern matching, should rather be handled on the left. In simply-typed languages, this subsumes the trivial case of Boolean guards; in our setting it becomes yet more powerful. Thirdly, elementary pattern matching decompositions have a well-defined interface given by a dependent type; they correspond to the statement of an induction principle for the datatype. More general, user-definable decompositions may be defined which also have types of the same general form. Elementary pattern matching may therefore be recast in abstract form, with a semantics given by translation. Such abstract decompositions of data generalize Wadler's (1987) notion of ‘view’. The programmer wishing to introduce a new view of a type $\mathit{T}$, and exploit it directly in pattern matching, may do so via a standard programming idiom. The type theorist, looking through the Curry–Howard lens, may see this as proving a theorem, one which establishes the validity of a new induction principle for $\mathit{T}$. We develop enough syntax and semantics to account for this high-level style of programming in dependent type theory. We close with the development of a typechecker for the simply-typed lambda calculus, which furnishes a view of raw terms as either being well-typed, or containing an error. The implementation of this view is ipso facto a proof that typechecking is decidable.

2014 ◽  
Vol 49 (1) ◽  
pp. 503-515 ◽  
Author(s):  
Robert Atkey ◽  
Neil Ghani ◽  
Patricia Johann

2019 ◽  
Vol 3 (ICFP) ◽  
pp. 1-29 ◽  
Author(s):  
Daniel Gratzer ◽  
Jonathan Sterling ◽  
Lars Birkedal

Author(s):  
Aleš Bizjak ◽  
Hans Bugge Grathwohl ◽  
Ranald Clouston ◽  
Rasmus E. Møgelberg ◽  
Lars Birkedal

2017 ◽  
Vol 1 (ICFP) ◽  
pp. 1-29 ◽  
Author(s):  
Andreas Nuyts ◽  
Andrea Vezzosi ◽  
Dominique Devriese

2004 ◽  
Vol 14 (1) ◽  
pp. 1-2
Author(s):  
GILLES BARTHE ◽  
PETER DYBJEN ◽  
PETER THIEMANN

Modern programming languages rely on advanced type systems that detect errors at compile-time. While the benefits of type systems have long been recognized, there are some areas where the standard systems in programming languages are not expressive enough. Language designers usually trade expressiveness for decidability of the type system. Some interesting programs will always be rejected (despite their semantical soundness) or be assigned uninformative types.


2015 ◽  
Vol 25 (5) ◽  
pp. 1010-1039 ◽  
Author(s):  
BENEDIKT AHRENS ◽  
KRZYSZTOF KAPULKIN ◽  
MICHAEL SHULMAN

We develop category theory within Univalent Foundations, which is a foundational system for mathematics based on a homotopical interpretation of dependent type theory. In this system, we propose a definition of ‘category’ for which equality and equivalence of categories agree. Such categories satisfy a version of the univalence axiom, saying that the type of isomorphisms between any two objects is equivalent to the identity type between these objects; we call them ‘saturated’ or ‘univalent’ categories. Moreover, we show that any category is weakly equivalent to a univalent one in a universal way. In homotopical and higher-categorical semantics, this construction corresponds to a truncated version of the Rezk completion for Segal spaces, and also to the stack completion of a prestack.


1932 ◽  
Vol 26 (3) ◽  
pp. 452-469 ◽  
Author(s):  
John Gilbert Heinberg

The term “majority rule” is as impossible to escape as it is apparently difficult to define with precision. Aristotle generally employed it to designate the conduct of government by the poor citizens, who were more numerous than the rich, in the Greek city states. In canon law, it meant the verdict of the maior and sanior pars of a small group. Frederic Harrison wrote about the “rule” of the “effective majority”—that section of any community or social aggregate, which, for the matter in hand, practically outweighs the remainder. He explains that it may do so “by virtue of its preponderance in numbers, or in influence, or in force of conviction, or in external resources, or in many other ways.” Sir George Cornewall Lewis thought that where the ultimate decision is vested in a body there is no alternative other than to count numbers, and to abide by the opinion of a majority. But in alleging that “no historian, in discussing the justice or propriety of any decision of a legislative body, or of a court of justice, thinks of defending the decision of the majority by saying that it was the decision of the majority,” he did not anticipate the view of the English historian Hearnshaw. According to the latter, “The faith of a democrat requires him to believe that in the long run the majority of the people finds its way to the truth, and that in the long run it tries to do the right.”


Sign in / Sign up

Export Citation Format

Share Document