Prove minimality is unique and add it to the headlines
- Define `ConflictRange.toSet`, the set of keys lying in a range - Add the headline `MinimalUnique`: any two minimal sound ranges for the same read and result denote the same set of keys - Transport `FormalConflictRange.Minimal.toSet_eq` across the bridge; the statement is unconditional, since `Minimal` already carries soundness - State `Statement.minimalUnique` in the challenge and add it to the comparator's `theorem_names` `lake build` is warning-free and `lake comparator` accepts both headlines.
This commit is contained in:
1 parent
bd5b3c885c
commit
efd1b323e7
4 files changed
+47
-6
No files matched your search
+21
-2
@@ -6,6 +6,9 @@ Released under Apache 2.0 license as described in the file LICENSE.
|
||||
|
||||
> **The closed form is minimal.** For every readable read/result pair `(r, res)`,
|
||||
> `closedForm r res` is a minimal sound conflict range.
|
||||
>
|
||||
> **Minimality is unique.** Any two minimal sound ranges for the same read and
|
||||
> result denote the same set of keys.
|
||||
|
||||
It is a *statement* file, meant for review, not a proof. It contains:
|
||||
|
||||
@@ -13,7 +16,7 @@ It is a *statement* file, meant for review, not a proof. It contains:
|
||||
ranges, soundness, and minimality
|
||||
* the closed form itself, in `## The closed form`, because the theorem is *about
|
||||
that function*
|
||||
* the headline as the proposition `ClosedFormMinimal`
|
||||
* the headlines as the propositions `ClosedFormMinimal` and `MinimalUnique`
|
||||
|
||||
There is no `theorem`, no `axiom`, no `sorry`, and the only import is Mathlib.
|
||||
|
||||
@@ -156,6 +159,9 @@ def ConflictRange.mem (cr : ConflictRange) (k : Key) : Prop :=
|
||||
|
||||
instance : Membership Key ConflictRange := ⟨ConflictRange.mem⟩
|
||||
|
||||
/-- The set of keys lying in a conflict range. -/
|
||||
def ConflictRange.toSet (cr : ConflictRange) : Set Key := {k | k ∈ cr}
|
||||
|
||||
/-- The keys of a database lying in a conflict range, ascending. -/
|
||||
def ConflictRange.keys (cr : ConflictRange) (db : DB) : List Key :=
|
||||
RangeRead.inRange db.keys cr.begin cr.end_
|
||||
@@ -1112,7 +1118,7 @@ def closedForm (r : RangeRead) (res : Result) : ConflictRange :=
|
||||
else if clampedNonpos r res then closedFormClamped r res
|
||||
else closedFormCrossed r res
|
||||
|
||||
/-! ## The headline -/
|
||||
/-! ## The headlines -/
|
||||
|
||||
/-- **The closed form is minimal.**
|
||||
|
||||
@@ -1121,4 +1127,17 @@ range: it is sound, and no proper subrange of it is sound. -/
|
||||
def ClosedFormMinimal : Prop :=
|
||||
∀ r res, Readable r res → Minimal r res (closedForm r res)
|
||||
|
||||
/-- **Minimality is unique.**
|
||||
|
||||
Any two minimal sound conflict ranges for the same read and result denote the same
|
||||
set of keys. This is a statement about `Minimal` alone, so it needs no readability
|
||||
hypothesis: minimality already carries soundness. Together with `ClosedFormMinimal`
|
||||
it says that `closedForm r res` is the minimal sound range up to its set of keys.
|
||||
|
||||
The converse direction does not hold: unique *key sets* do not pin the endpoints,
|
||||
so an empty range is only determined up to `toSet` equality. That is why this
|
||||
statement is about `ConflictRange.toSet` rather than about equality of ranges. -/
|
||||
def MinimalUnique : Prop :=
|
||||
∀ r res cr cr', Minimal r res cr → Minimal r res cr' → cr.toSet = cr'.toSet
|
||||
|
||||
end Statement
|
||||
Reference in new issue
Block a user