int_rules_4_3_7 = @theory begin

    #= ::Subsection::Closed:: =#
    #= 4.3.7*(d*trig)^m*(a+b*(c*tan)^n)^p =#
    @apply_utils Antiderivative(~(u') * (~a + ~(b') * tan(~(e') + ~(f') * ~x) ^ 2) ^ ~p, ~x) => Antiderivative(ActivateTrig(~u * (~a * sec(~e + ~f * ~x) ^ 2) ^ ~p), ~x) <-- FreeQ([~a, ~b, ~e, ~f, ~p], ~x) && EqQ(~a, ~b)
    @apply_utils Antiderivative(~(u') * (~(b') * tan(~(e') + ~(f') * ~x) ^ ~n) ^ ~p, ~x) => With([ff = FreeFactors(tan(~e + ~f * ~x), ~x)], (((~b * ff ^ ~n) ^ IntPart(~p) * (~b * tan(~e + ~f * ~x) ^ ~n) ^ FracPart(~p)) / (tan(~e + ~f * ~x) / ff) ^ (~n * FracPart(~p))) * Antiderivative(ActivateTrig(~u) * (tan(~e + ~f * ~x) / ff) ^ (~n * ~p), ~x)) <-- FreeQ([~b, ~e, ~f, ~n, ~p], ~x) && (Not(IntegerQ(~p)) && (IntegerQ(~n) && (EqQ(~u, 1) || MatchQ(~u, (~(d') * (~trig)(~e + ~f * ~x)) ^ ~(m') <-- FreeQ([d, m], ~x) && MemberQ([sin, cos, tan, cot, sec, csc], trig)))))
    @apply_utils Antiderivative(~(u') * (~(b') * (~(c') * tan(~(e') + ~(f') * ~x)) ^ ~n) ^ ~p, ~x) => (((~b) ^ IntPart(~p) * (~b * (~c * tan(~e + ~f * ~x)) ^ ~n) ^ FracPart(~p)) / (~c * tan(~e + ~f * ~x)) ^ (~n * FracPart(~p))) * Antiderivative(ActivateTrig(~u) * (~c * tan(~e + ~f * ~x)) ^ (~n * ~p), ~x) <-- FreeQ([~b, ~c, ~e, ~f, ~n, ~p], ~x) && (Not(IntegerQ(~p)) && (Not(IntegerQ(~n)) && (EqQ(~u, 1) || MatchQ(~u, (~(d') * (~trig)(~e + ~f * ~x)) ^ ~(m') <-- FreeQ([d, m], ~x) && MemberQ([sin, cos, tan, cot, sec, csc], trig)))))
    @apply_utils Antiderivative(1 / (~a + ~(b') * tan(~(e') + ~(f') * ~x) ^ 2), ~x) => ~x / (~a - ~b) - (~b / (~a - ~b)) * Antiderivative(sec(~e + ~f * ~x) ^ 2 / (~a + ~b * tan(~e + ~f * ~x) ^ 2), ~x) <-- FreeQ([~a, ~b, ~e, ~f], ~x) && NeQ(~a, ~b)
    @apply_utils Antiderivative((~a + ~(b') * (~(c') * tan(~(e') + ~(f') * ~x)) ^ ~n) ^ ~p, ~x) => With([ff = FreeFactors(tan(~e + ~f * ~x), ~x)], ((~c * ff) / ~f) * Subst(Antiderivative((~a + ~b * (ff * ~x) ^ ~n) ^ ~p / ((~c) ^ 2 + ff ^ 2 * (~x) ^ 2), ~x), ~x, (~c * tan(~e + ~f * ~x)) / ff)) <-- FreeQ([~a, ~b, ~c, ~e, ~f, ~n, ~p], ~x) && (IntegersQ(~n, ~p) || (IGtQ(~p, 0) || (EqQ((~n) ^ 2, 4) || EqQ((~n) ^ 2, 16))))
    @apply_utils Antiderivative((~a + ~(b') * (~(c') * tan(~(e') + ~(f') * ~x)) ^ ~n) ^ ~(p'), ~x) => Unintegrable((~a + ~b * (~c * tan(~e + ~f * ~x)) ^ ~n) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~e, ~f, ~n, ~p], ~x)
    @apply_utils Antiderivative(sin(~(e') + ~(f') * ~x) ^ ~m * (~a + ~(b') * (~(c') * tan(~(e') + ~(f') * ~x)) ^ ~n) ^ ~(p'), ~x) => With([ff = FreeFactors(tan(~e + ~f * ~x), ~x)], ((~c * ff ^ (~m + 1)) / ~f) * Subst(Antiderivative(((~x) ^ ~m * (~a + ~b * (ff * ~x) ^ ~n) ^ ~p) / ((~c) ^ 2 + ff ^ 2 * (~x) ^ 2) ^ (~m / 2 + 1), ~x), ~x, (~c * tan(~e + ~f * ~x)) / ff)) <-- FreeQ([~a, ~b, ~c, ~e, ~f, ~n, ~p], ~x) && IntegerQ(~m / 2)
    @apply_utils Antiderivative(sin(~(e') + ~(f') * ~x) ^ ~(m') * (~a + ~(b') * tan(~(e') + ~(f') * ~x) ^ 2) ^ ~(p'), ~x) => With([ff = FreeFactors(sec(~e + ~f * ~x), ~x)], (1 / (~f * ff ^ ~m)) * Subst(Antiderivative(((-1 + ff ^ 2 * (~x) ^ 2) ^ ((~m - 1) / 2) * ((~a - ~b) + ~b * ff ^ 2 * (~x) ^ 2) ^ ~p) / (~x) ^ (~m + 1), ~x), ~x, sec(~e + ~f * ~x) / ff)) <-- FreeQ([~a, ~b, ~e, ~f, ~p], ~x) && IntegerQ((~m - 1) / 2)
    @apply_utils Antiderivative(sin(~(e') + ~(f') * ~x) ^ ~(m') * (~a + ~(b') * tan(~(e') + ~(f') * ~x) ^ ~n) ^ ~(p'), ~x) => With([ff = FreeFactors(sec(~e + ~f * ~x), ~x)], (1 / (~f * ff ^ ~m)) * Subst(Antiderivative(((-1 + ff ^ 2 * (~x) ^ 2) ^ ((~m - 1) / 2) * (~a + ~b * (-1 + ff ^ 2 * (~x) ^ 2) ^ (~n / 2)) ^ ~p) / (~x) ^ (~m + 1), ~x), ~x, sec(~e + ~f * ~x) / ff)) <-- FreeQ([~a, ~b, ~e, ~f, ~p], ~x) && (IntegerQ((~m - 1) / 2) && IntegerQ(~n / 2))
    @apply_utils Antiderivative((~(d') * sin(~(e') + ~(f') * ~x)) ^ ~(m') * (~a + ~(b') * (~(c') * tan(~(e') + ~(f') * ~x)) ^ ~n) ^ ~(p'), ~x) => Antiderivative(ExpandTrig((~d * sin(~e + ~f * ~x)) ^ ~m * (~a + ~b * (~c * tan(~e + ~f * ~x)) ^ ~n) ^ ~p, ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~n], ~x) && IGtQ(~p, 0)
    @apply_utils Antiderivative((~(d') * sin(~(e') + ~(f') * ~x)) ^ ~m * (~a + ~(b') * tan(~(e') + ~(f') * ~x) ^ 2) ^ ~p, ~x) => With([ff = FreeFactors(tan(~e + ~f * ~x), ~x)], ((ff * (~d * sin(~e + ~f * ~x)) ^ ~m * (sec(~e + ~f * ~x) ^ 2) ^ (~m / 2)) / (~f * tan(~e + ~f * ~x) ^ ~m)) * Subst(Antiderivative(((ff * ~x) ^ ~m * (~a + ~b * ff ^ 2 * (~x) ^ 2) ^ ~p) / (1 + ff ^ 2 * (~x) ^ 2) ^ (~m / 2 + 1), ~x), ~x, tan(~e + ~f * ~x) / ff)) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~m, ~p], ~x) && Not(IntegerQ(~m))
    @apply_utils Antiderivative((~(d') * sin(~(e') + ~(f') * ~x)) ^ ~(m') * (~a + ~(b') * (~(c') * tan(~(e') + ~(f') * ~x)) ^ ~n) ^ ~(p'), ~x) => Unintegrable((~d * sin(~e + ~f * ~x)) ^ ~m * (~a + ~b * (~c * tan(~e + ~f * ~x)) ^ ~n) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~n, ~p], ~x)
    @apply_utils Antiderivative((~(d') * cos(~(e') + ~(f') * ~x)) ^ ~m * (~a + ~(b') * (~(c') * tan(~(e') + ~(f') * ~x)) ^ ~n) ^ ~p, ~x) => (~d * cos(~e + ~f * ~x)) ^ FracPart(~m) * (sec(~e + ~f * ~x) / ~d) ^ FracPart(~m) * Antiderivative((sec(~e + ~f * ~x) / ~d) ^ -(~m) * (~a + ~b * (~c * tan(~e + ~f * ~x)) ^ ~n) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~n, ~p], ~x) && Not(IntegerQ(~m))
    @apply_utils Antiderivative((~(d') * tan(~(e') + ~(f') * ~x)) ^ ~(m') * (~a + ~(b') * (~(c') * tan(~(e') + ~(f') * ~x)) ^ ~n) ^ ~(p'), ~x) => With([ff = FreeFactors(tan(~e + ~f * ~x), ~x)], ((~c * ff) / ~f) * Subst(Antiderivative((((~d * ff * ~x) / ~c) ^ ~m * (~a + ~b * (ff * ~x) ^ ~n) ^ ~p) / ((~c) ^ 2 + ff ^ 2 * (~x) ^ 2), ~x), ~x, (~c * tan(~e + ~f * ~x)) / ff)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~n, ~p], ~x) && (IGtQ(~p, 0) || (EqQ(~n, 2) || (EqQ(~n, 4) || IntegerQ(~p) && RationalQ(~n))))
    @apply_utils Antiderivative((~(d') * tan(~(e') + ~(f') * ~x)) ^ ~(m') * (~a + ~(b') * (~(c') * tan(~(e') + ~(f') * ~x)) ^ ~n) ^ ~(p'), ~x) => Antiderivative(ExpandTrig((~d * tan(~e + ~f * ~x)) ^ ~m * (~a + ~b * (~c * tan(~e + ~f * ~x)) ^ ~n) ^ ~p, ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~n], ~x) && IGtQ(~p, 0)
    @apply_utils Antiderivative((~(d') * tan(~(e') + ~(f') * ~x)) ^ ~(m') * (~a + ~(b') * (~(c') * tan(~(e') + ~(f') * ~x)) ^ ~n) ^ ~(p'), ~x) => Unintegrable((~d * tan(~e + ~f * ~x)) ^ ~m * (~a + ~b * (~c * tan(~e + ~f * ~x)) ^ ~n) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~n, ~p], ~x)
    @apply_utils Antiderivative((~(d') * cot(~(e') + ~(f') * ~x)) ^ ~m * (~a + ~(b') * tan(~(e') + ~(f') * ~x) ^ ~(n')) ^ ~(p'), ~x) => (~d) ^ (~n * ~p) * Antiderivative((~d * cot(~e + ~f * ~x)) ^ (~m - ~n * ~p) * (~b + ~a * cot(~e + ~f * ~x) ^ ~n) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~m, ~n, ~p], ~x) && (Not(IntegerQ(~m)) && IntegersQ(~n, ~p))
    @apply_utils Antiderivative((~(d') * cot(~(e') + ~(f') * ~x)) ^ ~m * (~a + ~(b') * (~(c') * tan(~(e') + ~(f') * ~x)) ^ ~n) ^ ~p, ~x) => (~d * cot(~e + ~f * ~x)) ^ FracPart(~m) * (tan(~e + ~f * ~x) / ~d) ^ FracPart(~m) * Antiderivative((tan(~e + ~f * ~x) / ~d) ^ -(~m) * (~a + ~b * (~c * tan(~e + ~f * ~x)) ^ ~n) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~n, ~p], ~x) && Not(IntegerQ(~m))
    @apply_utils Antiderivative(sec(~(e') + ~(f') * ~x) ^ ~m * (~a + ~(b') * (~(c') * tan(~(e') + ~(f') * ~x)) ^ ~n) ^ ~(p'), ~x) => With([ff = FreeFactors(tan(~e + ~f * ~x), ~x)], (ff / ((~c) ^ (~m - 1) * ~f)) * Subst(Antiderivative(((~c) ^ 2 + ff ^ 2 * (~x) ^ 2) ^ (~m / 2 - 1) * (~a + ~b * (ff * ~x) ^ ~n) ^ ~p, ~x), ~x, (~c * tan(~e + ~f * ~x)) / ff)) <-- FreeQ([~a, ~b, ~c, ~e, ~f, ~n, ~p], ~x) && (IntegerQ(~m / 2) && (IntegersQ(~n, ~p) || (IGtQ(~m, 0) || (IGtQ(~p, 0) || (EqQ((~n) ^ 2, 4) || EqQ((~n) ^ 2, 16))))))
    @apply_utils Antiderivative(sec(~(e') + ~(f') * ~x) ^ ~(m') * (~a + ~(b') * tan(~(e') + ~(f') * ~x) ^ ~n) ^ ~(p'), ~x) => With([ff = FreeFactors(sin(~e + ~f * ~x), ~x)], (ff / ~f) * Subst(Antiderivative(ExpandToSum(~b * (ff * ~x) ^ ~n + ~a * (1 - ff ^ 2 * (~x) ^ 2) ^ (~n / 2), ~x) ^ ~p / (1 - ff ^ 2 * (~x) ^ 2) ^ ((~m + ~n * ~p + 1) / 2), ~x), ~x, sin(~e + ~f * ~x) / ff)) <-- FreeQ([~a, ~b, ~e, ~f], ~x) && (IntegerQ((~m - 1) / 2) && (IntegerQ(~n / 2) && IntegerQ(~p)))
    @apply_utils Antiderivative(sec(~(e') + ~(f') * ~x) ^ ~(m') * (~a + ~(b') * tan(~(e') + ~(f') * ~x) ^ ~n) ^ ~(p'), ~x) => With([ff = FreeFactors(sin(~e + ~f * ~x), ~x)], (ff / ~f) * Subst(Antiderivative((1 / (1 - ff ^ 2 * (~x) ^ 2) ^ ((~m + 1) / 2)) * ((~b * (ff * ~x) ^ ~n + ~a * (1 - ff ^ 2 * (~x) ^ 2) ^ (~n / 2)) / (1 - ff ^ 2 * (~x) ^ 2) ^ (~n / 2)) ^ ~p, ~x), ~x, sin(~e + ~f * ~x) / ff)) <-- FreeQ([~a, ~b, ~e, ~f, ~p], ~x) && (IntegerQ((~m - 1) / 2) && (IntegerQ(~n / 2) && Not(IntegerQ(~p))))
    @apply_utils Antiderivative((~(d') * sec(~(e') + ~(f') * ~x)) ^ ~(m') * (~a + ~(b') * (~(c') * tan(~(e') + ~(f') * ~x)) ^ ~n) ^ ~(p'), ~x) => Antiderivative(ExpandTrig((~d * sec(~e + ~f * ~x)) ^ ~m * (~a + ~b * (~c * tan(~e + ~f * ~x)) ^ ~n) ^ ~p, ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~n], ~x) && IGtQ(~p, 0)
    @apply_utils Antiderivative((~(d') * sec(~(e') + ~(f') * ~x)) ^ ~m * (~a + ~(b') * tan(~(e') + ~(f') * ~x) ^ 2) ^ ~p, ~x) => With([ff = FreeFactors(tan(~e + ~f * ~x), ~x)], ((ff * (~d * sec(~e + ~f * ~x)) ^ ~m) / (~f * (sec(~e + ~f * ~x) ^ 2) ^ (~m / 2))) * Subst(Antiderivative((1 + ff ^ 2 * (~x) ^ 2) ^ (~m / 2 - 1) * (~a + ~b * ff ^ 2 * (~x) ^ 2) ^ ~p, ~x), ~x, tan(~e + ~f * ~x) / ff)) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~m, ~p], ~x) && Not(IntegerQ(~m))
    @apply_utils Antiderivative((~(d') * sec(~(e') + ~(f') * ~x)) ^ ~(m') * (~a + ~(b') * (~(c') * tan(~(e') + ~(f') * ~x)) ^ ~n) ^ ~(p'), ~x) => Unintegrable((~d * sec(~e + ~f * ~x)) ^ ~m * (~a + ~b * (~c * tan(~e + ~f * ~x)) ^ ~n) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~n, ~p], ~x)
    @apply_utils Antiderivative((~(d') * csc(~(e') + ~(f') * ~x)) ^ ~m * (~a + ~(b') * (~(c') * tan(~(e') + ~(f') * ~x)) ^ ~n) ^ ~p, ~x) => (~d * csc(~e + ~f * ~x)) ^ FracPart(~m) * (sin(~e + ~f * ~x) / ~d) ^ FracPart(~m) * Antiderivative((sin(~e + ~f * ~x) / ~d) ^ -(~m) * (~a + ~b * (~c * tan(~e + ~f * ~x)) ^ ~n) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~n, ~p], ~x) && Not(IntegerQ(~m))
end
