1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
//! # Temporal Ordering Law
//!
//! Typed shapes for temporal event ordering and temporal profiles.
//!
//! ## What this is
//!
//! The structural vocabulary for reasoning about *when* events occur relative
//! to each other — temporal order relationships, profile shapes over traces,
//! and evidence wrappers that carry a temporal context. These are the shapes
//! that a temporal conformance or temporal profile analysis engine produces
//! and consumes.
//!
//! ## What this is not
//!
//! The temporal analysis engine. Computing sojourn times, deriving temporal
//! profiles from event logs, performing temporal conformance checking against
//! a reference model, or detecting temporal anomalies all graduate to
//! `wasm4pm`. This module carries the shapes those operations produce.
//!
//! ## Paper authority
//!
//! The temporal profile conformance framework is described in:
//!
//! Adriansyah, A., Munoz-Gama, J., Carmona, J., van Dongen, B., van der Aalst,
//! W.M.P. (2015). *Measuring Precision of Modeled Behavior.* Information
//! Systems and e-Business Management.
//!
//! Also see van der Aalst (2013) Process Cubes for the time dimension as a
//! first-class cube axis.
//!
//! ## Graduate to `wasm4pm`
//!
//! When you need to *compute* temporal orders, derive sojourn times, or run
//! temporal conformance checking, graduate to `wasm4pm`.
use PhantomData;
/// Temporal ordering relationship between two events.
///
/// ## What this is
///
/// An enumeration of the four canonical temporal relations that can hold
/// between two events in a trace: `Before`, `After`, `Concurrent` (no strict
/// order), and `Unknown` (ordering not determinable from available data).
///
/// ## What this is not
///
/// Not a timestamp comparison engine. The relation is the *result* of a
/// comparison that belongs in `wasm4pm`. This type carries the structural
/// result shape only.
///
/// ## Graduate to `wasm4pm`
///
/// Deriving the ordering relation from event timestamps, handling time zones,
/// handling clock drift, and detecting impossible orderings all graduate to
/// `wasm4pm`.
///
/// # Examples
///
/// ```ignore
/// use wasm4pm_compat::temporal::TemporalOrder;
/// let order = TemporalOrder::Before;
/// assert_eq!(format!("{}", order), "before");
/// ```
/// A temporal profile for a trace — structural shape (not computed).
///
/// ## What this is
///
/// The structural shape of a temporal profile for a trace. `Trace` is the
/// type parameter naming the kind of trace this profile is derived from. The
/// profile itself is a collection of pairwise temporal ordering relations
/// between events in the trace — the shape that a temporal profile engine
/// produces and that a temporal conformance checker consumes.
///
/// ## What this is not
///
/// Not the profile derivation algorithm. Computing pairwise temporal relations
/// from timestamps, handling repeated activities, or computing average sojourn
/// times all graduate to `wasm4pm`.
///
/// ## Graduate to `wasm4pm`
///
/// Profile derivation, temporal conformance checking, and profile comparison
/// all graduate to `wasm4pm`.
///
/// # Examples
///
/// ```ignore
/// use wasm4pm_compat::temporal::TemporalProfile;
/// use core::marker::PhantomData;
/// struct MyTrace;
/// let profile: TemporalProfile<MyTrace> = TemporalProfile { trace: PhantomData };
/// ```
/// Witness that temporal ordering has been established for this evidence.
///
/// ## What this is
///
/// A zero-cost marker type witnessing that temporal ordering has been
/// established — i.e., that the evidence it annotates has had its event-pair
/// ordering relations derived and attached. This is the receipt shape for
/// the ordering derivation step.
///
/// ## What this is not
///
/// Not the ordering derivation algorithm. The algorithm graduates to `wasm4pm`.
///
/// # Examples
///
/// ```ignore
/// use wasm4pm_compat::temporal::TemporalOrderWitness;
/// let _w = TemporalOrderWitness;
/// ```
;
/// Witness that sojourn times have been computed for this evidence.
///
/// ## What this is
///
/// A zero-cost marker type witnessing that sojourn times (the time an activity
/// spends in execution) have been computed and attached to the evidence.
/// Sojourn time is a key temporal metric in temporal profile conformance.
///
/// ## What this is not
///
/// Not the sojourn time computation. The computation graduates to `wasm4pm`.
///
/// # Examples
///
/// ```ignore
/// use wasm4pm_compat::temporal::SojournTimeWitness;
/// let _w = SojournTimeWitness;
/// ```
;
/// A time-aware evidence wrapper adding temporal context to an inner value.
///
/// ## What this is
///
/// A structural wrapper that binds an inner value `T` to a temporal ordering
/// context `Order`. The `Order` type parameter names the temporal context
/// (e.g., `TemporalOrderWitness` for established ordering, `SojournTimeWitness`
/// for sojourn-time-enriched evidence). This allows functions to require that
/// evidence has had temporal context established before it is processed.
///
/// ## What this is not
///
/// Not a timestamp container. Timestamps and their computation graduate to
/// `wasm4pm`. This is the shape that carries already-established temporal
/// context.
///
/// ## Graduate to `wasm4pm`
///
/// All temporal computation (ordering derivation, sojourn time calculation,
/// temporal conformance checking) graduates to `wasm4pm`.
///
/// # Examples
///
/// ```ignore
/// use wasm4pm_compat::temporal::{TimeAwareEvidence, TemporalOrderWitness};
/// use core::marker::PhantomData;
///
/// let evidence: TimeAwareEvidence<u64, TemporalOrderWitness> = TimeAwareEvidence {
/// inner: 42u64,
/// order: PhantomData,
/// };
/// assert_eq!(evidence.inner, 42);
/// ```