A Core Calculus for XQuery 3.0 [chapter]

Giuseppe Castagna, Hyeonseung Im, Kim Nguyễn, Véronique Benzaken
2015 Lecture Notes in Computer Science  
XML processing languages can be classified according to whether they extract XML data by paths or pattern matching. In the former category one finds XQuery, in the latter XDuce and CDuce. The strengths of one category correspond to the weaknesses of the other. In this work, we propose to bridge the gap between two of these languages: XQuery and CDuce. To this end, we extend CDuce so as it can be seen as a succinct core λ-calculus that captures XQuery 3.0 programs. The extensions we consider
more » ... ntially allow CDuce to implement XPath-like navigation expressions by pattern matching and to precisely type them. The encoding of XQuery 3.0 into the extension of CDuce provides a formal semantics and a sound static type system for XQuery 3.0 programs. XQuery code: } CDuce code: 19 let get_links : <_>_ → (_ → _) → [ _ * ] = 20 fun page -> fun print -> 21 match page with 22 2013/7/16 Lemma E.8 then gives us e1[σ; γ] : t1. Finally, by the rule [T-SUB], we get e1[σ; γ] : t. Corollary E.21. The function application operator app is sound. Proof. Follows from Lemma E.8. Theorem E.22. The operators app, π1, π2, drm, rm, cons, and snoc are sound. Proof. Corollary E.21 proves the soundness of the function application operator app. We prove the soundness of the operators π1, π2, rm, cons, and snoc by exploiting the fact that the types in the domains of their corresponding typing functions (especially for cons and snoc) are more precise than their exact input (defined in Lemma E.4). We prove the soundness of drm in a similar way, using the soundness of rm. Corollary E.23. Let O be a set of operators {app, π1, π2, drm, rm, cons, snoc}. Our core calculus equipped with O is sound in the sense that for any expression e, if e : t, then e ; * Ω. Proof. The result follows from Theorems E.20 and E.22.
doi:10.1007/978-3-662-46669-8_10 fatcat:sv6vbe6ljfb7rfjuw7u6rifcxq