Zulip Chat Archive

Stream: lean4

Topic: What is the difference between `abbrev` and `@[inline] def`?


Victor Porton (Feb 13 2026 at 10:59):

What is the difference between abbrev and @[inline] def?

Robin Arnez (Feb 13 2026 at 11:04):

Well, abbrev is @[inline, reducible] def (+ some change to defeq), so it doesn't only affect compilation but also e.g. instance search or tactics like simp which will be able to look through the abbrev. Example:

def MyNat := Nat
#check (0 : MyNat) -- fails

@[inline] def MyNat2 := Nat
#check (0 : MyNat2) -- fails

abbrev MyNat3 := Nat
#check (0 : MyNat3) -- succeeds

Jovan Gerbscheid (Feb 14 2026 at 08:10):

Since the module system there is also another difference. abbrev now also adds the @[expose] tag.


Last updated: Feb 28 2026 at 14:05 UTC