(1) define `rule1` and `rule2` before `f`, and (2) wrap the rhs of the definition with `Evaluate` to suppress the `HoldAll` attribute of `SetDelayed`: f[x_, y_, z_] := Evaluate[(int1 + int2 + int3) /. rule1 /. rule2]; f[1, 2, 3] >14