mirror of
https://github.com/leanprover/lean4.git
synced 2026-03-17 18:34:06 +00:00
Compare commits
4 Commits
array_atta
...
nezero
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0061893d94 | ||
|
|
63c0ea0e2e | ||
|
|
4616617021 | ||
|
|
f59ef1d35c |
@@ -39,3 +39,5 @@ import Init.Data.BEq
|
||||
import Init.Data.Subtype
|
||||
import Init.Data.ULift
|
||||
import Init.Data.PLift
|
||||
import Init.Data.Zero
|
||||
import Init.Data.NeZero
|
||||
|
||||
@@ -141,8 +141,8 @@ instance : ShiftLeft (Fin n) where
|
||||
instance : ShiftRight (Fin n) where
|
||||
shiftRight := Fin.shiftRight
|
||||
|
||||
instance instOfNat : OfNat (Fin (no_index (n+1))) i where
|
||||
ofNat := Fin.ofNat i
|
||||
instance instOfNat {n : Nat} [NeZero n] {i : Nat} : OfNat (Fin (no_index n)) i where
|
||||
ofNat := Fin.ofNat' i (pos_of_neZero _)
|
||||
|
||||
instance : Inhabited (Fin (no_index (n+1))) where
|
||||
default := 0
|
||||
|
||||
@@ -5,6 +5,8 @@ Authors: Floris van Doorn, Leonardo de Moura
|
||||
-/
|
||||
prelude
|
||||
import Init.SimpLemmas
|
||||
import Init.Data.NeZero
|
||||
|
||||
set_option linter.missingDocs true -- keep it documented
|
||||
universe u
|
||||
|
||||
@@ -356,6 +358,8 @@ theorem eq_zero_or_pos : ∀ (n : Nat), n = 0 ∨ n > 0
|
||||
|
||||
protected theorem pos_of_ne_zero {n : Nat} : n ≠ 0 → 0 < n := (eq_zero_or_pos n).resolve_left
|
||||
|
||||
theorem pos_of_neZero (n : Nat) [NeZero n] : 0 < n := Nat.pos_of_ne_zero (NeZero.ne _)
|
||||
|
||||
theorem lt.base (n : Nat) : n < succ n := Nat.le_refl (succ n)
|
||||
|
||||
theorem lt_succ_self (n : Nat) : n < succ n := lt.base n
|
||||
@@ -714,6 +718,8 @@ protected theorem zero_ne_one : 0 ≠ (1 : Nat) :=
|
||||
|
||||
theorem succ_ne_zero (n : Nat) : succ n ≠ 0 := by simp
|
||||
|
||||
instance {n : Nat} : NeZero (succ n) := ⟨succ_ne_zero n⟩
|
||||
|
||||
/-! # mul + order -/
|
||||
|
||||
theorem mul_le_mul_left {n m : Nat} (k : Nat) (h : n ≤ m) : k * n ≤ k * m :=
|
||||
@@ -784,6 +790,9 @@ theorem pos_pow_of_pos {n : Nat} (m : Nat) (h : 0 < n) : 0 < n^m :=
|
||||
| zero => cases h
|
||||
| succ n => simp [Nat.pow_succ]
|
||||
|
||||
instance {n m : Nat} [NeZero n] : NeZero (n^m) :=
|
||||
⟨Nat.ne_zero_iff_zero_lt.mpr (Nat.pos_pow_of_pos m (pos_of_neZero _))⟩
|
||||
|
||||
/-! # min/max -/
|
||||
|
||||
/--
|
||||
|
||||
38
src/Init/Data/NeZero.lean
Normal file
38
src/Init/Data/NeZero.lean
Normal file
@@ -0,0 +1,38 @@
|
||||
/-
|
||||
Copyright (c) 2021 Eric Rodriguez. All rights reserved.
|
||||
Released under Apache 2.0 license as described in the file LICENSE.
|
||||
Authors: Eric Rodriguez
|
||||
-/
|
||||
prelude
|
||||
import Init.Data.Zero
|
||||
|
||||
|
||||
/-!
|
||||
# `NeZero` typeclass
|
||||
|
||||
We create a typeclass `NeZero n` which carries around the fact that `(n : R) ≠ 0`.
|
||||
|
||||
## Main declarations
|
||||
|
||||
* `NeZero`: `n ≠ 0` as a typeclass.
|
||||
-/
|
||||
|
||||
|
||||
variable {R : Type _} [Zero R]
|
||||
|
||||
/-- A type-class version of `n ≠ 0`. -/
|
||||
class NeZero (n : R) : Prop where
|
||||
/-- The proposition that `n` is not zero. -/
|
||||
out : n ≠ 0
|
||||
|
||||
theorem NeZero.ne (n : R) [h : NeZero n] : n ≠ 0 :=
|
||||
h.out
|
||||
|
||||
theorem NeZero.ne' (n : R) [h : NeZero n] : 0 ≠ n :=
|
||||
h.out.symm
|
||||
|
||||
theorem neZero_iff {n : R} : NeZero n ↔ n ≠ 0 :=
|
||||
⟨fun h ↦ h.out, NeZero.mk⟩
|
||||
|
||||
@[simp] theorem neZero_zero_iff_false {α : Type _} [Zero α] : NeZero (0 : α) ↔ False :=
|
||||
⟨fun h ↦ h.ne rfl, fun h ↦ h.elim⟩
|
||||
17
src/Init/Data/Zero.lean
Normal file
17
src/Init/Data/Zero.lean
Normal file
@@ -0,0 +1,17 @@
|
||||
/-
|
||||
Copyright (c) 2021 Gabriel Ebner. All rights reserved.
|
||||
Released under Apache 2.0 license as described in the file LICENSE.
|
||||
Authors: Gabriel Ebner, Mario Carneiro
|
||||
-/
|
||||
prelude
|
||||
import Init.Core
|
||||
|
||||
/-!
|
||||
Instances converting between `Zero α` and `OfNat α (nat_lit 0)`.
|
||||
-/
|
||||
|
||||
instance (priority := 300) Zero.toOfNat0 {α} [Zero α] : OfNat α (nat_lit 0) where
|
||||
ofNat := ‹Zero α›.1
|
||||
|
||||
instance (priority := 200) Zero.ofOfNat0 {α} [OfNat α (nat_lit 0)] : Zero α where
|
||||
zero := 0
|
||||
@@ -1304,6 +1304,11 @@ class HShiftRight (α : Type u) (β : Type v) (γ : outParam (Type w)) where
|
||||
this is equivalent to `a / 2 ^ b`. -/
|
||||
hShiftRight : α → β → γ
|
||||
|
||||
/-- A type with a zero element. -/
|
||||
class Zero (α : Type u) where
|
||||
/-- The zero element of the type. -/
|
||||
zero : α
|
||||
|
||||
/-- The homogeneous version of `HAdd`: `a + b : α` where `a b : α`. -/
|
||||
class Add (α : Type u) where
|
||||
/-- `a + b` computes the sum of `a` and `b`. See `HAdd`. -/
|
||||
|
||||
@@ -48,7 +48,8 @@ instance : ToExpr (Fin n) where
|
||||
toExpr a :=
|
||||
let r := mkRawNatLit a.val
|
||||
mkApp3 (.const ``OfNat.ofNat [0]) (.app (mkConst ``Fin) (toExpr n)) r
|
||||
(mkApp2 (.const ``Fin.instOfNat []) (mkNatLit (n-1)) r)
|
||||
(mkApp3 (.const ``Fin.instOfNat []) (toExpr n)
|
||||
(.app (.const ``Nat.instNeZeroSucc []) (mkNatLit (n-1))) r)
|
||||
|
||||
instance : ToExpr (BitVec n) where
|
||||
toTypeExpr := .app (mkConst ``BitVec) (toExpr n)
|
||||
|
||||
BIN
stage0/stdlib/Init/Data.c
generated
BIN
stage0/stdlib/Init/Data.c
generated
Binary file not shown.
BIN
stage0/stdlib/Init/Data/Fin/Basic.c
generated
BIN
stage0/stdlib/Init/Data/Fin/Basic.c
generated
Binary file not shown.
BIN
stage0/stdlib/Init/Data/List/Nat/TakeDrop.c
generated
BIN
stage0/stdlib/Init/Data/List/Nat/TakeDrop.c
generated
Binary file not shown.
BIN
stage0/stdlib/Init/Data/Nat/Basic.c
generated
BIN
stage0/stdlib/Init/Data/Nat/Basic.c
generated
Binary file not shown.
BIN
stage0/stdlib/Init/Data/NeZero.c
generated
Normal file
BIN
stage0/stdlib/Init/Data/NeZero.c
generated
Normal file
Binary file not shown.
BIN
stage0/stdlib/Init/Data/Zero.c
generated
Normal file
BIN
stage0/stdlib/Init/Data/Zero.c
generated
Normal file
Binary file not shown.
BIN
stage0/stdlib/Lean/Meta/LitValues.c
generated
BIN
stage0/stdlib/Lean/Meta/LitValues.c
generated
Binary file not shown.
BIN
stage0/stdlib/Lean/Meta/Match/Match.c
generated
BIN
stage0/stdlib/Lean/Meta/Match/Match.c
generated
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
stage0/stdlib/Lean/ToExpr.c
generated
BIN
stage0/stdlib/Lean/ToExpr.c
generated
Binary file not shown.
Binary file not shown.
@@ -1,12 +1,3 @@
|
||||
class Zero.{u} (α : Type u) where
|
||||
zero : α
|
||||
|
||||
instance Zero.toOfNat0 {α} [Zero α] : OfNat α (nat_lit 0) where
|
||||
ofNat := ‹Zero α›.1
|
||||
|
||||
instance Zero.ofOfNat0 {α} [OfNat α (nat_lit 0)] : Zero α where
|
||||
zero := 0
|
||||
|
||||
class One (α : Type u) where
|
||||
one : α
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
1870.lean:21:2-21:35: error: type mismatch
|
||||
1870.lean:12:2-12:35: error: type mismatch
|
||||
congrArg (@OfNat.ofNat Nat 0) (congrArg (@Zero.toOfNat0 Nat) ?_)
|
||||
has type
|
||||
OfNat.ofNat 0 = OfNat.ofNat 0 : Prop
|
||||
but is expected to have type
|
||||
OfNat.ofNat 0 = OfNat.ofNat 1 : Prop
|
||||
1870.lean:25:2-25:16: error: tactic 'apply' failed, failed to unify
|
||||
1870.lean:16:2-16:16: error: tactic 'apply' failed, failed to unify
|
||||
?f ?a₁ = ?f ?a₂
|
||||
with
|
||||
OfNat.ofNat 0 = OfNat.ofNat 1
|
||||
⊢ OfNat.ofNat 0 = OfNat.ofNat 1
|
||||
1870.lean:30:2-30:16: error: tactic 'apply' failed, failed to unify
|
||||
1870.lean:21:2-21:16: error: tactic 'apply' failed, failed to unify
|
||||
?f ?a₁ = ?f ?a₂
|
||||
with
|
||||
OfNat.ofNat 0 = OfNat.ofNat 1
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
class Zero (α : Type u) where
|
||||
zero : α
|
||||
class AddZeroClass (M : Type u) extends Zero M, Add M
|
||||
class AddMonoid (M : Type u) extends AddZeroClass M where
|
||||
nsmul : Nat → M → M := fun _ _ => Zero.zero
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
class Zero (A : Type u) where zero : A
|
||||
instance {A} [Zero A] : OfNat A (nat_lit 0) := ⟨Zero.zero⟩
|
||||
|
||||
class AddMonoid (A : Type u) extends Add A, Zero A
|
||||
class Semiring (R : Type u) extends AddMonoid R
|
||||
class SubNegMonoid (A : Type u) extends AddMonoid A, Neg A
|
||||
|
||||
@@ -39,12 +39,6 @@ class AddSemigroup (α : Type u) extends Add α where
|
||||
class AddCommSemigroup (α : Type u) extends AddSemigroup α where
|
||||
add_comm (a b : α) : a + b = b + a
|
||||
|
||||
class Zero (α : Type u) where
|
||||
zero : α
|
||||
|
||||
instance [Zero α] : OfNat α (nat_lit 0) where
|
||||
ofNat := Zero.zero
|
||||
|
||||
class AddMonoid (α : Type u) extends AddSemigroup α, Zero α where
|
||||
zero_add (a : α) : 0 + a = a
|
||||
add_zero (a : α) : a + 0 = a
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
class One (M : Type u) where one : M
|
||||
instance {M} [One M] : OfNat M (nat_lit 1) := ⟨One.one⟩
|
||||
|
||||
class Zero (A : Type u) where zero : A
|
||||
instance {A} [Zero A] : OfNat A (nat_lit 0) := ⟨Zero.zero⟩
|
||||
|
||||
class Monoid (M : Type u) extends Mul M, One M where
|
||||
mul_one (m : M) : m * 1 = m
|
||||
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
class Zero (A : Type u) where zero : A
|
||||
instance {A} [Zero A] : OfNat A (nat_lit 0) := ⟨Zero.zero⟩
|
||||
|
||||
class AddGroup (A : Type u) extends Zero A where
|
||||
gsmul : Int → A → A
|
||||
gsmul_zero' : ∀ a, gsmul 0 a = 0
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
class Zero (α : Type u) where
|
||||
zero : α
|
||||
|
||||
export Zero (zero)
|
||||
|
||||
instance [Zero α] : OfNat α (nat_lit 0) where
|
||||
ofNat := zero
|
||||
|
||||
class AddGroup (α : Type u) extends Add α, Zero α, Neg α where
|
||||
addAssoc : {a b c : α} → a + b + c = a + (b + c)
|
||||
zeroAdd : {a : α} → 0 + a = a
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
isDefEqOffsetBug.lean:27:2-27:5: error: type mismatch
|
||||
isDefEqOffsetBug.lean:19:2-19:5: error: type mismatch
|
||||
rfl
|
||||
has type
|
||||
0 + 0 = 0 + 0 : Prop
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
class NeZero (n : Nat) : Prop
|
||||
theorem mul_div (m n : Nat) [NeZero n] : (m * n) / n = m := sorry
|
||||
example [NeZero n] : (m * n) / n = m := by simp [mul_div m _]
|
||||
class NeZero' (n : Nat) : Prop
|
||||
theorem mul_div (m n : Nat) [NeZero' n] : (m * n) / n = m := sorry
|
||||
example [NeZero' n] : (m * n) / n = m := by simp [mul_div m _]
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
section algebra_hierarchy_classes_to_comm_ring
|
||||
|
||||
class Zero (α : Type) where
|
||||
zero : α
|
||||
|
||||
class One (α : Type) where
|
||||
one : α
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
abbrev Zero α := OfNat α (nat_lit 0)
|
||||
|
||||
class Monoid (α : Type u) [Zero α] extends Add α where
|
||||
zero_add (a : α) : 0 + a = a
|
||||
add_zero (a : α) : a + 0 = a
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
class Zero (α : Type) where
|
||||
zero : α
|
||||
|
||||
class AddCommGroup (α : Type) extends Zero α where
|
||||
|
||||
class Ring (α : Type) extends Zero α, AddCommGroup α
|
||||
|
||||
@@ -93,12 +93,6 @@ section Mathlib.Init.ZeroOne
|
||||
|
||||
set_option autoImplicit true
|
||||
|
||||
class Zero.{u} (α : Type u) where
|
||||
zero : α
|
||||
|
||||
instance (priority := 300) Zero.toOfNat0 {α} [Zero α] : OfNat α (nat_lit 0) where
|
||||
ofNat := ‹Zero α›.1
|
||||
|
||||
class One (α : Type u) where
|
||||
one : α
|
||||
|
||||
|
||||
@@ -3,3 +3,4 @@ example : (0 : Nat) = Nat.zero := by
|
||||
|
||||
example : (0 : Fin 9) = (Fin.ofNat 0) := by
|
||||
simp only [OfNat.ofNat]
|
||||
rfl
|
||||
|
||||
@@ -21,13 +21,8 @@ export One (one)
|
||||
instance [One α] : OfNat α (nat_lit 1) where
|
||||
ofNat := one
|
||||
|
||||
class Zero (α : Type u) where
|
||||
zero : α
|
||||
export Zero (zero)
|
||||
|
||||
instance [Zero α] : OfNat α (nat_lit 0) where
|
||||
ofNat := zero
|
||||
|
||||
class MulComm (α : Type u) [Mul α] : Prop where
|
||||
mulComm : {a b : α} → a * b = b * a
|
||||
export MulComm (mulComm)
|
||||
|
||||
@@ -21,8 +21,6 @@ export One (one)
|
||||
instance [One α] : OfNat α (nat_lit 1) where
|
||||
ofNat := one
|
||||
|
||||
class Zero (α : Type u) where
|
||||
zero : α
|
||||
export Zero (zero)
|
||||
|
||||
instance [Zero α] : OfNat α (nat_lit 0) where
|
||||
|
||||
@@ -26,12 +26,6 @@ section Mathlib.Init.ZeroOne
|
||||
|
||||
set_option autoImplicit true
|
||||
|
||||
class Zero.{u} (α : Type u) where
|
||||
zero : α
|
||||
|
||||
instance (priority := 300) Zero.toOfNat0 {α} [Zero α] : OfNat α (nat_lit 0) where
|
||||
ofNat := ‹Zero α›.1
|
||||
|
||||
class One (α : Type u) where
|
||||
one : α
|
||||
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
variable {R M : Type}
|
||||
|
||||
class Zero (α : Type) where
|
||||
zero : α
|
||||
|
||||
instance (priority := 300) Zero.toOfNat0 {α} [Zero α] : OfNat α (nat_lit 0) where
|
||||
ofNat := ‹Zero α›.1
|
||||
|
||||
/-- Typeclass for the `⊥` (`\bot`) notation -/
|
||||
class Bot (α : Type) where
|
||||
/-- The bot (`⊥`, `\bot`) element -/
|
||||
|
||||
5
tests/lean/run/fin_two_pow.lean
Normal file
5
tests/lean/run/fin_two_pow.lean
Normal file
@@ -0,0 +1,5 @@
|
||||
-- Check that we can write numerals in `Fin (2^n)`
|
||||
-- even though `2^n` is not a definitionally a successor,
|
||||
-- via the `NeZero (2^n)` instance.
|
||||
|
||||
example {n : Nat} : Fin (2^n) := 0
|
||||
@@ -2,12 +2,6 @@ universe u v w v₁ v₂ v₃ u₁ u₂ u₃
|
||||
|
||||
section Mathlib.Algebra.Group.ZeroOne
|
||||
|
||||
class Zero (α : Type u) where
|
||||
zero : α
|
||||
|
||||
instance (priority := 300) Zero.toOfNat0 {α} [Zero α] : OfNat α (nat_lit 0) where
|
||||
ofNat := ‹Zero α›.1
|
||||
|
||||
class One (α : Type u) where
|
||||
one : α
|
||||
|
||||
|
||||
@@ -44,10 +44,6 @@ end Std.Classes.RatCast
|
||||
|
||||
section Mathlib.Init.ZeroOne
|
||||
|
||||
class Zero.{u} (α : Type u) where
|
||||
zero : α
|
||||
instance Zero.toOfNat0 {α} [Zero α] : OfNat α (nat_lit 0) where
|
||||
ofNat := ‹Zero α›.1
|
||||
class One (α : Type u) where
|
||||
one : α
|
||||
instance One.toOfNat1 {α} [One α] : OfNat α (nat_lit 1) where
|
||||
|
||||
@@ -10,15 +10,6 @@ instance [OfNat α (nat_lit 1)] : One α where
|
||||
instance [One α] : OfNat α (nat_lit 1) where
|
||||
ofNat := One.one
|
||||
|
||||
class Zero (α : Type u) where
|
||||
zero : α
|
||||
|
||||
instance [OfNat α (nat_lit 0)] : Zero α where
|
||||
zero := 0
|
||||
|
||||
instance [Zero α] : OfNat α (nat_lit 0) where
|
||||
ofNat := Zero.zero
|
||||
|
||||
/- Simple Matrix -/
|
||||
|
||||
def Matrix (m n : Nat) (α : Type u) : Type u :=
|
||||
|
||||
@@ -6,15 +6,9 @@ export OfNatSound (ofNat_add)
|
||||
theorem ex1 {α : Type u} [Add α] [(n : Nat) → OfNat α n] [OfNatSound α] : (10000000 : α) + 10000000 = 20000000 :=
|
||||
ofNat_add ..
|
||||
|
||||
class Zero (α : Type u) where
|
||||
zero : α
|
||||
|
||||
class One (α : Type u) where
|
||||
one : α
|
||||
|
||||
instance [Zero α] : OfNat α (nat_lit 0) where
|
||||
ofNat := Zero.zero
|
||||
|
||||
instance [One α] : OfNat α (nat_lit 1) where
|
||||
ofNat := One.one
|
||||
|
||||
|
||||
@@ -12,4 +12,4 @@ local macro "ofNat_class" Class:ident n:num : command =>
|
||||
instance {α} [OfNat α (nat_lit $n)] : $Class α where
|
||||
$field:ident := $n)
|
||||
|
||||
ofNat_class Zero 0
|
||||
ofNat_class Zero' 0
|
||||
|
||||
@@ -23,30 +23,32 @@ scoped unif_hint (s : Magma) where
|
||||
|
||||
end Algebra
|
||||
|
||||
set_option pp.mvars false
|
||||
|
||||
def x : Nat := 10
|
||||
|
||||
/--
|
||||
error: application type mismatch
|
||||
mul ?m.742 x
|
||||
mul ?_ x
|
||||
argument
|
||||
x
|
||||
has type
|
||||
Nat : Type
|
||||
but is expected to have type
|
||||
?m.730.α : Type ?u.729
|
||||
?_.α : Type _
|
||||
-/
|
||||
#guard_msgs in
|
||||
#check mul x x -- Error: unification hint is not active
|
||||
|
||||
/--
|
||||
error: application type mismatch
|
||||
mul ?m.833 (x, x)
|
||||
mul ?_ (x, x)
|
||||
argument
|
||||
(x, x)
|
||||
has type
|
||||
Nat × Nat : Type
|
||||
but is expected to have type
|
||||
?m.817.α : Type ?u.816
|
||||
?_.α : Type _
|
||||
-/
|
||||
#guard_msgs in
|
||||
#check mul (x, x) (x, x) -- Error: no unification hint
|
||||
@@ -55,13 +57,13 @@ local infix:65 (priority := high) "*" => mul
|
||||
|
||||
/--
|
||||
error: application type mismatch
|
||||
?m.2484*x
|
||||
?_*x
|
||||
argument
|
||||
x
|
||||
has type
|
||||
Nat : Type
|
||||
but is expected to have type
|
||||
?m.2472.α : Type ?u.2471
|
||||
?_.α : Type _
|
||||
-/
|
||||
#guard_msgs in
|
||||
#check x*x -- Error: unification hint is not active
|
||||
@@ -73,13 +75,13 @@ open Algebra -- activate unification hints
|
||||
|
||||
/--
|
||||
error: application type mismatch
|
||||
?m.2585*(x, x)
|
||||
?_*(x, x)
|
||||
argument
|
||||
(x, x)
|
||||
has type
|
||||
Nat × Nat : Type
|
||||
but is expected to have type
|
||||
?m.2565.α : Type ?u.2564
|
||||
?_.α : Type _
|
||||
-/
|
||||
#guard_msgs in
|
||||
#check mul (x, x) (x, x) -- still error
|
||||
@@ -101,13 +103,13 @@ end Sec1
|
||||
|
||||
/--
|
||||
error: application type mismatch
|
||||
?m.2832*(x, x)
|
||||
?_*(x, x)
|
||||
argument
|
||||
(x, x)
|
||||
has type
|
||||
Nat × Nat : Type
|
||||
but is expected to have type
|
||||
?m.2812.α : Type ?u.2811
|
||||
?_.α : Type _
|
||||
-/
|
||||
#guard_msgs in
|
||||
#check (x, x) * (x, x) -- error, local hint is not active after end of section anymore
|
||||
|
||||
@@ -87,12 +87,6 @@ end Mathlib.Data.Quot
|
||||
|
||||
section Mathlib.Init.ZeroOne
|
||||
|
||||
class Zero.{u} (α : Type u) where
|
||||
zero : α
|
||||
|
||||
instance Zero.toOfNat0 {α} [Zero α] : OfNat α (nat_lit 0) where
|
||||
ofNat := ‹Zero α›.1
|
||||
|
||||
class One (α : Type u) where
|
||||
one : α
|
||||
|
||||
|
||||
@@ -4,18 +4,6 @@ https://github.com/leanprover/lean4/pull/2793.
|
||||
We find that we need to either specify a named argument or use `..` in certain rewrites.
|
||||
-/
|
||||
|
||||
section Mathlib.Init.ZeroOne
|
||||
|
||||
set_option autoImplicit true
|
||||
|
||||
class Zero.{u} (α : Type u) where
|
||||
zero : α
|
||||
|
||||
instance (priority := 300) Zero.toOfNat0 {α} [Zero α] : OfNat α (nat_lit 0) where
|
||||
ofNat := ‹Zero α›.1
|
||||
|
||||
end Mathlib.Init.ZeroOne
|
||||
|
||||
section Mathlib.Algebra.Group.Defs
|
||||
|
||||
universe u v w
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
universe u
|
||||
|
||||
class Zero (α : Type u) where
|
||||
zero : α
|
||||
|
||||
instance (priority := 300) Zero.toOfNat0 {α} [Zero α] : OfNat α (nat_lit 0) where
|
||||
ofNat := ‹Zero α›.1
|
||||
|
||||
class One (α : Type u) where
|
||||
one : α
|
||||
|
||||
|
||||
Reference in New Issue
Block a user