int_rules_4_1_0_2 = @theory begin

    #= ::Subsection::Closed:: =#
    #= 4.1.0.2*(a*trg)^m*(b*tan)^n =#
    @apply_utils Antiderivative((~(a') * sin(~(e') + ~(f') * ~x)) ^ ~m * (~(b') * tan(~(e') + ~(f') * ~x)) ^ ~n, ~x) => (-(~b) * (~a * sin(~e + ~f * ~x)) ^ ~m * (~b * tan(~e + ~f * ~x)) ^ (~n - 1)) / (~f * ~m) <-- FreeQ([~a, ~b, ~e, ~f, ~m, ~n], ~x) && EqQ((~m + ~n) - 1, 0)
    @apply_utils Antiderivative(sin(~(e') + ~(f') * ~x) ^ ~(m') * tan(~(e') + ~(f') * ~x) ^ ~(n'), ~x) => (-1 / ~f) * Subst(Antiderivative((1 - (~x) ^ 2) ^ (((~m + ~n) - 1) / 2) / (~x) ^ ~n, ~x), ~x, cos(~e + ~f * ~x)) <-- FreeQ([~e, ~f], ~x) && IntegersQ(~m, ~n, ((~m + ~n) - 1) / 2)
    @apply_utils Antiderivative(sin(~(e') + ~(f') * ~x) ^ ~m * (~(b') * tan(~(e') + ~(f') * ~x)) ^ ~(n'), ~x) => With([ff = FreeFactors(tan(~e + ~f * ~x), ~x)], ((~b * ff) / ~f) * Subst(Antiderivative((ff * ~x) ^ (~m + ~n) / ((~b) ^ 2 + ff ^ 2 * (~x) ^ 2) ^ (~m / 2 + 1), ~x), ~x, (~b * tan(~e + ~f * ~x)) / ff)) <-- FreeQ([~b, ~e, ~f, ~n], ~x) && IntegerQ(~m / 2)
    @apply_utils Antiderivative((~(a') * sin(~(e') + ~(f') * ~x)) ^ ~(m') * tan(~(e') + ~(f') * ~x) ^ ~(n'), ~x) => With([ff = FreeFactors(sin(~e + ~f * ~x), ~x)], (ff / ~f) * Subst(Antiderivative((ff * ~x) ^ (~m + ~n) / ((~a) ^ 2 - ff ^ 2 * (~x) ^ 2) ^ ((~n + 1) / 2), ~x), ~x, (~a * sin(~e + ~f * ~x)) / ff)) <-- FreeQ([~a, ~e, ~f, ~m], ~x) && IntegerQ((~n + 1) / 2)
    @apply_utils Antiderivative((~(a') * sin(~(e') + ~(f') * ~x)) ^ ~m * (~(b') * tan(~(e') + ~(f') * ~x)) ^ ~n, ~x) => (~b * (~a * sin(~e + ~f * ~x)) ^ (~m + 2) * (~b * tan(~e + ~f * ~x)) ^ (~n - 1)) / ((~a) ^ 2 * ~f * (~n - 1)) - (((~b) ^ 2 * (~m + 2)) / ((~a) ^ 2 * (~n - 1))) * Antiderivative((~a * sin(~e + ~f * ~x)) ^ (~m + 2) * (~b * tan(~e + ~f * ~x)) ^ (~n - 2), ~x) <-- FreeQ([~a, ~b, ~e, ~f], ~x) && (GtQ(~n, 1) && ((LtQ(~m, -1) || EqQ(~m, -1) && EqQ(~n, 3 / 2)) && IntegersQ(2 * ~m, 2 * ~n)))
    @apply_utils Antiderivative((~(a') * sin(~(e') + ~(f') * ~x)) ^ ~(m') * (~(b') * tan(~(e') + ~(f') * ~x)) ^ ~n, ~x) => (~b * (~a * sin(~e + ~f * ~x)) ^ ~m * (~b * tan(~e + ~f * ~x)) ^ (~n - 1)) / (~f * (~n - 1)) - (((~b) ^ 2 * ((~m + ~n) - 1)) / (~n - 1)) * Antiderivative((~a * sin(~e + ~f * ~x)) ^ ~m * (~b * tan(~e + ~f * ~x)) ^ (~n - 2), ~x) <-- FreeQ([~a, ~b, ~e, ~f, ~m], ~x) && (GtQ(~n, 1) && (IntegersQ(2 * ~m, 2 * ~n) && Not(GtQ(~m, 1) && Not(IntegerQ((~m - 1) / 2)))))
    @apply_utils Antiderivative(sqrt(~(a') * sin(~(e') + ~(f') * ~x)) / (~(b') * tan(~(e') + ~(f') * ~x)) ^ (3 / 2), ~x) => (2 * sqrt(~a * sin(~e + ~f * ~x))) / (~b * ~f * sqrt(~b * tan(~e + ~f * ~x))) + ((~a) ^ 2 / (~b) ^ 2) * Antiderivative(sqrt(~b * tan(~e + ~f * ~x)) / (~a * sin(~e + ~f * ~x)) ^ (3 / 2), ~x) <-- FreeQ([~a, ~b, ~e, ~f], ~x)
    @apply_utils Antiderivative((~(a') * sin(~(e') + ~(f') * ~x)) ^ ~m * (~(b') * tan(~(e') + ~(f') * ~x)) ^ ~n, ~x) => ((~a * sin(~e + ~f * ~x)) ^ ~m * (~b * tan(~e + ~f * ~x)) ^ (~n + 1)) / (~b * ~f * ~m) - (((~a) ^ 2 * (~n + 1)) / ((~b) ^ 2 * ~m)) * Antiderivative((~a * sin(~e + ~f * ~x)) ^ (~m - 2) * (~b * tan(~e + ~f * ~x)) ^ (~n + 2), ~x) <-- FreeQ([~a, ~b, ~e, ~f], ~x) && (LtQ(~n, -1) && (GtQ(~m, 1) && IntegersQ(2 * ~m, 2 * ~n)))
    @apply_utils Antiderivative((~(a') * sin(~(e') + ~(f') * ~x)) ^ ~(m') * (~(b') * tan(~(e') + ~(f') * ~x)) ^ ~n, ~x) => ((~a * sin(~e + ~f * ~x)) ^ ~m * (~b * tan(~e + ~f * ~x)) ^ (~n + 1)) / (~b * ~f * (~m + ~n + 1)) - ((~n + 1) / ((~b) ^ 2 * (~m + ~n + 1))) * Antiderivative((~a * sin(~e + ~f * ~x)) ^ ~m * (~b * tan(~e + ~f * ~x)) ^ (~n + 2), ~x) <-- FreeQ([~a, ~b, ~e, ~f, ~m], ~x) && (LtQ(~n, -1) && (NeQ(~m + ~n + 1, 0) && (IntegersQ(2 * ~m, 2 * ~n) && Not(EqQ(~n, -3 / 2) && EqQ(~m, 1)))))
    @apply_utils Antiderivative((~(a') * sin(~(e') + ~(f') * ~x)) ^ ~(m') * (~(b') * tan(~(e') + ~(f') * ~x)) ^ ~(n'), ~x) => (-(~b) * (~a * sin(~e + ~f * ~x)) ^ ~m * (~b * tan(~e + ~f * ~x)) ^ (~n - 1)) / (~f * ~m) + (((~a) ^ 2 * ((~m + ~n) - 1)) / ~m) * Antiderivative((~a * sin(~e + ~f * ~x)) ^ (~m - 2) * (~b * tan(~e + ~f * ~x)) ^ ~n, ~x) <-- FreeQ([~a, ~b, ~e, ~f, ~n], ~x) && ((GtQ(~m, 1) || EqQ(~m, 1) && EqQ(~n, 1 / 2)) && IntegersQ(2 * ~m, 2 * ~n))
    @apply_utils Antiderivative((~(a') * sin(~(e') + ~(f') * ~x)) ^ ~m * (~(b') * tan(~(e') + ~(f') * ~x)) ^ ~(n'), ~x) => (~b * (~a * sin(~e + ~f * ~x)) ^ (~m + 2) * (~b * tan(~e + ~f * ~x)) ^ (~n - 1)) / ((~a) ^ 2 * ~f * (~m + ~n + 1)) + ((~m + 2) / ((~a) ^ 2 * (~m + ~n + 1))) * Antiderivative((~a * sin(~e + ~f * ~x)) ^ (~m + 2) * (~b * tan(~e + ~f * ~x)) ^ ~n, ~x) <-- FreeQ([~a, ~b, ~e, ~f, ~n], ~x) && (LtQ(~m, -1) && (NeQ(~m + ~n + 1, 0) && IntegersQ(2 * ~m, 2 * ~n)))
    @apply_utils Antiderivative((~(a') * sin(~(e') + ~(f') * ~x)) ^ ~m * tan(~(e') + ~(f') * ~x) ^ ~n, ~x) => (1 / (~a) ^ ~n) * Antiderivative((~a * sin(~e + ~f * ~x)) ^ (~m + ~n) / cos(~e + ~f * ~x) ^ ~n, ~x) <-- FreeQ([~a, ~e, ~f, ~m], ~x) && (IntegerQ(~n) && Not(IntegerQ(~m)))
    @apply_utils Antiderivative((~(a') * sin(~(e') + ~(f') * ~x)) ^ ~(m') * (~(b') * tan(~(e') + ~(f') * ~x)) ^ ~n, ~x) => ((cos(~e + ~f * ~x) ^ ~n * (~b * tan(~e + ~f * ~x)) ^ ~n) / (~a * sin(~e + ~f * ~x)) ^ ~n) * Antiderivative((~a * sin(~e + ~f * ~x)) ^ (~m + ~n) / cos(~e + ~f * ~x) ^ ~n, ~x) <-- FreeQ([~a, ~b, ~e, ~f, ~m, ~n], ~x) && (Not(IntegerQ(~n)) && (ILtQ(~m, 0) || (EqQ(~m, 1) && EqQ(~n, -1 / 2) || IntegersQ(~m - 1 / 2, ~n - 1 / 2))))
    @apply_utils Antiderivative((~(a') * sin(~(e') + ~(f') * ~x)) ^ ~(m') * (~(b') * tan(~(e') + ~(f') * ~x)) ^ ~n, ~x) => ((~a * cos(~e + ~f * ~x) ^ (~n + 1) * (~b * tan(~e + ~f * ~x)) ^ (~n + 1)) / (~b * (~a * sin(~e + ~f * ~x)) ^ (~n + 1))) * Antiderivative((~a * sin(~e + ~f * ~x)) ^ (~m + ~n) / cos(~e + ~f * ~x) ^ ~n, ~x) <-- FreeQ([~a, ~b, ~e, ~f, ~m, ~n], ~x) && Not(IntegerQ(~n))
    @apply_utils Antiderivative((~(a') * cos(~(e') + ~(f') * ~x)) ^ ~m * (~(b') * tan(~(e') + ~(f') * ~x)) ^ ~n, ~x) => (~a * cos(~e + ~f * ~x)) ^ FracPart(~m) * (sec(~e + ~f * ~x) / ~a) ^ FracPart(~m) * Antiderivative((~b * tan(~e + ~f * ~x)) ^ ~n / (sec(~e + ~f * ~x) / ~a) ^ ~m, ~x) <-- FreeQ([~a, ~b, ~e, ~f, ~m, ~n], ~x) && (Not(IntegerQ(~m)) && Not(IntegerQ(~n)))
    @apply_utils Antiderivative((~(a') * cot(~(e') + ~(f') * ~x)) ^ ~m * (~(b') * tan(~(e') + ~(f') * ~x)) ^ ~n, ~x) => (~a * cot(~e + ~f * ~x)) ^ ~m * (~b * tan(~e + ~f * ~x)) ^ ~m * Antiderivative((~b * tan(~e + ~f * ~x)) ^ (~n - ~m), ~x) <-- FreeQ([~a, ~b, ~e, ~f, ~m, ~n], ~x) && (Not(IntegerQ(~m)) && Not(IntegerQ(~n)))
    @apply_utils Antiderivative((~(a') * sec(~(e') + ~(f') * ~x)) ^ ~(m') * (~(b') * tan(~(e') + ~(f') * ~x)) ^ ~(n'), ~x) => (-((~a * sec(~e + ~f * ~x)) ^ ~m) * (~b * tan(~e + ~f * ~x)) ^ (~n + 1)) / (~b * ~f * ~m) <-- FreeQ([~a, ~b, ~e, ~f, ~m, ~n], ~x) && EqQ(~m + ~n + 1, 0)
    @apply_utils Antiderivative((~(a') * sec(~(e') + ~(f') * ~x)) ^ ~(m') * (~(b') * tan(~(e') + ~(f') * ~x)) ^ ~(n'), ~x) => (~a / ~f) * Subst(Antiderivative((~a * ~x) ^ (~m - 1) * (-1 + (~x) ^ 2) ^ ((~n - 1) / 2), ~x), ~x, sec(~e + ~f * ~x)) <-- FreeQ([~a, ~e, ~f, ~m], ~x) && (IntegerQ((~n - 1) / 2) && Not(IntegerQ(~m / 2) && LtQ(0, ~m, ~n + 1)))
    @apply_utils Antiderivative(sec(~(e') + ~(f') * ~x) ^ ~m * (~(b') * tan(~(e') + ~(f') * ~x)) ^ ~(n'), ~x) => (1 / ~f) * Subst(Antiderivative((~b * ~x) ^ ~n * (1 + (~x) ^ 2) ^ (~m / 2 - 1), ~x), ~x, tan(~e + ~f * ~x)) <-- FreeQ([~b, ~e, ~f, ~n], ~x) && (IntegerQ(~m / 2) && Not(IntegerQ((~n - 1) / 2) && LtQ(0, ~n, ~m - 1)))
    @apply_utils Antiderivative((~(a') * sec(~(e') + ~(f') * ~x)) ^ ~(m') * (~(b') * tan(~(e') + ~(f') * ~x)) ^ ~n, ~x) => ((~a) ^ 2 * (~a * sec(~e + ~f * ~x)) ^ (~m - 2) * (~b * tan(~e + ~f * ~x)) ^ (~n + 1)) / (~b * ~f * (~n + 1)) - (((~a) ^ 2 * (~m - 2)) / ((~b) ^ 2 * (~n + 1))) * Antiderivative((~a * sec(~e + ~f * ~x)) ^ (~m - 2) * (~b * tan(~e + ~f * ~x)) ^ (~n + 2), ~x) <-- FreeQ([~a, ~b, ~e, ~f], ~x) && (LtQ(~n, -1) && ((GtQ(~m, 1) || EqQ(~m, 1) && EqQ(~n, -3 / 2)) && IntegersQ(2 * ~m, 2 * ~n)))
    @apply_utils Antiderivative((~(a') * sec(~(e') + ~(f') * ~x)) ^ ~(m') * (~(b') * tan(~(e') + ~(f') * ~x)) ^ ~n, ~x) => ((~a * sec(~e + ~f * ~x)) ^ ~m * (~b * tan(~e + ~f * ~x)) ^ (~n + 1)) / (~b * ~f * (~n + 1)) - ((~m + ~n + 1) / ((~b) ^ 2 * (~n + 1))) * Antiderivative((~a * sec(~e + ~f * ~x)) ^ ~m * (~b * tan(~e + ~f * ~x)) ^ (~n + 2), ~x) <-- FreeQ([~a, ~b, ~e, ~f, ~m], ~x) && (LtQ(~n, -1) && IntegersQ(2 * ~m, 2 * ~n))
    @apply_utils Antiderivative((~(a') * sec(~(e') + ~(f') * ~x)) ^ ~m * (~(b') * tan(~(e') + ~(f') * ~x)) ^ ~n, ~x) => (~b * (~a * sec(~e + ~f * ~x)) ^ ~m * (~b * tan(~e + ~f * ~x)) ^ (~n - 1)) / (~f * ~m) - (((~b) ^ 2 * (~n - 1)) / ((~a) ^ 2 * ~m)) * Antiderivative((~a * sec(~e + ~f * ~x)) ^ (~m + 2) * (~b * tan(~e + ~f * ~x)) ^ (~n - 2), ~x) <-- FreeQ([~a, ~b, ~e, ~f], ~x) && (GtQ(~n, 1) && ((LtQ(~m, -1) || EqQ(~m, -1) && EqQ(~n, 3 / 2)) && IntegersQ(2 * ~m, 2 * ~n)))
    @apply_utils Antiderivative((~(a') * sec(~(e') + ~(f') * ~x)) ^ ~(m') * (~(b') * tan(~(e') + ~(f') * ~x)) ^ ~n, ~x) => (~b * (~a * sec(~e + ~f * ~x)) ^ ~m * (~b * tan(~e + ~f * ~x)) ^ (~n - 1)) / (~f * ((~m + ~n) - 1)) - (((~b) ^ 2 * (~n - 1)) / ((~m + ~n) - 1)) * Antiderivative((~a * sec(~e + ~f * ~x)) ^ ~m * (~b * tan(~e + ~f * ~x)) ^ (~n - 2), ~x) <-- FreeQ([~a, ~b, ~e, ~f, ~m], ~x) && (GtQ(~n, 1) && (NeQ((~m + ~n) - 1, 0) && IntegersQ(2 * ~m, 2 * ~n)))
    @apply_utils Antiderivative((~(a') * sec(~(e') + ~(f') * ~x)) ^ ~m * (~(b') * tan(~(e') + ~(f') * ~x)) ^ ~n, ~x) => (-((~a * sec(~e + ~f * ~x)) ^ ~m) * (~b * tan(~e + ~f * ~x)) ^ (~n + 1)) / (~b * ~f * ~m) + ((~m + ~n + 1) / ((~a) ^ 2 * ~m)) * Antiderivative((~a * sec(~e + ~f * ~x)) ^ (~m + 2) * (~b * tan(~e + ~f * ~x)) ^ ~n, ~x) <-- FreeQ([~a, ~b, ~e, ~f, ~n], ~x) && ((LtQ(~m, -1) || EqQ(~m, -1) && EqQ(~n, -1 / 2)) && IntegersQ(2 * ~m, 2 * ~n))
    @apply_utils Antiderivative((~(a') * sec(~(e') + ~(f') * ~x)) ^ ~(m') * (~(b') * tan(~(e') + ~(f') * ~x)) ^ ~n, ~x) => ((~a) ^ 2 * (~a * sec(~e + ~f * ~x)) ^ (~m - 2) * (~b * tan(~e + ~f * ~x)) ^ (~n + 1)) / (~b * ~f * ((~m + ~n) - 1)) + (((~a) ^ 2 * (~m - 2)) / ((~m + ~n) - 1)) * Antiderivative((~a * sec(~e + ~f * ~x)) ^ (~m - 2) * (~b * tan(~e + ~f * ~x)) ^ ~n, ~x) <-- FreeQ([~a, ~b, ~e, ~f, ~n], ~x) && ((GtQ(~m, 1) || EqQ(~m, 1) && EqQ(~n, 1 / 2)) && (NeQ((~m + ~n) - 1, 0) && IntegersQ(2 * ~m, 2 * ~n)))
    @apply_utils Antiderivative(sec(~(e') + ~(f') * ~x) / sqrt(~(b') * tan(~(e') + ~(f') * ~x)), ~x) => (sqrt(sin(~e + ~f * ~x)) / (sqrt(cos(~e + ~f * ~x)) * sqrt(~b * tan(~e + ~f * ~x)))) * Antiderivative(1 / (sqrt(cos(~e + ~f * ~x)) * sqrt(sin(~e + ~f * ~x))), ~x) <-- FreeQ([~b, ~e, ~f], ~x)
    @apply_utils Antiderivative(sqrt(~(b') * tan(~(e') + ~(f') * ~x)) / sec(~(e') + ~(f') * ~x), ~x) => ((sqrt(cos(~e + ~f * ~x)) * sqrt(~b * tan(~e + ~f * ~x))) / sqrt(sin(~e + ~f * ~x))) * Antiderivative(sqrt(cos(~e + ~f * ~x)) * sqrt(sin(~e + ~f * ~x)), ~x) <-- FreeQ([~b, ~e, ~f], ~x)
    @apply_utils Antiderivative((~(a') * sec(~(e') + ~(f') * ~x)) ^ ~m * (~(b') * tan(~(e') + ~(f') * ~x)) ^ ~n, ~x) => (((~a) ^ (~m + ~n) * (~b * tan(~e + ~f * ~x)) ^ ~n) / ((~a * sec(~e + ~f * ~x)) ^ ~n * (~b * sin(~e + ~f * ~x)) ^ ~n)) * Antiderivative((~b * sin(~e + ~f * ~x)) ^ ~n / cos(~e + ~f * ~x) ^ (~m + ~n), ~x) <-- FreeQ([~a, ~b, ~e, ~f, ~m, ~n], ~x) && (IntegerQ(~n + 1 / 2) && IntegerQ(~m + 1 / 2))
    #= Antiderivative(((~a')*sec((~e')+(~f')*(~x)))^(~m')*((~b')*tan((~e')+(~f')*(~x)))^(~n),~x):=   (a*sec(e+f*x))^m*(b*tan(e+f*x))^(n+1)*(cos(e+f*x)^2)^((m+n+1)/2)/(b* f*(b*sin(e+f*x))^(n+1))* Subst(Antiderivative(x^n/(1-x^2/b^2)^((m+n+1)/2),x),x,b*sin(e+f*x)) <--  FreeQ([a,b,e,f,m,n],x) && Not(IntegerQ((n-1)/2)) &&  Not(IntegerQ(m/2)) =#
    @apply_utils Antiderivative((~(a') * sec(~(e') + ~(f') * ~x)) ^ ~(m') * (~(b') * tan(~(e') + ~(f') * ~x)) ^ ~n, ~x) => (((~a * sec(~e + ~f * ~x)) ^ ~m * (~b * tan(~e + ~f * ~x)) ^ (~n + 1) * (cos(~e + ~f * ~x) ^ 2) ^ ((~m + ~n + 1) / 2)) / (~b * ~f * (~n + 1))) * HypergeometricFunctions._₂F₁((~n + 1) / 2, (~m + ~n + 1) / 2, (~n + 3) / 2, sin(~e + ~f * ~x) ^ 2) <-- FreeQ([~a, ~b, ~e, ~f, ~m, ~n], ~x) && (Not(IntegerQ((~n - 1) / 2)) && Not(IntegerQ(~m / 2)))
    @apply_utils Antiderivative((~(a') * csc(~(e') + ~(f') * ~x)) ^ ~m * (~(b') * tan(~(e') + ~(f') * ~x)) ^ ~n, ~x) => (~a * csc(~e + ~f * ~x)) ^ FracPart(~m) * (sin(~e + ~f * ~x) / ~a) ^ FracPart(~m) * Antiderivative((~b * tan(~e + ~f * ~x)) ^ ~n / (sin(~e + ~f * ~x) / ~a) ^ ~m, ~x) <-- FreeQ([~a, ~b, ~e, ~f, ~m, ~n], ~x) && (Not(IntegerQ(~m)) && Not(IntegerQ(~n)))
end
