Programming With Non-Recursive Maps Last Update: Swansea, September, 2004 - PowerPoint PPT Presentation

About This Presentation
Title:

Programming With Non-Recursive Maps Last Update: Swansea, September, 2004

Description:

... we represent only positive informations: erasing is not a primitive operation. Erasing may be represented by using a fresh ... Erasing in Event Structures ... – PowerPoint PPT presentation

Number of Views:19
Avg rating:3.0/5.0
Slides: 73
Provided by: diUn4
Category:

less

Transcript and Presenter's Notes

Title: Programming With Non-Recursive Maps Last Update: Swansea, September, 2004


1
Programming With Non-Recursive MapsLast Update
Swansea, September, 2004
Stefano Berardi Università di
Torino http//www.di.unito.it/stefano
2
Summary
  • 1. A Dream
  • 2. Dynamic Objects
  • 3. Event Structures
  • 4. Equality and Convergence over Dynamic Objects
  • 5. A Model Of D02-maps
  • 6. An example.

2
3
References
  • This talk introduces the paper
  • An Intuitionistic Model of D02-maps
  • in preparation.

3
4
1. A Dream
  • If only we had a magic Wand

4
5
Just Dreaming ...
  • A program would be easier to write using an
    oracle O for simply existential statements, i.e.,
    using D02-maps.
  • O is no recursive map, it is rather a kind of
    magic wand, solving any question ?x.f(x)0, with
    f recursive map, in just one step.
  • Our dream. To define a model simulating O and
    D02-maps in a recursive way, closely enough to
    solve concrete problems.

5
6
The role of Intuitionistic Logic
  • We define a model of D02-maps using
    Intuitionistic Logic, in order to avoid any
    possibly circularity.
  • Classical logic implicitely makes use of
    non-recursive maps.
  • We want to avoid describing D02-maps in term of
    themselves.

6
7
An example of D02-map
  • Denote by NN the set of integer codes for total
    recursive maps over integers.
  • Using Classical Logic, we may prove there is a
    map F(NN)N, picking, for any fNN, some m
    F(f) which is a minimum point for f
  • "xÎN. f(m) f(x)

7
8
An example of D02-map
  • Here is mF(f)

y
yf(x)
yf(m)
xm
x
8
9
F is not recursive
  • There is no way of finding the minimum point m of
    f just by looking through finitely may values of
    f.

y
yf(x)
Area explored by a recursive F
x
m
9
10
D02-maps solve equations faster
  • Fix any three f, g, hNN.
  • Suppose we want to solve in x the unequation
    system
  • f(x) f(g(x))
  • f(x) f(h(x))
  • xF(f) is a solution by the choice of x, we have
    f(x) f(y) for all yÎN, in particular for
    yg(x), h(x).

(1)
10
11
Did we really find a solution?
  • Using the D02-map F, we solved the system rather
    quickly, with xF(f).
  • The solution xF(f), however, cannot be computed.
  • Apparently, using non-recursive maps we only
    prove the existence of the solution.

11
12
Blind Search
  • The only evident way to find the solution is
    blind search to look for the first xÎN such that
  • f(x) f(g(x))
  • f(x) f(h(x))
  • This is rather inefficient in general.
  • It makes no use of the ideas of the proof.

(1)
12
13
Our Goal
  • We want to define approximations of D02-maps, in
    order to use them to solve problems like the
    previous system.

13
14
2. Dynamic Objects
  • Truth may change with time

14
15
An Oracle for Simply Existential Statements
  • Our first step towards a model of D02-maps is
  • to define, for any recursive map fNN, some
    approximation of an oracle O(f)ÎTrue,False for
    xÎN.f(x)0.
  • O is no recursive map.
  • What do we know about xÎN.f(x)0 in general?

15
16
What do we know about xÎN.f(x)0?
  • We have, in general, an incomplete knowledge
    about xÎN.f(x)0.
  • Assume that, for some x1, ..., xn, we checked if
  • f(x1)0, ..., f(xn)0
  • If the answer is sometimes yes, we do know
  • xÎN.f(x)0 is True.
  • If the answer is always no, all we do know is
  • xÎx1, ..., xn.f(x)0 is false

16
17
The idea introducing a new object
  • Since we cannot compute the truth value of
    xÎN.f(x)0, we represent it by introducing a new
    object the family of all incomplete computations
    of xÎN.f(x)0.
  • That is the family of truth values of all
  • xÎx1, ..., xn.f(x)0
  • for x1, ..., xn finite set of integers.

17
18
A notion of State
  • We formalize the idea of incomplete computation
    of the truth value of xÎN.f(x)0 by introducing
    a set T of computation states or instants of
    time.
  • T is any partial ordering.
  • Each tÎT is characterized by a set a(t) of
    actions, taking place before t. In our case
  • a(t)x1, ..., xn
  • Any action corresponds to some xÎN for which we
    checked whether f(x)0.

18
19
The truth value for xÎN.f(x)0
  • The truth value V of xÎN.f(x)0 is a family
  • V(t)tÎT
  • indexed over computation states, with
  • V(t) truth value of (xÎa(t).f(x)0).
  • The statement (xÎa(t).f(x)0) is the restriction
    of (xÎN.f(x)0) to the finite set a(t)ÍN
    associated to t.

19
20
In each t?T, we compute f(x) for some new x
u3
f(9)0
V(u3)T
T
v3
v2
u2
f(6)6
V(u2)F
f(5)7
V(v3)F
t3
f(8)2
V(t3)T
u1
f(2)11
V(u1)F
V(t2)T
v1
f(4)0
t2
f(8)2
V(v2)F
t1
V(t1)F
f(5)7
V(t0)V(u0)V(v0)F
f(3)1
t0u0v0
20
21
3. Event Structures
  • We record all we did

21
22
A notion of Event Structure
  • An Event Structure consists of
  • 1. An inhabited recursive partial ordering T of
    states.
  • 2. a recursive set A of actions, which we may
    execute in any state tÎT, and which may fail.
  • 3. A recursive map aTfinite subsets of A
  • a(t) set of all actions executed before state t
  • a is weakly increasing.

22
23
Covering Assumption
  • Every action may be executed in any state for
    any tÎT, xÎA, there is some possibly future u³t
    such that xÎa(u) (x is executed before u).

T (states)
action x is executed here (it may fail)
u
t
23
24
An example of Event Structure
  • We consider actions of the form ltd,igt send the
    datum d to the memory of name i.
  • A (actions) Data ? MemoryNames
  • T (states) List(A)
  • a(t) (actions before t) ltd,igt ltd,igt?t
  • Any tÎT describes a computation up to the state
    t. Most of the information in t is intended only
    as comment to the computation.

25
Positive Informations
  • Assume ltd,igt?a(t) we sent datum d to the memory
    i before state t.
  • Then d is paired with i in all possible futures
    u of t (in all u?t), because a is weakly
    increasing.
  • In Event Structure we represent only positive
    informations erasing is not a primitive
    operation.
  • Erasing may be represented by using a fresh name
    for any new state of the memory i
  • lti,0gt, lti,1gt, lti,2gt,

26
Erasing in Event Structures
  • When memory i is in the state number n, its
    current content are only all d such that
  • lt d, lti,ngt gt ? a(t)
  • When the state number changes, the current
    content d of memory i is lost forever.
  • Every action a ltd, lti,mgtgt referring to a state
    m different from the current state (with m?n)
    fails (by this we mean a is recorded, but d is
    never used).

27
Dynamic Objects
  • Fix any recursive set X.
  • We call any recursive LTX a
  • dynamic object over X
  • Dyn(X) dynamic objects over X
  • Dyn(Bool) is the set of dynamic booleans.
  • The value of a dynamic object may change with
    time, and it may depends on all data we sent to
    any memory.

27
28
Embedding X in Dyn(X)
  • Static objects (objects whose value does not
    change with time) are particular dynamic objects.
  • There is an embedding (.)XDyn(X), mapping
    each xÎX into the dynamic object xÎDyn(X),
    defined by
  • x(t) x for all tÎT

28
29
Morphisms over Dynamic Objects
  • Fix any recursive sets X, X, Y. Any recursive
    application f X, XY may be raised pointwise
    to a recursive application
  • f Dyn(X), Dyn(X) Dyn(Y)
  • defined by f(L)(t) f(L(t)), for all tÎT. For
    instance we set
  • (L M)(t) L(t) M(t)
  • We consider all maps of the form f as morphisms
    over dynamic objects.

29
30
Morphisms over Dynamic Objects
  • A morphism over dynamic objects should take the
    current value L(t) Î X of a dynamic object and
    return the current value f(L(t)) Î Y of another
    one
  • In general, however, f(L(t)) could be itself
    dynamic, that is, it could depend on time.
  • The same value L(t) could correspond to
    different values f(L(t)) for different t.
  • Thus, a morphism will be, in general, some map
  • L, t ? f(L(t))(t)

30
31
Morphisms over Dynamic Objects
  • Fix any recursive sets X, Y. We call an
    application
  • ? Dyn(X)Dyn(Y)
  • a morphism if ?(L)(t) depends only over the
    current value L(t) of L, and on tÎT
  • ?( L )(t) ?( L(t) )(t) for all tÎT

31
32
Raising a map to a morphism
  • For all recursive X, Y, every recursive fX
    Dyn(Y) may be raised to a unique morphism
  • f Dyn(X) Dyn(Y)
  • Set, for all tÎT, and all LÎDyn(X)
  • f(L)(t) f(L(t))(t) ÎY
  • f(L) is called a synchronous application
  • the output f(.)(t) and the input L(t)
  • have the same clock tÎT

32
33
X
Y
f
L(t2)
f(L(t2))(t2)
f
L(t1)
f(L(t1))(t1)
f
L(t0)
f(L(t0))(t0)
33
34
4. Convergence and Equality for Dynamic Objects
  • We interpret parallel computations in Event
    Structures.

34
35
Some terminology for Parallel Computations
  • Computation states. They include local states
    of processes, and the state of a common memory.
  • Computation. An asyncronous parallel execution
    for a finite set of processes.
  • Agents. Processes modifying the common memory.
  • Clusters of Agents . Finite sets of agent, whose
    composition may change with time.

35
36
Interpreting Computation States
  • Any tÎT describes a possible state of a
    computation.
  • Any weakly increasing succession tNT
    represents a possible history of a computation.

36
37
Interpreting Computations
  • A computation is any weakly increasing total
    recursive succession tNT of states.

T (states)
t(3)
t(2)
t(1)
t(0)
37
38
Execution of an Agent
  • An agent outputs actions, possibly at very long
    intervals of time.
  • Any action may take very long time to be
    executed.
  • We allow actions to be executed in any order.
  • Many other actions, from different agents, may be
    executed at the same time there is no priority
    between agent.

38
39
Interpreting Agents
  • A agent is a way of choosing the next state in a
    computation.
  • A agent is any total recursive map
  • A TA
  • taking an state t, and returning some action
    A(t)ÎA to execute from t.
  • If t is any computation, we define the set of
    actions of t by ? n?N a(t(n))

39
40
Computations executing an Agent
  • We say that a computation tNT executes a agent
    A, or tA for short, iff for infinitely many iÎN
  • A(t(i)) ? actions of t
  • That is for infinitely many times, the action
    output by A at some step of t are executed in
    some step in t (maybe much later)
  • If tF, and ? is subsuccession of t, we set by
    definition ?F.

40
41
Computations executing an Agent
  • If a computation t executes a agent A, then A
    steers t for infinitely many times, the next
    position in t is partly determined by the action
    output by A.

T (states)
t(3)
t(2)
Constraint a(t(2)) ? A(t(1))
t(1)
t(0)
41
42
Computations executing many Agents
  • Many agents A, B, C, may steer infinitely
    many times the same computation t

T (states)
Constraint a(t(4)) ? C(t(3))
t(4)
t(3)
t(2)
Constraints a(t(2)) ? A(t(1)), B( t(1))
t(1)
t(0)
42
43
Interpreting Clusters of Agents
  • A cluster is a set of agents variable in time,
    represented by a total recursive map
  • F Tfinite sets of agents
  • taking an state tÎT, and returning the finite set
    of agents which are part of the cluster in the
    state t.
  • The agent A corresponds to the cluster constantly
    equal to A.

43
44
Computation executing a Cluster
  • We say that t executes a cluster F, or tF, iff
    for all agents A there are infinitely many iÎN
    such that
  • if AÎF(t(i)), then A (t(i)) ? actions of t
  • In infinitely many steps of t,
  • provided A is currently in F,
  • the action output by A takes place
  • (maybe much later) in t
  • If tF, and ? is subsuccession of a t, we set by
    definition ?F.

44
45
Two Sets of of Computations
  • Let tNT be any computation, L, MTX any
    dynamic objects.
  • L? is the set of computations tNT such that
  • Lt(n) Lt(n1) X, for some n?N
  • (LM) is the set of computations tNT such that
  • Lt(n) Mt(n) X, for some n?N

45
46
Forcing
  • We say that a cluster F forces a set P of
    computations, and we write
  • F P
  • iff tF implies t?P (if all computations
    executing F have the property P).

46
47
Convergence and Equality for Dynamic Objects
  • Let L, MTX be any dynamic objects.
  • L is convergent iff F L? for some F
  • L,M are equivalent iff F (LM) for some F
  • We think of a convergent dynamic object as a
    process learning a value.
  • Let P TBool be any dynamic boolean.
  • P is true iff F(PTrue) for some F

47
48
Assume AL?
A steers t, forcing L?

Constraint a(t(6)) ? A(t(5))
t(6) L(t(6))13
t(5) L(t(5))13
t(4) L(t(4))13
t(3)
Constraint a(t(2)) ? A(t(1))
t(2)
t(1)
t(0)
48
49
About Convergence
  • Assume F forces L? to converge. Classically, we
    may prove that if tF, then Lt is stationary.
  • However
  • On two different computations following F, L may
    converge to different values.
  • On some computation not following F, L may
    diverge.

50
u F ? Lu is convergent
t F ? Lt is convergent
Lu(2)4
Lr(2)9
Lt(3)3
Lu(1)4
r does not follows F Lr can diverge
Lt(2)3
Lr(1)1
Lt(1)2
Lt(0)7
50
51
Termination for clusters
  • The clusters F and ? are both dynamic objects
    over Pfin(A).
  • A cluster F is call terminating iff
  • F (F ?)
  • (if we execute F, eventually F becomes empty)
  • If F is terminating, and t follows F, then
    F(t(i)) ? for some iÎN.

51
52
5. An Intuitionistic Model Of D02-maps
  • Just a bit of Category Theory

52
53
The Category Eff
  • Eff is the Category of Countable Effective Sets.
  • Objects of Eff are
  • Partial Equivalent Relations over N
  • Morphisms of Eff are
  • Recursive Maps compatible with such Relations

53
54
The extension LX of X
  • For all X?Eff, we call LX the set of convergent
    dynamic objects, quotiented up to equivalence.
  • L is a Subcategory of Eff, whose morphisms are
    the morphism over dynamic objects preserving
  • convergence of a dynamic object
  • equivalence of two dynamic objects.

54
55
LX is an Universal Construction
  • Theorem (LX is an Universal Construction).
    (.)XLX is a universal morphism for the
    Category Eff w.r.t. the Category L.

55
56
Lifting a map to LXLY
  • Since (.)XLX is a universal morphism, we may
    lift every total recursive map fXY to some map
    fLXLY, defined by
  • f (f (.))
  • or, alternatively, by
  • f(L)(t) f(L(t)) for all tÎT
  • Lemma (Density). If f(x)g(x) is true for all
    xÎX, then f(L)g(L) is true for all LÎLX.

56
57
LN is a model of D02-maps
  • Theorem (LN is a model D02-maps).
  • Morphisms over LN are the smallest class
  • including oracles for S01-statements,
  • Including any (lifting of) total recursive map
    over N
  • closed under minimalization.
  • LN may be defined using only terminating
    clusters.

58
LX is a Conservative Extension of X
  • For all total recursive f, gXY, any equation
    f(x)g(x) over xÎX may be raised to some equation
    f(L)g(L) over LÎLX.
  • Theorem (Conservativity). If F f(L)g(L) for
    some LÎLX, then f(x)g(x) for some xÎX.
  • Conservativity allow to use LX in order to solve
    concrete problems about X.

58
59
Solving equations in X
  • In order to find some solution xÎX to f(x)g(x),
    it is enough to find some convergent dynamic
    solution LÎLX of f(L)g(L), then turn L into a
    solution xÎX of f(x)g(x).
  • x may be effectively computed out of L and the
    cluster F forcing f(L)g(L).
  • F is the constructive content of a classical
    proof of f(L)g(L).

59
60
Solving equations in X a Rule of Thumb
  • Assume F f(L)g(L).
  • We may assume F terminating.
  • Pick any t following F.
  • Look for the first i such that F(t(i))? (there
    is some because F is terminating).
  • Now xL(t(i)) is a solution of f(x)g(x).

60
61
6. An Example Solving System (1)
  • Is it a game or is it real?

61
62
Solvingf(x) f(g(x)) f(x) f(h(x))
(1)
  • (1) is the corresponding of (1) in LN.
  • Classically, and in N, a solution of (1) is any
    minimum point xÎN of f on N.
  • Intuitionistically, and in LN, a solution of (1)
    is any minimum point MÎLN of fon LN.
  • Any solution of (1) in LN may be effectively
    turned into some solution of (1) in N.

62
63
Minimum point as dynamical object
  • Fix fNN total recursive.
  • There is some MÎLN such that f(M)f(L) for all
    LÎLN.
  • We may define MTN, on all tÎT, by
  • M(t) first minimum point of f over a(t)È0
  • M is convergent if restricted to any computation,
    because it changes value at most f(0) times.

63
64
Minimum point as dynamical object
  • M(t) is, in fact, the minimum point of f over the
    finite set of integers we explored up to the
    state tÎT.


y
yf(x)
M(t)
a(t)È0
x
64
65
Minimum point as dynamical object
  • A agent forcing
  • ( f(M) f(x) ) True
  • for xÎN is Add(x)TA, defined for all tÎT by
  • Add(x)(t) if f(M(t)) f(x) then ? else x
  • In any computation t which follows Add(x), we
    have f(M(t(i))) f(x) true, from some iÎN on.
  • From the same i on we have Add(x)(t(i)) ?
  • Add(x) is terminating

65
66
Minimum point as dynamical object
  • (f(M) f(L)) is true for all LÎLN.
  • We may check that a agent forcing (f(M)
    f(L)) to be true is obtained by lifting Add
  • Add(L) TA

66
67
An integer solution of system (1)
  • xMÎL(N) solves
  • f(x)f(g(x))
  • f(x)f(h(x))
  • By the previous page, a cluster forcing (1) is
  • F Add(g(M)), Add(h(M))
  • We may check that F is terminating.
  • We may effectively turn M into a solution xmÎN
    of (1). How is computed m?

(1)
67
68
The agent Add(g(M))
  • Just by definition unfolding
  • Add(g(M))(t) (by definition of )
  • Add(g(M)(t))(t) (by definition of )
  • Add(g(M(t)))(t) (by definition of Add)
  • if f(M(t)) f(g(M(t))) then ? else g(M(t))
  • Add(g(M)) adds g(M(t)) to a(t), if the dynamic
    boolean f(M(t)) f(g(M(t))) is false.

68
69
The agent Add(h(M))
  • Same as before
  • Add(h(M))(t)
  • if f(M(t)) f(h(M(t))) then ? else h(M(t))
  • Add(h(M)) adds h(M(t)) to a(t), if the dynamic
    boolean f(M(t)) f(h(M(t))) is false.

69
70
The cluster F
  • Pick any computation t which follows
  • F Add(g(M)), Add(h(M))
  • At each step iÎN, if for xM(t(i)) either
  • f(x) f(g(x)) or f(x) f(h(x))
  • are false, we form a(t(i1)) by adding either
    g(x) or h(x) to a(t(i)) .
  • Otherwise we add nothing, F(t(i))? becomes
    empty, and xM(t(i)) is a solution of (1).

70
71
An algorithm solving system (1)
  • The intuitionistic proof of solvability of system
    (1) in LN implicitely contains a
    non-deterministic algorithm finding a solution of
    (1) in N
  • 1. Start from x0.
  • 2. Set xg(x) or xh(x) if, respectively, f(x)
    gt f(g(x)) or f(x) gt f(h(x)).
  • 3. Continue until f(x) f(g(x)) ? f(x) f(h(x))

71
72
Conclusions
  • If we have to find some x1, , xn?N such that
    P(x1, , xn), for some total recursive property
    P, it is enough to find some L1, , Ln?LN and a
    cluster F forcing P(L1, , Ln)True.
  • If F is terminating, to solve P(x1, , xn)True
    we pick any computation t following F. We look
    for the first i such that F(t(i))?. Eventually,
    we set x1L1(t(i)), , xnLn(t(i)).
  • This method is no blind search. In fact it makes
    no reference to P, only to F.

72
Write a Comment
User Comments (0)
About PowerShow.com