<<

Applications of Algebra and Coalgebra in Scientic Modelling Illustrated with the Logistic

M. Hauhs B. Trancón y Widemann

Ecological Modelling University of Bayreuth, D

Coalgebraic Methods in Computer 20100326/28 Paphos, CY

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 1 / 26 Context

This Talk and models of exemplied by the logistic map

Why at CMCS?

ecology ↔? scientic modelling ↔? coalgebra

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 2 / 26 Context

Relation of Ecology and Computer Science

Wikipedia

Nothing too obvious, long term work. . .

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 3 / 26 Scientic Modelling

What is Scientic Modelling? Real systems are studied using models. Models are stylized objects that resemble the in some properties considered essential. Which properties are essential is determined by the context, in particular by the scientic discipline. Most model types employed in empirical disciplines belong to either of two (dual?) paradigms.

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 4 / 26 Model Types: State vs. Behavior

Ontological Dispute State-based or behavior-based modelling? Scientic disciplines are biased:

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 5 / 26 Model Types: State vs. Behavior

Ontological Dispute State-based or behavior-based modelling? Scientic disciplines are biased:

Physics State is fundamental (snapshots of ) Behavior is the eect of natural laws Functional models dene variables and their dynamics Problems prediction of state and inference of parameters

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 5 / 26 Model Types: State vs. Behavior

Ontological Dispute State-based or behavior-based modelling? Scientic disciplines are biased:

Computer Science Behavior is fundamental (specications of technology) State is the artifact of implementation Interactive models dene interfaces and their protocols Problems assessment of situations and planning of strategies

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 5 / 26 Model Types: State vs. Behavior

Ecology has no theoretical framework of its own, is characterized by the interaction of living systems with their environment, hence calls for both paradigms, but is traditionally dominated by physicalism (PDEsa etc.); to the eect that relevance and rigor often appear mutually exclusive.

aPartial Dierential Equations

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 6 / 26 Model Types: State vs. Behavior Examples

Environment-Dominated Life-Dominated State soil / groundwater Behavior annual tree growth

Behavior runo from watershed State carbon pool in forest

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 7 / 26 Model Types: State vs. Behavior

Proposal: Formalize the Two Paradigms state ↔ algebra behavior ↔ coalgebra

exploit duality for unifying framework

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 8 / 26 Logistic Map

Denition [R. May, 1976, Nature] discrete-time demographical model simple real quadratic map

fr (x) = r · x · (1 − x)

with real growth parameter r > 0 restricted to the unit interval I = [0, 1] iteration produces complex behavior

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 9 / 26 Logistic Map

Forward Dynamics

Trajectories for given initial value x0 and parameter r

2 x0, fr (x0), fr (x0),... ∈ I

innite for r ≤ 4 eventually divergent for r > 4 all sorts of long-term dynamics: stable/unstable xpoints, stationary cycles, deterministic chaos, strange attractors test case for information/complexity measures [F. Wolf, 1999, Diss.]

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 10 / 26 Logistic Map

Graph

r < 4 r > 4

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 11 / 26 Logistic Map

Backward Dynamics

Each x has (at most) two preimages under fr innite binary decision tree or innite automaton binary input, state space I total for r ≥ 4 partial for r < 4: states x > r/4 (global max) are error states

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 12 / 26 Logistic Map

Finite Partitioning (Coloring) ( 0 x ∈ [0, 1 ) c x 2 ( ) = 1 1 x ∈ [ 2 , 1]

simple model of imperfect observation generating partition of symbolic dynamics

complementary to fr :

neither c nor fr is invertible, but hc, fr i is

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 13 / 26 Models as Homomorphisms

Modelling [R. Rosen, 1991, Life Itself]

Real2 Abstract2

causality computation time

Real1 Abstract1 abstraction

Wanted abstraction that commutes with dynamics Test round-trip ⇒ prediction

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 14 / 26 Models as Homomorphisms

Modelling [R. Rosen, 1991, Life Itself]

Real2 Abstract2

causality computation time

Real1 Abstract1 abstraction

Wanted abstraction that commutes with dynamics Test round-trip ⇒ prediction

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 14 / 26 F ( ) F ( ) F ( )

F ( ) F ( ) F ( )

Models as Homomorphisms

Generalization: (Co)Algebras h A2 - B2 6 6 α β

h A1 - B1 Base Case trivial signature functor (identity) Algebra signature F encodes model queries Coalgebra signature F encodes model observations

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 15 / 26 F ( ) F ( ) F ( )

Models as Homomorphisms

Generalization: (Co)Algebras h A2 - B2 6 6 α β

F (h) F (A2) - F (B2) Base Case trivial signature functor (identity) Algebra signature F encodes model queries Coalgebra signature F encodes model observations

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 15 / 26 F ( ) F ( ) F ( )

Models as Homomorphisms

Generalization: (Co)Algebras

F (h) F (A1) - F (B1) 6 6 α β

h A1 - B1 Base Case trivial signature functor (identity) Algebra signature F encodes model queries Coalgebra signature F encodes model observations

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 15 / 26 Taxonomy of Models

A Denition: Ane Functor AB Recursive structure: A-List with B-labelled end

A AB = A × (−) + B

A A go : A × X → AB (X ) stop : B → AB (X ) Agenda metaphors =⇒ formal calculus all ane functors have initial algebras / nal coalgebras generate model types by instantiating A/B with simple sets take cata-/anamorphisms as modelling ((co)induction)

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 16 / 26 Taxonomy of Models A Ane Functor AB

Initial Algebra

∗  A × B, [α1, α2]

  α1 a, (w, b) = cons(a, w), b α2(b) = (nil, b)

Catamorphism

∗   h : A × B, [α1, α2] → C, [γ1, γ2]

  h cons(a, w), b = γ1 a, h(w, b) h(nil, b) = γ2(b)

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 17 / 26 Taxonomy of Models A Ane Functor AB

Final Coalgebra

A∗ × B ∪ Aω, φ

φcons(a, w), b = goa, (w, b) φ(nil, b) = stop(b)

Anamorphism

h :(C, γ) → (A∗ × B ∪ Aω, φ)

( goa, h(c0) if γ(c) = go(a, c0) φh(c) = stop(b) if γ(c) = stop(b)

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 18 / 26 Taxonomy of Models A Ane Functor AB

Instances 1 A A A A1 A A∅ B ∅ B :

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 19 / 26 Taxonomy of Models A Ane Functor AB

Instances 1 A A A A1 A A∅ B ∅ B

Algebras: Iteration

(C, γ : 1 × C + B → C) General γ ∼ (f , g) f : C → Cg : B → C

 ∗ × B, (f0, g0) 1 ∼ Initial N N f0(n, b) = (n + 1, b) g0(b) = (0, b)

Catamorphism ([γ]) i(n, b) = f ng(b)

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 19 / 26 Taxonomy of Models A Ane Functor AB

Instances 1 A A A A1 A A∅ B ∅ B

Algebras: List Folding

(C, γ : A × C + 1 → C) General γ ∼ (f , e) f : A × C → Ce ∈ C

A∗, (cons, nil) Initial

Catamorphism ([γ]) jcons(a, w), b = f a, j(w) j(nil) = e

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 19 / 26 Taxonomy of Models A Ane Functor AB

Instances 1 A A A A1 A A∅ B ∅ B

Coalgebras: Stream Unfolding

(C, γ : C → A × C + ) General ∅ γ ∼ (h, t) h : C → At : C → C

(Aω, cons−1) Final

Anamorphism [(γ)] k(c) = consh(c), k(t(c))

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 19 / 26 Taxonomy of Models A Ane Functor AB

Instances 1 A A A A1 A A∅ B ∅ B

Coalgebras: Degenerate (C, γ : C → × C + B) General ∅ γ ∼ tt : C → B

(B, stop) Final

Anamorphism [(γ)] m = t

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 19 / 26 Model Instances

Functional, Deterministic

i × B - C 1 N F = AB C = I 6 6(f ,g) B f fr g id = I = = I F ( × B) - F (C) N F (i)

Given boundary (r) and exact initial (x0) conditions Predict state after n steps n i(n, x0) = fr (x0)

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 20 / 26 Model Instances

Functional, Nondeterministic

i × B - C 1 N F = AB C = P I 6 6(f ,g) B f fr g id = PI = P = PI F ( × B) - F (C) N F (i)

Given boundary (r) and potential initial (x0) conditions Predict state after n steps n i(n, x0) = Pfr (x0)

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 20 / 26 Model Instances

Functional, Probabilistic

i × B - C 1 ∼ N F = AB C = I 6 6(f ,g) ∼ ∼ B f fr g id ∼ = I = = I F ( × B) - F (C) N F (i)

a Given boundary (r) and distribution (CCDF ) of initial (x0) conditions Predict state after n steps ∼n i(n, x0) = fr (x0)

aCumulative Continuous Distribution Function

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 20 / 26 Model Instances

Inverse Functional

j × B - C A N F = A1 C = I 9 I 6 6(f ,e) A 2 f a h fr a he id = ( , ) = | ◦ = I F ( × B) - F (C) N F (j) ( fr (x) if c(x) = a fr |a(x) = undened if c(x) 6= a Given a nite trace of colors Solve for initial & nal states

j(a1 ... an) = fr |a1 ◦ · · · ◦ fr |an

limit n → ∞?

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 21 / 26 Model Instances

Interactive [Rutten, 2000]

F (k) - ω A F (Jr ) F (2 ) F = A C = Jr ∅ (h,t) 6 6 A = 2 h = ct = fr Jr - 2ω k

∞ \ n Jr = Pfr (I)(r > 4 ⇒ Cantor dust) n=0 Given the set of states not leading to termination Represent their fully abstract behavior at interface c n  k(x)(n) = c fr (x) (k iso)

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 22 / 26 Model Instances

Inverse Interactive (Work in Progress)

F (k) - ω  F (Jr ) F (2 ) k iso =⇒ Jr , (c, fr ) nal =⇒ (c, fr ) iso c f −1 −1 2 ( , r ) ? 6 (c, fr ) : 2 × Jr → Jr ' Jr → Jr Jr - 2ω k Game solitaire with binary moves Record a particular player's actual moves Cover reached states by some subsystem (-coalgebra) Describe subsystem axiomatically by modal Attribute axioms as strategy to player simple backward strategies have arbitrarily complicated forward reconstructions

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 23 / 26 Summary

Conclusion Generate family of model types (co)inductively from family of functors functionalinteractive mapped to algebracoalgebra functional & interactive models on par counterexamples to from complexity toy examples work out ne, so now for. . .

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 24 / 26 Outlook

Current & Challenges modal logic & ecosystem management non-well-founded structures & open-ended evolution information & complexity of behavior traces denition of life causality in biology

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 25 / 26 References

R.M. May (1976). Simple mathematical models with very complicated dynamics. Nature 261(5560), pp. 459467

R. Rosen (1991). Life Itself: A Comprehensive Inquiry into the Nature, Origin, and Fabrication of Life. Columbia Press, New York.

F. Wolf (1999). Berechnung von Information und Komplexität in Zeitreihen  Analyse des Wasserhaushaltes von bewaldeten Einzugsgebieten. Dissertation, Universität Bayreuth.

J.J.M.M. Rutten (2000). Universal coalgebra: a of systems. Theor. Comp. Sci. 249(1), pp. 380.

B. Trancón y Widemann, M. Hauhs (2009). Programming as a Model for the Theory of Ecosystems. In J. Knoop, A. Prantl (eds.). Programmiersprachen und Grundlagen der Programmierung; Post-Proceedings KPS 2009. Technical Report 2009-XII-1, pp. 186201. Institut für Computersprachen, Technische Universität Wien.

Hauhs, Trancón (Bayreuth) (Co)Algebra in Scientic Modelling CMCS 2010 26 / 26