feat(ModelTheory): add DefinablePred for fun_prop automation#38397
feat(ModelTheory): add DefinablePred for fun_prop automation#38397staroperator wants to merge 7 commits intoleanprover-community:masterfrom
DefinablePred for fun_prop automation#38397Conversation
PR summary c3e588b468
|
| File | Base Count | Head Count | Change |
|---|---|---|---|
| Mathlib.ModelTheory.Algebra.Ring.Basic | 698 | 701 | +3 (+0.43%) |
| Mathlib.ModelTheory.Arithmetic.Presburger.Basic | 705 | 708 | +3 (+0.43%) |
Import changes for all files
| Files | Import difference |
|---|---|
4 filesMathlib.FieldTheory.AxGrothendieck Mathlib.ModelTheory.Algebra.Field.IsAlgClosed Mathlib.ModelTheory.Algebra.Ring.Definability Mathlib.ModelTheory.Arithmetic.Presburger.Definability |
1 |
5 filesMathlib.ModelTheory.Algebra.Field.Basic Mathlib.ModelTheory.Algebra.Field.CharP Mathlib.ModelTheory.Algebra.Ring.Basic Mathlib.ModelTheory.Algebra.Ring.FreeCommRing Mathlib.ModelTheory.Arithmetic.Presburger.Basic |
3 |
Mathlib.ModelTheory.Algebra.Classes (new file) |
698 |
Declarations diff
+ AddFunction
+ CompatibleAdd
+ CompatibleInv
+ CompatibleMul
+ CompatibleNeg
+ CompatibleOne
+ CompatibleZero
+ Constants.one
+ Definable.of_definablePred
+ Definable.preimage_map
+ DefinableFun.const
+ DefinableFun.finsetProd
+ DefinableFun.inv
+ DefinableFun.mul
+ DefinableFun.mul_nat
+ DefinableFun.natCast
+ DefinableFun.nat_mul
+ DefinableFun.npow
+ DefinableFun.one
+ DefinablePred
+ DefinablePred.and
+ DefinablePred.comp
+ DefinablePred.const
+ DefinablePred.const_eq
+ DefinablePred.eq
+ DefinablePred.eq_const
+ DefinablePred.exists
+ DefinablePred.exists_finite
+ DefinablePred.exists_pi
+ DefinablePred.forall
+ DefinablePred.forall_finite
+ DefinablePred.forall_pi
+ DefinablePred.iff
+ DefinablePred.imp
+ DefinablePred.not
+ DefinablePred.of_definable
+ DefinablePred.or
+ DefinablePred.rel
+ Functions.inv
+ Functions.mul
+ InvFunction
+ MulFunction
+ NegFunction
+ OneConstant
+ ZeroConstant
+ _root_.FirstOrder.Language.Formula.definablePred_realize
+ _root_.Set.DefinablePred.le
+ _root_.Set.DefinablePred.lt
+ instance : AddFunction presburger := ⟨presburgerFunc.add⟩
+ instance : AddFunction ring := ⟨ringFunc.add⟩
+ instance : MulFunction ring := ⟨ringFunc.mul⟩
+ instance : NatCast (L.Term α)
+ instance : NegFunction ring := ⟨ringFunc.neg⟩
+ instance : OneConstant presburger := ⟨presburgerFunc.one⟩
+ instance : OneConstant ring := ⟨ringFunc.one⟩
+ instance : Pow (L.Term α) ℕ
+ instance : ZeroConstant presburger := ⟨presburgerFunc.zero⟩
+ instance : ZeroConstant ring := ⟨ringFunc.zero⟩
+ instance [InvFunction L] : Inv (L.Term α)
+ instance [MulFunction L] : Mul (L.Term α)
+ instance [OneConstant L] : One (L.Term α)
+ instance {M : Type*} [Zero M] [One M] [Add M] : CompatibleAdd presburger M
+ instance {M : Type*} [Zero M] [One M] [Add M] : CompatibleOne presburger M
+ instance {M : Type*} [Zero M] [One M] [Add M] : CompatibleZero presburger M
+ instance {M : Type*} [Zero M] [One M] [Add M] : presburger.Structure M
+ inv_def
+ mul_eq
+ neg_eq
+ pow_succ
+ pow_zero
+ prod
+ realize_inv
+ realize_npow
+ realize_prod
++ add_eq
++ one_eq
++ zero_eq
- _root_.Set.Definable.preimage_map
- addFunc
- add_def
- funMap_add
- funMap_one
- funMap_zero
- instance (α : Type*) : Add (Language.ring.Term α)
- instance (α : Type*) : Mul (Language.ring.Term α)
- instance (α : Type*) : Neg (Language.ring.Term α)
- instance (α : Type*) : One (Language.ring.Term α)
- instance (α : Type*) : Zero (Language.ring.Term α)
- instance : Add (presburger.Term α)
- instance : NatCast (presburger.Term α)
- instance : One (presburger.Term α)
- instance : SMul ℕ (presburger.Term α)
- instance : Zero (presburger.Term α)
- instance : presburger.Structure M
- mulFunc
- negFunc
- neg_def
- oneFunc
- realize_neg
- realize_nsmul
- realize_sum
- succ_nsmul
- sum
- zeroFunc
- zero_def
- zero_nsmul
-- realize_add
-- realize_zero
--+ realize_one
You can run this locally as follows
## summary with just the declaration names:
./scripts/pr_summary/declarations_diff.sh <optional_commit>
## more verbose report:
./scripts/pr_summary/declarations_diff.sh long <optional_commit>The doc-module for scripts/pr_summary/declarations_diff.sh contains some details about this script.
Decrease in tech debt: (relative, absolute) = (1.00, 0.00)
| Current number | Change | Type |
|---|---|---|
| 6533 | -1 | backward.isDefEq.respectTransparency |
Current commit 75c6194de2
Reference commit c3e588b468
This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/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 PR/issue depends on:
|
This PR adds
DefinablePred. It is the same asDefinable, except the latter applies onSet (α → M)and the former applies on(α → M) → Prop. There main reason to add this is that I want to automate the definability proof of predicates, and thatfun_propworks on functions (that include predicates) but not on sets.For example, with appropriate
fun_proplemmas added, one can automate definability result like this:This PR also removes certain
fun_proptags that would or should not be used in automation.Note: one may argue that we don't need a new definition if we use
aesopinstead offun_prop. However, in that case, we still need to write lemmas for{x | p x}targets (e.g. for{x | p x ∧ q x}), which have almost no difference with lemmas onporfun x => p x ∧ q xdirectly.