ebook img

Functorial Semantics of Second-Order Algebraic Theories PDF

0.29 MB·
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Functorial Semantics of Second-Order Algebraic Theories

Functorial Semantics of Second-Order Algebraic Theories MarceloFiore1 andOlaMahmoud2 Abstract 4 The purpose of this work is to complete the algebraic foundations of second-order languages from the 1 viewpoint of categorical algebra asdeveloped by Lawvere. Tothis end, this paper introduces the notion of 0 2 second-order algebraic theory and develops its basic theory. A crucial role in the definition is played by n the second-order theory of equality M, representing the most elementary operators and equations present a in every second-order language. The category M can be described abstractly via the universal property of J beingthefreecartesiancategoryonanexponentiableobject. Thereby,inthetraditionofcategoricalalgebra, 9 1 asecond-order algebraic theoryconsistsofacartesian categoryMandastrictcartesian identity-on-objects functor M → M that preserves the universal exponentiable object of M. Lawvere’s functorial semantics ] T for algebraic theories can then be generalised to the second-order setting. To verify the correctness of our C theory, two categorical equivalences are established: at the syntactic level, that of second-order equational . presentations and second-order algebraic theories; at the semantic level, that of second-order algebras and h t second-order functorial models. a m Keywords: Categoricalalgebra, algebraic theories, second-order languages, variable-binding, Lawvere [ theories, functorial semantics, exponentiable objects 1 v 7 1. Introduction 9 6 Algebra is the study of operations on mathematical structures, and the constructions and relationships 4 arising from them. These structures span the most basic algebraic entities, such as arithmetic, to the more . 1 abstract,suchasgroups,rings,lattices,etc. Basedonthese,Birkhoff[4]laidoutthefoundationsofageneral 0 4 unifying theory, now known as universal algebra. His formalisation of the notion of algebra starts with the 1 introduction ofequationalpresentations. Theseconstitutethesyntacticfoundationsofthesubject. Algebras : v are then the semantics, or model theory, and play a crucial role in establishing the logical foundations. i X Indeed,Birkhoffintroducedequationallogicasasoundandcompleteformaldeductivesystemforreasoning r aboutalgebraic structure. a The investigation of algebraic structure was further enriched by Lawvere’s fundamental work on al- gebraic theories [24]. His approach gives an elegant categorical framework for providing a presentation- independent treatmentofuniversalalgebra, anditembodiesthemotivationforthepresentwork. As per Lawvere’s own philosophy, we believe in the inevitability of algebraic content in mathematical subjects. We contend that it is only by looking at algebraic structure from all perspectives − syntactic, semantic, categorical − and the ways in which they interact, that the subject isproperly understood. In the context oflogic,algebra andtheoretical computing, forinstance, consider that: (i)initial-algebra semantics providescanonical compositional interpretations [19];(ii)freeconstructions amounttoabstract syntax[28] 1ComputerLaboratory,UniversityofCambridge 2FacultyofMathematicsandStatistics,UniversityofSt.Gallen PreprintsubmittedtoJournalofPureandAppliedAlgebra January21,2014 thatisamenabletoproofsbystructural induction anddefinitions bystructural recursion [6];(iii)equational presentations can be regarded as bidirectional rewriting theories and studied from a computational point of view [23]; (iv) algebraic theories come with an associated notion of algebraic translation [24], whose syntactic counterpart provides the right notion of syntactic translation between equational presentations [16, 17]; (v) strong monads have an associated metalogic from which equational logics can be synthesised [13,14]. Therealmofcategorical universalalgebrahassofarbeenrestricted tofirst-orderlanguages. Wefurther extend it to include languages with variable-binding, such as the λ-calculus [1] and predicate logic [2]. EmulatingLawvere’sframeworkwillenableusto: - define second-order algebraic theories to be structure preserving functors from a suitable base cate- gory,thesecond-ordertheoryofequality,toacategorywhichabstractlyclassifiesagivensecond-order presentation, - extract syntactic information via internal languages from the categorical framework of second-order algebraic theories, - synthesise anotion ofsyntactic translation from thecanonical notion ofmorphism ofalgebraic theo- ries,andviceversa, - establish thefunctoriality ofsecond-order semantics; allinsuchawaythattheexpectedcategorical equivalences arerespected. Moreprecisely, weobtain: 1. the Second-Order Syntactic Categorical Algebraic Theory Correspondence, by which second-order algebraic theories andtheirmorphismscorrespond tosecond-order equational presentations andsyn- tactictranslations; and 2. the Second-Order Semantic Categorical Algebraic Theory Correspondence, by which algebras for second-order equational presentations correspond tosecond-order functorial models. 2. First-OrderAlgebraicTheories Lawvere’s seminal thesis on algebraic theories [24] develops a presentation–independent category- theoretic formulation of finitary first-order theories; finitary in the sense that only operations of arity given by a finite cardinal are considered, and first-order in that the arguments of the operations do not allow variable-binding. Under his abstraction, an algebraic theory is a functor from a base category to a small category with strict finite products, whose morphishms can be thought of as tuples of derived operations. Thebase category represents the most fundamental equational theory, the theory ofequality. Itarises from the universal property of the categorical cartesian product. We review Lawvere’s categorical approach to universalalgebra anditssyntactic counterpart givenbymono-sorted equational presentations. Thefirst-order theory of equality. LetF bethe category of finite cardinals and all functions between them. The objects of F are denoted by n ∈ N; it comes equipped with a cocartesian structure given via cardinal sum m + n. F can be universally characterised as the free cocartesian category generated by the object 1. By duality, the opposite of F, which we shall denote by L for Lawvere, is equipped with finite products. Thiscategory, together withasuitable cartesian functor, formthemainconstituents ofaLawvere theory. 2 Definition2.1(Lawveretheory). ALawveretheory consists ofasmallcategory Lwithstrictly associative finite products, together with a strict cartesian identity-on-objects functor L: L → L. A morphism of Lawvere theories L: L → Land L′: L → L′ is acartesian functor F: L → L′ which commutes with the theoryfunctors Land L′. WewriteLAWforthecategory ofLawveretheories andtheirmorphisms. For a Lawvere theory L: L → L, the objects of L are then precisely those of L. For any n ∈ N, morphisms in L(n,1) are referred to as the operators of the theory, and those arising from L(n,1) as the elementary such operators. For any n,m ∈ N, morphisms in L(n,m) are m-tuples of operators, because L(n,m) (cid:27) L(n,1)m. Intuitively, a morphism of Lawvere theories encapsulates the idea of interpreting one theoryinanother. Definition 2.2 (Functorial models). A functorial model of a Lawvere theory L: L → L in a cartesian categoryC isacartesian functor L→ C. First-orderequationalpresentationsarethesyntacticcounterpart ofLawveretheories. Anequational presentation consists of a signature defining its operations and a set of axioms describing the equations it should obey. Formally, a mono-sorted first-order equational presentation is specified as E = (Σ,E), where Σ = {Σn}n∈N isanindexedfamilyoffirst-order operators. Foragivenn ∈ N,wesaythatanoperator ω ∈ Σn has arity n. The set of terms T (V) on a set of variables V generated by the signature Σ is built up by the Σ grammar t ∈ T (V) := v | ω(t ,...,t ) , Σ 1 k where v ∈ V, ω ∈ Σ , and for i = 1,...,k, t ∈ T (V). An equation is simply given by a pair of terms, and k i Σ thesetE oftheequationalpresentation E = (Σ,E)containsequations, whichwerefertoastheaxiomsofE. Definition 2.3 (First-order syntactic translations). There are two constituents defining the notion of mor- phism of first-order equational presentations E = (Σ,E) → E′ = (Σ′,E′). Anoperator ω ofΣ is mapped to a term Γ ⊢ t of Σ′, with its context Γ given by the arity of ω. This induces a mapping between the terms of Σ and Σ′ in such a way that the axioms of E are respected. Equational presentations are their syntactic presentations formacategory, denoted byFOEP. Indeed, a syntactic morphism with these properties mirrors the behaviour of morphisms of first-order algebraic theories. Notions of mappings of signatures and presentations have been developed in the first- ordersettingbyFujiwara[16,17],Goguenetal. [19],andVidalandTur[32],allofwhichusethecommon definitionthatasyntactic morphism mapsoperators toterms. Set-theoretic semantics. The model-theoretic universe of first-order languages is classically taken to bethecategorySet. A(set-theoretic) algebra inthisuniverseforafirst-ordersignature Σisapair(X,~−(cid:127) ) X consistingofasetXandinterpretationfunctions~ω(cid:127) : X|ω| → X,where|ω|denotesthearityofω. Algebras X induceinterpretations onterms(seeforexample[12]fordetails). Analgebraforanequational presentation E = (Σ,E) is an algebra for Σ which satisfies all equations in E, in the sense that an equal pair of terms inducesequalinterpretation functions inSet. 2.1. First-OrderCategorical AlgebraicTheoryCorrespondence The passage from Lawvere theories and their functorial models to mono-sorted first-order equational presentationsandtheiralgebrasisinvertible,makingLawveretheoriesanabstract,presentation-independent formalisation of equational presentations. Anyfirst-order equational presentation induces analgebraic the- ory, and, viceversa, anyalgebraic theory has anunderlying equational presentation. Moreover, morphisms 3 ofLawveretheoriescorrespondtosyntactictranslationsofequationalpresentations, whichgivesthefollow- ingresult. Theorem2.4. Thecategories LAWandFOEPareequivalent. ThesemanticcomponentoftheCategoricalAlgebraicTheoryCorrespondencegivenbytheequivalence betweenfunctorialmodelsforfirst-orderalgebraictheories,algebrasforfirst-orderequationalpresentations, andEilenberg-Moore algebras forfinitarymonads. Wereferthereaderto[5]fordetailed proofs. Proposition 2.5. For every S-sorted first-order equational presentation E, there exists a finitary monad T onSetS suchthatthecategoryofE-algebrasisisomorphictothatofEilenberg-MoorealgebrasforT. Also, for a set S and every finitary monad T on SetS, there exists a first-order algebraic theory L: L → L S suchthatthecategoryofEilenberg-MoorealgebrasforTisisomorphictothecategoryoffunctorialmodels FMod(L,SetS). 3. Second-OrderSyntaxandSemantics The passage from first to second order involves extending the language with both variable-binding operators andparameterised metavariables. Second-order operators bindalistofvariables ineachoftheir arguments, leading to syntax up to alpha equivalence [1]. On top of variables, second-order languages come equipped with parameterised metavariables. These are essentially second-order variables for which substitution also involves instantiation. Variable-binding constructs are at the core of fundamental calculi and theories in computer science and logic [7, 8]. Examples of second-order languages include the λ- calculus [1], the fixpoint operator [22], the primitive recursion operator [1], the universal and existential quantifiers ofpredicate logic[2],andthelistiterator[31]. Over the past two decades, many formal frameworks for languages with binding have been developed, including higher-order abstract syntax [29] and Gabbay and Pitts’ set-theoretic abstract syntax [18]. We review the second-order framework of Fiore et al. [15], as developed further by Hamana [20], Fiore [10], andFioreandHur[14]. 3.1. Second-order signatures Following thedevelopment ofAczel[1], a(mono-sorted) second-order signature Σ = (Ω,|−|)isspec- ified by a set of operators Ω and an arity function | − |: Ω → N∗. For an operator ω ∈ Ω, we write ω: (n ,...,n ) whenever it has arity |ω| = (n ,...,n ). The intended meaning here is that the operator ω 1 k 1 k takeskarguments binding n variables intheith argument. i Any language with variable binding fits this formalism, including languages with quantifiers [2], a fix- point operator [22], and the primitive recursion operator [1]. The most prototypical of all second-order languages istheλ-calculus. Example 3.1. The second-order signature Σ of the mono-sorted λ-calculus has operators abs: (1) and λ app: (0,0)representing λabstraction andapplication, respectively. 3.2. Second-order terms Second-order terms have metavariables on top of variables as building blocks. We use the notational convention of denoting variables similar to first-order variables by x,y,z, and metavariables by m,n,l. Metavariables comewithan associated natural number arity, also referred toasits meta-arity. A metavari- ablemofmeta-arity m,denotedbym: [m],istobeparameterised bymterms. 4 Second-ordertermsareconsideredincontextswithtwozones,eachrespectivelydeclaringmetavariables and variables. We use the following representation for contexts m : [m ],...,m : [m ]⊲ x ,...,x where 1 1 k k 1 n themetavariables m andvariables x areassumedtobedistinct. i j Terms are built up by means of operators from both variables and metavariables, and hence referred to as second-order. The judgement for second-order terms in context Θ ⊲ Γ ⊢ t is defined similar to the second-order syntaxofAczel[1]bythefollowingrules. (Variables) For x∈ Γ, Θ⊲Γ ⊢ x (Metavariables) For(m: [m]) ∈ Θ, Θ⊲Γ ⊢t (1 ≤ i ≤ m) i Θ⊲Γ ⊢m[t ,...,t ] 1 m (Operators) Forω: (n ,...,n ), 1 k →− Θ⊲Γ, x ⊢ t (1 ≤ i≤ k) i i →− →− Θ⊲Γ ⊢ω (x )t ,...,(x )t 1 1 k k (cid:0) (cid:1) where→−x standsfor x(i),...,x(i). i 1 ni Terms derived according to the first two rules only via variables and metavariables are referred to as elementary. Hence,anemptysignature withanemptysetofoperators generates onlyelementary terms. Terms are considered up to the α-equivalence relation induced by stipulating that, for every operator →− →− →− ω: (n ,...,n ),thevariables x inthetermω (x )t ,...,(x )t areboundint. 1 k i 1 1 k k i (cid:0) (cid:1) Example3.2. Twosampletermsforthesignature Σ ofthemono-sorted λ-calculus arem: [1],n: [0]⊲− ⊢ λ app abs (x)m[x] ,n[] andm: [1],n: [0]⊲− ⊢ m[n[]]. (cid:0) (cid:0) (cid:1) (cid:1) 3.3. Second-order substitution calculus Thesecond-order natureofthesyntaxrequiresatwo-levelsubstitutioncalculus. Eachlevelrespectively accounts for the substitution of variables and metavariables, with the latter operation depending on the former[1,22,31,10]. Definition3.3(Substitution). Theoperationofcapture-avoiding simultaneoussubstitutionoftermsforvari- ablesmapsΘ⊲ x ,...,x ⊢ tandΘ⊲Γ ⊢t (1 ≤ i ≤ n)toΘ⊲Γ⊢ t x := t according tothefollowing 1 n i i i i∈knk inductivedefinition: (cid:8) (cid:9) - x x := t = t j i i i∈knk j (cid:8) (cid:9) - m[...,s,...] x := t = m ...,s x := t ,... i i i∈knk i i i∈knk (cid:0) (cid:1)(cid:8) (cid:9) (cid:2) (cid:8) (cid:9) (cid:3) - ω(...,(y ,...,y )s,...) x := t = ω ...,(y ,...,y )s x := t,y := z ,... with 1 k i i i∈knk 1 k i i j j i∈knk,j∈kkk (cid:0)z < dom(Γ)forall j∈ kk(cid:1)k(cid:8). (cid:9) (cid:0) (cid:8) (cid:9) (cid:1) j Definition 3.4 (Metasubstitution). Theoperation of metasubstitution of abstracted terms for metavariables →− →− mapsm : [m ],...,m : [m ]⊲Γ ⊢ t andΘ⊲Γ, x ⊢ t (1 ≤ i ≤ k)toΘ⊲Γ ⊢ t m := (x )t according 1 1 k k i i i i i i∈kkk tothefollowinginductive definition: (cid:8) (cid:9) →− - x m := (x )t = x i i i i∈kkk (cid:8) (cid:9) 5 - m[s ,...,s ] m := (→−x )t = t x(i) := s m := (→−x )t (cid:0) l 1 ml (cid:1)(cid:8) i i i(cid:9)i∈kkk ln j j(cid:8) i i i(cid:9)i∈kkkoj∈kmlk →− →− →− →− - ω(...,(x)s,...) m := (x )t = ω ...,(x)s m := (x )t ,... i i i i∈kkk i i i i∈kkk (cid:0) (cid:1)(cid:8) (cid:9) (cid:0) (cid:8) (cid:9) (cid:1) The operation of metasubstitution is well-behaved, in the sense that it is compatible with substitu- tion (Substitution-Metasubstitution Lemma) and monoidal, meaning that it is associative (Metasubstitution LemmaI)andhasaunit(MetasubstitutionLemmaII).FormulationsoftheseLemmasaregiveninAppendix A,andadetailed proofcanbefoundin[27]. 3.4. Parameterisation Every second-order term Θ ⊲ Γ ⊢ t can be parameterised to yield a term Θ,Γˆ ⊲ − ⊢ tˆ, where for Γ = x ,...,x , Γˆ = x : [0],...,x : [0] and tˆ = t x := x[] . The variable context is thus replaced under 1 n 1 n i i i∈knk parameterisation byametavariablecontext,yie(cid:8)ldingane(cid:9)ssentiallyequivalentterm(formallyparameterised term)whereallitsvariablesarereplacedbymetavariables,whichdonotthemselvesparameteriseanyterms. Thisallowsustointuively thinkofmetavariables ofzerometa-arityasvariables, andviceversa. 3.5. Second-Order Equational Logic A second-order equation is given by a pair of second-order terms Θ⊲ Γ ⊢ s and Θ⊲Γ ⊢ t in context, written as Θ⊲Γ ⊢ s ≡ t. Asecond-order equational presentation E = (Σ,E)is specified byasecond-order signature Σtogetherwithasetofequations E,theaxiomsofthepresentation E,overit. Axiomsareusually denoted byΘ⊲Γ ⊢ t ≡ stodistinguish themfromanyotherequations. E Example3.5. Theequationalpresentation E = (Σ ,E )ofthemono-sortedλ-calculusextendsthesecond- λ λ λ ordersignature Σ withthefollowingaxioms. λ (β) m: [1],n: [0]⊲− ⊢ app abs (x)m[x] ,n[] ≡ m n[] Eλ (cid:0) (cid:0) (cid:1) (cid:1) (cid:2) (cid:3) (η) f: [0]⊲− ⊢ abs (x)app(f[],x) ≡ f[] Eλ (cid:0) (cid:1) Itisworthemphasisingthatthe(mono-sorted)λ-calculusismerelytakenasarunningexamplethrough- outthiswork,foritisthemostintuitiveandwidely-knownsuchcalculus. Theexpressivenessofthesecond- order formalism does not, however, rely exclusively onthatoftheλ-calculus. Onecandirectly axiomatise, say,primitiverecursion [1]andpredicate logic[30]assecond-order equational presentations. The rules of Second-Order Equational Logic are given in Figure 1. Besides the rules for axioms and equivalence, the logic consists of just one additional rule stating that the operation of metasubstitution in extended metavariable context is a congruence. The expressive power of this system can be seen through thefollowingtwosamplederivable rules. (Substitution) Θ⊲ x ,...,x ⊢ s≡ t Θ⊲Γ ⊢ s ≡ t (1 ≤ i≤ n) 1 n i i Θ⊲Γ ⊢ s{x := s} ≡ t{x := t} i i i∈knk i i i∈knk (Extension) m : [m ],...,m : [m ]⊲Γ⊢ s≡ t 1 1 k k m : [m +n],...,m : [m +n]⊲Γ,x ,...,x ⊢ s# ≡ t# 1 1 k k 1 n whereu# = u{m := (x ,...,x )m[y(i),...,y(i),x ,...,x ]} . i 1 n i 1 mi 1 n i∈kkk 6 (Axioms) Θ⊲Γ ⊢ s≡ t E Θ⊲Γ ⊢ s≡ t (Equivalence) Θ⊲Γ⊢ t Θ⊲Γ ⊢ s≡ t Θ⊲Γ⊢ s≡ t Θ⊲Γ ⊢t ≡ u Θ⊲Γ ⊢t ≡ t Θ⊲Γ ⊢ t ≡ s Θ⊲Γ ⊢ s≡ u (Extendedmetasubstitution) →− m : [m ],...,m : [m ]⊲Γ⊢ s≡ t Θ⊲∆, x ⊢ s ≡ t (1 ≤ i ≤ k) 1 1 k k i i i →− →− Θ⊲Γ,∆⊢ s m := (x )s ≡ t m := (x )t i i i i∈kkk i i i i∈kkk (cid:8) (cid:9) (cid:8) (cid:9) Figure1:Second-OrderEquationalLogic Performing the operation of parameterisation on a set of equations E to obtain a set of parameterised equations Eˆ,wehavethatallofthefollowingareequivalent: Θ⊲Γ ⊢ s≡ t , Θ,Γˆ ⊲− ⊢ sˆ≡ tˆ E E Θ⊲Γ ⊢ s≡ t , Θ,Γˆ ⊲− ⊢ sˆ≡ tˆ Eˆ Eˆ Hence,withoutlossofgenerality, anysetofaxiomscanbetransformed intoaparameterised setofaxioms, whichinessencerepresents thesameequational presentation. Onemayrestricttoaxiomscontaining empty variablecontexts asintheCRSsofKlop[21],butthereisnoreasonforustodothesame. 3.6. Second-Order Universal Algebra The model theory of Fiore and Hur [14] for second-order equational presentations is recalled. For our purposes,thisispresentedhereinelementaryconcretemodel-theoretictermsratherthaninabstractmonadic terms. Thereaderisreferred to[14]forthelatterperspective. Semantic universe. Recall that we write F for the free cocartesian category on an object. Explic- itly, F has N as set of objects and morphisms m → n given by functions kmk → knk. The second-order F model-theoretic development lies within the semantic universe Set , the presheaf category of sets in vari- able contexts [15]. It is a well-known category, and the formalisation of second-order model theory relies F onsomeofitsintrinsicproperties. Inparticular,Set isbicompletewithlimitsandcolimitscomputedpoint- wise[26]. WewriteyfortheYonedaembedding Fop ֒→ SetF. F Substitution. Werecall the substitution monoidal structure in the semantic universe Set as presented in[15]. Theunitisgivenbythepresheaf ofvariables y1,explicitly theembedding F ֒→ Set. Thisobjectis F a crucial element of the semantic universe Set , as it provides an arity for variable binding. The monoidal F tensorproduct X•Y ofpresheaves X,Y ∈ Set isgivenby k∈F X•Y = X(k)×Yk . Z Amonoid y1 ν✲ A ✛ς A•A 7 for the substitution monoidal structure equips A ∈ SetF with substitution structure. In particular, the map ν : yk → Ak,definedasthecomposite k yk (cid:27) (y1)k ν✲k Ak , induces the embedding (Ayn × An)(k) → A(k+n)× Ak(k)× An(k) → (A•A)(k), which, together with the multiplication, yield asubstitution operation ς : Ayn ×An → Afor everyn ∈ N. These substitution opera- n tionsprovidetheinterpretations ofmetavariables. Algebras. Everysecond-ordersignatureΣ = (Ω,|−|)inducesasignatureendofunctor F : SetF → SetF Σ givenby F X = Xyni . Σ a Y ω:(n1,...,nk)∈Ω i∈kkk F -algebras F X → X provideaninterpretation Σ Σ ~ω(cid:127) : Xyni → X X Y i∈kkk foreveryoperatorω: (n ,...,n )inΣ. Notethattherearecanonical naturalisomorphisms 1 k (X •Y) (cid:27) X •Y i i a a i∈I (cid:0) i∈I (cid:1) (X •Y) (cid:27) X •Y i i Y Y i∈knk (cid:0)i∈knk (cid:1) and,forallpointsη: y1 → Y,naturalextension maps η#n: Xyn•Y → (X•Y)yn . These constructions equip every signature endofunctor F with a pointed strength ̟ : F (X)•Y → Σ X,y1→Y Σ F (X • Y). This property plays a critical role in the notion of algebra with substitution structure, which Σ depends on this pointed strength. The extra structure on a presheaf Y in the form of a point ̟: y1 → Y reflectstheneedoffreshvariablesinthedefinitionofsubstitution forbindingoperators. Wereferthereader to[15]and[10]foradetaileddevelopment. Models. Amodel forasecond-order signature Σisan algebra equipped withacompatible substitution structure. Formally, Σ-models are defined to be Σ-monoids, which are objects A ∈ SetF equipped with an F -algebrastructureα: F A → Aandamonoidstructureν: y1 → Aandς: A•A → Athatarecompatible Σ Σ inthesensethatthefollowingdiagramcommutes. F (A)•A ̟✲A,ν F (A•A) F✲Σς F (A) Σ Σ Σ α•A α ❄ ❄ A•A ς ✲ A WedenotebyMod(Σ)thecategoryofΣ-models,withmorphismsgivenbymapsthatarebothF -algebra Σ andmonoidhomomorphisms. 8 Soundness and completeness. We review the soundness and completeness of the model theory of Second-Order Equational Logic as presented in [14]. A model A ∈ Mod(Σ) for a second-order signa- ture Σ is explicitly given by, for a metavariable context Θ = (m : [m ],...,m : [m ]) and variable context 1 1 k k Γ = (x1,...,xn), a presheaf ~Θ⊲Γ(cid:127)A = i∈kkkAymi × yn of SetF, together with interpretation functions ~ω(cid:127)A: j∈klkAynj → A for each operator ωQ: (n1,...,nl)ofΣ. This induces the interpretation ofasecond- order teQrm Θ⊲Γ ⊢ t in A as a morphism ~Θ⊲Γ ⊢ t(cid:127) : ~Θ⊲Γ(cid:127) → A in SetF, which is given by structural A A induction asfollows: - ~Θ⊲Γ ⊢ x(cid:127) isthecomposite i A ~Θ⊲Γ(cid:127) π2✲ yn νn✲ An π✲j A . A - ~Θ⊲Γ ⊢m[t ,...,t ](cid:127) isthecomposite i 1 mi A ~Θ⊲Γ(cid:127)A hπiπ1,✲fi Aymi ×Ami ς✲mi A , where f = ~Θ⊲Γ⊢ t (cid:127) . j A j∈kmik (cid:10) (cid:11) →− →− - Foranoperator ω: (n ,...,n)ofΣ,~Θ⊲Γ⊢ ω (y )t ,...,(y )t (cid:127) isthecomposite 1 l 1 1 l l A (cid:0) (cid:1) ~Θ⊲Γ(cid:127)A hfjij∈✲klk j∈klkAynj ~ω✲(cid:127)A A , Q where f istheexponential transpose of j →− i∈kkkAymi ×yn×ynj (cid:27) i∈kkkAymi ×y(n+nj) ~Θ⊲Γ,yj⊢tj✲(cid:127)A A . Q Q A model A ∈ Mod(Σ) satisfies an equation Θ⊲Γ ⊢ s ≡ t, which we write as A |= (Θ⊲Γ ⊢ s ≡ t), if andonly if~Θ⊲Γ ⊢ s(cid:127) = ~Θ⊲Γ ⊢ t(cid:127) inSetF. Forasecond-order equational presentation E = (Σ,E), the A A category Mod(E)ofE-modelsisthefullsubcategory ofMod(Σ)consisting oftheΣ-modelsthatsatisfy the axioms E. Theorem 3.6 (Second-Order Soundness and Completeness). For a second-order equational presentation E = (Σ,E),thejudgementΘ⊲Γ ⊢ s≡ tisderivablefromE ifandonlyifA |= (Θ⊲Γ ⊢ s≡ t)forallE-models A. Atthelevelofequationalderivability,theextensionof(first-order)universalalgebratothesecond-order framework,aspresentedinthischapter,isconservative. Clearly,everyfirst-ordersignatureisasecond-order signature inwhichalloperators donotbindanyvariables intheirarguments. Anyfirst-order termΓ ⊢ tcan therefore be represented as the second-order term − ⊲ Γ ⊢ t. Indeed, for a set of first-order equations, if the equation Γ ⊢ s ≡ t is derivable in first-order equational logic, then its corresponding second-order representative −⊲Γ ⊢ s ≡ tisderivable insecond-order equational logic. Theconverse statement iswhatis knownasconservativity ofsecond-order equational derivability. Although thisresultisnotdirectly utilised inourwork,werecallitforthebenefitofcomprehensiveness, andreferthereaderto[14]fortheproof. Theorem 3.7 (Conservativity). Second-Order Equational Logic (Figure 1) is a conservative extension of First-Order Equational Logic. More precisely, if a second-order equation between first-order terms − ⊲ Γ ⊢ s ≡ t lying in an empty metavariable context is derivable in second-order equational logic, then Γ ⊢ s ≡ tisderivable infirst-order equational logic. 9 4. TheSecond-OrderTheoryofEquality In categorical algebraic theory, the elementary theory of equality plays a pivotal role, as it represents the most fundamental such theory. We identify the second-order algebraic theory of equality M. This we do first in syntactic terms, via an explicit description of its categorical structure, and in abstract terms by establishing itsuniversalproperty. Justasthecartesian structure characterises first-orderalgebraic theories, wewillshowthatexponentiability abstractly formalises essential second-order characteristics. 4.1. Categorical exponentials ForC acartesiancategoryand A,BobjectsofC,anexponential object A ⇒ Bisauniversalmorphism from−×A: C → C to B. Explicitly, A ⇒ Bcomesequipped withamorphism : (A ⇒ B)×A → Bsuch thatforanyobjectC ofC and f: C×A → B,thereisaunique (f): C → A ⇒eB,theexponential mateof f,making ◦( (f)×A) = f. Acartesian functor F: C → D islexponential ifitpreserves theexponential structure ineC. Flormally,foranyexponential A ⇒ BinC, FA ⇒ FBisanexponential objectinD andthe exponential mateof F(A ⇒ B)×FA (cid:27) F((A ⇒ B)×A) Fe✲ FB is an isomorphism F(A ⇒ B) → FA ⇒ FB. Anobject C in a cartesian category C is exponentiable if for allobjects D ∈ C theexponentialC ⇒ DexistsinC. Givenanexponentiable objectC,then-arycartesian productCn isobviously exponentiable foralln ∈ N. 4.2. TheSecond-Order TheoryofEquality The syntactic viewpoint of second-order theories leads us to define the category M with set of objects givenbyN∗ andmorphisms(m ,...,m ) → (n ,...,n)givenbytuples 1 k 1 l m : [m ],...,m : [m ]⊲ x ,...,x ⊢t 1 1 k k 1 ni i i∈klk (cid:10) (cid:11) ofelementary termsundertheemptysecond-order signature. Theidentityon(m ,...,m )isgivenby 1 k m : [m ],...,m : [m ]⊲ x ,...,x ⊢ m[x ,...,x ] ; 1 1 k k 1 mi i 1 mi i∈kkk (cid:10) (cid:11) whilstthecomposition of l : [l ],...,l : [l]⊲ x ,...,x ⊢ s : (l ,...,l) → (m ,...,m ) 1 1 i i 1 mp p p∈kjk 1 i 1 j (cid:10) (cid:11) and m : [m ],...,m : [m ]⊲y ,...,y ⊢t : (m ,...,m )→ (n ,...,n ) 1 1 j j 1 nq q q∈kkk 1 j 1 k (cid:10) (cid:11) isgivenviametasubstitution by l : [l ],...,l : [l]⊲y ,...,y ⊢t {m := (x ,...,x )s } : (l ,...,l) → (n ,...,n ) . 1 1 i i 1 nq q p 1 mp p p∈kjk q∈kkk 1 i 1 k (cid:10) (cid:11) Thecategory Miswell-defined, astheidentity andassociativity axiomsholdbecause ofintrinsic prop- erties given by the Metasubstitution Lemmas. It comes equipped with a strict cartesian structure, with the terminalobjectgivenbytheemptysequence(),theterminalmap(m ,...,m )→ ()beingtheemptytuplehi, 1 k andthebinaryproduct of(m ,...,m )and(n ,...,n)givenbytheirconcatenation (m ,...,m ,n ,...,n). 1 k 1 l 1 k 1 l 10

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.