///|
fn main raise {
  let base = try! @temporal.Ledger::new()
  let original = try! base.commit(10L, [
    @temporal.Change::put("price", try! @temporal.Span::new(0L, 20L), "100"),
    @temporal.Change::put("discount", try! @temporal.Span::new(5L, 15L), "10"),
  ])
  let corrected = try! original.commit(20L, [
    @temporal.Change::delete("discount", try! @temporal.Span::new(10L, 13L)),
  ])
  let rows = try! corrected.aligned_timeline(
    ["discount", "price"],
    try! @temporal.Span::new(0L, 20L),
    20L,
  )
  assert_eq(rows.length(), 5)
  assert_true(rows[0].facts()[0].is_gap())
  assert_true(rows[2].facts()[0].is_deleted())
  assert_eq(rows[2].facts()[1].value(), Some("100"))
  assert_eq(rows[2].facts()[0].source().unwrap().known_at(), 20L)
  let past = try! corrected.aligned_timeline(
    ["discount", "price"],
    try! @temporal.Span::new(0L, 20L),
    10L,
  )
  assert_eq(past.length(), 3)
  assert_eq(past[1].facts()[0].value(), Some("10"))
  println(
    "Aligned facts: price and discount retain historical values, missing evidence and explicit withdrawal sources",
  )
}