Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This creates a new `aesop` rule set called `SetLike` to house lemmas about membership in subobjects. Lemmas like `pow_mem` should be included in the rule set: ```lean @[to_additive (attr := aesop safe apply (rule_sets [SetLike]))] theorem pow_mem {M A} [Monoid M] [SetLike A M] [SubmonoidClass A M] {S : A} {x : M} (hx : x ∈ S) : ∀ n : ℕ, x ^ n ∈ S ``` Lemmas about closures, like `AddSubmonoid.closure` should be included in the rule set, but they should be assigned a penalty (here we choose `20` throughout) so that they are not attempted before the general purpose ones like `pow_mem`. ```lean @[to_additive (attr := simp, aesop safe 20 apply (rule_sets [SetLike])) "The `AddSubmonoid` generated by a set includes the set."] theorem subset_closure : s ⊆ closure s := fun _ hx => mem_closure.2 fun _ hS => hS hx ``` In order for `aesop` to make effective use of `AddSubmonoid.closure` it needs the following new lemma. ```lean @[aesop 5% apply (rule_sets [SetLike])] lemma mem_of_subset {s : Set B} (hp : s ⊆ p) {x : B} (hx : x ∈ s) : x ∈ p := hp hx ``` Note: this lemma is marked as very unsafe (`5%`) because it will apply *whenever* the goal is of the form `x ∈ p` where `p` is any term of a `SetLike` instance; and moreover, it will create `s` as a metavariable, which is in general a terrible idea, but necessary for the reason mentioned above.
- Loading branch information
Showing
25 changed files
with
123 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/- | ||
Copyright (c) 2023 Jireh Loreaux. All rights reserved. | ||
Released under Apache 2.0 license as described in the file LICENSE. | ||
Authors: Jireh Loreaux | ||
-/ | ||
|
||
import Aesop | ||
|
||
/-! | ||
# SetLike Rule Set | ||
This module defines the `SetLike` Aesop rule set which is used by the | ||
`set_like` tactic. Aesop rule sets only become visible once the file in which | ||
they're declared is imported, so we must put this declaration into its own file. | ||
-/ | ||
|
||
declare_aesop_rule_sets [SetLike] (default := true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import Mathlib.Algebra.Star.Subalgebra | ||
import Mathlib.Algebra.Star.SelfAdjoint | ||
import Mathlib.Algebra.Star.NonUnitalSubalgebra | ||
import Mathlib.FieldTheory.Subfield | ||
|
||
set_option autoImplicit true | ||
|
||
example [Ring R] (S : Subring R) (hx : x ∈ S) (hy : y ∈ S) (hz : z ∈ S) (n m : ℕ) : | ||
n • x ^ 3 - 2 • y + z ^ m ∈ S := by | ||
aesop | ||
|
||
example [Ring R] (S : Set R) (hx : x ∈ S) (hy : y ∈ S) (hz : z ∈ S) (n m : ℕ) : | ||
n • x ^ 3 - y + z ^ m ∈ Subring.closure S := by | ||
aesop | ||
|
||
example [CommRing R] [Ring A] [Algebra R A] [StarRing R] [StarRing A] [StarModule R A] | ||
(r : R) (a b c : A) (n : ℕ) : | ||
-b + star (algebraMap R A r) + a ^ n * c ∈ StarSubalgebra.adjoin R {a, b, c} := by | ||
aesop | ||
|
||
example [Monoid M] (x : M) (n : ℕ) : x ^ n ∈ Submonoid.closure {x} := by | ||
aesop | ||
|
||
example [Monoid M] (x y z w : M) (n : ℕ) : (x * y) ^ n * w ∈ Submonoid.closure {x, y, z, w} := by | ||
aesop | ||
|
||
example [Group M] (x : M) (n : ℤ) : x ^ n ∈ Subgroup.closure {x} := by | ||
aesop | ||
|
||
example [Monoid M] (x y z : M) (S₁ S₂ : Submonoid M) (h : S₁ ≤ S₂) (hx : x ∈ S₁) | ||
(hy : y ∈ S₁) (hz : z ∈ S₂) : | ||
x * y * z ∈ S₂ := by | ||
aesop | ||
|
||
example [Monoid M] (x y z : M) (S₁ S₂ : Submonoid M) (h : S₁ ≤ S₂) (hx : x ∈ S₁) | ||
(hy : y ∈ S₁) (hz : z ∈ S₂) : | ||
x * y * z ∈ S₁ ⊔ S₂ := by | ||
aesop | ||
|
||
example [Monoid M] (x y z : M) (S : Submonoid M) (hxy : x * y ∈ S) (hz : z ∈ S) : | ||
z * (x * y) ∈ S := by | ||
aesop | ||
|
||
example [Field F] (S : Subfield F) (q : ℚ) : (q : F) ∈ S := by | ||
aesop | ||
|
||
example [Field F] (S : Subfield F) : (1.2 : F) ∈ S := by | ||
aesop | ||
|
||
example [Field F] (S : Subfield F) (x : F) (hx : x ∈ S) : ((12e-100 : F) • x⁻¹) ∈ S := by | ||
aesop |