• No se han encontrado resultados

CANTO XVIII *

In document Homero ILÍADA CANTO I (página 159-168)

In the example of the previous section we started with a stochastic process given by the function run :: (R, R) → SimpleProb R and the relation choice :: (R, R) → [R]. When viewing these as dynamical systems, we considered them as discrete systems runsys :: N → (R, R) → SimpleProb (R, R) and

108 CHAPTER 6. WORKING WITH MONADIC SYSTEMS

ctrlsys :: N → (R, R) → [(R, R)] respectively. However, both run and choice have the appropriate form to be used with inpsys, the function defined above in Section 6.1. Using inpsys, we obtain

inpsys run :: [R] → R → SimpleProb R inpsys choice :: [R] → R → [R]

Let us use R for the real numbers representing the states of run and C for those representing the states of choice:

inpsys run :: [C ] → R → SimpleProb R inpsys choice :: [R ] → C → [C ]

We could now pose the problem of combining such systems by noticing that the monoid of each system is related to the states of the other system. In fact, by rewriting run and choice to act on lists rather than elements by wrapping the states and the results, the state of each system would be equal to the monoid of the other system.

The general form of this combination is then: given

sys1 :: T1 → T2 → M T2 sys2 :: T2 → T1 → N T1

to combine them by using the output states of one system as elements of the monoid of the other system.

But, in fact, there is no need to introduce this special form of combi- nation, as the above example shows. We can transform both systems in discrete systems which have the same state space, by:

sys10:: N → (T1 , T2 ) → M (T1 , T2 )

sys10 = app f where f (t1 , t2 ) = fmap (λt → (t , t2 ) (sys1 t1 t2 ) sys20:: N → (T1 , T2 ) → N (T1 , T2 )

sys20 = app g where g (t1 , t2 ) = fmap (λt → (t1 , t ) (sys2 t2 t1 ) Thus, the problem of combining sys1 and sys2 is reduced to finding a serial combination of sys10 and sys20.

6.3

Conclusions

The main ideas of this chapter are expressed in the various constructors and combinators of monadic dynamical systems. The function inpsys, defined in the first section and used throughout, constructs a monadic dynami- cal system from a system “with input”, classically presented as a function f :: (X , A) → X . The combinators parsys and parfam construct monadic systems by putting in parallel two different systems or a family of identically typed systems, respectively. The combinator sysser allowed us to combine

6.3. CONCLUSIONS 109

two monadic dynamical systems which interact via a common state, in the case in which they have the same monad. We have then discussed several so- lutions for the case in which the two systems do not have the same monad. Special attention was paid to the combination, frequently encountered in practice, of a stochastic system with a non-deterministic one, where a first failed attempt at representing systems with input came surprisingly handy. Finally, we have seen that the case of systems interacting via their monoids can be reduced to that of systems interacting via their common state.

All the systems resulting from these constructions are monadic systems, and their trajectories, both macro and micro, can be computed with trj and mtrj . In the following chapter, when we return to the context of vulnera- bility, we will interpret mtrj as the implementation of the function possible which was returning the structures of possible future evolutions. If mtrj were restricted, say, to computing the trajectories of stochastic systems, its use as possible would be questionable. Due to the flexibility of monadic systems, however, we can hope to use mtrj in all situations that arise in practice.

In the course of this chapter we have also seen a number of limitations or awkward effects of using monadic systems. In the case of systems with in- put, the first attempt of obtaining a monadic system failed, resulting instead in a representation of parameterized systems. Moreover, there is in general no guidance about how to combine systems with different monads. Some- times, as in the case of combinations involving deterministic systems, the two monads are “promoted” to their composition, but this is by no means a universal solution. In the important case of combining non-deterministic systems serially with other systems, the common monad is a version of the parameterized systems monad.

Despite these flaws, we were always able to formulate a satisfactory, even if not always natural, monadic version of the systems involved. More experience with these combinators and others which might arise in practice will hopefully lead to a smoother presentation of these versions, or will reveal a simpler, better structure than that of the monad.

Chapter 7

Monadic Systems and

Vulnerability

In this chapter, we return to the model of vulnerability developed in Chapter 4. We use monadic dynamical systems to specialize some of its components, in particular the function possible which was assumed to generate the future evolutions of the world. We discuss how to define measures of harm on a structure of possible evolutions which are compatible with other measures of harm defined on a different structure. We implement a small example and show how a number of conditions can be computationally tested using QuickCheck.

7.1

Micro-trajectories as possible evolutions

The model of vulnerability developed in Chapter 4, expressed as

possible :: States → F Evolutions harm :: Evolutions → V measure :: F V → W vulnerability :: States → W

vulnerability = measure · fmap harm · possible

where F is a functor, V and W are ordered sets, and measure satisfies the monotonicity condition, left open the question of how its components might be implemented. In this chapter, we propose the following answer: the function possible is computed as the structure of micro-trajectories of a monadic dynamical system.

This answer implies that the type of future evolutions is the same as that of micro-trajectories, that is, [States ]. The states in question have been “narrowed down”, from general states of the world, to states of the dynamical system involved in the computation. Additionally, we have the restriction that F is a monad.

112 CHAPTER 7. MONADIC SYSTEMS AND VULNERABILITY

Formally, we have:

newtype VulnerabilityContext m v w x t

= VC (t → x → m x , [x ] → v , m v → w ) system (VC (sys, h, m)) = sys

harm (VC (sys, h, m)) = h measure (VC (sys, h, m)) = m

vulnerability vc x ts = (measure vc) (fmap (harm vc)

(mtrj (system vc) x ts))

We compute vulnerability in the context of a given monadic dynamical sys- tem, with given functions harm and measure. In such a context, vulnerabil- ity is computed in an initial state, along a given trajectory of inputs (which could be, for example, intervals of time).

This represents an implementation of the basic model of vulnerability. In the Sections 4.2 and 4.3, we have presented extensions involving the usage of sensitivity and adaptive capacity. We can implement these extensions by extending the context of vulnerability with the missing elements.

newtype SensitivityContext x v1 v2 v = SC ([x ] → v1 , [x ] → v2 , (v1 , v2 ) → v ) impacts (SC (i , s, c)) = i

sensitivity (SC (i , s, c)) = s combine (SC (i , s, c)) = c

vulnerability sensitivity sys meas sc = vulnerability (VC (sys, harm, meas))

where harm = (combine sc) · pair (impacts sc, sensitivity sc)

newtype AdaptiveCapacityContext x w w0 w00= AC (x → w0, (w , w0) → w00) adaptive capacity (AC (ac, adj )) = ac

adjust (AC (ac, adj )) = adj vulnerability adcap vc acc x ts

= (adjust acc) ((vulnerability vc x ts), adaptive capacity acc x )

In document Homero ILÍADA CANTO I (página 159-168)

Documento similar