int_rules_4_1_1_1 = @theory begin

    #= ::Subsection::Closed:: =#
    #= 4.1.1.1*(a+b*sin)^n =#
    @apply_utils Antiderivative(sin(~(c') + ~(d') * ~x) ^ ~n, ~x) => (-1 / ~d) * Subst(Antiderivative(expand((1 - (~x) ^ 2) ^ ((~n - 1) / 2), ~x), ~x), ~x, cos(~c + ~d * ~x)) <-- FreeQ([~c, ~d], ~x) && IGtQ((~n - 1) / 2, 0)
    @apply_utils Antiderivative(sin(~(c') + (~(d') * ~x) / 2) ^ 2, ~x) => ~x / 2 - sin(2 * ~c + ~d * ~x) / (2 * ~d) <-- FreeQ([~c, ~d], ~x)
    @apply_utils Antiderivative((~(b') * sin(~(c') + ~(d') * ~x)) ^ ~n, ~x) => (-(~b) * cos(~c + ~d * ~x) * (~b * sin(~c + ~d * ~x)) ^ (~n - 1)) / (~d * ~n) + (((~b) ^ 2 * (~n - 1)) / ~n) * Antiderivative((~b * sin(~c + ~d * ~x)) ^ (~n - 2), ~x) <-- FreeQ([~b, ~c, ~d], ~x) && (GtQ(~n, 1) && IntegerQ(2 * ~n))
    @apply_utils Antiderivative((~(b') * sin(~(c') + ~(d') * ~x)) ^ ~n, ~x) => (cos(~c + ~d * ~x) * (~b * sin(~c + ~d * ~x)) ^ (~n + 1)) / (~b * ~d * (~n + 1)) + ((~n + 2) / ((~b) ^ 2 * (~n + 1))) * Antiderivative((~b * sin(~c + ~d * ~x)) ^ (~n + 2), ~x) <-- FreeQ([~b, ~c, ~d], ~x) && (LtQ(~n, -1) && IntegerQ(2 * ~n))
    @apply_utils Antiderivative(sin(~(c') + pi / 2 + ~(d') * ~x), ~x) => sin(~c + ~d * ~x) / ~d <-- FreeQ([~c, ~d], ~x)
    @apply_utils Antiderivative(sin(~(c') + ~(d') * ~x), ~x) => -(cos(~c + ~d * ~x)) / ~d <-- FreeQ([~c, ~d], ~x)
    #= Antiderivative(1/sin((~c')+(~d')*(~x)),~x) := Antiderivative(csc(c+d*x),x) <--  FreeQ([c,d],x) =#
    @apply_utils Antiderivative(sqrt(sin(~(c') + ~(d') * ~x)), ~x) => (2 / ~d) * Elliptic.E((1 / 2) * ((~c - pi / 2) + ~d * ~x), 2) <-- FreeQ([~c, ~d], ~x)
    @apply_utils Antiderivative(1 / sqrt(sin(~(c') + ~(d') * ~x)), ~x) => (2 / ~d) * Elliptic.F((1 / 2) * ((~c - pi / 2) + ~d * ~x), 2) <-- FreeQ([~c, ~d], ~x)
    @apply_utils Antiderivative((~b * sin(~(c') + ~(d') * ~x)) ^ ~n, ~x) => ((~b * sin(~c + ~d * ~x)) ^ ~n / sin(~c + ~d * ~x) ^ ~n) * Antiderivative(sin(~c + ~d * ~x) ^ ~n, ~x) <-- FreeQ([~b, ~c, ~d], ~x) && (LtQ(-1, ~n, 1) && IntegerQ(2 * ~n))
    #= Antiderivative(((~b')*sin((~c')+(~d')*(~x)))^(~n),~x) :=  cos(c+d*x)/(b*d*sqrt(cos(c+d*x)^2))*Subst(Antiderivative(x^n/sqrt(1-x^2/b^2),x), x,b*sin(c+d*x)) <-- FreeQ([b,c,d,n],x) && Not(IntegerQ(2*n) ||  IntegerQ(3*n)) =#
    @apply_utils Antiderivative((~(b') * sin(~(c') + ~(d') * ~x)) ^ ~n, ~x) => ((cos(~c + ~d * ~x) * (~b * sin(~c + ~d * ~x)) ^ (~n + 1)) / (~b * ~d * (~n + 1) * sqrt(cos(~c + ~d * ~x) ^ 2))) * HypergeometricFunctions._₂F₁(1 / 2, (~n + 1) / 2, (~n + 3) / 2, sin(~c + ~d * ~x) ^ 2) <-- FreeQ([~b, ~c, ~d, ~n], ~x) && Not(IntegerQ(2 * ~n))
    @apply_utils Antiderivative((~a + ~(b') * sin(~(c') + ~(d') * ~x)) ^ 2, ~x) => (((2 * (~a) ^ 2 + (~b) ^ 2) * ~x) / 2 - (2 * ~a * ~b * cos(~c + ~d * ~x)) / ~d) - ((~b) ^ 2 * cos(~c + ~d * ~x) * sin(~c + ~d * ~x)) / (2 * ~d) <-- FreeQ([~a, ~b, ~c, ~d], ~x)
    @apply_utils Antiderivative((~a + ~(b') * sin(~(c') + ~(d') * ~x)) ^ ~n, ~x) => Antiderivative(ExpandTrig((~a + ~b * sin(~c + ~d * ~x)) ^ ~n, ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~n], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && IGtQ(~n, 0))
    @apply_utils Antiderivative(sqrt(~a + ~(b') * sin(~(c') + ~(d') * ~x)), ~x) => (-2 * ~b * cos(~c + ~d * ~x)) / (~d * sqrt(~a + ~b * sin(~c + ~d * ~x))) <-- FreeQ([~a, ~b, ~c, ~d], ~x) && EqQ((~a) ^ 2 - (~b) ^ 2, 0)
    @apply_utils Antiderivative((~a + ~(b') * sin(~(c') + ~(d') * ~x)) ^ ~n, ~x) => (-(~b) * cos(~c + ~d * ~x) * (~a + ~b * sin(~c + ~d * ~x)) ^ (~n - 1)) / (~d * ~n) + ((~a * (2 * ~n - 1)) / ~n) * Antiderivative((~a + ~b * sin(~c + ~d * ~x)) ^ (~n - 1), ~x) <-- FreeQ([~a, ~b, ~c, ~d], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && IGtQ(~n - 1 / 2, 0))
    @apply_utils Antiderivative(1 / (~a + ~(b') * sin(~(c') + ~(d') * ~x)), ~x) => -(cos(~c + ~d * ~x)) / (~d * (~b + ~a * sin(~c + ~d * ~x))) <-- FreeQ([~a, ~b, ~c, ~d], ~x) && EqQ((~a) ^ 2 - (~b) ^ 2, 0)
    @apply_utils Antiderivative(1 / sqrt(~a + ~(b') * sin(~(c') + ~(d') * ~x)), ~x) => (-2 / ~d) * Subst(Antiderivative(1 / (2 * ~a - (~x) ^ 2), ~x), ~x, (~b * cos(~c + ~d * ~x)) / sqrt(~a + ~b * sin(~c + ~d * ~x))) <-- FreeQ([~a, ~b, ~c, ~d], ~x) && EqQ((~a) ^ 2 - (~b) ^ 2, 0)
    @apply_utils Antiderivative((~a + ~(b') * sin(~(c') + ~(d') * ~x)) ^ ~n, ~x) => (~b * cos(~c + ~d * ~x) * (~a + ~b * sin(~c + ~d * ~x)) ^ ~n) / (~a * ~d * (2 * ~n + 1)) + ((~n + 1) / (~a * (2 * ~n + 1))) * Antiderivative((~a + ~b * sin(~c + ~d * ~x)) ^ (~n + 1), ~x) <-- FreeQ([~a, ~b, ~c, ~d], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && (LtQ(~n, -1) && IntegerQ(2 * ~n)))
    #= Antiderivative(((~a)+(~b')*sin((~c')+(~d')*(~x)))^(~n),~x) :=  a^2*cos(c+d*x)/(d*sqrt(a+b*sin(c+d*x))*sqrt(a-b*sin(c+d*x)))*Subst( Antiderivative((a+b*x)^(n-1/2)/sqrt(a-b*x),x),x,sin(c+d*x)) <--  FreeQ([a,b,c,d,n],x) && EqQ(a^2-b^2,0) && Not(IntegerQ(2*n)) =#
    @apply_utils Antiderivative((~a + ~(b') * sin(~(c') + ~(d') * ~x)) ^ ~n, ~x) => ((-(2 ^ (~n + 1 / 2)) * (~a) ^ (~n - 1 / 2) * ~b * cos(~c + ~d * ~x)) / (~d * sqrt(~a + ~b * sin(~c + ~d * ~x)))) * HypergeometricFunctions._₂F₁(1 / 2, 1 / 2 - ~n, 3 / 2, (1 / 2) * (1 - (~b * sin(~c + ~d * ~x)) / ~a)) <-- FreeQ([~a, ~b, ~c, ~d, ~n], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && (Not(IntegerQ(2 * ~n)) && GtQ(~a, 0)))
    @apply_utils Antiderivative((~a + ~(b') * sin(~(c') + ~(d') * ~x)) ^ ~n, ~x) => (((~a) ^ IntPart(~n) * (~a + ~b * sin(~c + ~d * ~x)) ^ FracPart(~n)) / (1 + (~b / ~a) * sin(~c + ~d * ~x)) ^ FracPart(~n)) * Antiderivative((1 + (~b / ~a) * sin(~c + ~d * ~x)) ^ ~n, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~n], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && (Not(IntegerQ(2 * ~n)) && Not(GtQ(~a, 0))))
    @apply_utils Antiderivative(sqrt(~a + ~(b') * sin(~(c') + ~(d') * ~x)), ~x) => ((2 * sqrt(~a + ~b)) / ~d) * Elliptic.E((1 / 2) * ((~c - pi / 2) + ~d * ~x), (2 * ~b) / (~a + ~b)) <-- FreeQ([~a, ~b, ~c, ~d], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && GtQ(~a + ~b, 0))
    @apply_utils Antiderivative(sqrt(~a + ~(b') * sin(~(c') + ~(d') * ~x)), ~x) => ((2 * sqrt(~a - ~b)) / ~d) * Elliptic.E((1 / 2) * (~c + pi / 2 + ~d * ~x), (-2 * ~b) / (~a - ~b)) <-- FreeQ([~a, ~b, ~c, ~d], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && GtQ(~a - ~b, 0))
    @apply_utils Antiderivative(sqrt(~a + ~(b') * sin(~(c') + ~(d') * ~x)), ~x) => (sqrt(~a + ~b * sin(~c + ~d * ~x)) / sqrt((~a + ~b * sin(~c + ~d * ~x)) / (~a + ~b))) * Antiderivative(sqrt(~a / (~a + ~b) + (~b / (~a + ~b)) * sin(~c + ~d * ~x)), ~x) <-- FreeQ([~a, ~b, ~c, ~d], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && Not(GtQ(~a + ~b, 0)))
    @apply_utils Antiderivative((~a + ~(b') * sin(~(c') + ~(d') * ~x)) ^ ~n, ~x) => (-(~b) * cos(~c + ~d * ~x) * (~a + ~b * sin(~c + ~d * ~x)) ^ (~n - 1)) / (~d * ~n) + (1 / ~n) * Antiderivative((~a + ~b * sin(~c + ~d * ~x)) ^ (~n - 2) * Simp((~a) ^ 2 * ~n + (~b) ^ 2 * (~n - 1) + ~a * ~b * (2 * ~n - 1) * sin(~c + ~d * ~x), ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && (GtQ(~n, 1) && IntegerQ(2 * ~n)))
    @apply_utils Antiderivative(1 / (~a + ~(b') * sin(~(c') + ~(d') * ~x)), ~x) => With([q = Rt((~a) ^ 2 - (~b) ^ 2, 2)], ~x / q + (2 / (~d * q)) * atan((~b * cos(~c + ~d * ~x)) / (~a + q + ~b * sin(~c + ~d * ~x)))) <-- FreeQ([~a, ~b, ~c, ~d], ~x) && (GtQ((~a) ^ 2 - (~b) ^ 2, 0) && PosQ(~a))
    @apply_utils Antiderivative(1 / (~a + ~(b') * sin(~(c') + ~(d') * ~x)), ~x) => With([q = Rt((~a) ^ 2 - (~b) ^ 2, 2)], -(~x) / q - (2 / (~d * q)) * atan((~b * cos(~c + ~d * ~x)) / ((~a - q) + ~b * sin(~c + ~d * ~x)))) <-- FreeQ([~a, ~b, ~c, ~d], ~x) && (GtQ((~a) ^ 2 - (~b) ^ 2, 0) && NegQ(~a))
    @apply_utils Antiderivative(1 / (~a + ~(b') * sin(~(c') + pi / 2 + ~(d') * ~x)), ~x) => With([e = FreeFactors(tan((~c + ~d * ~x) / 2), ~x)], ((2 * e) / ~d) * Subst(Antiderivative(1 / (~a + ~b + (~a - ~b) * e ^ 2 * (~x) ^ 2), ~x), ~x, tan((~c + ~d * ~x) / 2) / e)) <-- FreeQ([~a, ~b, ~c, ~d], ~x) && NeQ((~a) ^ 2 - (~b) ^ 2, 0)
    @apply_utils Antiderivative(1 / (~a + ~(b') * sin(~(c') + ~(d') * ~x)), ~x) => With([e = FreeFactors(tan((~c + ~d * ~x) / 2), ~x)], ((2 * e) / ~d) * Subst(Antiderivative(1 / (~a + 2 * ~b * e * ~x + ~a * e ^ 2 * (~x) ^ 2), ~x), ~x, tan((~c + ~d * ~x) / 2) / e)) <-- FreeQ([~a, ~b, ~c, ~d], ~x) && NeQ((~a) ^ 2 - (~b) ^ 2, 0)
    @apply_utils Antiderivative(1 / sqrt(~a + ~(b') * sin(~(c') + ~(d') * ~x)), ~x) => (2 / (~d * sqrt(~a + ~b))) * Elliptic.F((1 / 2) * ((~c - pi / 2) + ~d * ~x), (2 * ~b) / (~a + ~b)) <-- FreeQ([~a, ~b, ~c, ~d], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && GtQ(~a + ~b, 0))
    @apply_utils Antiderivative(1 / sqrt(~a + ~(b') * sin(~(c') + ~(d') * ~x)), ~x) => (2 / (~d * sqrt(~a - ~b))) * Elliptic.F((1 / 2) * (~c + pi / 2 + ~d * ~x), (-2 * ~b) / (~a - ~b)) <-- FreeQ([~a, ~b, ~c, ~d], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && GtQ(~a - ~b, 0))
    @apply_utils Antiderivative(1 / sqrt(~a + ~(b') * sin(~(c') + ~(d') * ~x)), ~x) => (sqrt((~a + ~b * sin(~c + ~d * ~x)) / (~a + ~b)) / sqrt(~a + ~b * sin(~c + ~d * ~x))) * Antiderivative(1 / sqrt(~a / (~a + ~b) + (~b / (~a + ~b)) * sin(~c + ~d * ~x)), ~x) <-- FreeQ([~a, ~b, ~c, ~d], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && Not(GtQ(~a + ~b, 0)))
    @apply_utils Antiderivative((~a + ~(b') * sin(~(c') + ~(d') * ~x)) ^ ~n, ~x) => (-(~b) * cos(~c + ~d * ~x) * (~a + ~b * sin(~c + ~d * ~x)) ^ (~n + 1)) / (~d * (~n + 1) * ((~a) ^ 2 - (~b) ^ 2)) + (1 / ((~n + 1) * ((~a) ^ 2 - (~b) ^ 2))) * Antiderivative((~a + ~b * sin(~c + ~d * ~x)) ^ (~n + 1) * Simp(~a * (~n + 1) - ~b * (~n + 2) * sin(~c + ~d * ~x), ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && (LtQ(~n, -1) && IntegerQ(2 * ~n)))
    @apply_utils Antiderivative((~a + ~(b') * sin(~(c') + ~(d') * ~x)) ^ ~n, ~x) => (cos(~c + ~d * ~x) / (~d * sqrt(1 + sin(~c + ~d * ~x)) * sqrt(1 - sin(~c + ~d * ~x)))) * Subst(Antiderivative((~a + ~b * ~x) ^ ~n / (sqrt(1 + ~x) * sqrt(1 - ~x)), ~x), ~x, sin(~c + ~d * ~x)) <-- FreeQ([~a, ~b, ~c, ~d, ~n], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && Not(IntegerQ(2 * ~n)))
    @apply_utils Antiderivative((~a + ~(b') * sin(~(c') + ~(d') * ~x) * cos(~(c') + ~(d') * ~x)) ^ ~n, ~x) => Antiderivative((~a + (~b * sin(2 * ~c + 2 * ~d * ~x)) / 2) ^ ~n, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~n], ~x)
end
