My question involves extending the functionality of
Integrateover specific integrals in the most generic manner.
Specifically, is it possible to "hack into" Integrate so as a to add to the "grammar" of analytic integration a new family of integrals which the user would have provided (in the spirit of ProbabilityDistribution which allows the user to include his own PDF into the existing tools).
The idea is that Mathematica would be able to identify when such integrals pop up and replace it by the given definition. The specific example I have in mind involves the integral of MultinormalDistribution over square subregions of the integration domain. That is to say I would like to attach to either MultiNormalDistribution, or Expectation, (or Integrate) the following rule
Expectation[Boole[(x>a)&&(y>b)], {x,y} ~Distributed~ MultinormalDistribution[{0,0},{{1,c},{c,1}}]] = FF[a,b,c] (where FF is a given function of a, b, and c which could be tabulated).
@JM suggested using TagSet or TagSetDelayed, but the difficulty is to decide to which function it should be associated with, and with what efficiency, given that it would be unwise to temper with build in symbols like Integrate?
Attempt
As a simpler toy problem I tried
Unprotect[Integrate]; Integrate /: Integrate[f[x], {x, a_, b_}] = F[a, b] Protect[Integrate]; for which Integrate[f[x],{x,1,2}] returns F[1,2]
But for instance Integrate[2 f[x], {x, 1, 2}] is not evaluated, which suggests that my new (possibly admittedly dangerous) definition has not been taken as a global rule for integration.
More relevantly, I tried
Unprotect[Expectation]; Expectation[ Boole[x_ > a_ && y_ > b_], {x_, y_}~Distributed~ MultinormalDistribution[{0, 0}, {{1, c_}, {c_, 1}}]] = FF[a, b, c] Protect[Expectation]; so that
Expectation[ Boole[x > 1 && y > 2], {x, y}~Distributed~ MultinormalDistribution[{0, 0}, {{1, 1/3}, {1/3, 1}}]] returns FF[1,2,1/3]
(after a short while).
Questions
What is the best way to write down the definition? Assign it to
MultinormalDistribution,Expectation,Integrate?How to make sure it is "integrated" by Mathematica so that when attempting, e.g. to compute the expectation of
d*Boole[x>a && y>b]it would returnd*FF[a,b,c](or the expectation ofu+Boole[x>a && y>b]the Expectation ofu + FF[a,b,c])? More specifically, how to make sure Mathematica tries to transform a given integral into a form which could match the new definition?
UPDATE
The package Rubi4 effectively extends the number of functions mathematica can integrate, though not following the path envisaged in this post.

OwenTcf math.stackexchange.com/questions/153421/… It remains interesting to extend it e.g. to 3D. $\endgroup$