Delimited Continuations, Applicative Functors and Natural Language Semantics

Size: px
Start display at page:

Download "Delimited Continuations, Applicative Functors and Natural Language Semantics"

Transcription

1 Delimited Continuations, Applicative Functors and Natural Language Semantics Björn Bringert Department of Computer Science and Engineering Chalmers University of Technology and University of Gothenburg November 17, 2008 Abstract We present a continuation-based approach to writing compositional semantics for type-theoretic grammars which accounts for quantifier scope ambiguity and scope islands. 1 Introduction Montague [1973] uses compositional rules that map English expressions to an intentional logic which combines higher-order logic with λ-calculus. There is a large body of work that extends this treatment to cover additional phenomena, such as scope ambiguities. These efforts, such as Cooper storage [Cooper, 1983], are often expressed as extensions to the core λ-calculus. We wish to stay within a (polymorphically) typed λ-calculus. Continuations have been proposed as an approach to deal with a range of semantic phenomena [Barker, 2002]. We show that it is possible to handle scope ambiguity and scope islands in a polymorphically typed λ-calculus. The language that we use has some syntactic extensions to λ-calculus, but these have straightforward translations to the core calculus. We use first-order logic as our target language, rather than the higher-order logic used by Montague [1973]. This lets us use our semantics for practical applications with existing automated first-order reasoning tools. In Section 2 we present a fragment of English described using a Grammatical Framework (GF) [Ranta, 2004a] grammar. Section 3 constitutes the bulk of this paper. It presents a sequence of progressively refined semantics for fragments of English. We start by introducing the most basic machinery in Section 3.1, which handles a small language fragment with only proper names and transitive and intransitive verbs. In this fragment, all constructs have straightforward interpretations. In Section 3.2, we add determiners, along with simple nouns, relational nouns and relative clauses. The problem of handling quantifiers in noun phrases is dealt with using Montague s type raising trick. In Section 3.3, we tackle quantifier scope ambiguity, by lifting our entire interpretation to a dynamic logic, in this case an applicative functor for continuation computations. By using a non-deterministic evaluation order, we can generate all possible quantifier scopings. In Section 3.4 we add a construct for delimited continuations, 1

2 and use it to handle scope islands. Section 4 describes how this approach can be implemented efficiently in the Haskell programming language. Section 5 gives a brief overview of some related work. 2 Syntax Grammatical Framework (GF) [Ranta, 2004a] is a type-theoretical grammar formalism. In order to introduce GF, and to give us an example syntax to work with in the following section, we present an example grammar for a fragment of English. The abstract syntax shown in Figure 1 defines categories (cat) and functions (fun). An example of an abstract syntax tree in this grammar is PredVP (DetCN Every (UseN Woman)) (UseV Walk). The concrete syntax shown in Figure 2 defines the linearization type (lincat) of each abstract syntax category, and the linearization (lin) of each abstract syntax function. In this concrete syntax, the abstract syntax tree above is linearized to: {s = every woman walks } In this simple example, no inflection, agreement or other complex morphosyntactic features are needed to implement the English concrete syntax. However, GF does allow more sophisticated linearization rules, with records, finite functions and algebraic data types, which can be used to implement more complex grammars without changing the abstract syntax. GF can be used to create multilingual grammars by associating multiple concrete syntaxes with a single abstract syntax. 3 Semantics Since we define the syntax with a GF grammar, we can write our interpretation functions over GF abstract syntax trees, which abstract away from details such as word order and agreement. We interpret each abstract syntax term as a term in a combination of λ-calculus and first-order logic with equality. We use the customary connectives and quantifiers, n-ary predicates, equality, inequality. When we show formulas which are the result of semantic interpretation, the will sometimes be simplified according to the rules of first-order logic. 3.1 Fragment 1: Basics Our first language fragment only contains sentences made up of proper names, and transitive or intransitive verbs. This lets use handle sentences such as John walks and John loves Mary, which are assigned the first-order logic formulas walk(john) and love(john, M ary), respectively. For each category C in the abstract syntax, there is a function ic : C C, where C is the interpretation type of C. We first provide a straightforward semantics for the lexical items. Proper names are plain constants: 2

3 abstract Toy = { } cat S; RS; VP; NP; Det; CN; cat V; V2; N; N2; PN; fun PredVP : NP VP S; fun RelVP : VP RS; fun UseV : V VP; fun ComplV2 : V2 NP VP; fun DetCN : Det CN NP; fun Everyone : NP; fun Someone : NP; fun UsePN : PN NP; fun Every : Det; fun A : Det; fun UseN : N CN; fun ComplN2 : N2 NP CN; fun RelCN : CN RS CN; fun Walk : V; fun Love, Eat : V2; fun Man, Woman, Burger : N; fun Owner : N2; fun John, Bill, Mary : PN; Figure 1: Toy.gf: Abstract syntax for a small language fragment. 3

4 concrete ToyEng of Toy = { } lincat S, RS, VP, NP, Det, CN = {s : Str}; lincat V, V2, N, N2, PN = {s : Str}; lin PredVP np vp = {s = np.s + vp.s }; lin RelVP vp = {s = who + vp.s }; lin UseV v = {s = v.s }; lin ComplV2 v2 np = {s = v2.s + np.s }; lin DetCN det cn = {s = det.s + cn.s }; lin Everyone = {s = everyone }; lin Someone = {s = someone }; lin UsePN pn = {s = pn.s }; lin Every = {s = every }; lin A = {s = a }; lin UseN n = {s = n.s }; lin ComplN2 n2 np = {s = n2.s + np.s }; lin RelCN cn rs = {s = cn.s + rs.s }; lin Walk = {s = walks }; lin Love = {s = loves }; lin Eat = {s = eats }; lin Man = {s = man }; lin Woman = {s = woman }; lin Burger = {s = burger }; lin Owner = {s = owner + of }; lin John = {s = John }; lin Bill = {s = Bill }; lin Mary = {s = Mary }; Figure 2: ToyEng.gf: Concrete syntax for a small fragment of English. 4

5 ipn : PN Ind ipn John = John ipn Mary = Mary ipn Bill = Bill Intransitive verbs are one-place predicates: iv : V (Ind Prop) iv Walk = λx. walk(x) Transitive verbs are two-place predicates. We take the subject as the first function argument, and the object as the second, which is the opposite to what Montague does. In addition to being more intuitive (in the opinion of the author), this order lets us use function composition in the complementation rules below. iv2 : V2 (Ind Ind Prop) iv2 Eat = λx y. eat(x, y) iv2 Love = λx y. love(x, y) Now for the semantics of the syntactic constructs. Noun phrases, which are only proper names at this point, are interpreted as individuals: inp : NP Ind inp (UsePN pn) = ipn pn Like intransitive verbs, verb phrases are interpreted as one-place predicates. ivp : VP (Ind Prop) For verb phrases formed from just an intransitive verb, nothing needs to be done: ivp (UseV v) = iv v In the case of transitive verb complementation, the interpretation of the object is given as the second argument to the two-place predicate which is the interpretation of the transitive verb (note that in our notation, function application binds harder than λ-abstraction): ivp (ComplV2 v2 np) = λy. (iv2 v2 ) y (inp np) Sentences are interpreted as propositions, and verb phrase predication is simply the application of the one-place verb phrase predicate to the noun phrase individual. is : S Prop is (PredVP np vp) = (ivp vp) (inp np) 5

6 3.2 Fragment 2: Adding determiners When we add determiners to our language fragment, we will need some way to handle quantifiers, as we would for example like the sentence everyone walks to have the interpretation x. walk(x). Our previous type of NP interpretations, Ind, is insufficient since we need to be able to introduce the universal quantifier on the top-level of the formula. Montague [1973] solved this problem by changing the type of NP interpretations to (Ind Prop) Prop, and we will do the same. We first add interpretations for the remaining lexical categories. Simple nouns are one-place predicates: in : N (Ind Prop) in Man = λx. man(x) in Woman = λx. woman(x) in Burger = λx. burger(x) Relational nouns are two-place predicates: in2 : N2 (Ind Ind Prop) in2 Owner = λx y. owner(x, y) Noun phrases now have the higher type needed to include quantified noun phrases: inp : NP ((Ind Prop) Prop) inp Everyone = λv. x. v x inp Someone = λv. x. v x Since we have changed the interpretation type of noun phrases, we also need to change the rule for UsePN, which lifts proper names to noun phrases: inp (UsePN pn) = λv. v (ipn pn) We can now handle noun phrases consisting of a determiner and a common noun, as in every man walks, which we would like to interpret as x. man (x) walk (x). inp (DetCN det cn) = (idet det) (icn cn) That requires determiners to be interpreted as two-place predicates over oneplace predicates. idet : Det (Ind Prop) (Ind Prop) Prop idet Every = λu v. x. u x v x idet A = λu v. x. u x v x We also have relative sentences, which are interpreted as one-place predicates. E.g. who walks, RelVP (UseV Walk) is interpreted as λx. walk (x). irs : RS (Ind Prop) irs (RelVP vp) = ivp vp Common nouns are one-place predicates. 6

7 icn : CN (Ind Prop) For simple nouns, there is nothing left to do: icn (UseN n) = in n Relational noun complementation is handled by letting the second argument of the relational noun be filled by the complement (this is done in a roundabout way because of the Montague trick). icn (ComplN2 n2 np) = λx. (inp np) ((in2 n2 ) x) or, equivalently, using the function composition operator (function application binds harder than composition): icn (ComplN2 n2 np) = inp np in2 n2 A relative sentence that modifies a common noun is interpreted as the conjunction of the propositions resulting from the two constituents. icn (RelCN cn rs) = λx. (icn cn) x (irs rs) x Since we have changed the type of noun phrase interpretations, we also need to change the rules which make use of noun phrases. In the case of NP VP sentences, all we need to do is to change the order of application. We apply the noun phrase interpretation ((Ind Prop) Prop) to the verb phrase interpretation (Ind Prop) to get the final Prop). is : S Prop is (PredVP np vp) = (inp np) (ivp vp) We also need to change the rule for transitive verb complementation since it uses NP: ivp (ComplV2 v2 np) = λx. (inp np) ((iv2 v2 ) x) This could also be written using, as with ComplN2 above. 3.3 Fragment 3: Quantifier scope ambiguity Consider a sentence such as every man loves a woman. previous section would interpret this as x. man(x) y. woman(y) love(x, y) However, the sentence also has the alternative meaning y. woman(y) x. man(x) love (x, y) The rules in the that is, that there is some woman whom every man loves. To be able to generate both these readings, we need to allow the quantifiers from a nested noun phrase to escape to the top level of the formula. We also need a mechanism for allowing interpretation to be non-deterministic. 7

8 A number of approaches have been proposed to handle quantifier scope ambiguity, such as Cooper storage [Cooper, 1983], and its improved version, Keller storage [Keller, 1988]. While it is possible to implement Keller storage in a typed λ-calculus, the result is not very elegant. Cooper storage seems difficult to implement in a typed way, because of the unsoundness that Keller pointed out. Instead of storage, we can use continuations to deal with quantifier scope. Barker [2002] shows that continuations can be used to handle a range of semantic phenomena, and that quantifier scope ambiguity can be handled by using a nondeterministic evaluation order in the continuized semantics. A continuation monad can be used to hide the plumbing details of continuation passing style in natural language semantics [Shan, 2001]. As Shan notes, one advantage of using a monadic style is that the monad in question can easily be replaced with a more elaborate one when we want to account for additional details, without having to change all the interpretation rules. However, it is in general not possible to make a continuation monad with non-deterministic evaluation order, since the bind operation of a monad ( in [Shan, 2001], >= in Haskell) requires left-to-right evaluation. But, fortunately for us, monads can be generalized to applicative functors [McBride and Paterson, 2008], whose combining operator ( ) is order-agnostic. Thus, instead of a continuation monad for natural language semantics, we propose a continuation applicative functor with non-deterministic evaluation order. In this section, we show that an applicative functor is sufficient for the needs of our semantics, and that it can handle quantifier scope ambiguities Interpretation Functor In the interest of readability, we will use set notation (e.g. {x, y, z}) below. This can be straightforwardly replaced by the Church encoding of lists to obtain a pure λ-calculus implementation. A non-deterministic continuized computation is a set of functions that return a value given its continuation (context). We will use Cont o a to mean a nondeterministic computation that returns a value of type o, and that gives access to a continuation that accepts an argument of type a. type Cont o a = {(a o) o} The raise function lifts a pure value into the functor. raise : a Cont o a raise a = {λc. c a} The operator performs lifted function application with both evaluation orders. In case the reader is concerned with the exponential behavior of this implementation, we refer to section 4.1. ( ) : Cont o (a b) Cont o a Cont o b xs ys = {λc. x (λf. y (λa. c (f a))) x xs, y ys} {λc. y (λa. x (λf. c (f a))) x xs, y ys} The raise (also called pure) and functions make this an applicative functor [McBride and Paterson, 2008]. Applicative functors generalize monads [Wadler, 8

9 1992, Moggi, 1989]. Shan [2001] shows how a continuation monad can be used to handle quantification. However, that treatment does not take quantifier scope ambiguity into account. We also define an evaluation operator ε (symbol borrowed from Shan [2004]) which runs a computation and retrieves all possible results. ε : Cont o o {o} ε x = {y (λf. f ) y x} We finally add a control operator ξ that gives access to the current continuation. Its implementation turns out to be very simple: ξ : ((a o) o) Cont o a ξ f = {f } In the interest of readability, instead of ξ (λκ. e), we will write ξκ. e Semantics In this example, the outer return type is always Prop, so we use I a as a shorthand for Cont Prop a. type I a = Cont Prop a We first lift the parts of our semantics that do not introduce any quantifiers to use our new continuation functor. Function application is replaced with lifted function application ( ), and raise is used to lift the combination functions where necessary. is : S I Prop is (PredVP np vp) = inp np ivp vp ivp : VP I (Ind Prop) ivp (UseV v) = iv v As we noted above, the interpretations of transitive verb and relation noun complementation can be written using function composition ( ). We now need to use lifted application of this operator. Note that application of a pure (nonlifted) function f to a lifted argument x is written as raise f x, and in the case of a two-argument function, raise f x y. As in Haskell, we use ( ) as a shorthand for (λf. λg. f g). ivp (ComplV2 v2 np) = raise ( ) inp np iv2 v2 Common noun interpretation is also the straightforward lifting of the interpretation in the previous section: icn : CN I (Ind Prop) icn (UseN n) = in n icn (ComplN2 n2 np) = raise ( ) inp np in2 n2 The interpretation of relational sentence modification looks a little hairy, but it is really just the lifted version of λx. (icn cn) x (irs rs) x. 9

10 icn (RelCN cn rs) = raise (λcn rs x. cn x rs x) icn cn irs rs Nothing needs to be done to the relative sentence interpretation, as it just returns the already lifted result of interpreting a verb phrase. irs : RS I (Ind Prop) irs (RelVP vp) = ivp vp Noun phrases and determiners introduce quantifiers. Since we want to move quantifiers to the top-level, these interpretations use the shift operator (ξ) to obtain the current continuation and wrap the quantifier around it. UsePN and DetCN are simply lifted. inp : NP I ((Ind Prop) Prop) inp Everyone = ξκ. x. κ (λv. v x) inp Someone = ξκ. x. κ (λv. v x) inp (UsePN pn) = raise (λx v. v x) ipn pn inp (DetCN det cn) = idet det icn cn idet : Det I ((Ind Prop) (Ind Prop) Prop) idet Every = ξκ. x. κ (λu v. u x v x) idet A = ξκ. x. κ (λu v. u x v x) Finally, we need to lift the lexicon to use the interpretation functor. This is very straightforward: we just use raise to lift each interpretation. Simple nouns: in : N I (Ind Prop) in Man = raise (λx. man(x)) in Woman = raise (λx. woman(x)) in Burger = raise (λx. burger(x)) Relational nouns: in2 : N2 I (Ind Ind Prop) in2 Owner = raise (λx y. owner(x, y)) Proper names: ipn : PN I Ind ipn John = raise John ipn Mary = raise Mary ipn Bill = raise Bill Intransitive verbs: iv : V I (Ind Prop) iv Walk = raise (λx. walk(x)) Transitive verbs: iv2 : V2 I (Ind Ind Prop) iv2 Eat = raise (λx y. eat(x, y)) iv2 Love = raise (λx y. love(x, y)) 10

11 3.4 Fragment 4: Scope islands A sentence such as a man who loves every woman eats a burger may at first appear to have 6 readings since the 3 quantifiers can be ordered in 3! = 6 ways. However, we may not consider all of those readings to be sensible. 1. x.man(x) y.woman(y) z.burger(z) love(x, y) eat(x, z) 2. * x.man(x) z.burger(z) y.woman(y) love(x, y) eat(x, z) 3. * y.woman(y) x.man(x) z.burger(z) love(x, y) eat(x, z) 4. * y.woman(y) z.burger(z) x.man(x) love(x, y) eat(x, z) 5. * z.burger(z) y.woman(y) x.man(x) love(x, y) eat(x, z) 6. z.burger(z) x.man(x) y.woman(y) love(x, y) eat(x, z) Readings 2 and 4 are not generated by our interpretation, in accordance with what Barker [2001] calls the syntactic constituent integrity scoping constraint. Semantic theory has it that relative clauses are scope islands, that is, no quantifier in the relative clause may take scope outside the relative clause. This disallows readings 3, 4, and 5. But 3 and 5 are returned by our interpretation in Fragment 3. It appears that we need a way to implement scope islands. Shan [2004] notes that delimited continuations are useful for modeling several natural language phenomena, and notes that Barker s [2002] treatment of scope islands implicitly uses reset ([ ]). Barker notes that this can only be done for categories whose interpretation type is t (Prop in our treatment). However, as we show below, we can do it for any type τ 1... τ n Prop (though we have only seen a need for Ind Prop so far). The [ ] function for creates a delimited continuation computation: [ ] : Cont o o Cont p o [x] = {λc. c y y ε x} We overload [ ] to also work on single argument functions. We use overloading here to simplify the notation. To stay within polymorphically typed λ-calculus, we could simply use two different names instead. [ ] : Cont o (a o) Cont p (a o) [x] = {λc. c y y ε x} This second version of [ ] uses a version of ε for single-argument functions: ε : Cont o (a o) {a o} ε x = {λe. y (λf. f e) y x} The rule for relative sentences now uses [ ] to make the relative sentence a scope island. irs : RS I (Ind Prop) irs (RelVP vp) = [ivp vp] With this addition, only readings 1 and 6 above are returned. 11

12 4 Haskell implementation The semantics is implemented as a Haskell [Peyton Jones, 2003] program. In fact, the rules that we have shown above are thinly camouflaged Haskell code. A Haskell program can be automatically extracted from the source code for this paper. 4.1 Efficiency The naive implementation above always uses both left-to-right and right-toleft evaluation whenever is used. This means that the number of formulas produced is roughly exponential in the number of nodes in the abstract syntax tree. However, since only a few of the interpretation rules make use of ξ, there are many duplicates. This blow-up can be avoided in most cases by changing the implementation of the continuation functor, as shown below. Now, the number of formulas produced is exponential in the number of uses of ξ. For some sentences, this may still be a significant number, but these are now syntactically different readings. Some of them may still be logically equivalent, for example if they only differ in the order of adjacent universal quantifiers A more efficient functor This is a representation of a non-deterministic continuation monad, with an added constructor (Pure) for computations which do not look at the continuation. data Cont o a = Pure {a} Cont {(a o) o} Getting a function that looks at the continuation from a Cont is easy: runcont : Cont o a {(a o) o} runcont (Pure xs) = {λc. c x x xs} runcont (Cont r) = r We define the applicative functor operators for our new functor. instance Applicative (Cont o) where The pure function of course uses the Pure constructor. pure a = Pure {a} We have a special case for Pure f Pure x that keeps the result pure, so that further uses of knows that it doesn t need both evaluation orders. If both of the sub-computations pure, the result is too. Pure fs Pure xs = Pure {f x f fs, x xs} If neither sub-computations is pure, the result is the cartesian product of the results of the sub-computations, with either left-to-right or right-to-left evaluation. Cont xs Cont ys = Cont $ concat {{λc. x (λf. y (λa. c (f a))), 12

13 λc. y (λa. x (λf. c (f a)))} x xs, y ys} If exacly one sub-computation is pure, then we only need one of the evaluation orders, since the result is the same regardless of the order. xs ys = Cont {λc. x (λf. y (λa. c (f a))) x runcont xs, y runcont ys} The ε operator is very similar to the naive version: ε : Cont o o {o} ε x = {y (λf. f ) y runcont x} ε : Cont o (a o) {a o} ε x = {λe. y (λf. f e) y runcont x} eval : Cont o (a b o) {a b o} eval x = {λe d. y (λf. f e d) y runcont x} The ξ operator is straightforward: ξ : ((a o) o) Cont o a ξ f = Cont {f } And so is the [ ] function for creating delimited continuation computations: [ ] : Cont o o Cont p o [x] = Pure (ε x) [ ] : Cont o (a o) Cont p (a o) [x] = Pure (ε x) reset : Cont o (a b o) Cont p (a b o) reset x = Pure (eval x) 5 Related Work Ranta [2004b] has a compositional semantics in dependent type theory. We share the idea of writing interpretation rules on the abstract syntax of a type theoretic grammar (GF in both cases). However, Ranta uses a dependently typed λ-calculus where we use a more pedestrian polymorphic λ-calculus. Also, Ranta handles quantifier scope ambiguity by making the grammar ambiguous while keeping the interpretation rules straightforward. Compared to Barker [2002], we have a more elegant way of writing interpretation rules, since the applicative functor formulation and control operators take care of the continuation plumbing. Also, we implement non-deterministic evaluation order in a single place, the definition of, rather than having to add multiple interpretations for each syntactic construct. 13

14 The idea of using a applicative functor for hiding the continuation plumbing is very similar to Shan s [2001] use of monads for the same purpose, but the restrictions of a monad does not allow the non-deterministic evaluation order that we need. In contrast to Blackburn and Bos [2005], we are using a an explicit abstract syntax, which makes it easier to change the surface language or the semantics independently. In particular, this makes it possible for us to construct a multilingual semantics. References Chris Barker. Integrity: A Syntactic Constraint on Quantificational Scoping. In Karine Megerdoomian and Leora A. Bar-El, editors, WC- CFL 20: Proceedings of the 20th West Coast Conference on Formal Linguistics, Somerville, MA, February Cascadilla Press. URL Chris Barker. Continuations and the nature of quantification. Natural Language Semantics, 10(3): , doi: /A: URL Patrick Blackburn and Johan Bos. Representation and Inference for Natural Language: A First Course in Computational Semantics. Center for the Study of Language and Information, April ISBN R. Cooper. Quantification and Syntactic Theory, volume 21 of Studies in Linguistics and Philosophy. Springer, 1 edition, April ISBN W. R. Keller. Nested Cooper storage: The proper treatment of quantification in ordinary noun phrases. In U. Reyle and C. Rohrer, editors, Natural Language Parsing and Linguistic Theories, pages Reidel, Dordrecht, Conor McBride and Ross Paterson. Applicative Programming with Effects. Journal of Functional Programming, 18(1):1 13, January doi: /S URL Eugenio Moggi. Computational lambda-calculus and monads. In Proceedings of the Fourth Annual Symposium on Logic in Computer Science (LICS 89), Pacific Grove, CA, USA, pages 14 23, Washington, DC, USA, June IEEE Computer Society Press. doi: /LICS URL Richard Montague. The Proper Treatment of Quantification in Ordinary English. pages , Simon Peyton Jones. The Haskell 98 Language. Journal of Functional Programming, 13(1):1 146, Aarne Ranta. Grammatical Framework: A Type-Theoretical Grammar Formalism. Journal of Functional Programming, 14(2): , March 2004a. ISSN doi: /S URL 14

15 Aarne Ranta. Computational Semantics in Type Theory. Mathematics and Social Sciences, 165:31 57, 2004b. URL Chung-Chieh Shan. Monads for natural language semantics. In Kristina Striegnitz, editor, Proceedings of the sixth ESSLLI Student Session, 13th European Summer School in Logic, Language and Information, Helsinki, Finland, pages , August URL Chung-Chieh Shan. Delimited continuations in natural language. In Hayo Thielecke, editor, Proceedings of the Fourth ACM SIGPLAN Continuations Workshop (CW 04), Venice, Italy, Birmingham B15 2TT, United Kingdom, January School of Computer Science, University of Birmingham. URL Philip Wadler. Comprehending Monads. Mathematical Structures in Computer Science, 2(4): , URL 15

Syntax-semantics interface and the non-trivial computation of meaning

Syntax-semantics interface and the non-trivial computation of meaning 1 Syntax-semantics interface and the non-trivial computation of meaning APA/ASL Group Meeting GVI-2: Lambda Calculi, Type Systems, and Applications to Natural Language APA Eastern Division 108th Annual

More information

Type raising, continuations, and classical logic

Type raising, continuations, and classical logic Type raising, continuations, and classical logic Philippe de Groote Inria-Lorraine Abstract. There is a striking analogy between type raising, as introduced by Montague (973), and the notion of continuation

More information

The Arrow Calculus (Functional Pearl)

The Arrow Calculus (Functional Pearl) The Arrow Calculus (Functional Pearl) Sam Lindley Philip Wadler Jeremy Yallop University of Edinburgh Abstract We introduce the arrow calculus, a metalanguage for manipulating Hughes s arrows with close

More information

Proseminar on Semantic Theory Fall 2013 Ling 720 An Algebraic Perspective on the Syntax of First Order Logic (Without Quantification) 1

Proseminar on Semantic Theory Fall 2013 Ling 720 An Algebraic Perspective on the Syntax of First Order Logic (Without Quantification) 1 An Algebraic Perspective on the Syntax of First Order Logic (Without Quantification) 1 1. Statement of the Problem, Outline of the Solution to Come (1) The Key Problem There is much to recommend an algebraic

More information

LING 130: Quantified Noun Phrases

LING 130: Quantified Noun Phrases LING 130: Quantified Noun Phrases James Pustejovsky March 15, 2010 1 Syntax for Typed λ-calculus We will now present a language which uses specific types of entities, where the entities are combined with

More information

Monads in Haskell. Nathanael Schilling. December 12, 2014

Monads in Haskell. Nathanael Schilling. December 12, 2014 Monads in Haskell Nathanael Schilling December 12, 2014 Abstract In Haskell, monads provide a mechanism for mapping functions of the type a -> m b to those of the type m a -> m b. This mapping is dependent

More information

Context-Free Grammars

Context-Free Grammars Department of Linguistics Ohio State University Syntax 2 (Linguistics 602.02) January 3, 2012 (CFGs) A CFG is an ordered quadruple T, N, D, P where a. T is a finite set called the terminals; b. N is a

More information

Formal Mathematics in Informal Language

Formal Mathematics in Informal Language Formal Mathematics in Informal Language Aarne Ranta MathWiki Workshop, Edinburgh, 31 October - 1 November 2007 Mature technology? Does type theory provide a mature technology for mathematics? Mature technology......

More information

COMPUTATIONAL SEMANTICS WITH FUNCTIONAL PROGRAMMING JAN VAN EIJCK AND CHRISTINA UNGER. lg Cambridge UNIVERSITY PRESS

COMPUTATIONAL SEMANTICS WITH FUNCTIONAL PROGRAMMING JAN VAN EIJCK AND CHRISTINA UNGER. lg Cambridge UNIVERSITY PRESS COMPUTATIONAL SEMANTICS WITH FUNCTIONAL PROGRAMMING JAN VAN EIJCK AND CHRISTINA UNGER lg Cambridge UNIVERSITY PRESS ^0 Contents Foreword page ix Preface xiii 1 Formal Study of Natural Language 1 1.1 The

More information

Logic and Natural Language Semantics: Formal Semantics

Logic and Natural Language Semantics: Formal Semantics Logic and Natural Language Semantics: Formal Semantics Raffaella Bernardi DISI, University of Trento e-mail: bernardi@disi.unitn.it Contents 1 Logic....................................................

More information

1 Delimited continuations in Haskell

1 Delimited continuations in Haskell 1 Delimited continuations in Haskell This section describes programming with delimited control in Haskell. Delimited control, like its instance, exceptions, is an effect. Therefore, we have to use monads.

More information

Coreference without Discourse Referents

Coreference without Discourse Referents Coreference without Discourse Referents A non-representational DRT-like discourse semantics Gianluca Giorgolo, Christina Unger UiL-OTS, Universiteit Utrecht Abstract We propose a non-representational,

More information

Discourse Representation Theory Building Discourse Representations

Discourse Representation Theory Building Discourse Representations and and Lehrstuhl für Künstliche Intelligenz Institut für Informatik Friedrich-Alexander-Universität Erlangen-Nürnberg 13. Januar 2006 1 1 Slides are mainly due to Johan Bos lecture on Semantics (GSLT)

More information

Lexicografie computationala Feb., 2012

Lexicografie computationala Feb., 2012 Lexicografie computationala Feb., 2012 Anca Dinu University of Bucharest Introduction When we construct meaning representations systematically, we integrate information from two different sources: 1. The

More information

Context-Free Grammars. Carl Pollard Ohio State University. Linguistics 680 Formal Foundations Tuesday, November 10, 2009

Context-Free Grammars. Carl Pollard Ohio State University. Linguistics 680 Formal Foundations Tuesday, November 10, 2009 Context-Free Grammars Carl Pollard Ohio State University Linguistics 680 Formal Foundations Tuesday, November 10, 2009 These slides are available at: http://www.ling.osu.edu/ scott/680 1 (1) Context-Free

More information

INTENSIONAL LOGIC TRANSLATION FOR QUANTITATIVE NATURAL LANGUAGE SENTENCES

INTENSIONAL LOGIC TRANSLATION FOR QUANTITATIVE NATURAL LANGUAGE SENTENCES STUDIA UNIV. BABEŞ BOLYAI, INFORMATICA, Volume XLV, Number 1, 2001 INTENSIONAL LOGIC TRANSLATION FOR QUANTITATIVE NATURAL LANGUAGE SENTENCES ADRIAN ONEŢ, DOINA TĂTAR Abstract. The performance of some natural

More information

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages. Lambda calculus

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages. Lambda calculus Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Tuesday, February 19, 2013 The lambda calculus (or λ-calculus) was introduced by Alonzo Church and Stephen Cole Kleene in

More information

Computational Linguistics: Syntax-Semantics

Computational Linguistics: Syntax-Semantics Computational Linguistics: Syntax-Semantics Raffaella Bernardi University of Trento Contents 1 The Three Tasks Revised................................... 3 2 Lambda terms and CFG...................................

More information

An Efficient Implementation of PATR for Categorial Unification Grammar

An Efficient Implementation of PATR for Categorial Unification Grammar An Efficient Implementation of PATR for Categorial Unification Grammar Todd Yampol Stanford University Lauri Karttunen Xerox PARC and CSLI 1 Introduction This paper describes C-PATR, a new C implementation

More information

Computational Linguistics: Syntax-Semantics Interface

Computational Linguistics: Syntax-Semantics Interface Computational Linguistics: Syntax-Semantics Interface Raffaella Bernardi KRDB, Free University of Bozen-Bolzano P.zza Domenicani, Room: 2.28, e-mail: bernardi@inf.unibz.it Contents 1 Lambda terms and DCG...................................

More information

Context-Free Grammars

Context-Free Grammars Context-Free Grammars Carl Pollard yntax 2 (Linguistics 602.02) January 3, 2012 Context-Free Grammars (CFGs) A CFG is an ordered quadruple T, N, D, P where a. T is a finite set called the terminals; b.

More information

CS 6110 S14 Lecture 1 Introduction 24 January 2014

CS 6110 S14 Lecture 1 Introduction 24 January 2014 CS 6110 S14 Lecture 1 Introduction 24 January 2014 1 Introduction What is a program? Is it just something that tells the computer what to do? Yes, but there is much more to it than that. The basic expressions

More information

Idioms are oblivious, arrows are meticulous, monads are promiscuous

Idioms are oblivious, arrows are meticulous, monads are promiscuous MSFP 2008 Idioms are oblivious, arrows are meticulous, monads are promiscuous Sam Lindley, Philip Wadler and Jeremy Yallop Laboratory for Foundations of Computer Science The University of Edinburgh Abstract

More information

Lecture 7. Introduction to Function-Argument Structure and Lambdas. 1. Function-argument structure in natural language

Lecture 7. Introduction to Function-Argument Structure and Lambdas. 1. Function-argument structure in natural language B. Partee, March 15, 2006 p.1 Lecture 7. Introduction to Function-Argument Structure and Lambdas 1. Function-argument structure in natural language...1 1.1. Function-argument application as basic semantic

More information

1 Introduction. 2 Set-Theory Formalisms. Formal Semantics -W2: Limitations of a Set-Theoretic Model SWU LI713 Meagan Louie August 2015

1 Introduction. 2 Set-Theory Formalisms. Formal Semantics -W2: Limitations of a Set-Theoretic Model SWU LI713 Meagan Louie August 2015 Formal Semantics -W2: Limitations of a Set-Theoretic Model SWU LI713 Meagan Louie August 2015 1 Introduction Recall from last week: The Semantic System 1. The Model/Ontology 2. Lexical Entries 3. Compositional

More information

Applicative Abstract Categorial Grammars

Applicative Abstract Categorial Grammars Tohoku University, Japan oleg@okmij.org Abstract We present the grammar/semantic formalism of Applicative Abstract Categorial Grammars (AACG), based on the recent techniques from functional programming:

More information

Polymorphic lambda calculus Princ. of Progr. Languages (and Extended ) The University of Birmingham. c Uday Reddy

Polymorphic lambda calculus Princ. of Progr. Languages (and Extended ) The University of Birmingham. c Uday Reddy 06-02552 Princ. of Progr. Languages (and Extended ) The University of Birmingham Spring Semester 2016-17 School of Computer Science c Uday Reddy2016-17 Handout 6: Polymorphic Type Systems 1. Polymorphic

More information

Indefinites and Sluicing. A type logical approach

Indefinites and Sluicing. A type logical approach Indefinites and Sluicing. A type logical approach Gerhard Jäger Zentrum für Allgemeine Sprachwissenschaft Berlin Abstract Following Jäger (2001a), we propose to extend the Lambek calculus with two additional

More information

arxiv: v2 [cs.ai] 18 Sep 2013

arxiv: v2 [cs.ai] 18 Sep 2013 Lambda Dependency-Based Compositional Semantics Percy Liang September 19, 2013 arxiv:1309.4408v2 [cs.ai] 18 Sep 2013 Abstract This short note presents a new formal language, lambda dependency-based compositional

More information

A system of constructor classes: overloading and implicit higher-order polymorphism

A system of constructor classes: overloading and implicit higher-order polymorphism A system of constructor classes: overloading and implicit higher-order polymorphism Mark P. Jones Yale University, Department of Computer Science, P.O. Box 2158 Yale Station, New Haven, CT 06520-2158.

More information

Formal Systems and their Applications

Formal Systems and their Applications Formal Systems and their Applications Dave Clarke (Dave.Clarke@cs.kuleuven.be) Acknowledgment: these slides are based in part on slides from Benjamin Pierce and Frank Piessens 1 Course Overview Introduction

More information

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Lecture 18 Thursday, March 29, 2018 In abstract algebra, algebraic structures are defined by a set of elements and operations

More information

A Brief Incomplete Introduction to NLTK

A Brief Incomplete Introduction to NLTK A Brief Incomplete Introduction to NLTK This introduction ignores and simplifies many aspects of the Natural Language TookKit, focusing on implementing and using simple context-free grammars and lexicons.

More information

Binding alongside Hamblin alternatives calls for variable-free semantics

Binding alongside Hamblin alternatives calls for variable-free semantics Binding alongside Hamblin alternatives calls for variable-free semantics Chung-chieh Shan Harvard University The compositional, bottom-up computation of alternative sets was first introduced by Hamblin

More information

Going beyond propositional logic

Going beyond propositional logic Going beyond propositional logic Consider the following statements: p: Ling took CS245 q: Ling passed CS245 r: Ling failed CS245 Taken literally, these are all atomic statements, and formally they have

More information

Introduction to Semantics. Expanding Our Formalism, Part 2 1

Introduction to Semantics. Expanding Our Formalism, Part 2 1 Expanding Our Formalism, Part 2 1 1. Lambda Notation for Defining Functions As you may have guessed by this point, most expressions of natural language will have some kind of function as their extension

More information

Solving Natural Language Math Problems

Solving Natural Language Math Problems Solving Natural Language Math Problems Takuya Matsuzaki (Nagoya University) Noriko H. Arai (National Institute of Informatics) Solving NL Math why? It is the first and the last goal of symbolic approach

More information

Back to the model. Jason Perry and Chung-chieh Shan Rutgers University. July 10, /24

Back to the model. Jason Perry and Chung-chieh Shan Rutgers University. July 10, /24 Back to the model Jason Perry and Chung-chieh Shan Rutgers University July 10, 2011 1/24 Text Hypothesis Text meaning (model(s)) Truth judgment (and explanation) 2/24 Text Hypothesis 2 1 Text meaning (model(s))

More information

Dowty Friday, July 22, 11

Dowty Friday, July 22, 11 Dowty 1994 The Role of Negative Polarity and Concord Marking in Natural Language Reasoning SALT IV, Cornell, Ithaca, NY. starts by explaining Sánchez work more lucidly than Sánchez himself presents a simpler

More information

II. Judgements and -polymorphism

II. Judgements and -polymorphism II. Judgements and -polymorphism II.1. Overview of Modern Type Theories Difference from simple type theory Example MTTs Judgements (basic statements in MTTs) II.2. Dependent product types (-types) Basic

More information

CIS 500 Software Foundations Fall September 25

CIS 500 Software Foundations Fall September 25 CIS 500 Software Foundations Fall 2006 September 25 The Lambda Calculus The lambda-calculus If our previous language of arithmetic expressions was the simplest nontrivial programming language, then the

More information

Typed Lambda Calculus for Syntacticians

Typed Lambda Calculus for Syntacticians Department of Linguistics Ohio State University January 12, 2012 The Two Sides of Typed Lambda Calculus A typed lambda calculus (TLC) can be viewed in two complementary ways: model-theoretically, as a

More information

Generating Quantifiers and Negation to Explain Homework Testing

Generating Quantifiers and Negation to Explain Homework Testing Generating Quantifiers and Negation to Explain Homework Testing Jason Perry and Chung-chieh Shan Rutgers University Department of Computer Science Abstract We describe Prograder, a software package for

More information

Handout 10: Imperative programs and the Lambda Calculus

Handout 10: Imperative programs and the Lambda Calculus 06-02552 Princ of Progr Languages (and Extended ) The University of Birmingham Spring Semester 2016-17 School of Computer Science c Uday Reddy2016-17 Handout 10: Imperative programs and the Lambda Calculus

More information

CMPUT 325 : Lambda Calculus Basics. Lambda Calculus. Dr. B. Price and Dr. R. Greiner. 13th October 2004

CMPUT 325 : Lambda Calculus Basics. Lambda Calculus. Dr. B. Price and Dr. R. Greiner. 13th October 2004 CMPUT 325 : Lambda Calculus Basics Dr. B. Price and Dr. R. Greiner 13th October 2004 Dr. B. Price and Dr. R. Greiner CMPUT 325 : Lambda Calculus Basics 1 Lambda Calculus Lambda calculus serves as a formal

More information

Class Intro & Compositional Semantics & Others

Class Intro & Compositional Semantics & Others LING 147. Semantics of Questions Week 1 Yimei Xiang September 1, 2016 1 Class intro Class Intro & Compositional Semantics & Others What does a declarative denote? A declarative denotes a proposition. Its

More information

Semantics of programming languages

Semantics of programming languages Semantics of programming languages Informatics 2A: Lecture 27 John Longley School of Informatics University of Edinburgh jrl@inf.ed.ac.uk 21 November, 2011 1 / 19 1 2 3 4 2 / 19 Semantics for programming

More information

Context and the Composition of Meaning

Context and the Composition of Meaning Context and the Composition of Meaning Jan van Eijck CWI and ILLC, Amsterdam, Uil-OTS, Utrecht LOLA7 Invited Talk, Pecs August 2002 Abstract Key ingredients in discourse meaning are reference markers:

More information

Syntax and Grammars 1 / 21

Syntax and Grammars 1 / 21 Syntax and Grammars 1 / 21 Outline What is a language? Abstract syntax and grammars Abstract syntax vs. concrete syntax Encoding grammars as Haskell data types What is a language? 2 / 21 What is a language?

More information

Talen en Compilers. Jurriaan Hage , period 2. November 13, Department of Information and Computing Sciences Utrecht University

Talen en Compilers. Jurriaan Hage , period 2. November 13, Department of Information and Computing Sciences Utrecht University Talen en Compilers 2017-2018, period 2 Jurriaan Hage Department of Information and Computing Sciences Utrecht University November 13, 2017 1. Introduction 1-1 This lecture Introduction Course overview

More information

Introductory Example

Introductory Example CSc 520 Principles of Programming Languages 21: Lambda Calculus Introduction Christian Collberg Department of Computer Science University of Arizona collberg@cs.arizona.edu Copyright c 2005 Christian Collberg

More information

Computational Linguistics: Feature Agreement

Computational Linguistics: Feature Agreement Computational Linguistics: Feature Agreement Raffaella Bernardi Contents 1 Admin................................................... 4 2 Formal Grammars......................................... 5 2.1 Recall:

More information

Functional Languages and Higher-Order Functions

Functional Languages and Higher-Order Functions Functional Languages and Higher-Order Functions Leonidas Fegaras CSE 5317/4305 L12: Higher-Order Functions 1 First-Class Functions Values of some type are first-class if They can be assigned to local variables

More information

Extracting the Range of cps from Affine Typing

Extracting the Range of cps from Affine Typing Extracting the Range of cps from Affine Typing Extended Abstract Josh Berdine, Peter W. O Hearn Queen Mary, University of London {berdine, ohearn}@dcs.qmul.ac.uk Hayo Thielecke The University of Birmingham

More information

CS 4110 Programming Languages & Logics. Lecture 17 Programming in the λ-calculus

CS 4110 Programming Languages & Logics. Lecture 17 Programming in the λ-calculus CS 4110 Programming Languages & Logics Lecture 17 Programming in the λ-calculus 10 October 2014 Announcements 2 Foster Office Hours 11-12 Enjoy fall break! Review: Church Booleans 3 We can encode TRUE,

More information

Dependency grammar and dependency parsing

Dependency grammar and dependency parsing Dependency grammar and dependency parsing Syntactic analysis (5LN455) 2014-12-10 Sara Stymne Department of Linguistics and Philology Based on slides from Marco Kuhlmann Mid-course evaluation Mostly positive

More information

1. true / false By a compiler we mean a program that translates to code that will run natively on some machine.

1. true / false By a compiler we mean a program that translates to code that will run natively on some machine. 1. true / false By a compiler we mean a program that translates to code that will run natively on some machine. 2. true / false ML can be compiled. 3. true / false FORTRAN can reasonably be considered

More information

Comp 411 Principles of Programming Languages Lecture 7 Meta-interpreters. Corky Cartwright January 26, 2018

Comp 411 Principles of Programming Languages Lecture 7 Meta-interpreters. Corky Cartwright January 26, 2018 Comp 411 Principles of Programming Languages Lecture 7 Meta-interpreters Corky Cartwright January 26, 2018 Denotational Semantics The primary alternative to syntactic semantics is denotational semantics.

More information

Programming with Patterns. ACM SIGPLAN Developer Tracks on Functional Programming (DEFUN 2009)

Programming with Patterns. ACM SIGPLAN Developer Tracks on Functional Programming (DEFUN 2009) Programming with Patterns ACM SIGPLAN Developer Tracks on Functional Programming (DEFUN 2009) Barry Jay Centre for Quantum Computing and Intelligent Systems University of Technology, Sydney 1:30-5:00pm,

More information

One of a number of approaches to a mathematical challenge at the time (1930): Constructibility

One of a number of approaches to a mathematical challenge at the time (1930): Constructibility λ Calculus Church s λ Calculus: Brief History One of a number of approaches to a mathematical challenge at the time (1930): Constructibility (What does it mean for an object, e.g. a natural number, to

More information

The design of a programming language for provably correct programs: success and failure

The design of a programming language for provably correct programs: success and failure The design of a programming language for provably correct programs: success and failure Don Sannella Laboratory for Foundations of Computer Science School of Informatics, University of Edinburgh http://homepages.inf.ed.ac.uk/dts

More information

The Lambda Calculus. 27 September. Fall Software Foundations CIS 500. The lambda-calculus. Announcements

The Lambda Calculus. 27 September. Fall Software Foundations CIS 500. The lambda-calculus. Announcements CIS 500 Software Foundations Fall 2004 27 September IS 500, 27 September 1 The Lambda Calculus IS 500, 27 September 3 Announcements Homework 1 is graded. Pick it up from Cheryl Hickey (Levine 502). We

More information

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Lecture 14 Tuesday, March 24, 2015 1 Parametric polymorphism Polymorph means many forms. Polymorphism is the ability of

More information

LOGIC AND DISCRETE MATHEMATICS

LOGIC AND DISCRETE MATHEMATICS LOGIC AND DISCRETE MATHEMATICS A Computer Science Perspective WINFRIED KARL GRASSMANN Department of Computer Science University of Saskatchewan JEAN-PAUL TREMBLAY Department of Computer Science University

More information

Monads. Mark Hills 6 August Department of Computer Science University of Illinois at Urbana-Champaign

Monads. Mark Hills 6 August Department of Computer Science University of Illinois at Urbana-Champaign Monads Mark Hills mhills@cs.uiuc.edu Department of Computer Science University of Illinois at Urbana-Champaign 6 August 2009 Hills Monads 1 / 19 Overview Overview Hills Monads 2 / 19 Why Monads? Overview

More information

Programming with Math and Logic

Programming with Math and Logic .. Programming with Math and Logic an invitation to functional programming Ed Morehouse Wesleyan University The Plan why fp? terms types interfaces The What and Why of Functional Programming Computing

More information

Type Systems Winter Semester 2006

Type Systems Winter Semester 2006 Type Systems Winter Semester 2006 Week 4 November 8 November 15, 2006 - version 1.1 The Lambda Calculus The lambda-calculus If our previous language of arithmetic expressions was the simplest nontrivial

More information

COMP3151/9151 Foundations of Concurrency Lecture 8

COMP3151/9151 Foundations of Concurrency Lecture 8 1 COMP3151/9151 Foundations of Concurrency Lecture 8 Liam O Connor CSE, UNSW (and data61) 8 Sept 2017 2 Shared Data Consider the Readers and Writers problem from Lecture 6: Problem We have a large data

More information

9/23/2014. Why study? Lambda calculus. Church Rosser theorem Completeness of Lambda Calculus: Turing Complete

9/23/2014. Why study? Lambda calculus. Church Rosser theorem Completeness of Lambda Calculus: Turing Complete Dr A Sahu Dept of Computer Science & Engineering IIT Guwahati Why study? Lambda calculus Syntax Evaluation Relationship to programming languages Church Rosser theorem Completeness of Lambda Calculus: Turing

More information

Introduction to the Lambda Calculus

Introduction to the Lambda Calculus Introduction to the Lambda Calculus Overview: What is Computability? Church s Thesis The Lambda Calculus Scope and lexical address The Church-Rosser Property Recursion References: Daniel P. Friedman et

More information

Advances in Programming Languages

Advances in Programming Languages T O Y H Advances in Programming Languages APL8: Multiparameter Type Classes, Constructor Classes Ian Stark School of Informatics The University of Edinburgh Thursday 4 February Semester 2 Week 4 E H U

More information

Pioneering Compiler Design

Pioneering Compiler Design Pioneering Compiler Design NikhitaUpreti;Divya Bali&Aabha Sharma CSE,Dronacharya College of Engineering, Gurgaon, Haryana, India nikhita.upreti@gmail.comdivyabali16@gmail.com aabha6@gmail.com Abstract

More information

Quoting side effects. Chung-chieh Shan Rutgers University

Quoting side effects. Chung-chieh Shan Rutgers University Quoting side effects Chung-chieh Shan Rutgers University 2007-10-13 http://xkcd.com/327/ 1 2 Computational Linguistics Computational Linguistics 3 4 Computational Linguistics ? 5 Outline Natural vs programming

More information

13. Januar Semantics (GSLT) Lehrstuhl für Künstliche Intelligenz Institut für Informatik Friedrich-Alexander-Universität Erlangen-Nürnberg

13. Januar Semantics (GSLT) Lehrstuhl für Künstliche Intelligenz Institut für Informatik Friedrich-Alexander-Universität Erlangen-Nürnberg and : and : Lehrstuhl für Künstliche Intelligenz Institut für Informatik Friedrich-Alexander-Universität Erlangen-Nürnberg 13. Januar 2006 1 1 Slides are mainly due to Johan Bos lecture on (GSLT) Overview

More information

Intro to Haskell Notes: Part 5

Intro to Haskell Notes: Part 5 Intro to Haskell Notes: Part 5 Adrian Brasoveanu October 5, 2013 Contents 1 Curried functions and related issues 1 1.1 Curried functions......................................... 1 1.2 Partially applied

More information

Semantics via Syntax. f (4) = if define f (x) =2 x + 55.

Semantics via Syntax. f (4) = if define f (x) =2 x + 55. 1 Semantics via Syntax The specification of a programming language starts with its syntax. As every programmer knows, the syntax of a language comes in the shape of a variant of a BNF (Backus-Naur Form)

More information

Lazy State Evaluation of Process Functional Programs

Lazy State Evaluation of Process Functional Programs Lazy State Evaluation of Process Functional Programs Ján Kollár Jan.Kollar@tuke.sk Jaroslav Porubän Jaroslav.Poruban@tuke.sk Peter Václavík Peter.Vaclavik@tuke.sk Miroslav Vidiščak Miroslav.Vidiscak@tuke.sk

More information

Dependency grammar and dependency parsing

Dependency grammar and dependency parsing Dependency grammar and dependency parsing Syntactic analysis (5LN455) 2015-12-09 Sara Stymne Department of Linguistics and Philology Based on slides from Marco Kuhlmann Activities - dependency parsing

More information

Multi-paradigm Declarative Languages

Multi-paradigm Declarative Languages Michael Hanus (CAU Kiel) Multi-paradigm Declarative Languages ICLP 2007 1 Multi-paradigm Declarative Languages Michael Hanus Christian-Albrechts-University of Kiel Programming Languages and Compiler Construction

More information

Context-free Grammars

Context-free Grammars 1 contents of Context-free Grammars Phrase Structure Everyday Grammars for Programming Language Formal Definition of Context-free Grammars Definition of Language Left-to-right Application cfg ects Transforming

More information

An Inverse Lambda Calculus Algorithm. For Natural Language Processing. Marcos Alvarez Gonzalez

An Inverse Lambda Calculus Algorithm. For Natural Language Processing. Marcos Alvarez Gonzalez An Inverse Lambda Calculus Algorithm For Natural Language Processing by Marcos Alvarez Gonzalez A Thesis Presented In Partial Fulfillment of the Requirements for the Degree Master of Science Approved November

More information

2 Ambiguity in Analyses of Idiomatic Phrases

2 Ambiguity in Analyses of Idiomatic Phrases Representing and Accessing [Textual] Digital Information (COMS/INFO 630), Spring 2006 Lecture 22: TAG Adjunction Trees and Feature Based TAGs 4/20/06 Lecturer: Lillian Lee Scribes: Nicolas Hamatake (nh39),

More information

Dependency grammar and dependency parsing

Dependency grammar and dependency parsing Dependency grammar and dependency parsing Syntactic analysis (5LN455) 2016-12-05 Sara Stymne Department of Linguistics and Philology Based on slides from Marco Kuhlmann Activities - dependency parsing

More information

Overview. CS389L: Automated Logical Reasoning. Lecture 6: First Order Logic Syntax and Semantics. Constants in First-Order Logic.

Overview. CS389L: Automated Logical Reasoning. Lecture 6: First Order Logic Syntax and Semantics. Constants in First-Order Logic. Overview CS389L: Automated Logical Reasoning Lecture 6: First Order Logic Syntax and Semantics Işıl Dillig So far: Automated reasoning in propositional logic. Propositional logic is simple and easy to

More information

Abstract register machines Lecture 23 Tuesday, April 19, 2016

Abstract register machines Lecture 23 Tuesday, April 19, 2016 Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Lecture 23 Tuesday, April 19, 2016 1 Why abstract machines? So far in the class, we have seen a variety of language features.

More information

Programming Languages Third Edition

Programming Languages Third Edition Programming Languages Third Edition Chapter 12 Formal Semantics Objectives Become familiar with a sample small language for the purpose of semantic specification Understand operational semantics Understand

More information

First-Class Type Classes

First-Class Type Classes First-Class Type Classes Matthieu Sozeau Joint work with Nicolas Oury LRI, Univ. Paris-Sud - Démons Team & INRIA Saclay - ProVal Project Gallium Seminar November 3rd 2008 INRIA Rocquencourt Solutions for

More information

Semester Review CSC 301

Semester Review CSC 301 Semester Review CSC 301 Programming Language Classes There are many different programming language classes, but four classes or paradigms stand out: l l l l Imperative Languages l assignment and iteration

More information

CS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Dan Grossman Spring 2011

CS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Dan Grossman Spring 2011 CS152: Programming Languages Lecture 11 STLC Extensions and Related Topics Dan Grossman Spring 2011 Review e ::= λx. e x e e c v ::= λx. e c τ ::= int τ τ Γ ::= Γ, x : τ (λx. e) v e[v/x] e 1 e 1 e 1 e

More information

Semantics and Generative Grammar. Expanding Our Formalism, Part 2 1. These more complex functions are very awkward to write in our current notation

Semantics and Generative Grammar. Expanding Our Formalism, Part 2 1. These more complex functions are very awkward to write in our current notation Expanding Our Formalism, Part 2 1 1. Lambda Notation for Defining Functions A Practical Concern: Most expressions of natural language will have some kind of function as their extension... These more complex

More information

Clausal Architecture and Verb Movement

Clausal Architecture and Verb Movement Introduction to Transformational Grammar, LINGUIST 601 October 1, 2004 Clausal Architecture and Verb Movement 1 Clausal Architecture 1.1 The Hierarchy of Projection (1) a. John must leave now. b. John

More information

This is already grossly inconvenient in present formalisms. Why do we want to make this convenient? GENERAL GOALS

This is already grossly inconvenient in present formalisms. Why do we want to make this convenient? GENERAL GOALS 1 THE FORMALIZATION OF MATHEMATICS by Harvey M. Friedman Ohio State University Department of Mathematics friedman@math.ohio-state.edu www.math.ohio-state.edu/~friedman/ May 21, 1997 Can mathematics be

More information

Data types for mcrl2

Data types for mcrl2 Data types for mcrl2 Aad Mathijssen April 5, 2018 We provide a syntax for the standard data types of the mcrl2 language. This syntax is intended to be a practical mix between standard mathematical notation

More information

6.863J Natural Language Processing Lecture 16: The meaning of it all, #2. (or #42) Instructor: Robert C. Berwick

6.863J Natural Language Processing Lecture 16: The meaning of it all, #2. (or #42) Instructor: Robert C. Berwick 6.863J Natural Language Processing Lecture 16: The meaning of it all, #2 (or #42) Instructor: Robert C. Berwick berwick@ai.mit.edu The Menu Bar Administrivia: Lab 4a out April 14 Agenda: What does this

More information

Evaluation of Predicate Calculus By Arve Meisingset, retired research scientist from Telenor Research Oslo Norway

Evaluation of Predicate Calculus By Arve Meisingset, retired research scientist from Telenor Research Oslo Norway Evaluation of Predicate Calculus By Arve Meisingset, retired research scientist from Telenor Research 31.05.2017 Oslo Norway Predicate Calculus is a calculus on the truth-values of predicates. This usage

More information

Proof Documents: Presentation and Representation

Proof Documents: Presentation and Representation Proof Documents: Presentation and Representation Bengt Nordström Computer Science, Chalmers and University of Göteborg National Institute of Advanced Industrial Science and Technology, Senri, Japan, April

More information

Typeful Ontologies with Direct Multilingual Verbalization

Typeful Ontologies with Direct Multilingual Verbalization Typeful Ontologies with Direct Multilingual Verbalization Ramona Enache and Krasimir Angelov Department of Computer Science and Engineering Chalmers University of Technology and University of Gothenburg

More information

Accurate Step Counting

Accurate Step Counting Accurate Step Counting Catherine Hope and Graham Hutton School of Computer Science and IT University of Nottingham, UK {cvh,gmh}@cs.nott.ac.uk Abstract Starting with an evaluator for a language, an abstract

More information

A Substructural Type System for Delimited Continuations

A Substructural Type System for Delimited Continuations 1 A Substructural Type System for Delimited Continuations Oleg Kiselyov (FNMOC) Chung-chieh Shan (Rutgers University) TLCA June 27, 2007 ? 2 Summary Small-step abstract interpretation type systems for

More information

Programming with Universes, Generically

Programming with Universes, Generically Programming with Universes, Generically Andres Löh Well-Typed LLP 24 January 2012 An introduction to Agda Agda Functional programming language Static types Dependent types Pure (explicit effects) Total

More information