Both CustomUnit and AlsoUnit are unit-like types, with a single constructor that takes no parameters.
Every pair of terms with either type is definitionally equal.
inductive CustomUnit where
| customUnit
example (e1 e2 : CustomUnit) : e1 = e2 := rfl
structure AlsoUnit where
example (e1 e2 : AlsoUnit) : e1 = e2 := rfl
Inductive types with parameters, such as WithParam, are also unit-like if all their fields' types are unit-like or proofs.
This check is performed after the parameters are instantiated.
structure WithParam (α : Type) where
a : α
a_eq_a : a = a
example (x y : WithParam Unit) : x = y := rfl
Note that in this example, WithParam α is only unit-like if α is unit-like. The following fails.
example (e1 e2 : WithParam Nat) : e1 = e2 := Type mismatch
rfl
has type
?m.3 = ?m.3
but is expected to have type
e1 = e2rfl
Type mismatch
rfl
has type
?m.3 = ?m.3
but is expected to have type
e1 = e2