categories, institutions, theories, abstract data types ... category of categories cat is a category...

66
Categories, Institutions, Theories, Abstract Data Types, and Development Graphs Florian Rabe Part of the course on Computational Logic by Michael Kohlhase Fall 2007, Jacobs University Bremen 1

Upload: others

Post on 22-May-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Categories, Institutions, Theories, Abstract Data Types, andDevelopment Graphs

Florian Rabe

Part of the course on Computational Logic by Michael Kohlhase

Fall 2007, Jacobs University Bremen

1

24.09.2007

2

Motivation

Two views on logic

I proof-oriented ⇒ calculi, axiomatizations, proof trees ⇒Michael so far and later

I model-oriented ⇒ models, interpretations, categories ⇒ menow and later

Related via soundness and completeness

3

Category Theory

I Abstraction from set-theoretical notions

I Extremely hard to understand

I Occurrence of same pattern in apparently unrelated branchesof mathematics

I Extremely helpful to have understood

I Tip: Intuition and images crucial for understanding, more sothan the formulas themselves

4

References

I Introduced by Samuel Eilenberg and Saunders Mac Lane in1942 – 1945

I Standard reference:

@Book{ c a t e g o r i e s ,au tho r = {S . Mac Lane } ,t i t l e = { Ca t e g o r i e s f o r the work ing mathemat ic ian

} ,y e a r = {1998} ,p u b l i s h e r = { Sp r i n g e r }}

I Recommended read: Steve Awodey’s lecture notes,http://www.andrew.cmu.edu/course/80-413-713/notes/cats.pdf

5

CategoryA category C consists of

I a collection |C| of objects

I for two objects A, B ∈ |C|, a collection C (A, B) of morphisms (arrows)from A to B

with the operations

I id−, which assigns to every object A ∈ |C| its identity morphismidA ∈ C (A, A)

I − •−, which assigns to three objects A1, A2, A3 ∈ |C | and two morphismsf1 ∈ C (A1, A2) and f2 ∈ C (A2, A3) their composition f1 • f2

such that for all objects Ai ∈ |C| for i = 1, 2, 3, 4 and all morphismsfi ∈ C (Ai , Ai+1) for i = 1, 2, 3

I f1 • idA2 = f1 and idA2 • f2 = f2 (identity laws)

I (f1 • f2) • f3 = f1 • (f2 • f3) (associativity law)

A1 A2 A3 A4

(f1 • f2) • f3 = f1 • (f2 • f3)

idA2f1 f2 f3

6

Example: Sets

The category Set is given by

I |Set|: all sets

I Set (A,B): mappings from A to B

I Identity and composition: as for mappings

7

Example: Graphs

A graph G with nodes N and edges E ⊆ N × N, induces acategory G ∗ by

I |G ∗| = N

I G ∗ (a, b) = {(n0, . . . , nr ) ∈ N r | r ∈ N, n0 = a, nr =b, (ni−1, ni ) ∈ E for all 1 ≤ i ≤ r}

I Identity: ida = (a)

I Composition:(n0, . . . , nr ) • (m0, . . . ,ms) = (n0, . . . nr ,m1, . . . ,ms)

In other words: Morphisms from a to b are paths in G from a to b,the identities are the empty paths, and composition isconcatenation.

8

Example: Abstracting from a Set Theoretic Concept

I A morphism f ∈ C (A,B) is called an isomorphism iff there isa morphism f −1 ∈ C (B,A) such that f • f −1 = idA andf −1 • f = idB .

I In that case, we say that A and B are isomorphic and writeA ∼= B.

I Isomorphisms in Set are exactly the bijections.

I For a graph G , the only isomorphisms in G ∗ are the identities.

9

The Category of Signatures

Recall: A FOL signature is a triple (Σf ,Σp, ar) wherear : Σf ∪ Σp → N assigns to each symbol its arity.

I The FOL signatures form a category Sig as follows:I |Sig|: all FOL signaturesI σ ∈ Sig

((Σf ,Σp, ar), (Σ′f ,Σ

′p, ar′)

)iff

σ :

{Σf → Σ′fΣp → Σ′p

}such that ar(s) = ar′(σ(s)) for all

s ∈ Σf ∪ Σp.I Identity: identity mappingI Composition: composition of mappings

10

The Category of ModelsRecall: A model of the FOL signature Σ = (Σf ,Σp, ar) is a pair(U, I ) where U is the universe and I is the interpretation functionassigning an n-ary function or an n-ary relation to every n-aryfunction or predicate symbol, respectively.

The models of Σ form a category ModΣ as follows:

I |ModΣ|: all Σ-modelsI ϕ ∈ ModΣ ((U, I ), (U ′, I ′)) iff: ϕ : U → U ′ such that

I for every f ∈ Σf with ar(f ) = n and all ui ∈ U:

ϕ(f I (u1, . . . , un)) = f I ′(ϕ(u1), . . . , ϕ(un))

I for every p ∈ Σp with ar(p) = n and all ui ∈ U:

(u1, . . . , un) ∈ pI ⇒ (ϕ(u1), . . . , ϕ(un)) ∈ pI ′

I Identity: identity mappingI Composition: composition of mappings

11

Remarks on Notation

I For |C|, sometimes the notation C0 is used.

I For C (A,B), the notations MorC(A,B) and HomC(A,B) arealso common. The set

⋃A,B∈|C|

C (A,B) is sometimes written

C1.

I The notation f • g is not common in the literature. Insteadf ; g is used. It is also common to write g ◦ f (i.e., withreversed composition order as for the composition ofmappings).

12

26.09.2007

13

Motivation: Functors

I Categories abstraction from set-theoretical notions

I Thus applications in different branches of mathematics

I Thus unification of definitions and theorems

I Full power of category theory utilized by relating categories toeach other

I To do that, introduction of functors

14

DiagramsI A diagram over C is a multigraph in which all nodes are

objects of C and all edges from A to B are morphisms from Ato B.

I Any path in a diagram induces a morphism by composing itsedges. A diagram commutes if these morphisms are equal forany two paths between the same nodes.

I Example: A (non-commuting) diagram over Sig relating thesignatures of monoids, groups, and rings:

ΣM : ∗, 1

ΣG : ·, 1, inv ΣR : +, 0,−, ·, 1

σMG

σGR

σMR

σMG : ∗ 7→ ·, 1 7→ 1

σGR : · 7→ +, 1 7→ 0, inv 7→ −

σMR : ∗ 7→ ·, 1 7→ 115

FunctorsF : C → C′ is a functor from a category C to a category C′ if

I F :

{|C| → |C′|C (A,B)→ C′ (F (A),F (B)) for all A,B ∈ |C|

I such that for all A1,A2,A3 ∈ |C| and all fi ∈ C (Ai ,Ai+1) fori = 1, 2:

F (idA) = idF (A) and F (f1 • f2) = F (f1) • F (f2)

Functors map (commuting) diagrams to (commuting) diagrams.

C C′A1

A2

A3

F (A1)

F (A2)

F (A3)

f1 • f2 F (f1) • F (f2)

f1

f2

F (f1)

F (f2)

F

16

The Category of Categories

Cat is a category defined by

I |Cat|: the collection of all categories

I Cat (C, C′): the collection of all functors from C to C′

I idC : maps all objects and morphisms of C to themselves

I F • G : maps an object A to G (F (A)) and a morphism f toG (F (f ))

17

DualityFor every category C, we define its dual (or opposite) category Cop

by:I |Cop| = |C|I Cop (A,B) = C (B,A)I idC

op

A = idCAI f •Cop

g = g •C f

A functor from C to C′op maps (commuting) diagrams over C to(commuting) diagrams over C′ if all arrows are flipped around:

C C′A1

A2

A3

F (A1)

F (A2)

F (A3)

f1

f2

F (f1)

F (f2)

F

18

Duality: Example

I Flipping arrows dualizes concepts, e.g., terminal and initial aredual concepts.

I An object A ∈ |C| is called terminal in C iff for all B ∈ |C |there is a unique f ∈ C (B,A).

I An object A ∈ |C| is called initial in C iff for all B ∈ |C | thereis a unique f ∈ C (A,B).

I Going to the opposite category cancels dualization: A isterminal in C iff it is initial in Cop.

19

Motivation: Institutions

I The concept of institutions abstracts from logical notions likeformulas, models, and satisfaction

I Provides common intuition and definitions

I Structures and orders the multitude of different logics

I Institution-independent theorems for general theory of logic

20

Reference

I Introduced in the 1980s by Joseph Goguen and Rod Burstall

I Standard reference (relatively gentle introduction and lots ofexamples)

@A r t i c l e { i n s t i t u t i o n s ,au tho r = ”J . A . Goguen and R . M. B u r s t a l l ” ,t i t l e = ” I n s t i t u t i o n s : Ab s t r a c t Model

Theory f o r S p e c i f i c a t i o n and Programming ” ,j o u r n a l = ” Jou rna l o f the A s s o c i a t i o n f o r

Computing Machinery ” ,volume = ”39(1) ” ,pages = ”95−−146”,y ea r = ”1992” ,

}

I Available online (use http://citeseer.ist.psu.edu/ tofind papers)

21

Institutions

An institution is a tuple (Sig,Sen,Mod, |=) where

I Sig is a category (signatures)

I Sen : Sig→ Set is a functor (assigning the set of sentences toa signature)

I Mod : Sig→ Catop is a functor (assigning the category ofmodels to a signature)

I |=Σ⊆ |Mod(Σ)| × Sen(Σ) is a relation between Σ-models andΣ-sentences for every Σ ∈ |Sig| (saying whether a formulaholds in a model)

such that the satisfaction condition holds (see below).

For a signature morphism σ, Sen(σ) is called sentence translationalong σ, and Mod(σ) is called model reduction along σ.

22

The Institution FOL (1)

The institution FOL for first-order logic is given by

I SigFOL: signatures as defined before

I SenFOL : Sig→ Set on objects (Σf ,Σp, ar):SenFOL(Σf ,Σp, ar) is the set of first-order formulas as definedbefore using function symbols from Σf and predicate symbolsfrom Σp with their respective arity given by ar

I SenFOL : Sig→ Set on morhismsσ : (Σf ,Σp, ar)→ (Σ′f ,Σ

′p, ar′):

SenFOL(σ) maps a formula ϕ ∈ SenFOL(Σf ,Σp, ar) to itselfexcept that every function or predicate symbol s is replacedwith σ(s)

23

The Institution FOL (2)

I ModFOL : Sig→ Catop on objects Σ:ModFOL(Σ) is the category ModΣ as defined before

I ModFOL on morhisms σ : Σ→ Σ′:ModFOL(σ) : ModFOL(Σ′)→ ModFOL(Σ) is a functor definedas follows

I ModFOL(σ) on objects (U ′, I ′): ModFOL(σ)(U ′, I ′) = (U, I )where U := U ′ and s I := σ(s)I ′ for all s ∈ Σf ∪ Σp

I ModFOL(σ) on morphisms ϕ : (U ′1, I′1)→ (U ′2, I

′2):

ModFOL(σ)(ϕ) = ϕ

24

The Institution FOL (2): ExampleRecall the diagram over SigFOL. Applying ModFOL and flipping thearrows yields a diagram over Cat. (The superscript FOL is droppedbelow.)

ΣM

ΣG ΣR

Mod(ΣM)

Mod(ΣG ) Mod(ΣR)

Sig Cat

σMG

σGR

σMR Mod(σMG )

Mod(σGR)

Mod(σMR)

For the ring Z ∈ |Mod(ΣR)| of integers, Mod(σGR)(Z) is theadditive group of the integers, and Mod(σMR)(Z) is themultiplicative monoid of the integers.

25

The Institution FOL (3)

I For a signature Σ ∈ |SigFOL|, a model M ∈ |ModFOL(Σ)|, anda formula ϕ ∈ SenFOL(Σ):M |=FOL

Σ ϕ iff M satisfies ϕ as defined before

I The satisfaction condition will be proven as an exercise.

26

Satisfaction ConditionFor all Σ,Σ′ ∈ |Sig|, σ ∈ Sig (Σ,Σ′), ϕ ∈ Sen(Σ), andM ′ ∈ Mod(Σ′):

M ′ |=Σ′ Sen(σ)(ϕ) iff Mod(σ)(M ′) |=Σ F

Σ

Σ′

ϕ ∈ Sen(Σ)

Sen(σ)(ϕ) ∈ Sen(Σ′)

Mod(Σ) 3 Mod(σ)(M ′)

Mod(Σ′) 3 M ′

Sig Set Cat

σ Sen(σ) Mod(σ)

|=Σ

|=Σ′

27

A Remark on Foundation

I We leave open what a ”collection of objects” is in thedefinition of categories. It cannot always be a set becausethen |Set| would have to contain itself.

I Similarly, the category of categories cannot exist because |Cat|would have to contain Cat.

I These questions are addressed by axiomatic set theory, whichprovides the foundation of mathematics.

I In principal, levels are introduced such thatI Level 0 contains all sets; the elements of a set are other sets.I Level 1 contains classes: |Set| is the class of all sets, and every

class is a subclass of |Set|. Every set is a class, but not viceversa.

I Level 2 contains super-classes, i.e., collections that maycontain other classes. |Cat| is such a super-class.

28

01.10.2007

29

First-order Logic with Equality

I SigFOL== SigFOL

I SenFOL=(Σ): like SenFOL(Σ) but with addtional case

A,A′ ∈ wff(Σi ) implies A.

= A′ ∈ wff(Σo)

I ModFOL== ModFOL

I |=FOL=

Σ : like |=FOLΣ but with additional case

M, α |=FOL=

Σ A.

= A′ iff [A]M,α = [A′]M,α

for every assignment α

30

Subinstitutions

I Assume an institution I = (SigI ,SenI ,ModI , |=I )I Various ways to construct subinstutions I ′ of I :

I make SigI ′ a subcategory of SigI

I make SenI ′(Σ) a subset of SenI (Σ)I make ModI ′(Σ) a subcategory of ModI (Σ)

I Several subinstitutions of FOL= are interestingI No equality: first-order logic FOLI No predicate symbols: algebraic logicI No predicate symbols and only ∀ and

.= as logical symbols:

equational logic

31

Motivation: Theories

I Mod(Σ) contains all possible models

I But we really want to single out certain models by imposingaxioms

I Thus: Theories are pairs of a signature and a set of axioms

I Reference: Same as for institutions

32

Notation

I For this section, assume a fixed institution (Sig, Sen,Mod, |=)

I Abbreviate for a set of sentences T and a signature morphismσ:

Sen(σ)(T ) = {Sen(σ)(F ) | F ∈ T}

33

Theories

I A theory is a pair (Σ,T ) for Σ ∈ |Sig| and T ⊆ Sen(Σ)

I The elements of T are called the axioms of the theory

I Example: The theory of monoids is (ΣM ,T M) where

T M = {∀x , y , z .(x∗y)∗z .= x∗(y∗z), ∀x .(x∗1 .

= x∧1∗x .= x)}

34

Entailment

I Define T |=Σ F as:for all M ∈ |Mod(Σ)|

if M |=Σ H for all H ∈ T , then M |=Σ FI T |=Σ F means

I F is a theorem of (Σ,T )I F is a (semantic) consequence of TI T entails F

35

The Category of Theories

I A signature morphism σ : Σ→ Σ′ is a theory morphism from(Σ,T ) to (Σ′,T ′) if

T ′ |=Σ′ Sen(σ)(F ) for all F ∈ T

I In particular: if Sen(σ)(T ) ⊆ T ′, then σ is a theory morphism

I For any institution I , theories and theory morphisms form acategory, denoted by ThI

I If σ : (Σ,T )→ (Σ′,T ′) is a theory morphism, then:

T |=Σ F implies T ′ |=Σ′ Sen(σ)(F )

I Theorem reuse: Theorem F of (Σ,T ) can be moved to(Σ′,T ′) along σ

36

Theories: Examples

I Groups: (ΣG ,T G ) where

T G = SenFOL=

(σMG )(T M)∪{∀x .x ·inv(x).

= 1∧inv(x)·x .= 1}}

I Commutative groups: (ΣG ,T cG ) whereT cG = T G ∪ {∀x , y .x · y .

= y · x}I Rings (without 1): (ΣR∗ ,T R∗) where

I ΣR∗ : +, 0,−, ·I σGR∗ : · 7→ +, 1 7→ 0, inv 7→ −I T R∗ = SenFOL=

(σGR∗)(T cG ) ∪ Φ where Φ containsassociativity of · and distributivity of · over +

I Rings (with 1): (ΣR ,T R) whereI ΣR : as ΣR∗ but with 1I T R = T R∗ ∪ Φ where Φ contains neutrality of 1 for ·I σR∗R : inclusion from ΣR∗ to ΣR

37

Theories: Examples (2)

I Commutative rings: (ΣR ,T cR) whereT cR = T R ∪ {∀x , y .x · y .

= y · x}I Fields: (ΣF ,T F ) where

I ΣF : as ΣR but with unary invI T F = T cR ∪ {∀x .(¬x

.= 0⇒ x · inv(x)

.= 1}

I σRF : inclusion from ΣR to ΣF

38

Hierarchy of Algebraic TheoriesIn ThFOL=

:

(ΣM ,T M)

(ΣG ,T G )

(ΣG ,T cG )

(ΣR∗ ,T R∗) (ΣR ,T R)

(ΣR ,T cR)

(ΣF ,T F )

σMG

idΣG

σGR∗

σR∗R

σMR

idΣR

σRF

39

Forgetful Functor

There is a functor Th→ Sig given by

I (Σ,T ) 7→ Σ

I σ : (Σ,T )→ (Σ′,T ′) 7→ σ : Σ→ Σ′

It is called forgetful because it forgets the axioms of a theory.

40

Abstract Data Types (ADT)

I An ADT is a pair (Σ,M) for Σ ∈ |Sig| and M⊆ |Mod(Σ)|I A signature morphism σ : Σ→ Σ′ is an ADT morphism from

(Σ,M) to (Σ′,M′) if Mod(σ)(M ′) ∈M for all M ′ ∈M′

I ADTs and ADT morphisms form a category ADT

41

Adjointness of Syntax and Semantics

I Define the ADT of the theory (Σ,T ):

(Σ,T )∗ =(Σ,{

M ∈ |Mod(Σ)|∣∣ M |=Σ F for all F ∈ T

})I Define the theory the ADT (Σ,M):

(Σ,M)∗ =(Σ,{

F ∈ Sen(Σ)∣∣ M |=Σ F for all M ∈M

})I −∗ is a pair of functors Th↔ ADT

I Define the closure of (Σ,T ): T • = (Σ,T )∗∗

I Define the closure of (Σ,M): M• = (Σ,M)∗∗

42

Adjointness of Syntax and Semantics (2)

I −∗ and −• satisfy very nice properties, namely that of anadjunction

I If Σ is fixed and omitted, their properties are known as aGalois connection:

I T ⊆ T ′ implies T ∗ ⊇ T ′∗

I M⊆M′ implies M∗ ⊇M′∗I T ⊆ T • and M⊆M•I T ⊆ T ′ implies T • ⊆ T ′

•and

M⊆M′ implies M• ⊆M′•I T •• = T • and M•• =M•

I Entailment: T |=Σ F iff F ∈ T •

43

ADT Specification

I ADT specification is the process of finding a theory (Σ,T )such that (Σ,T )∗ = (Σ,M) for a given ADT (Σ,M)

I The theories of monoids, groups, etc. specify the ADTs ofmonoids, groups, etc.

I The ADTs (ΣN, {M | M ∼= N}) and (ΣF , {M | M ∼= R})cannot be specified in FOL=

Here ΣN is the signature with the symbols 0, 1,+, ·.I The ADT (ΣF , {M | M ∼= Q}) can be specified in FOL=.

44

08.10.2007

45

Motivation

I Use morphisms to build big theories out of smaller ones (LittleTheories Approach)

I Modularity

I Reuse

I Management of change

46

References@A r t i c l e {HSTstructured ,

au tho r = ”R . Harper and D. S ann e l l a and A. T a r l e c k i” ,

t i t l e = ” S t r u c t u r e d P r e s e n t a t i o n s and Log i cR e p r e s e n t a t i o n s ” ,

j o u r n a l = ”Anna l s o f Pure and App l i ed Log i c ” ,y ea r = 1994 ,volume = 67 ,pages = ”113−−160”,

}

@InProceed ing s { devgraphs ,t i t l e = ”Towards an E v o l u t i o n a r y Formal Software−

Development Us ing {CASL}” ,au tho r = ”S . Au t e x i e r and D. Hut te r and H. Mantel and

A. S c h a i r e r ” ,s e r i e s = ” Lec tu r e Notes i n Computer S c i e n c e ” ,y ea r = ”1999” ,volume = ”1827” ,pages = ”73−−88”,

}47

Structured Specifications

I A language to build theories over an arbitrary institutionI Syntax: The collection STH(Σ) of structured theories with

signature Σ is given byI Presentations: for a theory (Σ,T ) with finite T ,

(Σ,T ) ∈ STH(Σ)I Union: If (ϑi ) ∈ STH for i = 1, 2, then ϑ1 ∪ ϑ2 ∈ STH(Σ)I Translations: If ϑ ∈ STH(Σ) and σ : Σ→ Σ′, thenσ(ϑ) ∈ STH(Σ′)

I Derivation/Hiding: If ϑ ∈ STH(Σ′) and σ : Σ→ Σ′, thenσ−1(ϑ) ∈ STH(Σ)

48

Notation

I For sets M ′ ⊆ M, N ′ ⊆ N, and a map f : M → N, we write

f (M ′) = {f (m) ∈ N | m ∈ M ′}

andf −1(N ′) = {m ∈ M | f (m) ∈ N ′}

I In particular: Sen(σ)(T ) is the set of translations along σ offormulas in T . And Sen(σ)−1(T ) is the set of formulas thatare translated along σ to a formula in T .

49

Semantics of Structured Specifications

I Every structured theory is supposed to abbreviate anunstructured theory. We can flatten out these abbreviatons bydefining a map f : STH(Σ)→ P(Sen(Σ)):

I I f (Σ,T ) = T •

I f (ϑ1 ∪ ϑ2) = (f (ϑ1) ∪ f (ϑ2))•

I f (σ(ϑ)) = (Sen(σ)(f (ϑ)))•

I f (σ−1(ϑ)) = Sen(σ)−1(f (ϑ))

I Remark: Sen(σ)−1(T ) is closed if T is closed.

50

Structured Specifications and Theory Morphisms

I Let ϑ ∈ STH(Σ), ϑ′ ∈ STH(Σ′), and let σ : Σ→ Σ′ be asignature morphism.

I Then σ is a theory morphism (Σ, f (ϑ))→ (Σ′, f (σ(ϑ))).

I Similarly, σ is a theory morphism(Σ, f (σ−1(ϑ′)))→ (Σ′, f (ϑ′)).

51

Example

I Let ϑM = (ΣM ,T M) be the theory of monoids, and similarlyfor the other example theories from Slide 39.

I Let ϑi (ΣG ,T i ) be the theory containing only the group axiomfor the inverse element.

I Then ϑG can be written in a structured way as σMG (ϑM)∪ ϑi .

I (The closure of) ϑG can be obtained as (σGR∗ • σRR∗)−1(ϑR).

52

Motivation: Development Graphs

I Structured theories are somewhat inconvenient.

I Tool support is easier if the structure is more explicit.

I Structured specifications do not handle difficult theorymorphisms, only those that exist by construction.

53

Development Graphs

I A development graph is an acyclic graph that hasI as nodes, theories,I as edges (links) from (Σ,T ) to (Σ′,T ′): signature morphisms

Σ→ Σ′ along with a type.I A type of a link is both one of definitional/theorem and one of

local/global.

I Definitional links: theory morphisms by construction

I Theorem links: non-trivial theory morphisms

54

Flattening a Development Graph

I Intuitively, the theories in the graph are not theories, butpartial theories.

I Flattening turns every node into the intended theory andevery definitional link into a theory morphism.

I Flattening is defined incuctivelyI Assume a node (Σ,T ) with incoming local definitional edgesσi from (Σi ,Ti ) and incoming global definitional edges σ′i from(Σ′i ,T

′i ).

I Then f (Σ,T ) = T ∪⋃

i Sen(σi )(Ti ) ∪⋃

i Sen(σ′i )(f (T ′i )).I Well-founded due to acyclicity.

55

Example: Development GraphRecall Slide 39. Dashed arrows are local. All arrows aredefinitional.

(ΣS , {assoc}) (ΣM , {neutral})

(ΣM , {commut})(ΣG , {inverse})

(ΣG ,∅)

(ΣR∗ , {distrib}) (ΣR ,∅) (ΣR ,∅)

σSM

idΣMσMG

idΣG

σGR∗

σR∗R

σMR

idΣRσ

SM•σ

MG•σ

GR∗

σMG

σMR

56

Decomposing Theorem Links

I Theorem links σ : (Σ,T )→ (Σ′,T ′) must be proved to betheory morphisms.

I If σ is local, all formulas in T must be derived from f (Σ′,T ′).

I If σ is global, all formulas in f (Σ,T ) must be derived fromf (Σ′,T ′).

I Global theorem links can be decomposed into local ones.

I Thus, the development structure can be used to dischargeproof obligations.

57

Example: Decomposing Theorem LinksTheorem links are thick.

A theorem link:

A B

C

A′ B ′

C ′

Its decomposition (The diagram must commute.):

A B

C

A′ B ′

C ′

58

Heterogenous Development Graphs

I So far: nodes and links live in the category ThI for a fixedinstitution I

I Generalization: Permit different institutions in the same graph

I Make the collection of institutions a category by defininginstitution translations.

I Then: Nodes are triples (I ,Σ,T ) of institution and theory;links from (I ,Σ,T ) to (I ′,Σ′,T ′) are pairs (µ, σ) for aninstitution translation µ : I → I ′ and a theory morphismσ : µ(Σ)→ Σ′ in I ′

59

Theory Graphs

I So far: modular development of the set of axioms

I Obvious extension: develop signatures by using modules, too

I Thus: Nodes (Σ,T ) where Σ is a partial signature

I The complete signature of a node is obtained by flattening

60

Example: Theory Graphs

({∗}, {assoc}) ({1}, {neutral})

(∅, {commut})({inv}, {inverse})

(∅,∅)

(∅, {distrib}) (∅,∅) (∅,∅)

σSM

idΣMσMG

idΣG

σGR∗

σR∗R

σMR

idΣR

σSM•σ

MG•σ

GR∗

σMG

σMR

61

Theory Graphs: Problems

I How to define edges if we need flattening to find out what thesignatures are?

I What happens if symbols are imported several times?

I Current work

62

Theory Graphs: Systems and StandardsI OBJ: J. Gogues and others;

http://www.cs.ucsd.edu/users/goguen/sys/obj.html;1970s; influential specification language

I IMPS: W. Farmer, J. Guttman, F. Thayer; 1990;http://imps.mcmaster.ca/; system using theorymorphisms for theorem reuse

I Maya: D. Autexier, D. Hutter, T. Mossakowski, A. Schairer;2000 (?);http://www-ags.dfki.uni-sb.de/~inka/maya.html; firstimplementation of develoment graphs, uses FOL=, offersmanagement of change

I Hets: T. Mossakowski and others; 2004 (?);http://www.informatik.uni-bremen.de/agbkb/forschung/formal_methods/CoFI/hets/index_e.htm;extends development graphs to the heterogeneous case

I OMDoc: M. Kohlhase; 2002 (?); http://www.omdoc.org/;XML-based semi-formal specification language

63

PushoutsGiven the left diagram in a category C. (P, p1, p2) is called apushout of (f1, f2) if the right diagram commutes

A B1

B2

f1

f2

A B1

B2 P

f1

f2 p1

p2

and if for every commuting (O, o1, o2) as in the left diagram, thereis a unique h such that the right diagram commutes.

A B1

B2 P

O

o1

o2

f1

f2 p1

p2

A B1

B2 P

O

f1

f2 p1

p2 o1

o2h

64

Pushouts: Intuition

I Pushouts generalize the concept of union with sharing

I P is the union of B1 and B2 with shared structure A

I There are a several pushouts in the running example, e.g.,

(ΣM ,T M) (ΣcM ,T cM)

(ΣG ,T G ) (ΣcG ,T cG )

idΣM

σMG σMG

idΣG

65

Pushouts: Lemmas

I So far, we have only defined flattening for FOL=.

I Pushouts are crucial for the structured theory developmentbecause we can use them to define in general what flatteningmeans.

I Lemma: Th has pushouts for all (f1, f2) if Sig does.

I Lemma: SigFOL=has pushouts.

66