data.set_like.basic
⟷
Mathlib.Data.SetLike.Basic
The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(last sync)
out_param
classes should not repeat the parents' out_param
(#18291)
This PR is a backport for a mathlib4 fix for a large amount of issues encountered in the port of group_theory.subgroup.basic
, leanprover-community/mathlib4#1797. Subobject classes such as mul_mem_class
and submonoid_class
take a set_like
parameter, and we were used to just copy over the M : out_param Type
declaration from set_like
. Since Lean 3 synthesizes from left to right, we'd fill in the out_param
from set_like
, then the has_mul M
instance would be available for synthesis and we'd be in business. In Lean 4 however, we will often go from right to left, so that MulMemClass ?M S [?inst : Mul ?M]
is handled first, which can't be solved before finding a Mul ?M
instance on the metavariable ?M
, causing search through all Mul
instances.
The solution is: whenever a class is declared that takes another class as parameter (i.e. unbundled inheritance), the out_param
s of the parent class should be unmarked and become in-params in the child class. Then Lean will try to find the parent class instance first, fill in the out_param
s and we'll be able to synthesize the child class instance without problems.
One consequence is that sometimes we have to give slightly more type ascription when talking about membership and the types don't quite align: if M
and M'
are semireducibly defeq, then before zero_mem_class S M
would work to prove (0 : M') ∈ (s : S)
, since the out_param
became a metavariable, was filled in, and then checked (up to semireducibility apparently) for equality. Now M
is checked to equal M'
before applying the instance, with instance-reducible transparency. I don't think this is a huge issue since it feels Lean 4 is stricter about these kinds of equalities anyway.
Mathlib4 pair: leanprover-community/mathlib4#1832
@@ -82,6 +82,15 @@ Note: if `set_like.coe` is a projection, implementers should create a simp lemma
@[simp] lemma mem_carrier {p : my_subobject X} : x ∈ p.carrier ↔ x ∈ (p : set X) := iff.rfl
```
to normalize terms.
+
+If you declare an unbundled subclass of `set_like`, for example:
+```
+class mul_mem_class (S : Type*) (M : Type*) [has_mul M] [set_like S M] where
+ ...
+```
+Then you should *not* repeat the `out_param` declaration, `set_like` will supply the value instead.
+This ensures in Lean 4 your subclass will not have issues with synthesis of the `[has_mul M]`
+parameter starting before the value of `M` is known.
-/
@[protect_proj]
class set_like (A : Type*) (B : out_param $ Type*) :=
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(first ported)
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,8 +3,8 @@ Copyright (c) 2021 Eric Wieser. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Eric Wieser
-/
-import Mathbin.Data.Set.Basic
-import Mathbin.Tactic.Monotonicity.Basic
+import Data.Set.Basic
+import Tactic.Monotonicity.Basic
#align_import data.set_like.basic from "leanprover-community/mathlib"@"feb99064803fd3108e37c18b0f77d0a8344677a3"
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,15 +2,12 @@
Copyright (c) 2021 Eric Wieser. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Eric Wieser
-
-! This file was ported from Lean 3 source module data.set_like.basic
-! leanprover-community/mathlib commit feb99064803fd3108e37c18b0f77d0a8344677a3
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Data.Set.Basic
import Mathbin.Tactic.Monotonicity.Basic
+#align_import data.set_like.basic from "leanprover-community/mathlib"@"feb99064803fd3108e37c18b0f77d0a8344677a3"
+
/-!
# Typeclass for types with a set-like extensionality property
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -110,8 +110,6 @@ namespace SetLike
variable {A : Type _} {B : Type _} [i : SetLike A B]
-include i
-
instance : CoeTC A (Set B) :=
⟨SetLike.coe⟩
@@ -146,9 +144,11 @@ protected theorem forall {q : p → Prop} : (∀ x, q x) ↔ ∀ x ∈ p, q ⟨x
#align set_like.forall SetLike.forall
-/
+#print SetLike.coe_injective /-
theorem coe_injective : Function.Injective (coe : A → Set B) := fun x y h =>
SetLike.coe_injective' h
#align set_like.coe_injective SetLike.coe_injective
+-/
#print SetLike.coe_set_eq /-
@[simp, norm_cast]
@@ -163,9 +163,11 @@ theorem ext' (h : (p : Set B) = q) : p = q :=
#align set_like.ext' SetLike.ext'
-/
+#print SetLike.ext'_iff /-
theorem ext'_iff : p = q ↔ (p : Set B) = q :=
coe_set_eq.symm
#align set_like.ext'_iff SetLike.ext'_iff
+-/
#print SetLike.ext /-
/-- Note: implementers of `set_like` must copy this lemma in order to tag it with `@[ext]`. -/
@@ -174,9 +176,11 @@ theorem ext (h : ∀ x, x ∈ p ↔ x ∈ q) : p = q :=
#align set_like.ext SetLike.ext
-/
+#print SetLike.ext_iff /-
theorem ext_iff : p = q ↔ ∀ x, x ∈ p ↔ x ∈ q :=
coe_injective.eq_iff.symm.trans Set.ext_iff
#align set_like.ext_iff SetLike.ext_iff
+-/
#print SetLike.mem_coe /-
@[simp]
@@ -216,39 +220,55 @@ protected theorem eta (x : p) (hx : (x : B) ∈ p) : (⟨x, hx⟩ : p) = x :=
instance (priority := 100) : PartialOrder A :=
{ PartialOrder.lift (coe : A → Set B) coe_injective with le := fun H K => ∀ ⦃x⦄, x ∈ H → x ∈ K }
+#print SetLike.le_def /-
theorem le_def {S T : A} : S ≤ T ↔ ∀ ⦃x : B⦄, x ∈ S → x ∈ T :=
Iff.rfl
#align set_like.le_def SetLike.le_def
+-/
+#print SetLike.coe_subset_coe /-
@[simp, norm_cast]
theorem coe_subset_coe {S T : A} : (S : Set B) ⊆ T ↔ S ≤ T :=
Iff.rfl
#align set_like.coe_subset_coe SetLike.coe_subset_coe
+-/
+#print SetLike.coe_mono /-
@[mono]
theorem coe_mono : Monotone (coe : A → Set B) := fun a b => coe_subset_coe.mpr
#align set_like.coe_mono SetLike.coe_mono
+-/
+#print SetLike.coe_ssubset_coe /-
@[simp, norm_cast]
theorem coe_ssubset_coe {S T : A} : (S : Set B) ⊂ T ↔ S < T :=
Iff.rfl
#align set_like.coe_ssubset_coe SetLike.coe_ssubset_coe
+-/
+#print SetLike.coe_strictMono /-
@[mono]
theorem coe_strictMono : StrictMono (coe : A → Set B) := fun a b => coe_ssubset_coe.mpr
#align set_like.coe_strict_mono SetLike.coe_strictMono
+-/
+#print SetLike.not_le_iff_exists /-
theorem not_le_iff_exists : ¬p ≤ q ↔ ∃ x ∈ p, x ∉ q :=
Set.not_subset
#align set_like.not_le_iff_exists SetLike.not_le_iff_exists
+-/
+#print SetLike.exists_of_lt /-
theorem exists_of_lt : p < q → ∃ x ∈ q, x ∉ p :=
Set.exists_of_ssubset
#align set_like.exists_of_lt SetLike.exists_of_lt
+-/
+#print SetLike.lt_iff_le_and_exists /-
theorem lt_iff_le_and_exists : p < q ↔ p ≤ q ∧ ∃ x ∈ q, x ∉ p := by
rw [lt_iff_le_not_le, not_le_iff_exists]
#align set_like.lt_iff_le_and_exists SetLike.lt_iff_le_and_exists
+-/
end SetLike
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -192,12 +192,10 @@ theorem coe_eq_coe {x y : p} : (x : B) = y ↔ x = y :=
#align set_like.coe_eq_coe SetLike.coe_eq_coe
-/
-/- warning: set_like.coe_mk clashes with [anonymous] -> [anonymous]
-Case conversion may be inaccurate. Consider using '#align set_like.coe_mk [anonymous]ₓ'. -/
@[simp, norm_cast]
-theorem [anonymous] (x : B) (hx : x ∈ p) : ((⟨x, hx⟩ : p) : B) = x :=
+theorem coe_mk (x : B) (hx : x ∈ p) : ((⟨x, hx⟩ : p) : B) = x :=
rfl
-#align set_like.coe_mk [anonymous]
+#align set_like.coe_mk SetLike.coe_mk
#print SetLike.coe_mem /-
@[simp]
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -146,12 +146,6 @@ protected theorem forall {q : p → Prop} : (∀ x, q x) ↔ ∀ x ∈ p, q ⟨x
#align set_like.forall SetLike.forall
-/
-/- warning: set_like.coe_injective -> SetLike.coe_injective is a dubious translation:
-lean 3 declaration is
- forall {A : Type.{u1}} {B : Type.{u2}} [i : SetLike.{u1, u2} A B], Function.Injective.{succ u1, succ u2} A (Set.{u2} B) ((fun (a : Type.{u1}) (b : Type.{u2}) [self : HasLiftT.{succ u1, succ u2} a b] => self.0) A (Set.{u2} B) (HasLiftT.mk.{succ u1, succ u2} A (Set.{u2} B) (CoeTCₓ.coe.{succ u1, succ u2} A (Set.{u2} B) (SetLike.Set.hasCoeT.{u1, u2} A B i))))
-but is expected to have type
- forall {A : Type.{u2}} {B : Type.{u1}} [i : SetLike.{u2, u1} A B], Function.Injective.{succ u2, succ u1} A (Set.{u1} B) (SetLike.coe.{u2, u1} A B i)
-Case conversion may be inaccurate. Consider using '#align set_like.coe_injective SetLike.coe_injectiveₓ'. -/
theorem coe_injective : Function.Injective (coe : A → Set B) := fun x y h =>
SetLike.coe_injective' h
#align set_like.coe_injective SetLike.coe_injective
@@ -169,12 +163,6 @@ theorem ext' (h : (p : Set B) = q) : p = q :=
#align set_like.ext' SetLike.ext'
-/
-/- warning: set_like.ext'_iff -> SetLike.ext'_iff is a dubious translation:
-lean 3 declaration is
- forall {A : Type.{u1}} {B : Type.{u2}} [i : SetLike.{u1, u2} A B] {p : A} {q : A}, Iff (Eq.{succ u1} A p q) (Eq.{succ u2} (Set.{u2} B) ((fun (a : Type.{u1}) (b : Type.{u2}) [self : HasLiftT.{succ u1, succ u2} a b] => self.0) A (Set.{u2} B) (HasLiftT.mk.{succ u1, succ u2} A (Set.{u2} B) (CoeTCₓ.coe.{succ u1, succ u2} A (Set.{u2} B) (SetLike.Set.hasCoeT.{u1, u2} A B i))) p) ((fun (a : Type.{u1}) (b : Type.{u2}) [self : HasLiftT.{succ u1, succ u2} a b] => self.0) A (Set.{u2} B) (HasLiftT.mk.{succ u1, succ u2} A (Set.{u2} B) (CoeTCₓ.coe.{succ u1, succ u2} A (Set.{u2} B) (SetLike.Set.hasCoeT.{u1, u2} A B i))) q))
-but is expected to have type
- forall {A : Type.{u2}} {B : Type.{u1}} [i : SetLike.{u2, u1} A B] {p : A} {q : A}, Iff (Eq.{succ u2} A p q) (Eq.{succ u1} (Set.{u1} B) (SetLike.coe.{u2, u1} A B i p) (SetLike.coe.{u2, u1} A B i q))
-Case conversion may be inaccurate. Consider using '#align set_like.ext'_iff SetLike.ext'_iffₓ'. -/
theorem ext'_iff : p = q ↔ (p : Set B) = q :=
coe_set_eq.symm
#align set_like.ext'_iff SetLike.ext'_iff
@@ -186,12 +174,6 @@ theorem ext (h : ∀ x, x ∈ p ↔ x ∈ q) : p = q :=
#align set_like.ext SetLike.ext
-/
-/- warning: set_like.ext_iff -> SetLike.ext_iff is a dubious translation:
-lean 3 declaration is
- forall {A : Type.{u1}} {B : Type.{u2}} [i : SetLike.{u1, u2} A B] {p : A} {q : A}, Iff (Eq.{succ u1} A p q) (forall (x : B), Iff (Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x p) (Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x q))
-but is expected to have type
- forall {A : Type.{u2}} {B : Type.{u1}} [i : SetLike.{u2, u1} A B] {p : A} {q : A}, Iff (Eq.{succ u2} A p q) (forall (x : B), Iff (Membership.mem.{u1, u2} B A (SetLike.instMembership.{u2, u1} A B i) x p) (Membership.mem.{u1, u2} B A (SetLike.instMembership.{u2, u1} A B i) x q))
-Case conversion may be inaccurate. Consider using '#align set_like.ext_iff SetLike.ext_iffₓ'. -/
theorem ext_iff : p = q ↔ ∀ x, x ∈ p ↔ x ∈ q :=
coe_injective.eq_iff.symm.trans Set.ext_iff
#align set_like.ext_iff SetLike.ext_iff
@@ -211,11 +193,6 @@ theorem coe_eq_coe {x y : p} : (x : B) = y ↔ x = y :=
-/
/- warning: set_like.coe_mk clashes with [anonymous] -> [anonymous]
-warning: set_like.coe_mk -> [anonymous] is a dubious translation:
-lean 3 declaration is
- forall {A : Type.{u1}} {B : Type.{u2}} [i : SetLike.{u1, u2} A B] {p : A} (x : B) (hx : Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x p), Eq.{succ u2} B ((fun (a : Type.{u2}) (b : Type.{u2}) [self : HasLiftT.{succ u2, succ u2} a b] => self.0) (Subtype.{succ u2} B (fun (x : B) => Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x p)) B (HasLiftT.mk.{succ u2, succ u2} (Subtype.{succ u2} B (fun (x : B) => Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x p)) B (CoeTCₓ.coe.{succ u2, succ u2} (Subtype.{succ u2} B (fun (x : B) => Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x p)) B (coeBase.{succ u2, succ u2} (Subtype.{succ u2} B (fun (x : B) => Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x p)) B (coeSubtype.{succ u2} B (fun (x : B) => Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x p))))) (Subtype.mk.{succ u2} B (fun (x : B) => Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x p) x hx)) x
-but is expected to have type
- forall {A : Type.{u1}} {B : Type.{u2}}, (Nat -> A -> B) -> Nat -> (List.{u1} A) -> (List.{u2} B)
Case conversion may be inaccurate. Consider using '#align set_like.coe_mk [anonymous]ₓ'. -/
@[simp, norm_cast]
theorem [anonymous] (x : B) (hx : x ∈ p) : ((⟨x, hx⟩ : p) : B) = x :=
@@ -241,84 +218,36 @@ protected theorem eta (x : p) (hx : (x : B) ∈ p) : (⟨x, hx⟩ : p) = x :=
instance (priority := 100) : PartialOrder A :=
{ PartialOrder.lift (coe : A → Set B) coe_injective with le := fun H K => ∀ ⦃x⦄, x ∈ H → x ∈ K }
-/- warning: set_like.le_def -> SetLike.le_def is a dubious translation:
-lean 3 declaration is
- forall {A : Type.{u1}} {B : Type.{u2}} [i : SetLike.{u1, u2} A B] {S : A} {T : A}, Iff (LE.le.{u1} A (Preorder.toHasLe.{u1} A (PartialOrder.toPreorder.{u1} A (SetLike.partialOrder.{u1, u2} A B i))) S T) (forall {{x : B}}, (Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x S) -> (Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x T))
-but is expected to have type
- forall {A : Type.{u2}} {B : Type.{u1}} [i : SetLike.{u2, u1} A B] {S : A} {T : A}, Iff (LE.le.{u2} A (Preorder.toLE.{u2} A (PartialOrder.toPreorder.{u2} A (SetLike.instPartialOrder.{u2, u1} A B i))) S T) (forall {{x : B}}, (Membership.mem.{u1, u2} B A (SetLike.instMembership.{u2, u1} A B i) x S) -> (Membership.mem.{u1, u2} B A (SetLike.instMembership.{u2, u1} A B i) x T))
-Case conversion may be inaccurate. Consider using '#align set_like.le_def SetLike.le_defₓ'. -/
theorem le_def {S T : A} : S ≤ T ↔ ∀ ⦃x : B⦄, x ∈ S → x ∈ T :=
Iff.rfl
#align set_like.le_def SetLike.le_def
-/- warning: set_like.coe_subset_coe -> SetLike.coe_subset_coe is a dubious translation:
-lean 3 declaration is
- forall {A : Type.{u1}} {B : Type.{u2}} [i : SetLike.{u1, u2} A B] {S : A} {T : A}, Iff (HasSubset.Subset.{u2} (Set.{u2} B) (Set.hasSubset.{u2} B) ((fun (a : Type.{u1}) (b : Type.{u2}) [self : HasLiftT.{succ u1, succ u2} a b] => self.0) A (Set.{u2} B) (HasLiftT.mk.{succ u1, succ u2} A (Set.{u2} B) (CoeTCₓ.coe.{succ u1, succ u2} A (Set.{u2} B) (SetLike.Set.hasCoeT.{u1, u2} A B i))) S) ((fun (a : Type.{u1}) (b : Type.{u2}) [self : HasLiftT.{succ u1, succ u2} a b] => self.0) A (Set.{u2} B) (HasLiftT.mk.{succ u1, succ u2} A (Set.{u2} B) (CoeTCₓ.coe.{succ u1, succ u2} A (Set.{u2} B) (SetLike.Set.hasCoeT.{u1, u2} A B i))) T)) (LE.le.{u1} A (Preorder.toHasLe.{u1} A (PartialOrder.toPreorder.{u1} A (SetLike.partialOrder.{u1, u2} A B i))) S T)
-but is expected to have type
- forall {A : Type.{u1}} {B : Type.{u2}} [i : SetLike.{u1, u2} A B] {S : A} {T : A}, Iff (HasSubset.Subset.{u2} (Set.{u2} B) (Set.instHasSubsetSet.{u2} B) (SetLike.coe.{u1, u2} A B i S) (SetLike.coe.{u1, u2} A B i T)) (LE.le.{u1} A (Preorder.toLE.{u1} A (PartialOrder.toPreorder.{u1} A (SetLike.instPartialOrder.{u1, u2} A B i))) S T)
-Case conversion may be inaccurate. Consider using '#align set_like.coe_subset_coe SetLike.coe_subset_coeₓ'. -/
@[simp, norm_cast]
theorem coe_subset_coe {S T : A} : (S : Set B) ⊆ T ↔ S ≤ T :=
Iff.rfl
#align set_like.coe_subset_coe SetLike.coe_subset_coe
-/- warning: set_like.coe_mono -> SetLike.coe_mono is a dubious translation:
-lean 3 declaration is
- forall {A : Type.{u1}} {B : Type.{u2}} [i : SetLike.{u1, u2} A B], Monotone.{u1, u2} A (Set.{u2} B) (PartialOrder.toPreorder.{u1} A (SetLike.partialOrder.{u1, u2} A B i)) (PartialOrder.toPreorder.{u2} (Set.{u2} B) (SemilatticeInf.toPartialOrder.{u2} (Set.{u2} B) (Lattice.toSemilatticeInf.{u2} (Set.{u2} B) (GeneralizedCoheytingAlgebra.toLattice.{u2} (Set.{u2} B) (GeneralizedBooleanAlgebra.toGeneralizedCoheytingAlgebra.{u2} (Set.{u2} B) (BooleanAlgebra.toGeneralizedBooleanAlgebra.{u2} (Set.{u2} B) (Set.booleanAlgebra.{u2} B))))))) ((fun (a : Type.{u1}) (b : Type.{u2}) [self : HasLiftT.{succ u1, succ u2} a b] => self.0) A (Set.{u2} B) (HasLiftT.mk.{succ u1, succ u2} A (Set.{u2} B) (CoeTCₓ.coe.{succ u1, succ u2} A (Set.{u2} B) (SetLike.Set.hasCoeT.{u1, u2} A B i))))
-but is expected to have type
- forall {A : Type.{u2}} {B : Type.{u1}} [i : SetLike.{u2, u1} A B], Monotone.{u2, u1} A (Set.{u1} B) (PartialOrder.toPreorder.{u2} A (SetLike.instPartialOrder.{u2, u1} A B i)) (PartialOrder.toPreorder.{u1} (Set.{u1} B) (SemilatticeInf.toPartialOrder.{u1} (Set.{u1} B) (Lattice.toSemilatticeInf.{u1} (Set.{u1} B) (GeneralizedCoheytingAlgebra.toLattice.{u1} (Set.{u1} B) (CoheytingAlgebra.toGeneralizedCoheytingAlgebra.{u1} (Set.{u1} B) (BiheytingAlgebra.toCoheytingAlgebra.{u1} (Set.{u1} B) (BooleanAlgebra.toBiheytingAlgebra.{u1} (Set.{u1} B) (Set.instBooleanAlgebraSet.{u1} B)))))))) (SetLike.coe.{u2, u1} A B i)
-Case conversion may be inaccurate. Consider using '#align set_like.coe_mono SetLike.coe_monoₓ'. -/
@[mono]
theorem coe_mono : Monotone (coe : A → Set B) := fun a b => coe_subset_coe.mpr
#align set_like.coe_mono SetLike.coe_mono
-/- warning: set_like.coe_ssubset_coe -> SetLike.coe_ssubset_coe is a dubious translation:
-lean 3 declaration is
- forall {A : Type.{u1}} {B : Type.{u2}} [i : SetLike.{u1, u2} A B] {S : A} {T : A}, Iff (HasSSubset.SSubset.{u2} (Set.{u2} B) (Set.hasSsubset.{u2} B) ((fun (a : Type.{u1}) (b : Type.{u2}) [self : HasLiftT.{succ u1, succ u2} a b] => self.0) A (Set.{u2} B) (HasLiftT.mk.{succ u1, succ u2} A (Set.{u2} B) (CoeTCₓ.coe.{succ u1, succ u2} A (Set.{u2} B) (SetLike.Set.hasCoeT.{u1, u2} A B i))) S) ((fun (a : Type.{u1}) (b : Type.{u2}) [self : HasLiftT.{succ u1, succ u2} a b] => self.0) A (Set.{u2} B) (HasLiftT.mk.{succ u1, succ u2} A (Set.{u2} B) (CoeTCₓ.coe.{succ u1, succ u2} A (Set.{u2} B) (SetLike.Set.hasCoeT.{u1, u2} A B i))) T)) (LT.lt.{u1} A (Preorder.toHasLt.{u1} A (PartialOrder.toPreorder.{u1} A (SetLike.partialOrder.{u1, u2} A B i))) S T)
-but is expected to have type
- forall {A : Type.{u1}} {B : Type.{u2}} [i : SetLike.{u1, u2} A B] {S : A} {T : A}, Iff (HasSSubset.SSubset.{u2} (Set.{u2} B) (Set.instHasSSubsetSet.{u2} B) (SetLike.coe.{u1, u2} A B i S) (SetLike.coe.{u1, u2} A B i T)) (LT.lt.{u1} A (Preorder.toLT.{u1} A (PartialOrder.toPreorder.{u1} A (SetLike.instPartialOrder.{u1, u2} A B i))) S T)
-Case conversion may be inaccurate. Consider using '#align set_like.coe_ssubset_coe SetLike.coe_ssubset_coeₓ'. -/
@[simp, norm_cast]
theorem coe_ssubset_coe {S T : A} : (S : Set B) ⊂ T ↔ S < T :=
Iff.rfl
#align set_like.coe_ssubset_coe SetLike.coe_ssubset_coe
-/- warning: set_like.coe_strict_mono -> SetLike.coe_strictMono is a dubious translation:
-lean 3 declaration is
- forall {A : Type.{u1}} {B : Type.{u2}} [i : SetLike.{u1, u2} A B], StrictMono.{u1, u2} A (Set.{u2} B) (PartialOrder.toPreorder.{u1} A (SetLike.partialOrder.{u1, u2} A B i)) (PartialOrder.toPreorder.{u2} (Set.{u2} B) (SemilatticeInf.toPartialOrder.{u2} (Set.{u2} B) (Lattice.toSemilatticeInf.{u2} (Set.{u2} B) (GeneralizedCoheytingAlgebra.toLattice.{u2} (Set.{u2} B) (GeneralizedBooleanAlgebra.toGeneralizedCoheytingAlgebra.{u2} (Set.{u2} B) (BooleanAlgebra.toGeneralizedBooleanAlgebra.{u2} (Set.{u2} B) (Set.booleanAlgebra.{u2} B))))))) ((fun (a : Type.{u1}) (b : Type.{u2}) [self : HasLiftT.{succ u1, succ u2} a b] => self.0) A (Set.{u2} B) (HasLiftT.mk.{succ u1, succ u2} A (Set.{u2} B) (CoeTCₓ.coe.{succ u1, succ u2} A (Set.{u2} B) (SetLike.Set.hasCoeT.{u1, u2} A B i))))
-but is expected to have type
- forall {A : Type.{u2}} {B : Type.{u1}} [i : SetLike.{u2, u1} A B], StrictMono.{u2, u1} A (Set.{u1} B) (PartialOrder.toPreorder.{u2} A (SetLike.instPartialOrder.{u2, u1} A B i)) (PartialOrder.toPreorder.{u1} (Set.{u1} B) (SemilatticeInf.toPartialOrder.{u1} (Set.{u1} B) (Lattice.toSemilatticeInf.{u1} (Set.{u1} B) (GeneralizedCoheytingAlgebra.toLattice.{u1} (Set.{u1} B) (CoheytingAlgebra.toGeneralizedCoheytingAlgebra.{u1} (Set.{u1} B) (BiheytingAlgebra.toCoheytingAlgebra.{u1} (Set.{u1} B) (BooleanAlgebra.toBiheytingAlgebra.{u1} (Set.{u1} B) (Set.instBooleanAlgebraSet.{u1} B)))))))) (SetLike.coe.{u2, u1} A B i)
-Case conversion may be inaccurate. Consider using '#align set_like.coe_strict_mono SetLike.coe_strictMonoₓ'. -/
@[mono]
theorem coe_strictMono : StrictMono (coe : A → Set B) := fun a b => coe_ssubset_coe.mpr
#align set_like.coe_strict_mono SetLike.coe_strictMono
-/- warning: set_like.not_le_iff_exists -> SetLike.not_le_iff_exists is a dubious translation:
-lean 3 declaration is
- forall {A : Type.{u1}} {B : Type.{u2}} [i : SetLike.{u1, u2} A B] {p : A} {q : A}, Iff (Not (LE.le.{u1} A (Preorder.toHasLe.{u1} A (PartialOrder.toPreorder.{u1} A (SetLike.partialOrder.{u1, u2} A B i))) p q)) (Exists.{succ u2} B (fun (x : B) => Exists.{0} (Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x p) (fun (H : Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x p) => Not (Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x q))))
-but is expected to have type
- forall {A : Type.{u2}} {B : Type.{u1}} [i : SetLike.{u2, u1} A B] {p : A} {q : A}, Iff (Not (LE.le.{u2} A (Preorder.toLE.{u2} A (PartialOrder.toPreorder.{u2} A (SetLike.instPartialOrder.{u2, u1} A B i))) p q)) (Exists.{succ u1} B (fun (x : B) => And (Membership.mem.{u1, u2} B A (SetLike.instMembership.{u2, u1} A B i) x p) (Not (Membership.mem.{u1, u2} B A (SetLike.instMembership.{u2, u1} A B i) x q))))
-Case conversion may be inaccurate. Consider using '#align set_like.not_le_iff_exists SetLike.not_le_iff_existsₓ'. -/
theorem not_le_iff_exists : ¬p ≤ q ↔ ∃ x ∈ p, x ∉ q :=
Set.not_subset
#align set_like.not_le_iff_exists SetLike.not_le_iff_exists
-/- warning: set_like.exists_of_lt -> SetLike.exists_of_lt is a dubious translation:
-lean 3 declaration is
- forall {A : Type.{u1}} {B : Type.{u2}} [i : SetLike.{u1, u2} A B] {p : A} {q : A}, (LT.lt.{u1} A (Preorder.toHasLt.{u1} A (PartialOrder.toPreorder.{u1} A (SetLike.partialOrder.{u1, u2} A B i))) p q) -> (Exists.{succ u2} B (fun (x : B) => Exists.{0} (Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x q) (fun (H : Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x q) => Not (Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x p))))
-but is expected to have type
- forall {A : Type.{u2}} {B : Type.{u1}} [i : SetLike.{u2, u1} A B] {p : A} {q : A}, (LT.lt.{u2} A (Preorder.toLT.{u2} A (PartialOrder.toPreorder.{u2} A (SetLike.instPartialOrder.{u2, u1} A B i))) p q) -> (Exists.{succ u1} B (fun (x : B) => And (Membership.mem.{u1, u2} B A (SetLike.instMembership.{u2, u1} A B i) x q) (Not (Membership.mem.{u1, u2} B A (SetLike.instMembership.{u2, u1} A B i) x p))))
-Case conversion may be inaccurate. Consider using '#align set_like.exists_of_lt SetLike.exists_of_ltₓ'. -/
theorem exists_of_lt : p < q → ∃ x ∈ q, x ∉ p :=
Set.exists_of_ssubset
#align set_like.exists_of_lt SetLike.exists_of_lt
-/- warning: set_like.lt_iff_le_and_exists -> SetLike.lt_iff_le_and_exists is a dubious translation:
-lean 3 declaration is
- forall {A : Type.{u1}} {B : Type.{u2}} [i : SetLike.{u1, u2} A B] {p : A} {q : A}, Iff (LT.lt.{u1} A (Preorder.toHasLt.{u1} A (PartialOrder.toPreorder.{u1} A (SetLike.partialOrder.{u1, u2} A B i))) p q) (And (LE.le.{u1} A (Preorder.toHasLe.{u1} A (PartialOrder.toPreorder.{u1} A (SetLike.partialOrder.{u1, u2} A B i))) p q) (Exists.{succ u2} B (fun (x : B) => Exists.{0} (Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x q) (fun (H : Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x q) => Not (Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x p)))))
-but is expected to have type
- forall {A : Type.{u2}} {B : Type.{u1}} [i : SetLike.{u2, u1} A B] {p : A} {q : A}, Iff (LT.lt.{u2} A (Preorder.toLT.{u2} A (PartialOrder.toPreorder.{u2} A (SetLike.instPartialOrder.{u2, u1} A B i))) p q) (And (LE.le.{u2} A (Preorder.toLE.{u2} A (PartialOrder.toPreorder.{u2} A (SetLike.instPartialOrder.{u2, u1} A B i))) p q) (Exists.{succ u1} B (fun (x : B) => And (Membership.mem.{u1, u2} B A (SetLike.instMembership.{u2, u1} A B i) x q) (Not (Membership.mem.{u1, u2} B A (SetLike.instMembership.{u2, u1} A B i) x p)))))
-Case conversion may be inaccurate. Consider using '#align set_like.lt_iff_le_and_exists SetLike.lt_iff_le_and_existsₓ'. -/
theorem lt_iff_le_and_exists : p < q ↔ p ≤ q ∧ ∃ x ∈ q, x ∉ p := by
rw [lt_iff_le_not_le, not_le_iff_exists]
#align set_like.lt_iff_le_and_exists SetLike.lt_iff_le_and_exists
mathlib commit https://github.com/leanprover-community/mathlib/commit/0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8
@@ -243,7 +243,7 @@ instance (priority := 100) : PartialOrder A :=
/- warning: set_like.le_def -> SetLike.le_def is a dubious translation:
lean 3 declaration is
- forall {A : Type.{u1}} {B : Type.{u2}} [i : SetLike.{u1, u2} A B] {S : A} {T : A}, Iff (LE.le.{u1} A (Preorder.toLE.{u1} A (PartialOrder.toPreorder.{u1} A (SetLike.partialOrder.{u1, u2} A B i))) S T) (forall {{x : B}}, (Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x S) -> (Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x T))
+ forall {A : Type.{u1}} {B : Type.{u2}} [i : SetLike.{u1, u2} A B] {S : A} {T : A}, Iff (LE.le.{u1} A (Preorder.toHasLe.{u1} A (PartialOrder.toPreorder.{u1} A (SetLike.partialOrder.{u1, u2} A B i))) S T) (forall {{x : B}}, (Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x S) -> (Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x T))
but is expected to have type
forall {A : Type.{u2}} {B : Type.{u1}} [i : SetLike.{u2, u1} A B] {S : A} {T : A}, Iff (LE.le.{u2} A (Preorder.toLE.{u2} A (PartialOrder.toPreorder.{u2} A (SetLike.instPartialOrder.{u2, u1} A B i))) S T) (forall {{x : B}}, (Membership.mem.{u1, u2} B A (SetLike.instMembership.{u2, u1} A B i) x S) -> (Membership.mem.{u1, u2} B A (SetLike.instMembership.{u2, u1} A B i) x T))
Case conversion may be inaccurate. Consider using '#align set_like.le_def SetLike.le_defₓ'. -/
@@ -253,7 +253,7 @@ theorem le_def {S T : A} : S ≤ T ↔ ∀ ⦃x : B⦄, x ∈ S → x ∈ T :=
/- warning: set_like.coe_subset_coe -> SetLike.coe_subset_coe is a dubious translation:
lean 3 declaration is
- forall {A : Type.{u1}} {B : Type.{u2}} [i : SetLike.{u1, u2} A B] {S : A} {T : A}, Iff (HasSubset.Subset.{u2} (Set.{u2} B) (Set.hasSubset.{u2} B) ((fun (a : Type.{u1}) (b : Type.{u2}) [self : HasLiftT.{succ u1, succ u2} a b] => self.0) A (Set.{u2} B) (HasLiftT.mk.{succ u1, succ u2} A (Set.{u2} B) (CoeTCₓ.coe.{succ u1, succ u2} A (Set.{u2} B) (SetLike.Set.hasCoeT.{u1, u2} A B i))) S) ((fun (a : Type.{u1}) (b : Type.{u2}) [self : HasLiftT.{succ u1, succ u2} a b] => self.0) A (Set.{u2} B) (HasLiftT.mk.{succ u1, succ u2} A (Set.{u2} B) (CoeTCₓ.coe.{succ u1, succ u2} A (Set.{u2} B) (SetLike.Set.hasCoeT.{u1, u2} A B i))) T)) (LE.le.{u1} A (Preorder.toLE.{u1} A (PartialOrder.toPreorder.{u1} A (SetLike.partialOrder.{u1, u2} A B i))) S T)
+ forall {A : Type.{u1}} {B : Type.{u2}} [i : SetLike.{u1, u2} A B] {S : A} {T : A}, Iff (HasSubset.Subset.{u2} (Set.{u2} B) (Set.hasSubset.{u2} B) ((fun (a : Type.{u1}) (b : Type.{u2}) [self : HasLiftT.{succ u1, succ u2} a b] => self.0) A (Set.{u2} B) (HasLiftT.mk.{succ u1, succ u2} A (Set.{u2} B) (CoeTCₓ.coe.{succ u1, succ u2} A (Set.{u2} B) (SetLike.Set.hasCoeT.{u1, u2} A B i))) S) ((fun (a : Type.{u1}) (b : Type.{u2}) [self : HasLiftT.{succ u1, succ u2} a b] => self.0) A (Set.{u2} B) (HasLiftT.mk.{succ u1, succ u2} A (Set.{u2} B) (CoeTCₓ.coe.{succ u1, succ u2} A (Set.{u2} B) (SetLike.Set.hasCoeT.{u1, u2} A B i))) T)) (LE.le.{u1} A (Preorder.toHasLe.{u1} A (PartialOrder.toPreorder.{u1} A (SetLike.partialOrder.{u1, u2} A B i))) S T)
but is expected to have type
forall {A : Type.{u1}} {B : Type.{u2}} [i : SetLike.{u1, u2} A B] {S : A} {T : A}, Iff (HasSubset.Subset.{u2} (Set.{u2} B) (Set.instHasSubsetSet.{u2} B) (SetLike.coe.{u1, u2} A B i S) (SetLike.coe.{u1, u2} A B i T)) (LE.le.{u1} A (Preorder.toLE.{u1} A (PartialOrder.toPreorder.{u1} A (SetLike.instPartialOrder.{u1, u2} A B i))) S T)
Case conversion may be inaccurate. Consider using '#align set_like.coe_subset_coe SetLike.coe_subset_coeₓ'. -/
@@ -274,7 +274,7 @@ theorem coe_mono : Monotone (coe : A → Set B) := fun a b => coe_subset_coe.mpr
/- warning: set_like.coe_ssubset_coe -> SetLike.coe_ssubset_coe is a dubious translation:
lean 3 declaration is
- forall {A : Type.{u1}} {B : Type.{u2}} [i : SetLike.{u1, u2} A B] {S : A} {T : A}, Iff (HasSSubset.SSubset.{u2} (Set.{u2} B) (Set.hasSsubset.{u2} B) ((fun (a : Type.{u1}) (b : Type.{u2}) [self : HasLiftT.{succ u1, succ u2} a b] => self.0) A (Set.{u2} B) (HasLiftT.mk.{succ u1, succ u2} A (Set.{u2} B) (CoeTCₓ.coe.{succ u1, succ u2} A (Set.{u2} B) (SetLike.Set.hasCoeT.{u1, u2} A B i))) S) ((fun (a : Type.{u1}) (b : Type.{u2}) [self : HasLiftT.{succ u1, succ u2} a b] => self.0) A (Set.{u2} B) (HasLiftT.mk.{succ u1, succ u2} A (Set.{u2} B) (CoeTCₓ.coe.{succ u1, succ u2} A (Set.{u2} B) (SetLike.Set.hasCoeT.{u1, u2} A B i))) T)) (LT.lt.{u1} A (Preorder.toLT.{u1} A (PartialOrder.toPreorder.{u1} A (SetLike.partialOrder.{u1, u2} A B i))) S T)
+ forall {A : Type.{u1}} {B : Type.{u2}} [i : SetLike.{u1, u2} A B] {S : A} {T : A}, Iff (HasSSubset.SSubset.{u2} (Set.{u2} B) (Set.hasSsubset.{u2} B) ((fun (a : Type.{u1}) (b : Type.{u2}) [self : HasLiftT.{succ u1, succ u2} a b] => self.0) A (Set.{u2} B) (HasLiftT.mk.{succ u1, succ u2} A (Set.{u2} B) (CoeTCₓ.coe.{succ u1, succ u2} A (Set.{u2} B) (SetLike.Set.hasCoeT.{u1, u2} A B i))) S) ((fun (a : Type.{u1}) (b : Type.{u2}) [self : HasLiftT.{succ u1, succ u2} a b] => self.0) A (Set.{u2} B) (HasLiftT.mk.{succ u1, succ u2} A (Set.{u2} B) (CoeTCₓ.coe.{succ u1, succ u2} A (Set.{u2} B) (SetLike.Set.hasCoeT.{u1, u2} A B i))) T)) (LT.lt.{u1} A (Preorder.toHasLt.{u1} A (PartialOrder.toPreorder.{u1} A (SetLike.partialOrder.{u1, u2} A B i))) S T)
but is expected to have type
forall {A : Type.{u1}} {B : Type.{u2}} [i : SetLike.{u1, u2} A B] {S : A} {T : A}, Iff (HasSSubset.SSubset.{u2} (Set.{u2} B) (Set.instHasSSubsetSet.{u2} B) (SetLike.coe.{u1, u2} A B i S) (SetLike.coe.{u1, u2} A B i T)) (LT.lt.{u1} A (Preorder.toLT.{u1} A (PartialOrder.toPreorder.{u1} A (SetLike.instPartialOrder.{u1, u2} A B i))) S T)
Case conversion may be inaccurate. Consider using '#align set_like.coe_ssubset_coe SetLike.coe_ssubset_coeₓ'. -/
@@ -295,7 +295,7 @@ theorem coe_strictMono : StrictMono (coe : A → Set B) := fun a b => coe_ssubse
/- warning: set_like.not_le_iff_exists -> SetLike.not_le_iff_exists is a dubious translation:
lean 3 declaration is
- forall {A : Type.{u1}} {B : Type.{u2}} [i : SetLike.{u1, u2} A B] {p : A} {q : A}, Iff (Not (LE.le.{u1} A (Preorder.toLE.{u1} A (PartialOrder.toPreorder.{u1} A (SetLike.partialOrder.{u1, u2} A B i))) p q)) (Exists.{succ u2} B (fun (x : B) => Exists.{0} (Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x p) (fun (H : Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x p) => Not (Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x q))))
+ forall {A : Type.{u1}} {B : Type.{u2}} [i : SetLike.{u1, u2} A B] {p : A} {q : A}, Iff (Not (LE.le.{u1} A (Preorder.toHasLe.{u1} A (PartialOrder.toPreorder.{u1} A (SetLike.partialOrder.{u1, u2} A B i))) p q)) (Exists.{succ u2} B (fun (x : B) => Exists.{0} (Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x p) (fun (H : Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x p) => Not (Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x q))))
but is expected to have type
forall {A : Type.{u2}} {B : Type.{u1}} [i : SetLike.{u2, u1} A B] {p : A} {q : A}, Iff (Not (LE.le.{u2} A (Preorder.toLE.{u2} A (PartialOrder.toPreorder.{u2} A (SetLike.instPartialOrder.{u2, u1} A B i))) p q)) (Exists.{succ u1} B (fun (x : B) => And (Membership.mem.{u1, u2} B A (SetLike.instMembership.{u2, u1} A B i) x p) (Not (Membership.mem.{u1, u2} B A (SetLike.instMembership.{u2, u1} A B i) x q))))
Case conversion may be inaccurate. Consider using '#align set_like.not_le_iff_exists SetLike.not_le_iff_existsₓ'. -/
@@ -305,7 +305,7 @@ theorem not_le_iff_exists : ¬p ≤ q ↔ ∃ x ∈ p, x ∉ q :=
/- warning: set_like.exists_of_lt -> SetLike.exists_of_lt is a dubious translation:
lean 3 declaration is
- forall {A : Type.{u1}} {B : Type.{u2}} [i : SetLike.{u1, u2} A B] {p : A} {q : A}, (LT.lt.{u1} A (Preorder.toLT.{u1} A (PartialOrder.toPreorder.{u1} A (SetLike.partialOrder.{u1, u2} A B i))) p q) -> (Exists.{succ u2} B (fun (x : B) => Exists.{0} (Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x q) (fun (H : Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x q) => Not (Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x p))))
+ forall {A : Type.{u1}} {B : Type.{u2}} [i : SetLike.{u1, u2} A B] {p : A} {q : A}, (LT.lt.{u1} A (Preorder.toHasLt.{u1} A (PartialOrder.toPreorder.{u1} A (SetLike.partialOrder.{u1, u2} A B i))) p q) -> (Exists.{succ u2} B (fun (x : B) => Exists.{0} (Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x q) (fun (H : Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x q) => Not (Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x p))))
but is expected to have type
forall {A : Type.{u2}} {B : Type.{u1}} [i : SetLike.{u2, u1} A B] {p : A} {q : A}, (LT.lt.{u2} A (Preorder.toLT.{u2} A (PartialOrder.toPreorder.{u2} A (SetLike.instPartialOrder.{u2, u1} A B i))) p q) -> (Exists.{succ u1} B (fun (x : B) => And (Membership.mem.{u1, u2} B A (SetLike.instMembership.{u2, u1} A B i) x q) (Not (Membership.mem.{u1, u2} B A (SetLike.instMembership.{u2, u1} A B i) x p))))
Case conversion may be inaccurate. Consider using '#align set_like.exists_of_lt SetLike.exists_of_ltₓ'. -/
@@ -315,7 +315,7 @@ theorem exists_of_lt : p < q → ∃ x ∈ q, x ∉ p :=
/- warning: set_like.lt_iff_le_and_exists -> SetLike.lt_iff_le_and_exists is a dubious translation:
lean 3 declaration is
- forall {A : Type.{u1}} {B : Type.{u2}} [i : SetLike.{u1, u2} A B] {p : A} {q : A}, Iff (LT.lt.{u1} A (Preorder.toLT.{u1} A (PartialOrder.toPreorder.{u1} A (SetLike.partialOrder.{u1, u2} A B i))) p q) (And (LE.le.{u1} A (Preorder.toLE.{u1} A (PartialOrder.toPreorder.{u1} A (SetLike.partialOrder.{u1, u2} A B i))) p q) (Exists.{succ u2} B (fun (x : B) => Exists.{0} (Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x q) (fun (H : Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x q) => Not (Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x p)))))
+ forall {A : Type.{u1}} {B : Type.{u2}} [i : SetLike.{u1, u2} A B] {p : A} {q : A}, Iff (LT.lt.{u1} A (Preorder.toHasLt.{u1} A (PartialOrder.toPreorder.{u1} A (SetLike.partialOrder.{u1, u2} A B i))) p q) (And (LE.le.{u1} A (Preorder.toHasLe.{u1} A (PartialOrder.toPreorder.{u1} A (SetLike.partialOrder.{u1, u2} A B i))) p q) (Exists.{succ u2} B (fun (x : B) => Exists.{0} (Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x q) (fun (H : Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x q) => Not (Membership.Mem.{u2, u1} B A (SetLike.hasMem.{u1, u2} A B i) x p)))))
but is expected to have type
forall {A : Type.{u2}} {B : Type.{u1}} [i : SetLike.{u2, u1} A B] {p : A} {q : A}, Iff (LT.lt.{u2} A (Preorder.toLT.{u2} A (PartialOrder.toPreorder.{u2} A (SetLike.instPartialOrder.{u2, u1} A B i))) p q) (And (LE.le.{u2} A (Preorder.toLE.{u2} A (PartialOrder.toPreorder.{u2} A (SetLike.instPartialOrder.{u2, u1} A B i))) p q) (Exists.{succ u1} B (fun (x : B) => And (Membership.mem.{u1, u2} B A (SetLike.instMembership.{u2, u1} A B i) x q) (Not (Membership.mem.{u1, u2} B A (SetLike.instMembership.{u2, u1} A B i) x p)))))
Case conversion may be inaccurate. Consider using '#align set_like.lt_iff_le_and_exists SetLike.lt_iff_le_and_existsₓ'. -/
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
Fully update the module docstrings (in particular, the examples given therein) after #8386.
This includes switching to where syntax, but also replacing Lean 3 syntax, replacing => by "\mapsto" while at it and indenting code per the style guide. As such, it's also a follow-up to #11301.
Co-authored-by: @Vierkantor
Co-authored-by: Vierkantor <vierkantor@vierkantor.com>
@@ -48,7 +48,7 @@ instance : SetLike (MySubobject X) X :=
/-- Copy of a `MySubobject` with a new `carrier` equal to the old one. Useful to fix definitional
equalities. See Note [range copy pattern]. -/
protected def copy (p : MySubobject X) (s : Set X) (hs : s = ↑p) : MySubobject X :=
- { carrier := s,
+ { carrier := s
op_mem' := hs.symm ▸ p.op_mem' }
@[simp] lemma coe_copy (p : MySubobject X) (s : Set X) (hs : s = ↑p) :
@@ -187,7 +187,7 @@ theorem coe_eq_coe {x y : p} : (x : B) = y ↔ x = y :=
#align set_like.coe_eq_coe SetLike.coe_eq_coe
-- Porting note: this is not necessary anymore due to the way coercions work
- #noalign set_like.coe_mk
+#noalign set_like.coe_mk
@[simp]
theorem coe_mem (x : p) : (x : B) ∈ p :=
variables
, universes
' syntax in doc comments (#11404)
It's deprecated in favour of variable
; likely a leftover from the port.
Also replace universes
, which is invalid now.
@@ -36,7 +36,7 @@ structure MySubobject (X : Type*) [ObjectTypeclass X] :=
namespace MySubobject
-variables {X : Type*} [ObjectTypeclass X] {x : X}
+variable {X : Type*} [ObjectTypeclass X] {x : X}
instance : SetLike (MySubobject X) X :=
⟨MySubobject.carrier, fun p q h => by cases p; cases q; congr!⟩
Homogenises porting notes via capitalisation and addition of whitespace.
It makes the following changes:
@@ -186,7 +186,7 @@ theorem coe_eq_coe {x y : p} : (x : B) = y ↔ x = y :=
Subtype.ext_iff_val.symm
#align set_like.coe_eq_coe SetLike.coe_eq_coe
--- porting note: this is not necessary anymore due to the way coercions work
+-- Porting note: this is not necessary anymore due to the way coercions work
#noalign set_like.coe_mk
@[simp]
@@ -197,7 +197,7 @@ theorem coe_mem (x : p) : (x : B) ∈ p :=
@[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
--- porting note: removed `@[simp]` because `simpNF` linter complained
+-- Porting note: removed `@[simp]` because `simpNF` linter complained
protected theorem eta (x : p) (hx : (x : B) ∈ p) : (⟨x, hx⟩ : p) = x := rfl
#align set_like.eta SetLike.eta
not necessary anymore
porting notes (#11086)
Solves porting notes claiming
by simply deleting them.
@@ -187,7 +187,7 @@ theorem coe_eq_coe {x y : p} : (x : B) = y ↔ x = y :=
#align set_like.coe_eq_coe SetLike.coe_eq_coe
-- porting note: this is not necessary anymore due to the way coercions work
-#noalign set_like.coe_mk
+ #noalign set_like.coe_mk
@[simp]
theorem coe_mem (x : p) : (x : B) ∈ p :=
@@ -194,7 +194,7 @@ theorem coe_mem (x : p) : (x : B) ∈ p :=
x.2
#align set_like.coe_mem SetLike.coe_mem
-@[aesop 5% apply (rule_sets [SetLike])]
+@[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
-- porting note: removed `@[simp]` because `simpNF` linter complained
$
with <|
(#9319)
See Zulip thread for the discussion.
@@ -62,7 +62,7 @@ end MySubobject
An alternative to `SetLike` could have been an extensional `Membership` typeclass:
```
-class ExtMembership (α : out_param $ Type u) (β : Type v) extends Membership α β :=
+class ExtMembership (α : out_param <| Type u) (β : Type v) extends Membership α β :=
(ext_iff : ∀ {s t : β}, s = t ↔ ∀ (x : α), x ∈ s ↔ x ∈ t)
```
While this is equivalent, `SetLike` conveniently uses a carrier set projection directly.
Although most of the docs were ported, we still used old function syntax and congr'
instead of congr!
. I tested the new version on Subgroup
.
@@ -39,7 +39,7 @@ namespace MySubobject
variables {X : Type*} [ObjectTypeclass X] {x : X}
instance : SetLike (MySubobject X) X :=
- ⟨MySubobject.carrier, λ p q h, by cases p; cases q; congr'⟩
+ ⟨MySubobject.carrier, fun p q h => by cases p; cases q; congr!⟩
@[simp] lemma mem_carrier {p : MySubobject X} : x ∈ p.carrier ↔ x ∈ (p : Set X) := Iff.rfl
↥S
instead of { x // x ∈ S }
for SetLike (#7927)
Adds a delaborator detecting { x // x ∈ S }
where the membership uses SetLike.instMembership
, since then this matches the CoeSort
instance for SetLike
.
@@ -108,12 +108,29 @@ variable {A : Type*} {B : Type*} [i : SetLike A B]
instance : CoeTC A (Set B) where coe := SetLike.coe
-instance (priority := 100) : Membership B A :=
+instance (priority := 100) instMembership : Membership B A :=
⟨fun x p => x ∈ (p : Set B)⟩
instance (priority := 100) : CoeSort A (Type _) :=
⟨fun p => { x : B // x ∈ p }⟩
+section Delab
+open Lean PrettyPrinter.Delaborator SubExpr
+
+/-- For terms that match the `CoeSort` instance's body, pretty print as `↥S`
+rather than as `{ x // x ∈ S }`. The discriminating feature is that membership
+uses the `SetLike.instMembership` instance. -/
+@[delab app.Subtype]
+def delabSubtypeSetLike : Delab := whenPPOption getPPNotation do
+ let #[_, .lam n _ body _] := (← getExpr).getAppArgs | failure
+ guard <| body.isAppOf ``Membership.mem
+ let #[_, _, inst, .bvar 0, _] := body.getAppArgs | failure
+ guard <| inst.isAppOfArity ``instMembership 3
+ let S ← withAppArg <| withBindingBody n <| withNaryArg 4 delab
+ `(↥$S)
+
+end Delab
+
variable (p q : A)
@[simp, norm_cast]
If a set t
is an upper set inside a lower set s
, then s \ t
is a lower set.
@@ -140,6 +140,8 @@ theorem coe_set_eq : (p : Set B) = q ↔ p = q :=
coe_injective.eq_iff
#align set_like.coe_set_eq SetLike.coe_set_eq
+@[norm_cast] lemma coe_ne_coe : (p : Set B) ≠ q ↔ p ≠ q := coe_injective.ne_iff
+
theorem ext' (h : (p : Set B) = q) : p = q :=
coe_injective h
#align set_like.ext' SetLike.ext'
SetLike
default rule set for aesop
(#7111)
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:
@[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
.
@[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.
@[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.
@@ -5,6 +5,7 @@ Authors: Eric Wieser
-/
import Mathlib.Data.Set.Basic
import Mathlib.Tactic.Monotonicity.Attr
+import Mathlib.Tactic.SetLike
#align_import data.set_like.basic from "leanprover-community/mathlib"@"feb99064803fd3108e37c18b0f77d0a8344677a3"
@@ -174,6 +175,9 @@ theorem coe_mem (x : p) : (x : B) ∈ p :=
x.2
#align set_like.coe_mem SetLike.coe_mem
+@[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
+
-- porting note: removed `@[simp]` because `simpNF` linter complained
protected theorem eta (x : p) (hx : (x : B) ∈ p) : (⟨x, hx⟩ : p) = x := rfl
#align set_like.eta SetLike.eta
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -29,13 +29,13 @@ boilerplate for every `SetLike`: a `coe_sort`, a `coe` to set, a
A typical subobject should be declared as:
```
-structure MySubobject (X : Type _) [ObjectTypeclass X] :=
+structure MySubobject (X : Type*) [ObjectTypeclass X] :=
(carrier : Set X)
(op_mem' : ∀ {x : X}, x ∈ carrier → sorry ∈ carrier)
namespace MySubobject
-variables {X : Type _} [ObjectTypeclass X] {x : X}
+variables {X : Type*} [ObjectTypeclass X] {x : X}
instance : SetLike (MySubobject X) X :=
⟨MySubobject.carrier, λ p q h, by cases p; cases q; congr'⟩
@@ -75,7 +75,7 @@ subobjects
/-- A class to indicate that there is a canonical injection between `A` and `Set B`.
This has the effect of giving terms of `A` elements of type `B` (through a `Membership`
-instance) and a compatible coercion to `Type _` as a subtype.
+instance) and a compatible coercion to `Type*` as a subtype.
Note: if `SetLike.coe` is a projection, implementers should create a simp lemma such as
```
@@ -85,7 +85,7 @@ to normalize terms.
If you declare an unbundled subclass of `SetLike`, for example:
```
-class MulMemClass (S : Type _) (M : Type _) [Mul M] [SetLike S M] where
+class MulMemClass (S : Type*) (M : Type*) [Mul M] [SetLike S M] where
...
```
Then you should *not* repeat the `outParam` declaration so `SetLike` will supply the value instead.
@@ -93,7 +93,7 @@ This ensures your subclass will not have issues with synthesis of the `[Mul M]`
before the value of `M` is known.
-/
@[notation_class * carrier Simps.findCoercionArgs]
-class SetLike (A : Type _) (B : outParam <| Type _) where
+class SetLike (A : Type*) (B : outParam <| Type*) where
/-- The coercion from a term of a `SetLike` to its corresponding `Set`. -/
protected coe : A → Set B
/-- The coercion from a term of a `SetLike` to its corresponding `Set` is injective. -/
@@ -103,7 +103,7 @@ class SetLike (A : Type _) (B : outParam <| Type _) where
attribute [coe] SetLike.coe
namespace SetLike
-variable {A : Type _} {B : Type _} [i : SetLike A B]
+variable {A : Type*} {B : Type*} [i : SetLike A B]
instance : CoeTC A (Set B) where coe := SetLike.coe
Per https://github.com/leanprover/lean4/issues/2343, we are going to need to change the automatic generation of instance names, as they become too long.
This PR ensures that everywhere in Mathlib that refers to an instance by name, that name is given explicitly, rather than being automatically generated.
There are four exceptions, which are now commented, with links to https://github.com/leanprover/lean4/issues/2343.
This was implemented by running Mathlib against a modified Lean that appended _ᾰ
to all automatically generated names, and fixing everything.
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@@ -178,7 +178,7 @@ theorem coe_mem (x : p) : (x : B) ∈ p :=
protected theorem eta (x : p) (hx : (x : B) ∈ p) : (⟨x, hx⟩ : p) = x := rfl
#align set_like.eta SetLike.eta
-instance (priority := 100) : PartialOrder A :=
+instance (priority := 100) instPartialOrder : PartialOrder A :=
{ PartialOrder.lift (SetLike.coe : A → Set B) coe_injective with
le := fun H K => ∀ ⦃x⦄, x ∈ H → x ∈ K }
@@ -2,15 +2,12 @@
Copyright (c) 2021 Eric Wieser. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Eric Wieser
-
-! This file was ported from Lean 3 source module data.set_like.basic
-! leanprover-community/mathlib commit feb99064803fd3108e37c18b0f77d0a8344677a3
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Data.Set.Basic
import Mathlib.Tactic.Monotonicity.Attr
+#align_import data.set_like.basic from "leanprover-community/mathlib"@"feb99064803fd3108e37c18b0f77d0a8344677a3"
+
/-!
# Typeclass for types with a set-like extensionality property
@@ -33,15 +33,15 @@ boilerplate for every `SetLike`: a `coe_sort`, a `coe` to set, a
A typical subobject should be declared as:
```
structure MySubobject (X : Type _) [ObjectTypeclass X] :=
-(carrier : Set X)
-(op_mem' : ∀ {x : X}, x ∈ carrier → sorry ∈ carrier)
+ (carrier : Set X)
+ (op_mem' : ∀ {x : X}, x ∈ carrier → sorry ∈ carrier)
namespace MySubobject
variables {X : Type _} [ObjectTypeclass X] {x : X}
instance : SetLike (MySubobject X) X :=
-⟨MySubobject.carrier, λ p q h, by cases p; cases q; congr'⟩
+ ⟨MySubobject.carrier, λ p q h, by cases p; cases q; congr'⟩
@[simp] lemma mem_carrier {p : MySubobject X} : x ∈ p.carrier ↔ x ∈ (p : Set X) := Iff.rfl
@@ -50,14 +50,14 @@ instance : SetLike (MySubobject X) X :=
/-- Copy of a `MySubobject` with a new `carrier` equal to the old one. Useful to fix definitional
equalities. See Note [range copy pattern]. -/
protected def copy (p : MySubobject X) (s : Set X) (hs : s = ↑p) : MySubobject X :=
-{ carrier := s,
- op_mem' := hs.symm ▸ p.op_mem' }
+ { carrier := s,
+ op_mem' := hs.symm ▸ p.op_mem' }
@[simp] lemma coe_copy (p : MySubobject X) (s : Set X) (hs : s = ↑p) :
(p.copy s hs : Set X) = s := rfl
lemma copy_eq (p : MySubobject X) (s : Set X) (hs : s = ↑p) : p.copy s hs = p :=
-SetLike.coe_injective hs
+ SetLike.coe_injective hs
end MySubobject
```
@@ -65,7 +65,7 @@ end MySubobject
An alternative to `SetLike` could have been an extensional `Membership` typeclass:
```
class ExtMembership (α : out_param $ Type u) (β : Type v) extends Membership α β :=
-(ext_iff : ∀ {s t : β}, s = t ↔ ∀ (x : α), x ∈ s ↔ x ∈ t)
+ (ext_iff : ∀ {s t : β}, s = t ↔ ∀ (x : α), x ∈ s ↔ x ∈ t)
```
While this is equivalent, `SetLike` conveniently uses a carrier set projection directly.
@[simps]
for the definition of an AddGroup
, it will now generate the correct lemmas for 0
, +
, nsmul
and zsmul
using OfNat
and heterogenous operations. This is needed for #2609.
nsmul
, zsmul
and numerals.zpow
and npow
projections, since their argument order is different than that of HPow.pow
(that was likely done for the sake of to_additive
, but we can consider to revisit that choice).nvMonoid
bug encountered in #2609
toDiv
is a prefix of toDivInvMonoid
_toDiv
is a prefix of your projection with _
prepended (e.g. _toDivInvMonoid
), now we are checking whether toDiv_
is a prefix of your projection with _
appended (which doesn't match toDivInvMonoid_
).@@ -95,6 +95,7 @@ Then you should *not* repeat the `outParam` declaration so `SetLike` will supply
This ensures your subclass will not have issues with synthesis of the `[Mul M]` parameter starting
before the value of `M` is known.
-/
+@[notation_class * carrier Simps.findCoercionArgs]
class SetLike (A : Type _) (B : outParam <| Type _) where
/-- The coercion from a term of a `SetLike` to its corresponding `Set`. -/
protected coe : A → Set B
Update some SHAs of files that changed in mathlib3.
These 17 files need mainly only updated SHA as they've been only touched by backports or already have been forward-ported.
The relevant changes are:
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Eric Wieser
! This file was ported from Lean 3 source module data.set_like.basic
-! leanprover-community/mathlib commit fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e
+! leanprover-community/mathlib commit feb99064803fd3108e37c18b0f77d0a8344677a3
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
This is an extremely partial port of the mono*
tactic from Lean 3, implemented as a macro on top of solve_by_elim
. The original mono
had many configuration options and no documentation, so quite a bit is missing (and almost all the Lean 3 tests fail). Nonetheless I think it's worth merging this, because
@[mono]
mono
will succeed fairly often in the port even though it fails nearly all the testsCo-authored-by: thorimur <68410468+thorimur@users.noreply.github.com>
@@ -9,6 +9,7 @@ Authors: Eric Wieser
! if you have ported upstream changes.
-/
import Mathlib.Data.Set.Basic
+import Mathlib.Tactic.Monotonicity.Attr
/-!
# Typeclass for types with a set-like extensionality property
@@ -192,7 +193,7 @@ theorem coe_subset_coe {S T : A} : (S : Set B) ⊆ T ↔ S ≤ T :=
Iff.rfl
#align set_like.coe_subset_coe SetLike.coe_subset_coe
--- porting note: TODO: add back @[mono]
+@[mono]
theorem coe_mono : Monotone (SetLike.coe : A → Set B) := fun _ _ => coe_subset_coe.mpr
#align set_like.coe_mono SetLike.coe_mono
@@ -201,7 +202,7 @@ theorem coe_ssubset_coe {S T : A} : (S : Set B) ⊂ T ↔ S < T :=
Iff.rfl
#align set_like.coe_ssubset_coe SetLike.coe_ssubset_coe
--- porting note: TODO: add back @[mono]
+@[mono]
theorem coe_strictMono : StrictMono (SetLike.coe : A → Set B) := fun _ _ => coe_ssubset_coe.mpr
#align set_like.coe_strict_mono SetLike.coe_strictMono
Type*
to Type _
(#1866)
A bunch of docstrings were still mentioning Type*
. This changes them to Type _
.
@@ -31,13 +31,13 @@ boilerplate for every `SetLike`: a `coe_sort`, a `coe` to set, a
A typical subobject should be declared as:
```
-structure MySubobject (X : Type*) [ObjectTypeclass X] :=
+structure MySubobject (X : Type _) [ObjectTypeclass X] :=
(carrier : Set X)
(op_mem' : ∀ {x : X}, x ∈ carrier → sorry ∈ carrier)
namespace MySubobject
-variables {X : Type*} [ObjectTypeclass X] {x : X}
+variables {X : Type _} [ObjectTypeclass X] {x : X}
instance : SetLike (MySubobject X) X :=
⟨MySubobject.carrier, λ p q h, by cases p; cases q; congr'⟩
@@ -77,7 +77,7 @@ subobjects
/-- A class to indicate that there is a canonical injection between `A` and `Set B`.
This has the effect of giving terms of `A` elements of type `B` (through a `Membership`
-instance) and a compatible coercion to `Type*` as a subtype.
+instance) and a compatible coercion to `Type _` as a subtype.
Note: if `SetLike.coe` is a projection, implementers should create a simp lemma such as
```
outParam
classes should not repeat the parents' outParam
(#1832)
This PR fixes a large amount of issues encountered in the port of GroupTheory.Subgroup.Basic
, #1797. Subobject classes such as MulMemClass
and SubmonoidClass
take a SetLike
parameter, and we were used to just copy over the M : outParam Type
declaration from SetLike
. Since Lean 3 synthesized from left to right, we'd fill in the outParam
from SetLike
, then the Mul M
instance would be available for synthesis and we'd be in business. In Lean 4 however, we often go from right to left, so that MulMemClass ?M S [?inst : Mul ?M]
is handled first, which can't be solved before finding a Mul ?M
instance on the metavariable ?M
, causing search through all Mul
instances.
The solution is: whenever a class is declared that takes another class as parameter (i.e. unbundled inheritance), the outParam
s of the parent class should be unmarked and become in-params in the child class. Then Lean will try to find the parent class instance first, fill in the outParam
s and we'll be able to synthesize the child class instance without problems.
@@ -84,6 +84,15 @@ Note: if `SetLike.coe` is a projection, implementers should create a simp lemma
@[simp] lemma mem_carrier {p : MySubobject X} : x ∈ p.carrier ↔ x ∈ (p : Set X) := Iff.rfl
```
to normalize terms.
+
+If you declare an unbundled subclass of `SetLike`, for example:
+```
+class MulMemClass (S : Type _) (M : Type _) [Mul M] [SetLike S M] where
+ ...
+```
+Then you should *not* repeat the `outParam` declaration so `SetLike` will supply the value instead.
+This ensures your subclass will not have issues with synthesis of the `[Mul M]` parameter starting
+before the value of `M` is known.
-/
class SetLike (A : Type _) (B : outParam <| Type _) where
/-- The coercion from a term of a `SetLike` to its corresponding `Set`. -/
The script used to do this is included. The yaml file was obtained from https://raw.githubusercontent.com/wiki/leanprover-community/mathlib/mathlib4-port-status.md
@@ -2,6 +2,11 @@
Copyright (c) 2021 Eric Wieser. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Eric Wieser
+
+! This file was ported from Lean 3 source module data.set_like.basic
+! leanprover-community/mathlib commit fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e
+! Please do not edit these lines, except to modify the commit id
+! if you have ported upstream changes.
-/
import Mathlib.Data.Set.Basic
All dependencies are ported!