Repository navigation
[Merged by Bors] - feat(ModelTheory): Presburger definability and semilinear sets - #27100
staroperator wants to merge 16 commits into
Conversation
PR summary f821781ed2Import changes exceeding 2%
|
| File | Base Count | Head Count | Change |
|---|---|---|---|
| Mathlib.ModelTheory.Arithmetic.Presburger.Semilinear.Defs | 881 | 1017 | +136 (+15.44%) |
Import changes for all files
| Files | Import difference |
|---|---|
Mathlib.ModelTheory.Arithmetic.Presburger.Semilinear.Basic |
7 |
Mathlib.ModelTheory.Arithmetic.Presburger.Semilinear.Defs |
136 |
Mathlib.ModelTheory.Arithmetic.Presburger.Definability (new file) |
1293 |
Declarations diff
+ IsLinearSet.definable
+ IsSemilinearSet.definable
+ Nat.isSemilinearSet_iff_ultimately_periodic
+ definable_iff_isSemilinearSet
+ definable₁_iff_ultimately_periodic
+ isProperSemilinearSet_iff
+ isSemilinearSet_boundedFormula_realize
+ isSemilinearSet_formula_realize_semilinear
+ isSemilinearSet_iff
+ mul_not_definable
+ term_realize_eq_add_dotProduct
You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>
## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>The doc-module for script/declarations_diff.sh contains some details about this script.
No changes to technical debt.
You can run this locally as
./scripts/technical-debt-metrics.sh pr_summary
- The
relativevalue is the weighted sum of the differences with weight given by the inverse of the current value of the statistic. - The
absolutevalue is therelativevalue divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).
|
This pull request has conflicts, please merge |
This PR introduces the first-order language of [Presburger Arithmetic](https://en.wikipedia.org/wiki/Presburger_arithmetic). It has not defined the theory of Presburger Arithmetic yet (left as TODO), but is enough to prove some definability results (#27100). Co-authored-by: staroperator <[email protected]>
|
This pull request has conflicts, please merge |
…community#27099) This PR introduces the first-order language of [Presburger Arithmetic](https://en.wikipedia.org/wiki/Presburger_arithmetic). It has not defined the theory of Presburger Arithmetic yet (left as TODO), but is enough to prove some definability results (leanprover-community#27100). Co-authored-by: staroperator <[email protected]>
|
This pull request has conflicts, please merge |
…community#27099) This PR introduces the first-order language of [Presburger Arithmetic](https://en.wikipedia.org/wiki/Presburger_arithmetic). It has not defined the theory of Presburger Arithmetic yet (left as TODO), but is enough to prove some definability results (leanprover-community#27100). Co-authored-by: staroperator <[email protected]>
…community#27099) This PR introduces the first-order language of [Presburger Arithmetic](https://en.wikipedia.org/wiki/Presburger_arithmetic). It has not defined the theory of Presburger Arithmetic yet (left as TODO), but is enough to prove some definability results (leanprover-community#27100). Co-authored-by: staroperator <[email protected]>
|
This pull request has conflicts, please merge |
Separated from #27100. This PR defines the [linear and semilinear sets](https://en.wikipedia.org/wiki/Generalized_arithmetic_progression#Semilinear_sets) for any `AddCommMonoid` and prove some basic properties.
…unity#27342) Separated from leanprover-community#27100. This PR defines the [linear and semilinear sets](https://en.wikipedia.org/wiki/Generalized_arithmetic_progression#Semilinear_sets) for any `AddCommMonoid` and prove some basic properties.
…unity#27342) Separated from leanprover-community#27100. This PR defines the [linear and semilinear sets](https://en.wikipedia.org/wiki/Generalized_arithmetic_progression#Semilinear_sets) for any `AddCommMonoid` and prove some basic properties.
…ference and complement (#27414) Separated from #27100. This PR proves that semilinear sets in any commutative monoid are closed under intersection, set difference and complement (requires finitely generated). We prove these results on `ℕ ^ k` first (which are private) and then generalize to any monoid.
7dddc82 to
e3b8f1f
Compare
f797fb7 to
af9ab31
Compare
awainverse
left a comment
There was a problem hiding this comment.
Looks good, except for a comment about splitting a theorem with a large proof.
|
|
||
| /-- In the 1-dimensional case, a set is Presburger arithmetic definable in `ℕ` if and only if it | ||
| is ultimately periodic, i.e. periodic after some number `k`. -/ | ||
| theorem definable₁_iff_ultimately_periodic {s : Set ℕ} : |
There was a problem hiding this comment.
I'd break this result up slightly, spinning off the first few lines, because the vast majority of the proof is just about semilinear sets.
Since we already have files about semilinear sets, the second lemma can be moved into one of those, provided the imports are changed accordingly.
First lemma:
A.Definable₁ presburger s ↔ IsSemilinearSet s := by
rw [Definable₁, definable_iff_isSemilinearSet,
← isSemilinearSet_image_iff (LinearEquiv.funUnique (Fin 1) ℕ ℕ), ← preimage_setOf_eq]
simp only [LinearEquiv.funUnique_apply, Function.eval, Fin.default_eq_zero, setOf_mem_eq]
rw [image_preimage_eq s fun x => ⟨![x], rfl⟩]```
Second lemma:
```lemma isSemilinearSet_iff_ultimately_periodic {s : Set ℕ} :
IsSemilinearSet s ↔ ∃ k, ∃ p > 0, ∀ x ≥ k, x ∈ s ↔ x + p ∈ s := by```
Then this theorem can be
```/-- In the 1-dimensional case, a set is Presburger arithmetic definable in `ℕ` if and only if it
is ultimately periodic, i.e. periodic after some number `k`. -/
theorem definable₁_iff_ultimately_periodic {s : Set ℕ} :
A.Definable₁ presburger s ↔ ∃ k, ∃ p > 0, ∀ x ≥ k, x ∈ s ↔ x + p ∈ s := by
rw [definable₁_iff_isSemilinearSet, isSemilinearSet_iff_ultimately_periodic]```
There was a problem hiding this comment.
That makes sense. Thanks!
awainverse
left a comment
There was a problem hiding this comment.
My suggested changes were implemented well, this looks good to me.
|
maintainer merge |
|
🚀 Pull request has been placed on the maintainer queue by awainverse. |
|
Thank you! LGTM bors merge |
This PR formalizes the classical result that Presburger definable sets are the same as semilinear sets. As an application of this result, we show that the graph of multiplication is not Presburger definable.
|
Pull request successfully merged into master. Build succeeded: |
…rover-community#27100) This PR formalizes the classical result that Presburger definable sets are the same as semilinear sets. As an application of this result, we show that the graph of multiplication is not Presburger definable.
This PR formalizes the classical result that Presburger definable sets are the same as semilinear sets. As an application of this result, we show that the graph of multiplication is not Presburger definable.
Matrix.vecCons_inj#26896finSumFinEquiv_symm_apply_castSucc#27081sep_subset_setOf#27087