Engine

7.6. Statements of Conditions🔗

The exact statements behind the claims on the page Conditions.

theorem quantities_ever_and_last_of_take_the_whole_selector : SameReading parseCondExpr "ever A except B where x = 1" "ever (A except (B where x = 1))" ∧ SameReading parseCondExpr "at most 3 A except B" "at most 3 (A except B)" ∧ SameReading parseCondExpr "last of A except B is A" "last of (A except B) is A"

proof: spec/Spec/Readable.lean:118

theorem no_allows_only_zero (n : Nat) : Quantity.no.allows n = true ↔ n = 0

proof: spec/Spec/Meaning.lean:395

theorem at_least_allows_counts_from_m_up (m n : Nat) : (Quantity.atLeast m).allows n = true ↔ m ≤ n

proof: spec/Spec/Meaning.lean:399

theorem at_most_allows_counts_up_to_m (m n : Nat) : (Quantity.atMost m).allows n = true ↔ n ≤ m

proof: spec/Spec/Meaning.lean:403

theorem exactly_allows_only_m (m n : Nat) : (Quantity.exactly m).allows n = true ↔ n = m

proof: spec/Spec/Meaning.lean:407

theorem between_allows_both_ends_and_everything_between (lo hi n : Nat) : (Quantity.between lo hi).allows n = true ↔ lo ≤ n ∧ n ≤ hi

proof: spec/Spec/Meaning.lean:411

theorem is_null_holds_exactly_when_the_value_is_null (ctx : Ctx) (a : ValueExpr) : evalCondExpr ctx (.isNull a) = true ↔ evalValueExpr ctx a = .null

proof: spec/Spec/Facts.lean:421

theorem a_comparison_with_null_on_the_left_is_false (op : CmpOp) (v : Value) : Value.cmp op .null v = false

proof: spec/Spec/Laws.lean:16

theorem a_comparison_with_null_on_the_right_is_false (op : CmpOp) (v : Value) : Value.cmp op v .null = false

proof: spec/Spec/Laws.lean:20

theorem not_equal_with_null_is_false_too : Value.cmp .ne .null (.num 1) = false ∧ Value.cmp .eq .null (.num 1) = false

proof: spec/Spec/Laws.lean:30

theorem comparisons_across_kinds_are_false_not_equal_included : Value.cmp .ne (.num 1) (.str "1") = false ∧ Value.cmp .eq (.num 1) (.str "1") = false

proof: spec/Spec/Laws.lean:35

theorem for_values_of_one_kind_not_equal_is_the_negation_of_equal {a b : Value} (ha : a ≠ .null) (hb : b ≠ .null) (hk : a.sameKind b = true) : Value.cmp .ne a b = !Value.cmp .eq a b

proof: spec/Spec/Laws.lean:23

theorem ever_is_at_least_1 (ctx : Ctx) (s : Selector) : evalCondExpr ctx (.ever s) = evalCondExpr ctx (.qty (.atLeast 1) s)

proof: spec/Spec/Lemmas.lean:8

theorem never_is_no (ctx : Ctx) (s : Selector) : evalCondExpr ctx (.never s) = evalCondExpr ctx (.qty .no s)

proof: spec/Spec/Lemmas.lean:14

theorem never_is_not_ever (ctx : Ctx) (s : Selector) : evalCondExpr ctx (.never s) = evalCondExpr ctx (.not (.ever s))

proof: spec/Spec/Lemmas.lean:20

theorem at_most_n_is_not_at_least_n_plus_1 (k n : Nat) : Quantity.allows k (.atMost n) = !Quantity.allows k (.atLeast (n + 1))

proof: spec/Spec/Laws.lean:164

theorem between_n_and_m_is_at_least_n_and_at_most_m (k n m : Nat) : Quantity.allows k (.between n m) = (Quantity.allows k (.atLeast n) && Quantity.allows k (.atMost m))

proof: spec/Spec/Laws.lean:168

theorem exactly_n_is_between_n_and_n (k n : Nat) : Quantity.allows k (.exactly n) = Quantity.allows k (.between n n)

proof: spec/Spec/Laws.lean:172

theorem between_n_and_m_with_m_below_n_is_always_false {k n m : Nat} (h : m < n) : Quantity.allows k (.between n m) = false

proof: spec/Spec/Laws.lean:176

theorem last_of_is_false_when_nothing_is_picked {ctx : Ctx} {s : Selector} (h : evalSelector ctx ctx.hist s = []) (t : String) : evalCondExpr ctx (.isType s t) = false

proof: spec/Spec/Facts.lean:426

theorem ever_t_stays_true_as_events_are_appended (ctx : Ctx) (t : String) (h es : List Event) (he : evalCondExpr { ctx with hist := h } (.ever (.type t)) = true) : evalCondExpr { ctx with hist := h ++ es } (.ever (.type t)) = true

proof: spec/Spec/Laws.lean:510

theorem ever_stays_true_when_the_picks_only_grow {ctx : Ctx} {s : Selector} {h h' : List Event} (hs : ∀ e ∈ evalSelector { ctx with hist := h } h s, e ∈ evalSelector { ctx with hist := h' } h' s) (he : evalCondExpr { ctx with hist := h } (.ever s) = true) : evalCondExpr { ctx with hist := h' } (.ever s) = true

proof: spec/Spec/Laws.lean:499

theorem ever_can_become_false_when_a_later_event_arrives : let A : Event := { entity := "x", type := "A", key := "k" } let B : Event := { entity := "x", type := "B", key := "k" } let s : Selector := .filter (.type "A") (.never (.type "B")) evalCondExpr { world := World.empty, hist := [A] } (.ever s) = true ∧ evalCondExpr { world := World.empty, hist := [A, B] } (.ever s) = false

proof: spec/Spec/Laws.lean:516