@@ -25,6 +25,9 @@ and in many cases this will suffice to do the proof that a recursive function
2525is only called on smaller values.
2626If the default proof strategy fails, it is recommended to supply a custom
2727size measure using the `termination_by` argument on the function definition.
28+
29+ The derived `SizeOf` instances are intended only for termination checking and
30+ are not compiled. It is not recommended to use `sizeOf` for programming purposes.
2831-/
2932class SizeOf (α : Sort u) where
3033 /-- The "size" of an element, a natural number which decreases on fields of
@@ -49,17 +52,17 @@ for every element of `α`.
4952Every type `α` has a low priority default `SizeOf` instance that just returns `0`
5053for every element of `α`.
5154-/
52- instance (priority := low) instSizeOfDefault (α : Sort u) : SizeOf α where
55+ noncomputable instance (priority := low) instSizeOfDefault (α : Sort u) : SizeOf α where
5356 sizeOf := default.sizeOf α
5457
5558@[simp] theorem sizeOf_default (n : α) : sizeOf n = 0 := rfl
5659
57- instance : SizeOf Nat where
60+ noncomputable instance : SizeOf Nat where
5861 sizeOf n := n
5962
6063@[simp] theorem sizeOf_nat (n : Nat) : sizeOf n = n := rfl
6164
62- instance [SizeOf α] : SizeOf (Unit → α) where
65+ noncomputable instance [SizeOf α] : SizeOf (Unit → α) where
6366 sizeOf f := sizeOf (f ())
6467
6568@[simp] theorem sizeOf_thunk [SizeOf α] (f : Unit → α) : sizeOf f = sizeOf (f ()) :=
0 commit comments