That algorithm isn’t easily programmed, though, and will fail in the many cases where the integral cannot be expressed in elementary functions.
Worse, according to that page, it needs the ability to check whether expressions are zero (https://en.wikipedia.org/wiki/Constant_problem), and that, in general, is undecidable if I understand that page correctly.
https://mathworld.wolfram.com/RischAlgorithm.html seems a tiny bit more optimistic about the limitations of this approach, but https://link.springer.com/chapter/10.1007/978-3-319-00894-3_... seems, to me, in line with what Wikipedia says.
Automatic differentiation works because we have the chain rule (f . g)'(x) = f'(g(x)) g'(x), telling us how to differentiate functions which are composed from simpler building blocks. But there is no analogous rule for integration.
D f = f' <=> S f' = f # inverse
# chain rule
D (f . g) x = D f (g x) * D g x
# divide by D g x
D (f . g) x / D g x = (D f) (g x)
# S vs D inverse
D (S f' . g) x / D g x = (f' . g) x
# commute = and integrate both sides
S (f' . g) x = S \x( D (S f' . g) x / D g x ) x
# rename and drop argument
S (f . g) = S \x( D (S f . g) x / D g x )
The problem is that the RHS is, in the general case, not any less complex (and often much more) than the LHS.Edit: Note that (S f . g) is integrating only f, then composing with g, which is what you want; it's the S \x(...) that causes problems.
Integration is a whole different ball game. It's essentially a puzzle: what function, when differentiated, produces this result? There are various heuristics you can apply, e.g. integration by parts. And there are some databases of common integrals. But in the end, there's no algorithm, integration requires ingenuity to solve.