Compare commits

...

4 Commits

Author SHA1 Message Date
Kim Morrison
d8acb660cf fix test 2025-04-14 04:37:51 +02:00
Leonardo de Moura
c0f2d74932 chore: remove TODOs 2025-04-13 16:59:24 -07:00
Leonardo de Moura
b077d7d3c0 chore: add [grind ext] funext 2025-04-13 16:56:18 -07:00
Leonardo de Moura
c6acc39965 chore: fix error message 2025-04-13 16:55:31 -07:00
9 changed files with 21 additions and 10 deletions

View File

@@ -13,3 +13,4 @@ import Init.Grind.Util
import Init.Grind.Offset
import Init.Grind.PP
import Init.Grind.CommRing
import Init.Grind.Ext

10
src/Init/Grind/Ext.lean Normal file
View File

@@ -0,0 +1,10 @@
/-
Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura
-/
prelude
import Init.Ext
import Init.Grind.Tactics
attribute [grind ext] funext

View File

@@ -20,7 +20,7 @@ builtin_initialize extTheoremsExt : SimpleScopedEnvExtension Name ExtTheorems
def validateExtAttr (declName : Name) : CoreM Unit := do
unless ( Ext.isExtTheorem declName) do
throwError "invalid `[grind ext]`, `{declName}` is tagged with `[ext]`"
throwError "invalid `[grind ext]`, `{declName}` is not tagged with `[ext]`"
def addExtAttr (declName : Name) (attrKind : AttributeKind) : CoreM Unit := do
validateExtAttr declName

View File

@@ -62,8 +62,6 @@ where
: toListTR.go t acc = t.toList ++ acc := by
induction t generalizing acc <;> grind [toListTR.go, toList]
attribute [grind ext] funext -- TODO: remove after update-stage0
@[csimp] theorem Tree.toList_eq_toListTR_csimp
: @Tree.toList = @Tree.toListTR := by
grind [toList_eq_toListTR]

View File

@@ -68,7 +68,6 @@ structure NatTrans [Category.{v₁, u₁} C] [Category.{v₂, u₂} D] (F G : Fu
naturality : X Y : C (f : X Y), F.map f app Y = app X G.map f := by grind
attribute [grind ext] NatTrans.ext -- TODO: remove after builtin extensionality for structures
attribute [grind ext] funext -- TODO: remove after update-stage0
attribute [simp, grind =] NatTrans.naturality

View File

@@ -68,7 +68,6 @@ structure NatTrans [Category.{v₁, u₁} C] [Category.{v₂, u₂} D] (F G : Fu
/-- The naturality square for a given morphism. -/
naturality : X Y : C (f : X Y), F.map f app Y = app X G.map f := by grind
attribute [grind ext] funext -- TODO: remove
attribute [grind ext] NatTrans.ext
attribute [simp, grind =] NatTrans.naturality

View File

@@ -1,6 +1,4 @@
set_option grind.warning false
attribute [grind ext] funext -- TODO: remove
example (f : (Nat Nat) Nat Nat Nat) : a = b f (fun x => a + x) 1 b = f (fun x => b + x) 1 a := by
grind

View File

@@ -159,7 +159,6 @@ we are allowed to increase the size of the branches by one, and still be smaller
| var _ => 1
| .ite i t e => 2 * normSize i + max (normSize t) (normSize e) + 1
attribute [grind ext] funext -- TODO remove
set_option profiler true
/--
Normalizes the expression at the same time as

View File

@@ -19,15 +19,22 @@ theorem getElem!_of_getElem?' [Inhabited α] :
{l : List α} {i : Nat}, l[i]? = some b l[i]! = b := by
grind
attribute [grind ext] List.ext_getElem?
attribute [local grind =] Option.map_some Option.map_none in
attribute [local grind =] getElem?_map in
attribute [local grind =] getElem?_replicate in
theorem map_replicate' : (replicate n a).map f = replicate n (f a) := by
grind +extAll
attribute [grind ext] List.ext_getElem?
attribute [local grind =] Option.map_some Option.map_none in
attribute [local grind =] getElem?_map in
attribute [local grind =] getElem?_replicate in
theorem map_replicate'' : (replicate n a).map f = replicate n (f a) := by
grind?
#print map_replicate'
#print map_replicate''
attribute [local grind =] getLast?_eq_some_iff in
attribute [local grind] mem_concat_self in