Reasoning with Intervals on Granules

The formalizations of periods of time inside a linear model of Time are usually based on the notion of intervals, that may contain or may not their endpoints. This is not enought when the periods are written in terms of coarse granularities with respect to the event taken into account. For instance, how to express the inter-war period in terms of a {\em years} interval? This paper presents a new type of intervals, neither open, nor closed or open-closed and the extension of operations on intervals of this new type, in order to reduce the gap between the discourse related to temporal relationship and its translation into a discretized model of Time.


Introduction
As Humberstone mentionned it in its introduction [12], ever since Zeno, philosophers have been aware that there is something problematic about the notion of an instant, or moment of time.The problem of the instant of change is the following: is an object which changes in a certain respect at a certain moment in its pre-change or its post-change state, at that moment ?If the answer is "neither", it violates the law of excluded middle.If the answer is "both", it violates the law of non-contradiction.In order to get a more adequate answer, the notion of interval of time, or period, has been prefered, a period being an uninterrupted stretch of time, during which something may happen.This notion of period is an entity in its own right and not a set of points.This response can be traced back to Aristotle and even to the Stoicism.
In european languages, one refers to time as instants as well as periods, related to calendar units and clock units (e.g.years, weeks, months, hours and seconds).For instance, in English, "We met them yesterday" refers to a period of time; but "We met them at eleven" refers to an instant, introduced by at.In German for days or part of days, the preposition am is used, and for longer periods, im is used: one says "Am Dienstag" but "Im Sommer".
Depending on the context, a same unit is viewed as a point or an interval.Allen and Hayes [3] have proposed a model that takes into account the two objects.In order to avoid confusion between mathematical objects and temporal object, they propose periods instead of intervals and moments as points, following Humberstone [12].
Most human activities are linked to the social artefacts that are named calendars and refer to calendar units.These units are also called granularities [6] or chronologies [14] or time units [15], and this research domain has been recognized to be an important issue.Conversions are proposed when two granularities are commensurable, as months and years are.The method is always the same.If a granularity f , say months, is finer than a granularity g, say years, an occurrence of f , a month, is translated into the occurrence of g, the year, that contains it: June2000 is so converted into 2000.In the other way, an occurrence of g is converted into the interval of all occurrences of f that are contained in it: 2002 is converted into [January2002, December2002].Conversions between incommensurable granularities are proposed also when these two granularities have in commun a finer granularity, Days with respect to months and weeks.
In [9,4] has been pointed out that a constraint about a temporal relationship in one granularity may not be preserved in another granularity.As an example, if a constraint says that an event must happen in the day that follows the day when another event happens, then this constraint cannot be translated into one in terms of hours because it is incorrect to say that the second event must happen within 24 hours after the first event happens.The reader can see that the solution is x hours for some x such that 1 ≤ x ≤ 47.This constraint cannot be also translated automatically into one in terms of months because the first event may occur the last day of a month, the next day taking then place in an other month.
In Databases framework, the same problem has been risen [8].In fact, it is clear that, when the Time line, supposed to be continuous, is partitioned into intervals with non-null length, called granules of time, any instant is approximated with such a granule.Exactly in the same manner as any measurement is an approximation of what is measured.Two instants that are located within the same granule, inside a granularity, may be strictly ordered inside a finer granularity.Different approaches have been proposed, for dealing with that problem of precision or indeterminacy, based on fuzzy sets or possibilistic distributions [7].Much attention has been paid about the conversion of temporal expression from one granularity to another, about an information which is supposed to be timestamped with the good granularity according to its management.But until now, no attention has been paid to the discrepancy between the time granularity expressed in the discourse and the time granularity induced by the knowledge level, that induces temporal relationships on finer granularity that are contained in the knowledge level, but not expressed in the discourse.
For instance, the worldwide II war is called 1939-1945 war, which express the fact that this war began in the course of the year 1939 and ended in the course of year 1945.The same thing can be said about 1914-1918 war.And the period between these two wars is obviously, for a human being, the period 1918-1939, which is understood by every one to begin in the course of 1918 and end in the course of 1939.
This problem is concerned with how to express indeterminacy related to the expression in the course of which can be expressed or simply inferred by the knowledge of he context.
That is the problem we address in this paper which can be divided in three steps: i.e. (1) how to express the difference between ends of intervals that are wholly included in the validity period of the fact taken into account and the endpoints of intervals that are partially included in it, (2) how to manage with it inside a granularity and (3) how to go from one granularity to another one.
The paper is organized as follows.We begin with two examples that motivate this work.The first one is taken from a book about french history, the second one is inspired by the REANIMATIC project, which is devoted to a medical datawarehouse.Then, refering to Allen's work and to the concept of chronology and calendar, we propose a new kind of interval, buit on granules, with three types of ends.In forth part, we recall the boolean calculus on usual intervals (with two types of ends) and extend the calculus to intervals on granules.We end showing how these new intervals and their calculus allow to solve our two example problems.

Two examples
The first example concerns the linguistic temporal locution entre-deux-guerres, that we want to translate inside the framework of a formal model.The second one is the description of how beds are managed in a french hospital.
Temporal elements provided by usual Data Models for Time are either points, intervals or subsets of a linear and discrete set, such as the set of positive integers IN , or as the set of integers Z Z.But points, in Data Model for Time, are not without duration.They represents an occurrence of a time unit, which is an uninterrupted stretch of time with duration.So that an interval of such objects is in fact an interval of intervals.There are only four types of intervals in IN and Z Z: the open interval, in which the two endpoints are outside the interval; the closed interval, in which the two endpoints are inside the interval; the openclosed interval, in which the left endpoint is outside and the right endpoint is inside the interval; the closed-open interval, in which the left endpoint is inside and the right endpoint is outside the interval.Let us take all occurrences of the unit years as points and apply on the first world-war period (1914)(1915)(1916)(1917)(1918) the four types of intervals.The closed interval [1914,1918]   In order to have a good representation of this kind of problem, we need a new kind of object which is both sharable as any uninterrupted stretch of time and irresolvable as atomic object.Let us call this kind of object a granule.

Beds managment in hospitals
In a french hospital, a day begins at 8 a.m. and lasts 24 hours.If Jack goes to the hospital at 2 p.m. on monday march 13th and leaves at 10 a.m. on friday march 17th, he will be registered and will be requested to pay for 5 days.If George goes to the same hospital at 6 p.m. on monday march 6th and leaves at 10 a.m. on monday march 13th, he will be registered and will be requested to pay for 8 days.If Karl goes to the same hospital from 11 a.m. to 4 p.m. on monday march 13th, he will be recorded and will be requested to pay for 1 day.
Suppose that they occupy the same bed, let us say bed 13.The registration database is described in Table 1.The amounts of chage dues by the patients are computed following Table 2, all intervals are supposed to be closed.

Table 1. The relational table of staying days in the hospital
The stay includes the two endpoints days, even if they are partial.That so, the day 03/13 is paid three times instead of one time, since according to the hospital database, for the same bed, 5+8+1=14 days have been accounted from 03/06 until 03/17 (that is for 12 days) thought at any moment there is at most one person in the bed.The solution that consists in changing the time unit to hours would induce perhaps less liberty for a patient to leave the hospital and a change inside the database of the hospital.Let us show that none of closed, The total due for bed 13, during the period beginning at 03/06 and ending at 03/17 is 4+7+0=11.If bed 13 is not used on 03/18, the day 03/17 is not perceived and all the day 03/13 is due by Jack, Karl paying nothing.
We get three different solutions : 14, 9 and 13 days paid.None of these solutions gives the good result, that is 12 days.

A new kind of interval
A granularity induces a sequence of points on the physical time line, which are the meeting points of granules.Each point can be viewed as the representative of the granule that just follows it (in the sense of the arrow of Time).In that sense, a granule is the set of all events occurring during that period of time.This point of view is close to the natural meaning of a date, which is potentially refinable until all events have been ordered (in a world where no synchronization occurs due to an ideal clock which is absolutely precise)1 .We first revisite Allen's qualitative relationships between a period and a granule with respect to the granule, that is the result on a granule of the non-vacuous intersection between a period and a granule.Secondly, we revisite chronologies and calendars in order to qualify a granule inside its own granularity.We end this section providing tools for denoting how two periods can share a same granule.

Allen's relations
The 13 possible relations between two symbolic intervals were set by Allen [1] and we show them in Figure 2.
In [2], the relation meet is proved to be the generator of the 13 Allen relations, and induces the notion of Russel's point as an equivalence class.Also in [2], in order to avoid confusion between the span of time taken by an event and its mathematical representation, the term period is preferred to the term interval, and the term moment is preferred to the term point but they are not themselves periods, not even very short ones.Two periods meet where there is neither stretch of time between them or stretch of time that they share.Moments in time are "places" where periods meet.A moment is then an abstract object, the nature of which is different from the interval nature.
A time period is the sort of thing that an event might occupy.Even a flash of lighting, although momenttlike in many ways, must be a period because it contains a real physical event.Other things can happen at the same time as the flash.

Chronology revisited
In [14], has been noticed that there are two kinds of objects in a calendar, firstly there are chronologies, associated to each unit, that allow to situate events and to measure periods of time, and secondly there are relationships between chronologies, that allow to situate and measure each event inside the best chronology for it and then to compare and to synchronize all events in a same framework.It is possible to measure the period of time taken by an event inside a chronology (an interval of measure is given by the number of occurrences of unit that is included in that period and the number of occurrences of unit that have a non vacuous intersection with that period.But when one says that two occurrences of the unit Month do not have the same length, it is supposed implicitly that there is a way to measure or compare these two occurrences, that is with respect to either a relationship with another chronology (for instance: Day) or a revealed time domain.
The path from one chronology into another one is a change of granularity.In recent works, calendars are considered as a particular case of the theory of granularity [11,9,5].These works deals with functions that convert a measure or a mark from one chronology into another one when some constraints of commensurability and of synchronization of the origins are achieved.
[14] provides a categorical view of these functions which are the elementary objects on which elementary operations, called functors, are applied; that is operations well-known in usual arithmetics on the set of natural numbers like addition for concatenating two calendars, or multiplication of a morphism by an ordinal for iterating a calendar.In that framework, a chronology is defined as a couple α, U where α is an ordinal such that 0 < α ≤ ω, named its temporal domain, and U is its unit.Finite chronologies are very useful because we can iterate or aggregate them for building new ones.Iteration allows building periodic chronologies.It is worth to notice that addition (used to concatenate) and multiplication (used to iterate) on ordinals are not commutative (except in the finite case).But the commutativity has to be strictly avoided as far as chronologies are concerned, so that, staying in the framework of ordinals can help not to use this property, that aims to erase the time dimension.
Inside a chronology, a unit is the thickness of the now.α is the number of units taken into account, often called time-windowing function, for example in [15].As such, it is the well-ordered set.The α elements of the ordinal α are its elements.But neither α nor its elements, that we yet call occurrences of unit (or units for short), are those which are thought when devising of the two natures of an ordinal.These two natures of indivisibility or divisibility, depending of what Hobbs [11] calls a change of granularity.
But nothing is said about ordinals as elements inside a chronology.We argue that the true nature of such an ordinal inside a chronology is granule.
A granule is not a moment, but an atomic period.It is not possible to cut it (which is unacceptable for an atomic object) but as an interval, it can be in one of the 13 atomic Allen's relations with any period.Restricted to the granule, there are only four possible relations2 , that is only four ways for a period to intersect a granule, as shown in figure 3. Fig. 3. How a white period may intersect a black granule For instance, the relation between the intersection of period of the first worldwide war with year 1914 is (1914], with 1915 is [1915], with 1916 is [1916], with 1917 is [1917] and with 1918 is [1918).The symbols [ and ] have the same meaning as for usual intervals.The two others symbols "(" [resp.")"] mean that the moment, thought as an ordered set is not wholly taken but only a finishing [resp.a beginning] section of it is taken.
Thus an endpoint of an interval can be either excluded, or included or partially included.We then have nine type of intervals depending of the status of the two endpoints.These types are only qualitative because nothing is said about the part which is included.But this suffices to answer correctly to the following question: "Knowing the two worldwide war periods (14,18) and (39,45), what is the inter-war period?"The answer is (18,39).
Granules have many of the properties of moments: if a period has moments at its ends, then these granules are unique, and they uniquely define the period between them.But granules also differ from moments in many ways, for instance they have distinct endpoints.
Calendars, in the databases community, are defined upon the discrete ordered set of chronons, which is a partition with finite intervals of the physical time line.A chronon, which is a finite non vacuous interval of IR, is treated exactly as if a mathematical point.But it is not a mathematical point because it is very large with respect to the Planck time, so that lots of sequential things may appear during this leap of time inside the system, but the system will work on them as if they where simultaneous.We will argue that they are neither a moment nor a period even if, projected on the temporal linear and continuous line, they seem to be intervals as periods are, so that periods are viewed as interval of intervals.This explains why usual mathematical definitions of intervals, which have to be either closed or open with respect to their ends, is not the right framework.
We suggest to adopt the denomination of a granule for this kind of object.We now recall the vocabulary of [14].A chronology is potentially made for cover all the physical Time line, but the need for changing units brings to the definition of calendars, to go from a unit to a coarser or a finer one.Hence we set:

Definition 1 (chronology).
A chronology is a couple α, U where α is an ordinal such that 0 < α ≤ ω, named its temporal domain, and U is its unit.

Definition 2 (atomic calendar).
Let α, U and β, V be two chronologies such that α ≤ β ≤ ω and let f UV a morphism from α into β.The data U, V, f UV defines a structure named an atomic calendar.
An atomic calendar has two commensurable units.A calendar is a directed acyclic graph where the set of nodes is the set of units, the set of vertices is the set of morphisms such that, if U and V are neighbors, f UV is the vertex between them.

Granules
Hence, we add a new element between point and interval in a calendar.It has to be noted than granule is the prime element of the description, because it is defined inside a chronology.Points and intervals are dual objects with respect to morphisms.As far as reality is no more concerned inside a calendar, it is natural to use points and intervals.Definition 3 (granule, point, interval).
x ∈ α is a granule of the chronology α, U . 2. Let α, U and β, V be two chronologies and U, V, f UV be an atomic calendar.
x ∈ α is an interval with respect to the chronology β, V .3. Let γ, X and α, U be two chronologies and X, U, f XU be an atomic calendar.
x ∈ α is a point with respect to the chronology γ, X .
An interval inside a chronology has a mathematical meaning, but a period of the linear timeline, mapped inside a chronology is not exactly an interval as far as its limits are It can be useful to say if the entire moment is taken or not.This is why we add a new type of endpoint for partially included end-moment that we note: • (g, − for a left-end-granule not totally included inside the period • −, g) for a right-end-moment not totally included inside the period Figure 4 shows a representation of (g, −.

(g,-
We are now able to set that inter-war 14-18 is the interval (1914,1918).The following section will be devoted to the reasoning with such interval, in order to get an answer to the hospital problem.Before leaving this section, it is important to know how two periods share the same partial end-granule.The three solutions, shown in Figure 5, are given in the following picture and show three different kinds of union; one with a non vacuous intersection, which is denoted by "-,-", one with the meet relations, which is denoted by "-,g)(g,-" and the other with an interval gap in between which we name disjoint-union and denote it by "-,g) (g,-".
We are now ready to embark in the calculus.

The calculus
We first recall the calculus on usual interval, then we extend this calculus in the natural manner. (-,g)(g,-)

The open/closed interval calculus
As far as intervals are based on points, the general definition of intervals inside a lattice These four types are derived from the two ways that exist for typing each of the two endpoints: included or excluded.So we have Let us set ∼ the algebraic operator that converts an endpoint of an interval to the corresponding endpoint of the adjacent interval (that meets it in that endpoint), as shown in the table 5: The binary operators union and intersection Table 5.
of two intervals that share a same endpoint are given in the table 6: Mathematics works on ideal objects with null dimension: the points.A point is essentially atomic.In the set of real number IR, any point is the limit of any infinite set of fitting together intervals which contain it [13,Weierstrass theorem].This is due to the completeness of IR.The physical time-line is usually modellized by a convex part of IR.

extended calculus
In IR, the closure of an interval is the closed interval with the same endpoints, the opening of an interval is the open interval with the same endpoint.That Table 6.Union and Intersection allow us to extend the ∼ operator and these two topological operators (in IR) as described in table 7.
Let α, U and β, V be two chronologies such that α ≤ β ≤ ω, let f UV be a morphism from α into β and U, V, f UV the atomic calendar.The reader will convince her/himself that the table 9 is true.

The Inter-war
The period of the inter-war is the period between the two periods (1914,1918) and (1939,1945).These two intervals cover only a part of their endpoints.Hence, the period between has to cover the parts of the two endpoints 1918 and 1939 which are not covered by the two war periods and all the years between 1918 and 1945.This period is then the intersection between the complementary of the two intervals "-,1918)" and "(1939,-".It is obtained first by using the ∼ operator on both endpoints "-,1918)" and "(1939,-" which provides the two intervals "(1918,-" and "-,1939)", secondly by the intersection of them which gives (1918,1939).

Table 8. Extended union and Extended intersection
Table 9.From one chronology to another one

The Hospital
Jack's period in the hospital is "(03/06, 03/13)", that is two partial days (one beginning and one ending) and 5 full days.
All these informations may help the social security and the patients to have a fairer fee to pay!In this paper, we introduced a new type of interval and the extension of operations on intervals to this new type of interval based on the three different meanings of what it is usually called a granule inside a chronology, depending on whether it is viewed above, under or inside its chronology.We showed on two examples how to use these new tools.We are going, in the REANIMATIC project, to implement them and to provide translation functions between all kinds of chronologies inside a calendar.
Our proposition consists in the offer of a best approximation of what is due to the hospital, i.e. the possibility of signifying if an endpoint day is totally or partially occupied by a patient.Our solution gives the good solution and the number of users of a same beds per day.Our proposition offers a good compromise between the hospital interest and patients' one.It will be possible to write that 03/13 has been shared by three patients, but of course, without knowing proportionality because staying inside the same time unit.
This new type of interval is adequate not only for expressing time life period inside a chronology, but also for translating Allen's relations between symbolic intervals inside a chronology.This concept of partially included end-granule is very closed to the theory of granularity, inside which it would be used a lot as far as qualitative reasoning is concerned.
says that the first world-war began at the begining of the year 1914 and ended at the end of the year 1918; the open interval ]1914,1918[ says that the first world-war began at the begining of the year 1915 and ended at the end of the year 1917; the closed-open interval [1914, 1918[ says that the first world-war began at the begining of the year 1914 and ended at the end of the year 1917; and the open-closed interval ]1914, 1918] says that the first world-war began at the begining of the year 1915 and ended at the end of the year 1918.None of these four intervals models the qualitative meaning of the linguistic locution in the course of, semantically linked to the expression (1914-1918) as shown in Figure 1.

Fig. 5 .
Fig. 5. How two periods share the same black end-granule g

Table 2 .
The closed interval's solution: the usual case open, open-closed or closed-open intervals, with the same endpoints, are able to model this reality, that is to make the social security to pay only one day per bed, when a bed is occupied (partly or not) this day without to change the granularity.Days due computes the number of days inside the interval.The open interval will give the following table 3: Only 3+6+0=9 days will

Table 3 .
the open interval's solution

Table 4 .
the closed-open interval's solution