Substitution, composition of BDDs, variable renaming, cofactors, and evaluation are all the same mathematical operation: substitution. You can do the substitution you are interested in using the Python package dd
as follows:
import dd.autoref as _bdd
f1_formula = 'ite(d, FALSE, ite(c, ite(a, FALSE, TRUE), FALSE))'
f2_formula = (
'ite(d, ite(b, TRUE, ite(a, FALSE, TRUE)), '
'ite(c, ite(b, TRUE, ite(a, FALSE, TRUE)), TRUE))')
# create a BDD manager and BDDs for the above formulas
bdd = _bdd.BDD()
bdd.declare('a', 'b', 'c', 'd')
f1 = bdd.add_expr(f1_formula)
f2 = bdd.add_expr(f2_formula)
# substitute `f1` for `d` in `f2`
sub = dict(d=f1)
r = bdd.let(sub, f2)
# dump the BDDs to a PNG file
bdd.dump('foo.png', [f1, f2, r])
print(f'f1: {f1}, f2: {f2}, r: {r}')
The above creates the output:
f1: @-7, f2: @14, r: @11
and the file foo.png
shown below. For assignments of Boolean values to the variables:
f1_formula
corresponds to the negated BDD at node 7
f2_formula
corresponds to the BDD at node 14
r
(the composition) corresponds to the BDD at node 11.

The "let" method is named after the LET... IN
construct in TLA+.