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
+18
-1
@@ -39,6 +39,9 @@ theorem keys_eq (cr : ConflictRange) (db : DB) :
|
||||
unfold RangeRead.inRange
|
||||
rfl
|
||||
|
||||
theorem toSet_eq (cr : ConflictRange) :
|
||||
(toRefCR cr).toSet = cr.toSet := rfl
|
||||
|
||||
theorem agreeOn_iff (cr : ConflictRange) (db₁ db₂ : DB) :
|
||||
FormalConflictRange.AgreeOn (toRefCR cr) (toRefDB db₁) (toRefDB db₂) ↔
|
||||
AgreeOn cr db₁ db₂ := by
|
||||
@@ -107,7 +110,7 @@ theorem closedForm_eq (r : RangeRead) (res : Result) :
|
||||
· unfold FormalConflictRange.conflictRangeClosedFormClosed closedForm
|
||||
simp [hne]
|
||||
|
||||
/-! ## The headline -/
|
||||
/-! ## The headlines -/
|
||||
|
||||
/-- **The closed form is minimal.** This is the reference theorem
|
||||
`minimal_conflictRangeClosedFormClosed`, transported across the definitional
|
||||
@@ -120,4 +123,18 @@ theorem closedFormMinimal : ClosedFormMinimal := by
|
||||
rw [closedForm_eq r res] at hmin
|
||||
exact (minimal_iff r res (closedForm r res)).mp hmin
|
||||
|
||||
/-- **Minimality is unique.** This is the reference theorem
|
||||
`FormalConflictRange.Minimal.toSet_eq`, transported across the definitional
|
||||
bridge. It is unconditional: the reference proof uses only that the
|
||||
intersection of two sound ranges is sound, so no readability hypothesis is
|
||||
needed. -/
|
||||
theorem minimalUnique : MinimalUnique := by
|
||||
intro r res cr cr' h h'
|
||||
have h₁ : FormalConflictRange.Minimal (toRefRead r) (toRefRes res) (toRefCR cr) :=
|
||||
(minimal_iff r res cr).mpr h
|
||||
have h₂ : FormalConflictRange.Minimal (toRefRead r) (toRefRes res) (toRefCR cr') :=
|
||||
(minimal_iff r res cr').mpr h'
|
||||
have hset := FormalConflictRange.Minimal.toSet_eq h₁ h₂
|
||||
rwa [toSet_eq cr, toSet_eq cr'] at hset
|
||||
|
||||
end Statement
|
||||
Reference in new issue
Block a user