Lean4
/-- `FS a` is the set of finite sums in `a`, i.e. `m ∈ FS a` if `m` is the sum of a nonempty
subsequence of `a`. We give a direct inductive definition instead of talking about subsequences. -/
inductive FS {M} [AddSemigroup M] : Stream' M → Set M
| head' (a : Stream' M) : FS a a.head
| tail' (a : Stream' M) (m : M) (h : FS a.tail m) : FS a m
| cons' (a : Stream' M) (m : M) (h : FS a.tail m) : FS a (a.head + m)