File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed
Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -161,6 +161,7 @@ partial def mkSizeOfFn (recName : Name) (declName : Name): MetaM Unit := do
161161 safety := DefinitionSafety.safe
162162 hints := ReducibilityHints.abbrev
163163 }
164+ enableRealizationsForConst declName
164165
165166/--
166167 Create `sizeOf` functions for all inductive datatypes in the mutual inductive declaration containing `typeName`
@@ -518,6 +519,7 @@ def mkSizeOfInstances (typeName : Name) : MetaM Unit := do
518519 hints := .abbrev
519520 }
520521 addInstance instDeclName AttributeKind.global (eval_prio default)
522+ enableRealizationsForConst instDeclName
521523 if genSizeOfSpec.get (← getOptions) then
522524 mkSizeOfSpecTheorems indInfo.all.toArray fns recMap
523525
Original file line number Diff line number Diff line change 1+
2+ inductive Tree (α : Type ) where
3+ | leaf : α → Tree α
4+ | node : Array (Tree α) → Tree α
5+
6+ def Tree.map {α β} (f : α → β) : Tree α → Tree β
7+ | .leaf x => .leaf (f x)
8+ | .node ts => .node (ts.map (Tree.map f))
9+
10+ def Tree.map' {α β} [SizeOf α]: (t : Tree α) → (f : (x : α) → sizeOf x < sizeOf t → β) → Tree β
11+ | .leaf x, f => .leaf (f x (by simp))
12+ | .node ts, f => .node (ts.attach.map (fun ⟨t, ht⟩ =>
13+ Tree.map' t (fun x hx => f x (by have := Array.sizeOf_lt_of_mem ht; grind [node.sizeOf_spec]))))
14+
15+ /--
16+ error: Tactic `try?` failed: consider using `grind` manually, or `try? +missing` for partial proofs containing `sorry`
17+
18+ α β : Type
19+ inst✝ : SizeOf α
20+ f : α → β
21+ t : Tree α
22+ ⊢ map f t = t.map' fun x x_1 => f x
23+ -/
24+ #guard_msgs in
25+ theorem Tree.map_eq_map' {α β} [SizeOf α] (f : α → β) (t : Tree α) :
26+ Tree.map f t = Tree.map' t (fun x _ => f x) := by try ?
27+
28+
29+ inductive Tree' where | nil
30+
31+ #guard_msgs in
32+ example : 0 <= (Tree'.nil : Tree')._sizeOf_1 := by simp [Tree'._sizeOf_1]
You can’t perform that action at this time.
0 commit comments