Zulip Chat Archive
Stream: general
Topic: Proving sizeOf structure field is less than sizeOf structure
Mai (Feb 19 2026 at 03:15):
Silly question, but I just don't quite seem to get it.
structure A
structure S where
a : A
example {s : S} : sizeOf s.a < sizeOf s := by
sorry
Violeta Hernández (Feb 19 2026 at 03:31):
structure A
structure S where
a : A
example {s : S} : sizeOf s.a < sizeOf s := by
exact Nat.lt_succ_self _
Violeta Hernández (Feb 19 2026 at 03:32):
I believe sizeOf of a structure is generally defined as the sum of sizes of its fields, plus one
Théophile (Feb 19 2026 at 09:17):
You can also rely on the lemma S.mk.sizeOf_spec, e.g.
structure A
structure S where
a : A
example {s : S} : sizeOf s.a < sizeOf s := by
cases s
simp only [S.mk.sizeOf_spec]
-- goal: sizeOf a✝ < 1 + sizeOf a✝
simp
Last updated: Feb 28 2026 at 14:05 UTC