Find every real-valued function $f$ whose domain is an interval $I$ (finite or infinite) having 0 as a left-hand endpoint, such that for every positive member $x$ of $I$ the average of $f$ over the closed interval $[0, x]$ is equal to the geometric mean of the numbers $f(0)$ and $f(x)$.

the set of functions $f(x) = \frac{a}{(1 - c x)^2}$ where $a \geq 0$

Show that \[ f(x) = \frac{a}{(1 - cx)^2} \begin{cases} \text{for } 0 \le x < \frac{1}{c}, & \text{if } c > 0\\ \text{for } 0 \le x < \infty, & \text{if } c \le 0, \end{cases} \] where $a > 0$.

@Eq (Set (Real → Real)) answer
  (@setOf (Real → Real) fun (f : Real → Real) =>
    @Exists Real fun (a : Real) =>
      @Exists Real fun (c : Real) =>
        And (@GE.ge Real Real.instLE a (@OfNat.ofNat Real (nat_lit 0) (@Zero.toOfNat0 Real Real.instZero)))
          (@Eq (Real → Real) f fun (x : Real) =>
            @HDiv.hDiv Real Real Real (@instHDiv Real (@DivInvMonoid.toDiv Real Real.instDivInvMonoid)) a
              (@HPow.hPow Real Nat Real (@instHPow Real Nat (@Monoid.toNatPow Real Real.instMonoid))
                (@HSub.hSub Real Real Real (@instHSub Real Real.instSub)
                  (@OfNat.ofNat Real (nat_lit 1) (@One.toOfNat1 Real Real.instOne))
                  (@HMul.hMul Real Real Real (@instHMul Real Real.instMul) c x))
                (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2))))))

∀ s f, P s f ↔ 0 ≤ f ∧ ∀ x ∈ s, ⨍ t in Ico 0 x, f t = √(f 0 * f x)

answer = {f : ℝ → ℝ | P (Ioi 0) f ∨ (∃ e > 0, P (Ioo 0 e) f)}


Evaluate in closed form \[ \sum_{k=1}^n {n \choose k} k^2. \]

Show that the expression equals $n(n+1)2^{n-2}$.

@Eq (Nat → Nat) answer fun (n_1 : Nat) =>
  @HMul.hMul Nat Nat Nat (@instHMul Nat instMulNat)
    (@HMul.hMul Nat Nat Nat (@instHMul Nat instMulNat) n_1
      (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) n_1 (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))))
    (@HPow.hPow Nat Nat Nat (@instHPow Nat Nat (@Monoid.toNatPow Nat Nat.instMonoid))
      (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))
      (@HSub.hSub Nat Nat Nat (@instHSub Nat instSubNat) n_1 (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))))

answer n = ∑ k in Finset.Icc 1 n, Nat.choose n k * k^2


Find an integral formula (i.e., a function $z$ such that $y(x) = \int_{1}^{x} z(t) dt$) for the solution of the differential equation $$\delta (\delta - 1) (\delta - 2) \cdots (\delta - n + 1) y = f(x)$$ with the initial conditions $y(1) = y'(1) = \cdots = y^{(n-1)}(1) = 0$, where $n \in \mathbb{N}$, $f$ is continuous for all $x \ge 1$, and $\delta$ denotes $x\frac{d}{dx}$.

Show that the solution is $$y(x) = \int_{1}^{x} \frac{(x - t)^{n - 1} f(t)}{(n - 1)!t^n} dt$$.

@Eq ((Real → Real) → Nat → Real → Real → Real) answer fun (f_1 : Real → Real) (n_1 : Nat) (x t : Real) =>
  @HDiv.hDiv Real Real Real (@instHDiv Real (@DivInvMonoid.toDiv Real Real.instDivInvMonoid))
    (@HMul.hMul Real Real Real (@instHMul Real Real.instMul)
      (@HPow.hPow Real Nat Real (@instHPow Real Nat (@Monoid.toNatPow Real Real.instMonoid))
        (@HSub.hSub Real Real Real (@instHSub Real Real.instSub) x t)
        (@HSub.hSub Nat Nat Nat (@instHSub Nat instSubNat) n_1
          (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))))
      (f_1 t))
    (@HMul.hMul Real Real Real (@instHMul Real Real.instMul)
      (@Nat.cast Real Real.instNatCast
        (Nat.factorial
          (@HSub.hSub Nat Nat Nat (@instHSub Nat instSubNat) n_1
            (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))))))
      (@HPow.hPow Real Nat Real (@instHPow Real Nat (@Monoid.toNatPow Real Real.instMonoid)) t n_1))

(ℝ → ℝ) → ℕ → ℝ → ℝ → ℝ

P

ℕ → (ℝ → ℝ) → (ℝ → ℝ)

hP

P 0 = id ∧ ∀ i y, P (i + 1) y = P i (fun x ↦ x * deriv y x - i * y x)

∀ x ≥ 1, y x = ∫ t in (1 : ℝ)..x, answer f n x t


For what integer $a$ does $x^2-x+a$ divide $x^{13}+x+90$?

@Eq Int answer (@OfNat.ofNat Int (nat_lit 2) (@instOfNat (nat_lit 2)))

Polynomial.X^2 - Polynomial.X + (Polynomial.C a) ∣ (Polynomial.X ^ 13 + Polynomial.X + (Polynomial.C 90))


Let $S$ be the set of all numbers of the form $2^m3^n$, where $m$ and $n$ are integers, and let $P$ be the set of all positive real numbers. Is $S$ dense in $P$?


Find every twice-differentiable real-valued function $f$ with domain the set of all real numbers and satisfying the functional equation $(f(x))^2-(f(y))^2=f(x+y)f(x-y)$ for all real numbers $x$ and $y$.

the set of functions of the form $A \sinh(k u)$, $A u$, or $A \sin(k u)$

Show that the solution is the sets of functions $f(u)=A\sinh ku$, $f(u)=Au$, and $f(u)=A\sin ku$ with $A,k \in \mathbb{R}$.

@Eq (Set (Real → Real)) answer
  (@Union.union (Set (Real → Real)) (@Set.instUnion (Real → Real))
    (@Union.union (Set (Real → Real)) (@Set.instUnion (Real → Real))
      (@setOf (Real → Real) fun (x : Real → Real) =>
        @Exists Real fun (A : Real) =>
          @Exists Real fun (k : Real) =>
            @Eq (Real → Real)
              (fun (u : Real) =>
                @HMul.hMul Real Real Real (@instHMul Real Real.instMul) A
                  (Real.sinh (@HMul.hMul Real Real Real (@instHMul Real Real.instMul) k u)))
              x)
      (@setOf (Real → Real) fun (x : Real → Real) =>
        @Exists Real fun (A : Real) =>
          @Eq (Real → Real) (fun (u : Real) => @HMul.hMul Real Real Real (@instHMul Real Real.instMul) A u) x))
    (@setOf (Real → Real) fun (x : Real → Real) =>
      @Exists Real fun (A : Real) =>
        @Exists Real fun (k : Real) =>
          @Eq (Real → Real)
            (fun (u : Real) =>
              @HMul.hMul Real Real Real (@instHMul Real Real.instMul) A
                (Real.sin (@HMul.hMul Real Real Real (@instHMul Real Real.instMul) k u)))
            x))


Let $\alpha$ be a real number. Find all continuous real-valued functions $f : [0, 1] \to (0, \infty)$ such that
\begin{align*}
\int_0^1 f(x) dx &= 1, \\
\int_0^1 x f(x) dx &= \alpha, \\
\int_0^1 x^2 f(x) dx &= \alpha^2. \\
\end{align*}

@Eq (Real → Set (Real → Real)) answer fun (x : Real) =>
  @EmptyCollection.emptyCollection (Set (Real → Real)) (@Set.instEmptyCollection (Real → Real))

ℝ → Set (ℝ → ℝ)

answer α = {f : ℝ → ℝ | (∀ x ∈ Icc 0 1, f x > 0) ∧ ContinuousOn f (Icc 0 1) ∧ ∫ x in (0)..1, f x = 1 ∧ ∫ x in (0)..1, x * f x = α ∧ ∫ x in (0)..1, x^2 * f x = α^2}


Let $\triangle ABC$ satisfy $\angle CAB < \angle BCA < \frac{\pi}{2} < \angle ABC$. If the bisector of the external angle at $A$ meets line $BC$ at $P$, the bisector of the external angle at $B$ meets line $CA$ at $Q$, and $AP = BQ = AB$, find $\angle CAB$.

Show that the solution is $\angle CAB = \frac{\pi}{15}$.

@Eq Real answer
  (@HDiv.hDiv Real Real Real (@instHDiv Real (@DivInvMonoid.toDiv Real Real.instDivInvMonoid)) Real.pi
    (@OfNat.ofNat Real (nat_lit 15)
      (@instOfNatAtLeastTwo Real (nat_lit 15) Real.instNatCast
        (@instNatAtLeastTwo (@OfNat.ofNat Nat (nat_lit 13) (instOfNatNat (nat_lit 13)))))))

hangles

∠ C A B < ∠ B C A ∧ ∠ B C A < π/2 ∧ π/2 < ∠ A B C

hX

Collinear ℝ {X, B, C} ∧ ∠ X A B = (π - ∠ C A B)/2 ∧ dist A X = dist A B

hY

Collinear ℝ {Y, C, A} ∧ ∠ Y B C = (π - ∠ A B C)/2 ∧ dist B Y = dist A B


How many orderings of the integers from $1$ to $n$ satisfy the condition that, for every integer $i$ except the first, there exists some earlier integer in the ordering which differs from $i$ by $1$?

open EuclideanGeometry Topology Filter Complex

@Eq (Nat → Nat) answer fun (n_1 : Nat) =>
  @HPow.hPow Nat Nat Nat (@instHPow Nat Nat (@Monoid.toNatPow Nat Nat.instMonoid))
    (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))
    (@HSub.hSub Nat Nat Nat (@instHSub Nat instSubNat) n_1 (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))))

{p ∈ permsOfFinset (Finset.Icc 1 n) | ∀ m ∈ Finset.Icc 2 n, ∃ k ∈ Finset.Ico 1 m, p m = p k + 1 ∨ p m = p k - 1}.card = answer n


@Eq Real answer
  (@HDiv.hDiv Real Real Real (@instHDiv Real (@DivInvMonoid.toDiv Real Real.instDivInvMonoid))
    (@OfNat.ofNat Real (nat_lit 1) (@One.toOfNat1 Real Real.instOne))
    (@OfNat.ofNat Real (nat_lit 2)
      (@instOfNatAtLeastTwo Real (nat_lit 2) Real.instNatCast
        (@instNatAtLeastTwo (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0)))))))

Tendsto (fun n : ℕ ↦ ∫ x in {x : Fin (n+1) → ℝ | ∀ k : Fin (n+1), x k ∈ Set.Icc 0 1}, (Real.cos (Real.pi/(2 * (n+1)) * ∑ k : Fin (n+1), x k))^2) atTop (𝓝 answer)


Consider polynomial forms $ax^2-bx+c$ with integer coefficients which have two distinct zeros in the open interval $0<x<1$. Exhibit with a proof the least positive integer value of $a$ for which such a polynomial exists.

Show that the minimum possible value for $a$ is $5$.

@Eq Nat answer (@OfNat.ofNat Nat (nat_lit 5) (instOfNatNat (nat_lit 5)))

hS

S = {a | ∃ P : Polynomial ℤ, P.degree = 2 ∧ (∃ z1 z2 : Set.Ioo (0 : ℝ) 1, z1 ≠ z2 ∧ aeval (z1 : ℝ) P = 0 ∧ aeval (z2 : ℝ) P = 0) ∧P.coeff 2 = a ∧ a > 0}


Given real numbers $\{a_i\}$ and $\{b_i\}$, ($i=1,2,3,4$), such that $a_1b_2-a_2b_1 \neq 0$. Consider the set of all solutions $(x_1,x_2,x_3,x_4)$ of the simultaneous equations $a_1x_1+a_2x_2+a_3x_3+a_4x_4=0$ and $b_1x_1+b_2x_2+b_3x_3+b_4x_4=0$, for which no $x_i$ ($i=1,2,3,4$) is zero. Each such solution generates a $4$-tuple of plus and minus signs $(\text{signum }x_1,\text{signum }x_2,\text{signum }x_3,\text{signum }x_4)$. Determine, with a proof, the maximum number of distinct $4$-tuples possible.

Show that the maximum number of distinct $4$-tuples is eight.

@Eq Nat answer (@OfNat.ofNat Nat (nat_lit 8) (instOfNatNat (nat_lit 8)))

hnumtuples

numtuples = {s : Fin 4 → ℝ | ∃ x : Fin 4 → ℝ, (∀ i : Fin 4, x i ≠ 0) ∧ (∑ i : Fin 4, a i * x i) = 0 ∧ (∑ i : Fin 4, b i * x i) = 0 ∧ (∀ i : Fin 4, s i = Real.sign (x i))}.encard


Let $V$ be the set of all quadratic polynomials with real coefficients such that $|P(x)| \le 1$ for all $x \in [0, 1]$. Find the supremum of $|P'(0)|$ across all $P \in V$.

@Eq Real answer
  (@OfNat.ofNat Real (nat_lit 8)
    (@instOfNatAtLeastTwo Real (nat_lit 8) Real.instNatCast
      (@instNatAtLeastTwo (@OfNat.ofNat Nat (nat_lit 6) (instOfNatNat (nat_lit 6))))))

V = {P : ℝ[X] | P.degree = 2 ∧ ∀ x ∈ Set.Icc 0 1, |P.eval x| ≤ 1}

sSup {|(derivative P).eval 0| | P ∈ V} = answer


Find all polynomials of the form $\sum_{0}^{n} a_{i} x^{n-i}$ with $n \ge 1$ and $a_i = \pm 1$ for all $0 \le i \le n$ whose roots are all real.

@Eq (Set (@Polynomial Complex Complex.instSemiring)) answer
  (@Insert.insert (@Polynomial Complex Complex.instSemiring) (Set (@Polynomial Complex Complex.instSemiring))
    (@Set.instInsert (@Polynomial Complex Complex.instSemiring))
    (@HSub.hSub (@Polynomial Complex Complex.instSemiring) (@Polynomial Complex Complex.instSemiring)
      (@Polynomial Complex Complex.instSemiring)
      (@instHSub (@Polynomial Complex Complex.instSemiring) (@Polynomial.sub Complex Complex.instRing))
      (@Polynomial.X Complex Complex.instSemiring)
      (@OfNat.ofNat (@Polynomial Complex Complex.instSemiring) (nat_lit 1)
        (@One.toOfNat1 (@Polynomial Complex Complex.instSemiring) (@Polynomial.one Complex Complex.instSemiring))))
    (@Insert.insert (@Polynomial Complex Complex.instSemiring) (Set (@Polynomial Complex Complex.instSemiring))
      (@Set.instInsert (@Polynomial Complex Complex.instSemiring))
      (@Neg.neg (@Polynomial Complex Complex.instSemiring) (@Polynomial.neg' Complex Complex.instRing)
        (@HSub.hSub (@Polynomial Complex Complex.instSemiring) (@Polynomial Complex Complex.instSemiring)
          (@Polynomial Complex Complex.instSemiring)
          (@instHSub (@Polynomial Complex Complex.instSemiring) (@Polynomial.sub Complex Complex.instRing))
          (@Polynomial.X Complex Complex.instSemiring)
          (@OfNat.ofNat (@Polynomial Complex Complex.instSemiring) (nat_lit 1)
            (@One.toOfNat1 (@Polynomial Complex Complex.instSemiring) (@Polynomial.one Complex Complex.instSemiring)))))
      (@Insert.insert (@Polynomial Complex Complex.instSemiring) (Set (@Polynomial Complex Complex.instSemiring))
        (@Set.instInsert (@Polynomial Complex Complex.instSemiring))
        (@HAdd.hAdd (@Polynomial Complex Complex.instSemiring) (@Polynomial Complex Complex.instSemiring)
          (@Polynomial Complex Complex.instSemiring)
          (@instHAdd (@Polynomial Complex Complex.instSemiring) (@Polynomial.add' Complex Complex.instSemiring))
          (@Polynomial.X Complex Complex.instSemiring)
          (@OfNat.ofNat (@Polynomial Complex Complex.instSemiring) (nat_lit 1)
            (@One.toOfNat1 (@Polynomial Complex Complex.instSemiring) (@Polynomial.one Complex Complex.instSemiring))))
        (@Insert.insert (@Polynomial Complex Complex.instSemiring) (Set (@Polynomial Complex Complex.instSemiring))
          (@Set.instInsert (@Polynomial Complex Complex.instSemiring))
          (@Neg.neg (@Polynomial Complex Complex.instSemiring) (@Polynomial.neg' Complex Complex.instRing)
            (@HAdd.hAdd (@Polynomial Complex Complex.instSemiring) (@Polynomial Complex Complex.instSemiring)
              (@Polynomial Complex Complex.instSemiring)
              (@instHAdd (@Polynomial Complex Complex.instSemiring) (@Polynomial.add' Complex Complex.instSemiring))
              (@Polynomial.X Complex Complex.instSemiring)
              (@OfNat.ofNat (@Polynomial Complex Complex.instSemiring) (nat_lit 1)
                (@One.toOfNat1 (@Polynomial Complex Complex.instSemiring)
                  (@Polynomial.one Complex Complex.instSemiring)))))
          (@Insert.insert (@Polynomial Complex Complex.instSemiring) (Set (@Polynomial Complex Complex.instSemiring))
            (@Set.instInsert (@Polynomial Complex Complex.instSemiring))
            (@HSub.hSub (@Polynomial Complex Complex.instSemiring) (@Polynomial Complex Complex.instSemiring)
              (@Polynomial Complex Complex.instSemiring)
              (@instHSub (@Polynomial Complex Complex.instSemiring) (@Polynomial.sub Complex Complex.instRing))
              (@HAdd.hAdd (@Polynomial Complex Complex.instSemiring) (@Polynomial Complex Complex.instSemiring)
                (@Polynomial Complex Complex.instSemiring)
                (@instHAdd (@Polynomial Complex Complex.instSemiring) (@Polynomial.add' Complex Complex.instSemiring))
                (@HPow.hPow (@Polynomial Complex Complex.instSemiring) Nat (@Polynomial Complex Complex.instSemiring)
                  (@instHPow (@Polynomial Complex Complex.instSemiring) Nat
                    (@Monoid.toNatPow (@Polynomial Complex Complex.instSemiring)
                      (@MonoidWithZero.toMonoid (@Polynomial Complex Complex.instSemiring)
                        (@Semiring.toMonoidWithZero (@Polynomial Complex Complex.instSemiring)
                          (@Polynomial.semiring Complex Complex.instSemiring)))))
                  (@Polynomial.X Complex Complex.instSemiring)
                  (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2))))
                (@Polynomial.X Complex Complex.instSemiring))
              (@OfNat.ofNat (@Polynomial Complex Complex.instSemiring) (nat_lit 1)
                (@One.toOfNat1 (@Polynomial Complex Complex.instSemiring)
                  (@Polynomial.one Complex Complex.instSemiring))))
            (@Insert.insert (@Polynomial Complex Complex.instSemiring) (Set (@Polynomial Complex Complex.instSemiring))
              (@Set.instInsert (@Polynomial Complex Complex.instSemiring))
              (@Neg.neg (@Polynomial Complex Complex.instSemiring) (@Polynomial.neg' Complex Complex.instRing)
                (@HSub.hSub (@Polynomial Complex Complex.instSemiring) (@Polynomial Complex Complex.instSemiring)
                  (@Polynomial Complex Complex.instSemiring)
                  (@instHSub (@Polynomial Complex Complex.instSemiring) (@Polynomial.sub Complex Complex.instRing))
                  (@HAdd.hAdd (@Polynomial Complex Complex.instSemiring) (@Polynomial Complex Complex.instSemiring)
                    (@Polynomial Complex Complex.instSemiring)
                    (@instHAdd (@Polynomial Complex Complex.instSemiring)
                      (@Polynomial.add' Complex Complex.instSemiring))
                    (@HPow.hPow (@Polynomial Complex Complex.instSemiring) Nat
                      (@Polynomial Complex Complex.instSemiring)
                      (@instHPow (@Polynomial Complex Complex.instSemiring) Nat
                        (@Monoid.toNatPow (@Polynomial Complex Complex.instSemiring)
                          (@MonoidWithZero.toMonoid (@Polynomial Complex Complex.instSemiring)
                            (@Semiring.toMonoidWithZero (@Polynomial Complex Complex.instSemiring)
                              (@Polynomial.semiring Complex Complex.instSemiring)))))
                      (@Polynomial.X Complex Complex.instSemiring)
                      (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2))))
                    (@Polynomial.X Complex Complex.instSemiring))
                  (@OfNat.ofNat (@Polynomial Complex Complex.instSemiring) (nat_lit 1)
                    (@One.toOfNat1 (@Polynomial Complex Complex.instSemiring)
                      (@Polynomial.one Complex Complex.instSemiring)))))
              (@Insert.insert (@Polynomial Complex Complex.instSemiring)
                (Set (@Polynomial Complex Complex.instSemiring))
                (@Set.instInsert (@Polynomial Complex Complex.instSemiring))
                (@HSub.hSub (@Polynomial Complex Complex.instSemiring) (@Polynomial Complex Complex.instSemiring)
                  (@Polynomial Complex Complex.instSemiring)
                  (@instHSub (@Polynomial Complex Complex.instSemiring) (@Polynomial.sub Complex Complex.instRing))
                  (@HSub.hSub (@Polynomial Complex Complex.instSemiring) (@Polynomial Complex Complex.instSemiring)
                    (@Polynomial Complex Complex.instSemiring)
                    (@instHSub (@Polynomial Complex Complex.instSemiring) (@Polynomial.sub Complex Complex.instRing))
                    (@HPow.hPow (@Polynomial Complex Complex.instSemiring) Nat
                      (@Polynomial Complex Complex.instSemiring)
                      (@instHPow (@Polynomial Complex Complex.instSemiring) Nat
                        (@Monoid.toNatPow (@Polynomial Complex Complex.instSemiring)
                          (@MonoidWithZero.toMonoid (@Polynomial Complex Complex.instSemiring)
                            (@Semiring.toMonoidWithZero (@Polynomial Complex Complex.instSemiring)
                              (@Polynomial.semiring Complex Complex.instSemiring)))))
                      (@Polynomial.X Complex Complex.instSemiring)
                      (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2))))
                    (@Polynomial.X Complex Complex.instSemiring))
                  (@OfNat.ofNat (@Polynomial Complex Complex.instSemiring) (nat_lit 1)
                    (@One.toOfNat1 (@Polynomial Complex Complex.instSemiring)
                      (@Polynomial.one Complex Complex.instSemiring))))
                (@Insert.insert (@Polynomial Complex Complex.instSemiring)
                  (Set (@Polynomial Complex Complex.instSemiring))
                  (@Set.instInsert (@Polynomial Complex Complex.instSemiring))
                  (@Neg.neg (@Polynomial Complex Complex.instSemiring) (@Polynomial.neg' Complex Complex.instRing)
                    (@HSub.hSub (@Polynomial Complex Complex.instSemiring) (@Polynomial Complex Complex.instSemiring)
                      (@Polynomial Complex Complex.instSemiring)
                      (@instHSub (@Polynomial Complex Complex.instSemiring) (@Polynomial.sub Complex Complex.instRing))
                      (@HSub.hSub (@Polynomial Complex Complex.instSemiring) (@Polynomial Complex Complex.instSemiring)
                        (@Polynomial Complex Complex.instSemiring)
                        (@instHSub (@Polynomial Complex Complex.instSemiring)
                          (@Polynomial.sub Complex Complex.instRing))
                        (@HPow.hPow (@Polynomial Complex Complex.instSemiring) Nat
                          (@Polynomial Complex Complex.instSemiring)
                          (@instHPow (@Polynomial Complex Complex.instSemiring) Nat
                            (@Monoid.toNatPow (@Polynomial Complex Complex.instSemiring)
                              (@MonoidWithZero.toMonoid (@Polynomial Complex Complex.instSemiring)
                                (@Semiring.toMonoidWithZero (@Polynomial Complex Complex.instSemiring)
                                  (@Polynomial.semiring Complex Complex.instSemiring)))))
                          (@Polynomial.X Complex Complex.instSemiring)
                          (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2))))
                        (@Polynomial.X Complex Complex.instSemiring))
                      (@OfNat.ofNat (@Polynomial Complex Complex.instSemiring) (nat_lit 1)
                        (@One.toOfNat1 (@Polynomial Complex Complex.instSemiring)
                          (@Polynomial.one Complex Complex.instSemiring)))))
                  (@Insert.insert (@Polynomial Complex Complex.instSemiring)
                    (Set (@Polynomial Complex Complex.instSemiring))
                    (@Set.instInsert (@Polynomial Complex Complex.instSemiring))
                    (@HSub.hSub (@Polynomial Complex Complex.instSemiring) (@Polynomial Complex Complex.instSemiring)
                      (@Polynomial Complex Complex.instSemiring)
                      (@instHSub (@Polynomial Complex Complex.instSemiring) (@Polynomial.sub Complex Complex.instRing))
                      (@HSub.hSub (@Polynomial Complex Complex.instSemiring) (@Polynomial Complex Complex.instSemiring)
                        (@Polynomial Complex Complex.instSemiring)
                        (@instHSub (@Polynomial Complex Complex.instSemiring)
                          (@Polynomial.sub Complex Complex.instRing))
                        (@HAdd.hAdd (@Polynomial Complex Complex.instSemiring)
                          (@Polynomial Complex Complex.instSemiring) (@Polynomial Complex Complex.instSemiring)
                          (@instHAdd (@Polynomial Complex Complex.instSemiring)
                            (@Polynomial.add' Complex Complex.instSemiring))
                          (@HPow.hPow (@Polynomial Complex Complex.instSemiring) Nat
                            (@Polynomial Complex Complex.instSemiring)
                            (@instHPow (@Polynomial Complex Complex.instSemiring) Nat
                              (@Monoid.toNatPow (@Polynomial Complex Complex.instSemiring)
                                (@MonoidWithZero.toMonoid (@Polynomial Complex Complex.instSemiring)
                                  (@Semiring.toMonoidWithZero (@Polynomial Complex Complex.instSemiring)
                                    (@Polynomial.semiring Complex Complex.instSemiring)))))
                            (@Polynomial.X Complex Complex.instSemiring)
                            (@OfNat.ofNat Nat (nat_lit 3) (instOfNatNat (nat_lit 3))))
                          (@HPow.hPow (@Polynomial Complex Complex.instSemiring) Nat
                            (@Polynomial Complex Complex.instSemiring)
                            (@instHPow (@Polynomial Complex Complex.instSemiring) Nat
                              (@Monoid.toNatPow (@Polynomial Complex Complex.instSemiring)
                                (@MonoidWithZero.toMonoid (@Polynomial Complex Complex.instSemiring)
                                  (@Semiring.toMonoidWithZero (@Polynomial Complex Complex.instSemiring)
                                    (@Polynomial.semiring Complex Complex.instSemiring)))))
                            (@Polynomial.X Complex Complex.instSemiring)
                            (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))))
                        (@Polynomial.X Complex Complex.instSemiring))
                      (@OfNat.ofNat (@Polynomial Complex Complex.instSemiring) (nat_lit 1)
                        (@One.toOfNat1 (@Polynomial Complex Complex.instSemiring)
                          (@Polynomial.one Complex Complex.instSemiring))))
                    (@Insert.insert (@Polynomial Complex Complex.instSemiring)
                      (Set (@Polynomial Complex Complex.instSemiring))
                      (@Set.instInsert (@Polynomial Complex Complex.instSemiring))
                      (@Neg.neg (@Polynomial Complex Complex.instSemiring) (@Polynomial.neg' Complex Complex.instRing)
                        (@HSub.hSub (@Polynomial Complex Complex.instSemiring)
                          (@Polynomial Complex Complex.instSemiring) (@Polynomial Complex Complex.instSemiring)
                          (@instHSub (@Polynomial Complex Complex.instSemiring)
                            (@Polynomial.sub Complex Complex.instRing))
                          (@HSub.hSub (@Polynomial Complex Complex.instSemiring)
                            (@Polynomial Complex Complex.instSemiring) (@Polynomial Complex Complex.instSemiring)
                            (@instHSub (@Polynomial Complex Complex.instSemiring)
                              (@Polynomial.sub Complex Complex.instRing))
                            (@HAdd.hAdd (@Polynomial Complex Complex.instSemiring)
                              (@Polynomial Complex Complex.instSemiring) (@Polynomial Complex Complex.instSemiring)
                              (@instHAdd (@Polynomial Complex Complex.instSemiring)
                                (@Polynomial.add' Complex Complex.instSemiring))
                              (@HPow.hPow (@Polynomial Complex Complex.instSemiring) Nat
                                (@Polynomial Complex Complex.instSemiring)
                                (@instHPow (@Polynomial Complex Complex.instSemiring) Nat
                                  (@Monoid.toNatPow (@Polynomial Complex Complex.instSemiring)
                                    (@MonoidWithZero.toMonoid (@Polynomial Complex Complex.instSemiring)
                                      (@Semiring.toMonoidWithZero (@Polynomial Complex Complex.instSemiring)
                                        (@Polynomial.semiring Complex Complex.instSemiring)))))
                                (@Polynomial.X Complex Complex.instSemiring)
                                (@OfNat.ofNat Nat (nat_lit 3) (instOfNatNat (nat_lit 3))))
                              (@HPow.hPow (@Polynomial Complex Complex.instSemiring) Nat
                                (@Polynomial Complex Complex.instSemiring)
                                (@instHPow (@Polynomial Complex Complex.instSemiring) Nat
                                  (@Monoid.toNatPow (@Polynomial Complex Complex.instSemiring)
                                    (@MonoidWithZero.toMonoid (@Polynomial Complex Complex.instSemiring)
                                      (@Semiring.toMonoidWithZero (@Polynomial Complex Complex.instSemiring)
                                        (@Polynomial.semiring Complex Complex.instSemiring)))))
                                (@Polynomial.X Complex Complex.instSemiring)
                                (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))))
                            (@Polynomial.X Complex Complex.instSemiring))
                          (@OfNat.ofNat (@Polynomial Complex Complex.instSemiring) (nat_lit 1)
                            (@One.toOfNat1 (@Polynomial Complex Complex.instSemiring)
                              (@Polynomial.one Complex Complex.instSemiring)))))
                      (@Insert.insert (@Polynomial Complex Complex.instSemiring)
                        (Set (@Polynomial Complex Complex.instSemiring))
                        (@Set.instInsert (@Polynomial Complex Complex.instSemiring))
                        (@HAdd.hAdd (@Polynomial Complex Complex.instSemiring)
                          (@Polynomial Complex Complex.instSemiring) (@Polynomial Complex Complex.instSemiring)
                          (@instHAdd (@Polynomial Complex Complex.instSemiring)
                            (@Polynomial.add' Complex Complex.instSemiring))
                          (@HSub.hSub (@Polynomial Complex Complex.instSemiring)
                            (@Polynomial Complex Complex.instSemiring) (@Polynomial Complex Complex.instSemiring)
                            (@instHSub (@Polynomial Complex Complex.instSemiring)
                              (@Polynomial.sub Complex Complex.instRing))
                            (@HSub.hSub (@Polynomial Complex Complex.instSemiring)
                              (@Polynomial Complex Complex.instSemiring) (@Polynomial Complex Complex.instSemiring)
                              (@instHSub (@Polynomial Complex Complex.instSemiring)
                                (@Polynomial.sub Complex Complex.instRing))
                              (@HPow.hPow (@Polynomial Complex Complex.instSemiring) Nat
                                (@Polynomial Complex Complex.instSemiring)
                                (@instHPow (@Polynomial Complex Complex.instSemiring) Nat
                                  (@Monoid.toNatPow (@Polynomial Complex Complex.instSemiring)
                                    (@MonoidWithZero.toMonoid (@Polynomial Complex Complex.instSemiring)
                                      (@Semiring.toMonoidWithZero (@Polynomial Complex Complex.instSemiring)
                                        (@Polynomial.semiring Complex Complex.instSemiring)))))
                                (@Polynomial.X Complex Complex.instSemiring)
                                (@OfNat.ofNat Nat (nat_lit 3) (instOfNatNat (nat_lit 3))))
                              (@HPow.hPow (@Polynomial Complex Complex.instSemiring) Nat
                                (@Polynomial Complex Complex.instSemiring)
                                (@instHPow (@Polynomial Complex Complex.instSemiring) Nat
                                  (@Monoid.toNatPow (@Polynomial Complex Complex.instSemiring)
                                    (@MonoidWithZero.toMonoid (@Polynomial Complex Complex.instSemiring)
                                      (@Semiring.toMonoidWithZero (@Polynomial Complex Complex.instSemiring)
                                        (@Polynomial.semiring Complex Complex.instSemiring)))))
                                (@Polynomial.X Complex Complex.instSemiring)
                                (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))))
                            (@Polynomial.X Complex Complex.instSemiring))
                          (@OfNat.ofNat (@Polynomial Complex Complex.instSemiring) (nat_lit 1)
                            (@One.toOfNat1 (@Polynomial Complex Complex.instSemiring)
                              (@Polynomial.one Complex Complex.instSemiring))))
                        (@Singleton.singleton (@Polynomial Complex Complex.instSemiring)
                          (Set (@Polynomial Complex Complex.instSemiring))
                          (@Set.instSingletonSet (@Polynomial Complex Complex.instSemiring))
                          (@Neg.neg (@Polynomial Complex Complex.instSemiring)
                            (@Polynomial.neg' Complex Complex.instRing)
                            (@HAdd.hAdd (@Polynomial Complex Complex.instSemiring)
                              (@Polynomial Complex Complex.instSemiring) (@Polynomial Complex Complex.instSemiring)
                              (@instHAdd (@Polynomial Complex Complex.instSemiring)
                                (@Polynomial.add' Complex Complex.instSemiring))
                              (@HSub.hSub (@Polynomial Complex Complex.instSemiring)
                                (@Polynomial Complex Complex.instSemiring) (@Polynomial Complex Complex.instSemiring)
                                (@instHSub (@Polynomial Complex Complex.instSemiring)
                                  (@Polynomial.sub Complex Complex.instRing))
                                (@HSub.hSub (@Polynomial Complex Complex.instSemiring)
                                  (@Polynomial Complex Complex.instSemiring) (@Polynomial Complex Complex.instSemiring)
                                  (@instHSub (@Polynomial Complex Complex.instSemiring)
                                    (@Polynomial.sub Complex Complex.instRing))
                                  (@HPow.hPow (@Polynomial Complex Complex.instSemiring) Nat
                                    (@Polynomial Complex Complex.instSemiring)
                                    (@instHPow (@Polynomial Complex Complex.instSemiring) Nat
                                      (@Monoid.toNatPow (@Polynomial Complex Complex.instSemiring)
                                        (@MonoidWithZero.toMonoid (@Polynomial Complex Complex.instSemiring)
                                          (@Semiring.toMonoidWithZero (@Polynomial Complex Complex.instSemiring)
                                            (@Polynomial.semiring Complex Complex.instSemiring)))))
                                    (@Polynomial.X Complex Complex.instSemiring)
                                    (@OfNat.ofNat Nat (nat_lit 3) (instOfNatNat (nat_lit 3))))
                                  (@HPow.hPow (@Polynomial Complex Complex.instSemiring) Nat
                                    (@Polynomial Complex Complex.instSemiring)
                                    (@instHPow (@Polynomial Complex Complex.instSemiring) Nat
                                      (@Monoid.toNatPow (@Polynomial Complex Complex.instSemiring)
                                        (@MonoidWithZero.toMonoid (@Polynomial Complex Complex.instSemiring)
                                          (@Semiring.toMonoidWithZero (@Polynomial Complex Complex.instSemiring)
                                            (@Polynomial.semiring Complex Complex.instSemiring)))))
                                    (@Polynomial.X Complex Complex.instSemiring)
                                    (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))))
                                (@Polynomial.X Complex Complex.instSemiring))
                              (@OfNat.ofNat (@Polynomial Complex Complex.instSemiring) (nat_lit 1)
                                (@One.toOfNat1 (@Polynomial Complex Complex.instSemiring)
                                  (@Polynomial.one Complex Complex.instSemiring)))))))))))))))))

{P : ℂ[X] | P.natDegree ≥ 1 ∧ (∀ k ∈ Set.Icc 0 P.natDegree, P.coeff k = 1 ∨ P.coeff k = -1) ∧
    ∀ z : ℂ, P.eval z = 0 → ∃ r : ℝ, r = z} = answer


Let $p$ be a prime number. Find the number of distinct $2 \times 2$ matrices $$\begin{pmatrix} a & b \\ c & d \end{pmatrix}$$ such that $a, b, c, d \in \{0, 1, ..., p - 1\}$, $a + d \equiv 1 \pmod p$, and $ad - bc \equiv 0 \pmod p$.

open Finset Polynomial Topology Filter Metric

@Eq (Nat → Nat) answer fun (p_1 : Nat) =>
  @HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat)
    (@HPow.hPow Nat Nat Nat (@instHPow Nat Nat (@Monoid.toNatPow Nat Nat.instMonoid)) p_1
      (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2))))
    p_1

{M : Matrix (Fin 2) (Fin 2) (ZMod p) | M 0 0 + M 1 1 = 1 ∧ M 0 0 * M 1 1 - M 0 1 * M 1 0 = 0}.ncard = answer p


What are the possible ranges (across all real inputs $x$ and $y$) of a polynomial $f(x, y)$ with real coefficients?

{{x} | x : ℝ} ∪ {Set.Ici x | x : ℝ} ∪ {Set.Iic x | x : ℝ} ∪ {Set.Iio x | x : ℝ} ∪ {Set.Ioi x | x : ℝ} ∪ {Set.univ}

Show that the possibles ranges are a single point, any half-open or half-closed semi-infinite interval, or all real numbers.

@Eq (Set (Set Real)) answer
  (@Union.union (Set (Set Real)) (@Set.instUnion (Set Real))
    (@Union.union (Set (Set Real)) (@Set.instUnion (Set Real))
      (@Union.union (Set (Set Real)) (@Set.instUnion (Set Real))
        (@Union.union (Set (Set Real)) (@Set.instUnion (Set Real))
          (@Union.union (Set (Set Real)) (@Set.instUnion (Set Real))
            (@setOf (Set Real) fun (x : Set Real) =>
              @Exists Real fun (x_1 : Real) =>
                @Eq (Set Real) (@Singleton.singleton Real (Set Real) (@Set.instSingletonSet Real) x_1) x)
            (@setOf (Set Real) fun (x : Set Real) =>
              @Exists Real fun (x_1 : Real) => @Eq (Set Real) (@Set.Ici Real Real.instPreorder x_1) x))
          (@setOf (Set Real) fun (x : Set Real) =>
            @Exists Real fun (x_1 : Real) => @Eq (Set Real) (@Set.Iic Real Real.instPreorder x_1) x))
        (@setOf (Set Real) fun (x : Set Real) =>
          @Exists Real fun (x_1 : Real) => @Eq (Set Real) (@Set.Iio Real Real.instPreorder x_1) x))
      (@setOf (Set Real) fun (x : Set Real) =>
        @Exists Real fun (x_1 : Real) => @Eq (Set Real) (@Set.Ioi Real Real.instPreorder x_1) x))
    (@Singleton.singleton (Set Real) (Set (Set Real)) (@Set.instSingletonSet (Set Real)) (@Set.univ Real)))

answer = {{z : ℝ | ∃ x : Fin 2 → ℝ, MvPolynomial.eval x f = z} | f : MvPolynomial (Fin 2) ℝ}


Show that a finite group can not be the union of two of its proper subgroups. Does the statement remain true if 'two' is replaced by 'three'?

Show that the statement is no longer true if 'two' is replaced by 'three'.

∀ n, P n ↔ ∀ (G : Type) [Group G] [Finite G],
      ∀ H : Fin n → Subgroup G, (∀ i, H i < ⊤) → ⋃ i, (H i : Set G) < ⊤


Find the length of the longest possible sequence of equal nonzero digits (in base 10) in which a perfect square can terminate. Also, find the smallest square that attains this length.

The maximum attainable length is $3$; the smallest such square is $38^2 = 1444$.

@Eq (Prod Nat Nat) answer
  (@Prod.mk Nat Nat (@OfNat.ofNat Nat (nat_lit 3) (instOfNatNat (nat_lit 3)))
    (@OfNat.ofNat Nat (nat_lit 1444) (instOfNatNat (nat_lit 1444))))

hL

∀ n : ℕ, L n ≤ (Nat.digits 10 n).length ∧
(∀ k : ℕ, k < L n → (Nat.digits 10 n)[k]! = (Nat.digits 10 n)[0]!) ∧
(L n ≠ (Nat.digits 10 n).length → (Nat.digits 10 n)[L n]! ≠ (Nat.digits 10 n)[0]!)

(∃ n : ℕ, (Nat.digits 10 (n^2))[0]! ≠ 0 ∧ L (n^2) = answer.1) ∧
(∀ n : ℕ, (Nat.digits 10 (n^2))[0]! ≠ 0 → L (n^2) ≤ answer.1) ∧
(∃ m : ℕ, m^2 = answer.2) ∧
L (answer.2) = answer.1 ∧
(Nat.digits 10 answer.2)[0]! ≠ 0 ∧
∀ n : ℕ, (Nat.digits 10 (n^2))[0]! ≠ 0 ∧ L (n^2) = answer.1 → n^2 ≥ answer.2


Evaluate the infinite product $\lim_{n \to \infty} \frac{1}{n^4} \prod_{i = 1}^{2n} (n^2 + i^2)^{1/n}$.

Show that the solution is $e^{2 \log(5) - 4 + 2 arctan(2)}$.

open Metric Set EuclideanGeometry Filter Topology

@Eq Real answer
  (Real.exp
    (@HAdd.hAdd Real Real Real (@instHAdd Real Real.instAdd)
      (@HSub.hSub Real Real Real (@instHSub Real Real.instSub)
        (@HMul.hMul Real Real Real (@instHMul Real Real.instMul)
          (@OfNat.ofNat Real (nat_lit 2)
            (@instOfNatAtLeastTwo Real (nat_lit 2) Real.instNatCast
              (@instNatAtLeastTwo (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))))))
          (Real.log
            (@OfNat.ofNat Real (nat_lit 5)
              (@instOfNatAtLeastTwo Real (nat_lit 5) Real.instNatCast
                (@instNatAtLeastTwo (@OfNat.ofNat Nat (nat_lit 3) (instOfNatNat (nat_lit 3))))))))
        (@OfNat.ofNat Real (nat_lit 4)
          (@instOfNatAtLeastTwo Real (nat_lit 4) Real.instNatCast
            (@instNatAtLeastTwo (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))))))
      (@HMul.hMul Real Real Real (@instHMul Real Real.instMul)
        (@OfNat.ofNat Real (nat_lit 2)
          (@instOfNatAtLeastTwo Real (nat_lit 2) Real.instNatCast
            (@instNatAtLeastTwo (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))))))
        (Real.arctan
          (@OfNat.ofNat Real (nat_lit 2)
            (@instOfNatAtLeastTwo Real (nat_lit 2) Real.instNatCast
              (@instNatAtLeastTwo (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))))))))))

Tendsto (fun n => 1/(n^4) * ∏ i in Finset.Icc (1 : ℤ) (2*n), ((n^2 + i^2) : ℝ)^((1 : ℝ)/n)) atTop (𝓝 answer)


Determine all polynomials $P(x)$ such that $P(x^2 + 1) = (P(x))^2 + 1$ and $P(0) = 0$.

Show that the only such polynomial is the identity function.

@Eq (Set (@Polynomial Real Real.semiring)) answer
  (@Singleton.singleton (@Polynomial Real Real.semiring) (Set (@Polynomial Real Real.semiring))
    (@Set.instSingletonSet (@Polynomial Real Real.semiring)) (@Polynomial.X Real Real.semiring))

∀ P : Polynomial ℝ, P ∈ answer ↔ (P.eval 0 = 0 ∧ (∀ x : ℝ, P.eval (x^2 + 1) = (P.eval x)^2 + 1))


After each play of a certain game of solitaire, the player receives either $a$ or $b$ points, where $a$ and $b$ are positive integers with $a > b$; scores accumulate from play to play. If there are $35$ unattainable scores, one of which is $58$, find $a$ and $b$.

Show that the solution is $a = 11$ and $b = 8$.

@Eq (Prod Int Int) answer
  (@Prod.mk Int Int (@OfNat.ofNat Int (nat_lit 11) (@instOfNat (nat_lit 11)))
    (@OfNat.ofNat Int (nat_lit 8) (@instOfNat (nat_lit 8))))

pab

ℤ → ℤ → Prop

hpab

∀ x y, pab x y ↔
    {s : ℕ | ¬∃ m n : ℕ, m*x + n*y = s}.ncard = 35 ∧
    ¬∃ m n : ℕ, m*x + n*y = 58


Find all functions $F : \mathbb{R} \setminus \{0, 1\} \to \mathbb{R}$ that satisfy $F(x) + F\left(\frac{x - 1}{x}\right) = 1 + x$ for all $x \in \mathbb{R} \setminus \{0, 1\}$.

The only such function is $F(x) = \frac{x^3 - x^2 - 1}{2x(x - 1)}$.

@Eq (Set (Real → Real)) answer
  (@Singleton.singleton (Real → Real) (Set (Real → Real)) (@Set.instSingletonSet (Real → Real)) fun (x : Real) =>
    @HDiv.hDiv Real Real Real (@instHDiv Real (@DivInvMonoid.toDiv Real Real.instDivInvMonoid))
      (@HSub.hSub Real Real Real (@instHSub Real Real.instSub)
        (@HSub.hSub Real Real Real (@instHSub Real Real.instSub)
          (@HPow.hPow Real Nat Real (@instHPow Real Nat (@Monoid.toNatPow Real Real.instMonoid)) x
            (@OfNat.ofNat Nat (nat_lit 3) (instOfNatNat (nat_lit 3))))
          (@HPow.hPow Real Nat Real (@instHPow Real Nat (@Monoid.toNatPow Real Real.instMonoid)) x
            (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))))
        (@OfNat.ofNat Real (nat_lit 1) (@One.toOfNat1 Real Real.instOne)))
      (@HMul.hMul Real Real Real (@instHMul Real Real.instMul)
        (@HMul.hMul Real Real Real (@instHMul Real Real.instMul)
          (@OfNat.ofNat Real (nat_lit 2)
            (@instOfNatAtLeastTwo Real (nat_lit 2) Real.instNatCast
              (@instNatAtLeastTwo (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))))))
          x)
        (@HSub.hSub Real Real Real (@instHSub Real Real.instSub) x
          (@OfNat.ofNat Real (nat_lit 1) (@One.toOfNat1 Real Real.instOne)))))

hP

P = fun (F : ℝ → ℝ) => ∀ x ∈ S, F x + F ((x - 1)/x) = 1 + x

∀ F ∈ answer, P F ∧ ∀ f : ℝ → ℝ, P f → ∃ F ∈ answer, (∀ x ∈ S, f x = F x)


We call a function $f$ from $[0,1]$ to the reals to be supercontinuous on $[0,1]$ if the Cesaro-limit exists for the sequence $f(x_1), f(x_2), f(x_3), \dots$ whenever it does for the sequence $x_1, x_2, x_3 \dots$. Find all supercontinuous functions on $[0,1]$.

the set of all linear functions on [0,1]

Show that the solution is the set of affine functions.

open EuclideanGeometry Filter Topology Set

@Eq (Set (Real → Real)) answer
  (@setOf (Real → Real) fun (f : Real → Real) =>
    @Exists Real fun (A : Real) =>
      @Exists Real fun (B : Real) =>
        ∀ (x : Real),
          @Membership.mem Real (Set Real) (@Set.instMembership Real)
              (@Set.Icc Real Real.instPreorder (@OfNat.ofNat Real (nat_lit 0) (@Zero.toOfNat0 Real Real.instZero))
                (@OfNat.ofNat Real (nat_lit 1) (@One.toOfNat1 Real Real.instOne)))
              x →
            @Eq Real (f x)
              (@HAdd.hAdd Real Real Real (@instHAdd Real Real.instAdd)
                (@HMul.hMul Real Real Real (@instHMul Real Real.instMul) A x) B))

∀ x, climit_exists x ↔ ∃ C : ℝ, Tendsto (fun n => (∑ i in Finset.range n, (x i))/(n : ℝ)) atTop (𝓝 C)

hsupercontinuous

∀ f, supercontinuous f ↔ ∀ (x : ℕ → ℝ), (∀ i : ℕ, x i ∈ Icc 0 1) → climit_exists x → climit_exists (fun i => f (x i))


Let $x : \mathbb{R} \to \mathbb{R}$ be a twice differentiable function whose second derivative is nonstrictly decreasing. If $x(t) - x(0) = s$, $x'(0) = 0$, and $x'(t) = v$ for some $t > 0$, find the maximum possible value of $t$ in terms of $s$ and $v$.

Show that the maximum possible time is $t = \frac{2s}{v}$.

open EuclideanGeometry Filter Topology Set MeasureTheory Metric

@Eq (Real → Real → Real) answer fun (s_1 v_1 : Real) =>
  @HDiv.hDiv Real Real Real (@instHDiv Real (@DivInvMonoid.toDiv Real Real.instDivInvMonoid))
    (@HMul.hMul Real Real Real (@instHMul Real Real.instMul)
      (@OfNat.ofNat Real (nat_lit 2)
        (@instOfNatAtLeastTwo Real (nat_lit 2) Real.instNatCast
          (@instNatAtLeastTwo (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))))))
      s_1)
    v_1

valid

ℝ → (ℝ → ℝ) → Prop

hvalid

∀ t x, valid t x ↔
      DifferentiableOn ℝ x (Set.Icc 0 t) ∧ DifferentiableOn ℝ (deriv x) (Set.Icc 0 t) ∧
      AntitoneOn (deriv (deriv x)) (Set.Icc 0 t) ∧
      deriv x 0 = 0 ∧ deriv x t = v ∧ x t - x 0 = s

IsGreatest {t | ∃ x : ℝ → ℝ, valid t x} (answer s v)


Consider an infinite series whose $n$th term is given by $\pm \frac{1}{n}$, where the actual values of the $\pm$ signs repeat in blocks of $8$ (so the $\frac{1}{9}$ term has the same sign as the $\frac{1}{1}$ term, and so on). Call such a sequence balanced if each block contains four $+$ and four $-$ signs. Prove that being balanced is a sufficient condition for the sequence to converge. Is being balanced also necessary for the sequence to converge?

open Nat Set MeasureTheory Topology Filter

hL

L.length = 8 ∧ ∀ i : Fin L.length, L[i] = 1 ∨ L[i] = -1

hpluses

pluses = {i : Fin L.length | L[i] = 1}.ncard

hS

S = fun n : ℕ ↦ ∑ i in Finset.Icc 1 n, L[i % 8]/i

answer ↔ ((∃ l : ℝ, Tendsto S atTop (𝓝 l)) → pluses = 4)


How many zeros does the function $f(x) = 2^x - 1 - x^2$ have on the real line?

@Eq Nat answer (@OfNat.ofNat Nat (nat_lit 3) (instOfNatNat (nat_lit 3)))


Suppose $f$ is a function on $[0,1]$ with continuous derivative satisfying $0 < f'(x) \leq 1$ and $f 0 = 0$. Prove that $\left[\int_0^1 f(x) dx\right]]^2 \geq \int_0^1 (f(x))^3 dx$, and find an example where equality holds.

Show that one such example where equality holds is the identity function.

@Eq (Real → Real) answer fun (x : Real) => x

hprop = fun g => ContDiff ℝ 1 g ∧ (∀ x : ℝ, 0 < deriv g x ∧ deriv g x ≤ 1) ∧ g 0 = 0

hprop answer ∧ (∫ x in Icc 0 1, answer x)^2 = ∫ x in Icc 0 1, (answer x)^3


Call a set of positive integers 'conspiratorial' if no three of them are pairwise relatively prime. What is the largest number of elements in any conspiratorial subset of the integers 1 through 16?

@Eq Nat answer (@OfNat.ofNat Nat (nat_lit 11) (instOfNatNat (nat_lit 11)))

hconspiratorial

∀ S, conspiratorial S ↔ ∀ a ∈ S, ∀ b ∈ S, ∀ c ∈ S, (a > 0 ∧ b > 0 ∧ c > 0) ∧ ((a ≠ b ∧ b ≠ c ∧ a ≠ c) → (Int.gcd a b > 1 ∨ Int.gcd b c > 1 ∨ Int.gcd a c > 1))

IsGreatest {k | ∃ S, S ⊆ Icc 1 16 ∧ conspiratorial S ∧ S.encard = k} answer


A well-known theorem asserts that a prime $p > 2$ can be written as the sum of two perfect squres if and only if $p \equiv 1 \bmod 4$. Find which primes $p > 2$ can be written in each of the following forms, using (not necessarily positive) integers $x$ and $y$: (a) $x^2 + 16y^2$, (b) $4x^2 + 4xy + 5y^2$.

({p : ℕ | p.Prime ∧ p ≡ 1 [MOD 8]}, {p : ℕ | p.Prime ∧ p ≡ 5 [MOD 8]})

Show that that the answer to (a) is the set of primes which are $1 \bmod 8$, and the solution to (b) is the set of primes which are $5 \bmod 8$.

@Eq (Prod (Set Nat) (Set Nat)) answer
  (@Prod.mk (Set Nat) (Set Nat)
    (@setOf Nat fun (p_1 : Nat) =>
      And (Nat.Prime p_1)
        (Nat.ModEq (@OfNat.ofNat Nat (nat_lit 8) (instOfNatNat (nat_lit 8))) p_1
          (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))))
    (@setOf Nat fun (p_1 : Nat) =>
      And (Nat.Prime p_1)
        (Nat.ModEq (@OfNat.ofNat Nat (nat_lit 8) (instOfNatNat (nat_lit 8))) p_1
          (@OfNat.ofNat Nat (nat_lit 5) (instOfNatNat (nat_lit 5))))))

∀ p : ℕ, p.Prime ∧ p > 2 → ((∃ m n : ℤ, p = m^2 + n^2) ↔ p ≡ 1 [MOD 4])

∀ p : ℕ,
    ((p.Prime ∧ p > 2 ∧ (∃ x y : ℤ, p = x^2 + 16*y^2)) ↔ p ∈ answer.1) ∧
    ((p.Prime ∧ p > 2 ∧ (∃ x y : ℤ, p = 4*x^2 + 4*x*y + 5*y^2)) ↔ p ∈ answer.2)


Evaluate in closed form: $\frac{1}{2^{n-1}} \sum_{k < n/2} (n-2k)*{n \choose k}$.

Show that the solution is $\frac{n}{2^{n-1}} * {(n-1) \choose \left[ (n-1)/2 \right]}$.

@Eq (Nat → Rat) answer fun (n_1 : Nat) =>
  @HMul.hMul Rat Rat Rat (@instHMul Rat Rat.instMul)
    (@HDiv.hDiv Rat Rat Rat (@instHDiv Rat Rat.instDiv) (@OfNat.ofNat Rat (nat_lit 1) (@Rat.instOfNat (nat_lit 1)))
      (@HPow.hPow Rat Nat Rat (@instHPow Rat Nat Rat.instPowNat)
        (@OfNat.ofNat Rat (nat_lit 2) (@Rat.instOfNat (nat_lit 2)))
        (@HSub.hSub Nat Nat Nat (@instHSub Nat instSubNat) n_1
          (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))))))
    (@HMul.hMul Rat Rat Rat (@instHMul Rat Rat.instMul) (@Nat.cast Rat Rat.instNatCast n_1)
      (@Nat.cast Rat Rat.instNatCast
        (Nat.choose
          (@HSub.hSub Nat Nat Nat (@instHSub Nat instSubNat) n_1
            (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))))
          (@Nat.floor Nat Nat.instOrderedSemiring instFloorSemiringNat
            (@HDiv.hDiv Nat Nat Nat (@instHDiv Nat Nat.instDiv) n_1
              (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2))))))))

(1 : ℚ) / (2 ^ (n - 1)) * ∑ k in Finset.Icc 0 ⌊n / 2⌋₊, (n - 2 * k) * (n.choose k) = answer n


Given $n$, let $k(n)$ be the minimal degree of any monic integral polynomial $f$ such that the value of $f(x)$ is divisible by $n$ for every integer $x$. Find the value of $k(1000000)$.

@Eq Nat answer (@OfNat.ofNat Nat (nat_lit 25) (instOfNatNat (nat_lit 25)))

hdivnallx = fun f => Monic f ∧ (∀ x : ℤ, (10^6 : ℤ) ∣ f.eval x)

sInf {d : ℕ | ∃ f : Polynomial ℤ, hdivnallx f ∧ d = f.natDegree} = answer


For a set with $1000$ elements, how many subsets are there whose candinality is respectively $\equiv 0 \bmod 3, \equiv 1 \bmod 3, \equiv 2 \bmod 3$?

Show that there answer is that there are $(2^1000-1)/3$ subsets of cardinality $\equiv 0 \bmod 3$ and $\equiv 1 \bmod 3$, and $1 + (2^1000-1)/3$ subsets of cardinality $\equiv 2 \bmod 3$.

@Eq (Prod Nat (Prod Nat Nat)) answer
  (@Prod.mk Nat (Prod Nat Nat)
    (@HDiv.hDiv Nat Nat Nat (@instHDiv Nat Nat.instDiv)
      (@HSub.hSub Nat Nat Nat (@instHSub Nat instSubNat)
        (@HPow.hPow Nat Nat Nat (@instHPow Nat Nat (@Monoid.toNatPow Nat Nat.instMonoid))
          (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))
          (@OfNat.ofNat Nat (nat_lit 1000) (instOfNatNat (nat_lit 1000))))
        (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))))
      (@OfNat.ofNat Nat (nat_lit 3) (instOfNatNat (nat_lit 3))))
    (@Prod.mk Nat Nat
      (@HDiv.hDiv Nat Nat Nat (@instHDiv Nat Nat.instDiv)
        (@HSub.hSub Nat Nat Nat (@instHSub Nat instSubNat)
          (@HPow.hPow Nat Nat Nat (@instHPow Nat Nat (@Monoid.toNatPow Nat Nat.instMonoid))
            (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))
            (@OfNat.ofNat Nat (nat_lit 1000) (instOfNatNat (nat_lit 1000))))
          (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))))
        (@OfNat.ofNat Nat (nat_lit 3) (instOfNatNat (nat_lit 3))))
      (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))
        (@HDiv.hDiv Nat Nat Nat (@instHDiv Nat Nat.instDiv)
          (@HSub.hSub Nat Nat Nat (@instHSub Nat instSubNat)
            (@HPow.hPow Nat Nat Nat (@instHPow Nat Nat (@Monoid.toNatPow Nat Nat.instMonoid))
              (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))
              (@OfNat.ofNat Nat (nat_lit 1000) (instOfNatNat (nat_lit 1000))))
            (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))))
          (@OfNat.ofNat Nat (nat_lit 3) (instOfNatNat (nat_lit 3)))))))

count0 = {S | S ⊆ Finset.Icc 1 n ∧ S.card ≡ 0 [MOD 3]}.ncard

count1 = {S | S ⊆ Finset.Icc 1 n ∧ S.card ≡ 1 [MOD 3]}.ncard

count2 = {S | S ⊆ Finset.Icc 1 n ∧ S.card ≡ 2 [MOD 3]}.ncard


If an integer $n$ can be written as the sum of two triangular numbers (that is, $n = \frac{a^2 + a}{2} + \frac{b^2 + b}{2}$ for some integers $a$ and $b$), express $4n + 1$ as the sum of the squares of two integers $x$ and $y$, giving $x$ and $y$ in terms of $a$ and $b$. Also, show that if $4n + 1 = x^2 + y^2$ for some integers $x$ and $y$, then $n$ can be written as the sum of two triangular numbers.

$x = a + b + 1$ and $y = a - b$ (or vice versa).

@Eq (Prod (Prod Int Int → Int) (Prod Int Int → Int)) answer
  (@Prod.mk (Prod Int Int → Int) (Prod Int Int → Int)
    (fun (x : Prod Int Int) =>
      _example.match_2 (fun (x_1 : Prod Int Int) => Int) x fun (a b : Int) =>
        @HAdd.hAdd Int Int Int (@instHAdd Int Int.instAdd) (@HAdd.hAdd Int Int Int (@instHAdd Int Int.instAdd) a b)
          (@OfNat.ofNat Int (nat_lit 1) (@instOfNat (nat_lit 1))))
    fun (x : Prod Int Int) =>
    _example.match_2 (fun (x_1 : Prod Int Int) => Int) x fun (a b : Int) =>
      @HSub.hSub Int Int Int (@instHSub Int Int.instSub) a b)

((ℤ × ℤ) → ℤ) × ((ℤ × ℤ) → ℤ)

nab

(ℤ × ℤ × ℤ) → Prop

nxy

(ℤ × ℤ × ℤ) → Prop

(∀ n a b : ℤ, nab (n, a, b) → nxy (n, answer.1 (a, b), answer.2 (a, b))) ∧ ∀ n : ℤ, (∃ x y : ℤ, nxy (n, x, y)) → ∃ a b : ℤ, nab (n, a, b)


For which ordered pairs $(b, c)$ of real numbers do both roots of $z^2 + bz + c$ lie strictly inside the unit disk (i.e., $\{|z| < 1\}$) in the complex plane?

The desired region is the strict interior of the triangle with vertices $(0, -1)$, $(2, 1)$, and $(-2, 1)$.

@Eq Prop (answer (@Prod.mk Real Real b c))
  (And (@LT.lt Real Real.instLT c (@OfNat.ofNat Real (nat_lit 1) (@One.toOfNat1 Real Real.instOne)))
    (And
      (@GT.gt Real Real.instLT (@HSub.hSub Real Real Real (@instHSub Real Real.instSub) c b)
        (@Neg.neg Real Real.instNeg (@OfNat.ofNat Real (nat_lit 1) (@One.toOfNat1 Real Real.instOne))))
      (@GT.gt Real Real.instLT (@HAdd.hAdd Real Real Real (@instHAdd Real Real.instAdd) c b)
        (@Neg.neg Real Real.instNeg (@OfNat.ofNat Real (nat_lit 1) (@One.toOfNat1 Real Real.instOne))))))

(∀ z : ℂ, (Polynomial.X^2 + (Polynomial.C (b : ℂ)) * Polynomial.X + (Polynomial.C (c : ℂ)) : Polynomial ℂ).eval z = 0 → ‖z‖ < 1) ↔ answer (b, c)


If $a$, $b$, and $c$ are real numbers satisfying $0 < a < b < c$, at what points in the set $$\{(x, y, z) \in \mathbb{R}^3 : x^b + y^b + z^b = 1, x \ge 0, y \ge 0, z \ge 0\}$$ does $f(x, y, z) = x^a + y^b + z^c$ attain its maximum and minimum?

$f$ attains its maximum at $\left(x_0, (1 - x_0^b)^{\frac{1}{b}}, 0\right)$ and its minimum at $\left(0, (1 - z_0^b)^{\frac{1}{b}}, z_0\right)$, where $x_0 = \left(\frac{a}{b}\right)^{\frac{1}{b-a}}$ and $z_0 = \left(\frac{b}{c}\right)^{\frac{1}{c-b}}$.

@Eq
  (Prod (Prod Real (Prod Real Real) → Prod Real (Prod Real Real))
    (Prod Real (Prod Real Real) → Prod Real (Prod Real Real)))
  answer
  (@Prod.mk (Prod Real (Prod Real Real) → Prod Real (Prod Real Real))
    (Prod Real (Prod Real Real) → Prod Real (Prod Real Real))
    (fun (x : Prod Real (Prod Real Real)) =>
      _example.match_1 (fun (x_1 : Prod Real (Prod Real Real)) => Prod Real (Prod Real Real)) x
        fun (a_1 b_1 c_1 : Real) =>
        @Prod.mk Real (Prod Real Real)
          (@HPow.hPow Real Real Real (@instHPow Real Real Real.instPow)
            (@HDiv.hDiv Real Real Real (@instHDiv Real (@DivInvMonoid.toDiv Real Real.instDivInvMonoid)) a_1 b_1)
            (@HDiv.hDiv Real Real Real (@instHDiv Real (@DivInvMonoid.toDiv Real Real.instDivInvMonoid))
              (@OfNat.ofNat Real (nat_lit 1) (@One.toOfNat1 Real Real.instOne))
              (@HSub.hSub Real Real Real (@instHSub Real Real.instSub) b_1 a_1)))
          (@Prod.mk Real Real
            (@HPow.hPow Real Real Real (@instHPow Real Real Real.instPow)
              (@HSub.hSub Real Real Real (@instHSub Real Real.instSub)
                (@OfNat.ofNat Real (nat_lit 1) (@One.toOfNat1 Real Real.instOne))
                (@HPow.hPow Real Real Real (@instHPow Real Real Real.instPow)
                  (@HPow.hPow Real Real Real (@instHPow Real Real Real.instPow)
                    (@HDiv.hDiv Real Real Real (@instHDiv Real (@DivInvMonoid.toDiv Real Real.instDivInvMonoid)) a_1
                      b_1)
                    (@HDiv.hDiv Real Real Real (@instHDiv Real (@DivInvMonoid.toDiv Real Real.instDivInvMonoid))
                      (@OfNat.ofNat Real (nat_lit 1) (@One.toOfNat1 Real Real.instOne))
                      (@HSub.hSub Real Real Real (@instHSub Real Real.instSub) b_1 a_1)))
                  b_1))
              (@HDiv.hDiv Real Real Real (@instHDiv Real (@DivInvMonoid.toDiv Real Real.instDivInvMonoid))
                (@OfNat.ofNat Real (nat_lit 1) (@One.toOfNat1 Real Real.instOne)) b_1))
            (@OfNat.ofNat Real (nat_lit 0) (@Zero.toOfNat0 Real Real.instZero))))
    fun (x : Prod Real (Prod Real Real)) =>
    _example.match_1 (fun (x_1 : Prod Real (Prod Real Real)) => Prod Real (Prod Real Real)) x
      fun (a_1 b_1 c_1 : Real) =>
      @Prod.mk Real (Prod Real Real) (@OfNat.ofNat Real (nat_lit 0) (@Zero.toOfNat0 Real Real.instZero))
        (@Prod.mk Real Real
          (@HPow.hPow Real Real Real (@instHPow Real Real Real.instPow)
            (@HSub.hSub Real Real Real (@instHSub Real Real.instSub)
              (@OfNat.ofNat Real (nat_lit 1) (@One.toOfNat1 Real Real.instOne))
              (@HPow.hPow Real Real Real (@instHPow Real Real Real.instPow)
                (@HPow.hPow Real Real Real (@instHPow Real Real Real.instPow)
                  (@HDiv.hDiv Real Real Real (@instHDiv Real (@DivInvMonoid.toDiv Real Real.instDivInvMonoid)) b_1 c_1)
                  (@HDiv.hDiv Real Real Real (@instHDiv Real (@DivInvMonoid.toDiv Real Real.instDivInvMonoid))
                    (@OfNat.ofNat Real (nat_lit 1) (@One.toOfNat1 Real Real.instOne))
                    (@HSub.hSub Real Real Real (@instHSub Real Real.instSub) c_1 b_1)))
                b_1))
            (@HDiv.hDiv Real Real Real (@instHDiv Real (@DivInvMonoid.toDiv Real Real.instDivInvMonoid))
              (@OfNat.ofNat Real (nat_lit 1) (@One.toOfNat1 Real Real.instOne)) b_1))
          (@HPow.hPow Real Real Real (@instHPow Real Real Real.instPow)
            (@HDiv.hDiv Real Real Real (@instHDiv Real (@DivInvMonoid.toDiv Real Real.instDivInvMonoid)) b_1 c_1)
            (@HDiv.hDiv Real Real Real (@instHDiv Real (@DivInvMonoid.toDiv Real Real.instDivInvMonoid))
              (@OfNat.ofNat Real (nat_lit 1) (@One.toOfNat1 Real Real.instOne))
              (@HSub.hSub Real Real Real (@instHSub Real Real.instSub) c_1 b_1)))))

((ℝ × ℝ × ℝ) → (ℝ × ℝ × ℝ)) × ((ℝ × ℝ × ℝ) → (ℝ × ℝ × ℝ))

P

(ℝ × ℝ × ℝ) → Prop

f

(ℝ × ℝ × ℝ) → ℝ

hP

P = fun (x, y, z) => x ≥ 0 ∧ y ≥ 0 ∧ z ≥ 0 ∧ x^b + y^b + z^b = 1

(P (answer.1 (a, b, c)) ∧ ∀ x y z : ℝ, P (x, y, z) →
f (x, y, z) ≤ f (answer.1 (a, b, c))) ∧
(P (answer.2 (a, b, c)) ∧ ∀ x y z : ℝ, P (x, y, z) →
f (x, y, z) ≥ f (answer.2 (a, b, c)))


Let $n = 2m$, where $m$ is an odd integer greater than 1. Let $\theta = e^{2\pi i/n}$. Expression $(1 - \theta)^{-1}$ explicitly as a polynomial in $\theta$ \[ a_k \theta^k  + a_{k-1}\theta^{k-1} + \dots + a_1\theta + a_0\], with integer coefficients $a_i$.

Show that the solution is the polynomial $0 + \theta + \theta^3 + \dots + \theta^{m-2}$, alternating consecutive coefficients between 0 and 1.

@Eq (Nat → @Polynomial Int Int.instSemiring) answer fun (m_1 : Nat) =>
  @Finset.sum Nat (@Polynomial Int Int.instSemiring)
    (@NonUnitalNonAssocSemiring.toAddCommMonoid (@Polynomial Int Int.instSemiring)
      (@NonUnitalNonAssocCommSemiring.toNonUnitalNonAssocSemiring (@Polynomial Int Int.instSemiring)
        (@NonUnitalNonAssocCommRing.toNonUnitalNonAssocCommSemiring (@Polynomial Int Int.instSemiring)
          (@NonUnitalCommRing.toNonUnitalNonAssocCommRing (@Polynomial Int Int.instSemiring)
            (@CommRing.toNonUnitalCommRing (@Polynomial Int Int.instSemiring)
              (@Polynomial.commRing Int Int.instCommRing))))))
    (Finset.range
      (@HDiv.hDiv Nat Nat Nat (@instHDiv Nat Nat.instDiv)
        (@HSub.hSub Nat Nat Nat (@instHSub Nat instSubNat) m_1
          (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))))
        (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))))
    fun (j : Nat) =>
    @HPow.hPow (@Polynomial Int Int.instSemiring) Nat (@Polynomial Int Int.instSemiring)
      (@instHPow (@Polynomial Int Int.instSemiring) Nat
        (@Monoid.toNatPow (@Polynomial Int Int.instSemiring)
          (@MonoidWithZero.toMonoid (@Polynomial Int Int.instSemiring)
            (@Semiring.toMonoidWithZero (@Polynomial Int Int.instSemiring)
              (@Polynomial.semiring Int Int.instSemiring)))))
      (@Polynomial.X Int Int.instSemiring)
      (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat)
        (@HMul.hMul Nat Nat Nat (@instHMul Nat instMulNat) (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2))) j)
        (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))))

1/(1 - θ) = Polynomial.aeval θ (answer m)


Let $H$ be a subgroup of the additive group of ordered pairs of integers under componentwise addition. If $H$ is generated by the elements $(3, 8)$, $(4, -1)$, and $(5, 4)$, then $H$ is also generated by two elements $(1, b)$ and $(0, a)$ for some integer $b$ and positive integer $a$. Find $a$.

@Eq Int answer (@OfNat.ofNat Int (nat_lit 7) (@instOfNat (nat_lit 7)))

(∃ b : ℤ, H = {h : (ℤ × ℤ) | ∃ u v : ℤ, h = (u, u*b + v*answer)}) ∧ answer > 0


Let $s_k (a_1, a_2, \dots, a_n)$ denote the $k$-th elementary symmetric function; that is, the sum of all $k$-fold products of the $a_i$. For example, $s_1 (a_1, \dots, a_n) = \sum_{i=1}^{n} a_i$, and $s_2 (a_1, a_2, a_3) = a_1a_2 + a_2a_3 + a_1a_3$. Find the supremum $M_k$ (which is never attained) of $$\frac{s_k (a_1, a_2, \dots, a_n)}{(s_1 (a_1, a_2, \dots, a_n))^k}$$ across all $n$-tuples $(a_1, a_2, \dots, a_n)$ of positive real numbers with $n \ge k$.

open Polynomial Real Complex Matrix Filter Topology Multiset

@Eq (Nat → Real) answer fun (k : Nat) =>
  @HDiv.hDiv Real Real Real (@instHDiv Real (@DivInvMonoid.toDiv Real Real.instDivInvMonoid))
    (@OfNat.ofNat Real (nat_lit 1) (@One.toOfNat1 Real Real.instOne))
    (@Nat.cast Real Real.instNatCast (Nat.factorial k))

∀ k : ℕ, k > 0 → (∀ a : Multiset ℝ, (∀ i ∈ a, i > 0) ∧ card a ≥ k →
(esymm a k)/(esymm a 1)^k ≤ answer k) ∧
∀ M : ℝ, M < answer k → (∃ a : Multiset ℝ, (∀ i ∈ a, i > 0) ∧ card a ≥ k ∧
(esymm a k)/(esymm a 1)^k > M)


Let $C = \{(x, y) \in \mathbb{R}^2 : x^2 + y^2 = 1\}$ denote the unit circle. Does there exist $B \subseteq C$ for which $B$ is topologically closed and contains exactly one point from each pair of diametrically opposite points in $C$?

P

ℝ × ℝ → Prop

(∃ B ⊆ setOf P, IsClosed B ∧ ∀ x y : ℝ, P (x, y) → Xor' ((x, y) ∈ B) ((-x, -y) ∈ B)) ↔ answer


Find all integer solutions $(p, r, q, s)$ of the equation $|p^r - q^s| = 1$, where $p$ and $q$ are prime and $r$ and $s$ are greater than $1$.

@Eq (Set (Prod Nat (Prod Nat (Prod Nat Nat)))) answer
  (@Insert.insert (Prod Nat (Prod Nat (Prod Nat Nat))) (Set (Prod Nat (Prod Nat (Prod Nat Nat))))
    (@Set.instInsert (Prod Nat (Prod Nat (Prod Nat Nat))))
    (@Prod.mk Nat (Prod Nat (Prod Nat Nat)) (@OfNat.ofNat Nat (nat_lit 3) (instOfNatNat (nat_lit 3)))
      (@Prod.mk Nat (Prod Nat Nat) (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))
        (@Prod.mk Nat Nat (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))
          (@OfNat.ofNat Nat (nat_lit 3) (instOfNatNat (nat_lit 3))))))
    (@Singleton.singleton (Prod Nat (Prod Nat (Prod Nat Nat))) (Set (Prod Nat (Prod Nat (Prod Nat Nat))))
      (@Set.instSingletonSet (Prod Nat (Prod Nat (Prod Nat Nat))))
      (@Prod.mk Nat (Prod Nat (Prod Nat Nat)) (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))
        (@Prod.mk Nat (Prod Nat Nat) (@OfNat.ofNat Nat (nat_lit 3) (instOfNatNat (nat_lit 3)))
          (@Prod.mk Nat Nat (@OfNat.ofNat Nat (nat_lit 3) (instOfNatNat (nat_lit 3)))
            (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2))))))))

Set (ℕ × ℕ × ℕ × ℕ)


Let $r$ be a real root of $P(x) = x^3 + ax^2 + bx - 1$, where $a$ and $b$ are integers and $P$ is irreducible over the rationals. Suppose that $r + 1$ is a root of $x^3 + cx^2 + dx + 1$, where $c$ and $d$ are also integers. Express another root $s$ of $P$ as a function of $r$ that does not depend on the values of $a$, $b$, $c$, or $d$.

The possible answers are $s = -\frac{1}{r + 1}$ and $s = -\frac{r + 1}{r}$.

@Eq (Prod (Real → Real) (Real → Real)) answer
  (@Prod.mk (Real → Real) (Real → Real)
    (fun (r_1 : Real) =>
      @HDiv.hDiv Real Real Real (@instHDiv Real (@DivInvMonoid.toDiv Real Real.instDivInvMonoid))
        (@Neg.neg Real Real.instNeg (@OfNat.ofNat Real (nat_lit 1) (@One.toOfNat1 Real Real.instOne)))
        (@HAdd.hAdd Real Real Real (@instHAdd Real Real.instAdd) r_1
          (@OfNat.ofNat Real (nat_lit 1) (@One.toOfNat1 Real Real.instOne))))
    fun (r_1 : Real) =>
    @HDiv.hDiv Real Real Real (@instHDiv Real (@DivInvMonoid.toDiv Real Real.instDivInvMonoid))
      (@Neg.neg Real Real.instNeg
        (@HAdd.hAdd Real Real Real (@instHAdd Real Real.instAdd) r_1
          (@OfNat.ofNat Real (nat_lit 1) (@One.toOfNat1 Real Real.instOne))))
      r_1)

(ℝ → ℝ) × (ℝ → ℝ)

hP

P = Polynomial.X^3 + (Polynomial.C (a : ℚ))*Polynomial.X^2 + (Polynomial.C (b : ℚ))*Polynomial.X - (Polynomial.C 1) ∧ Polynomial.aeval r P = 0 ∧ Irreducible P

hQ

Q = Polynomial.X^3 + (Polynomial.C (c : ℚ))*Polynomial.X^2 + (Polynomial.C (d : ℚ))*Polynomial.X + (Polynomial.C 1) ∧ Polynomial.aeval (r + 1) Q = 0

∃ s : ℝ, Polynomial.aeval s P = 0 ∧ (s = answer.1 r ∨ s = answer.2 r)


Find $$\lim_{n \to \infty} \frac{1}{n} \sum_{k=1}^{n}\left(\left\lfloor \frac{2n}{k} \right\rfloor - 2\left\lfloor \frac{n}{k} \right\rfloor\right).$$ Your answer should be in the form $\ln(a) - b$, where $a$ and $b$ are positive integers.

The limit equals $\ln(4) - 1$, so $a = 4$ and $b = 1$.

@Eq (Prod Nat Nat) answer
  (@Prod.mk Nat Nat (@OfNat.ofNat Nat (nat_lit 4) (instOfNatNat (nat_lit 4)))
    (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))))

Tendsto (fun n : ℕ => ((1 : ℝ)/n)*∑ k in Finset.Icc (1 : ℤ) n, (Int.floor ((2*n)/k) - 2*Int.floor (n/k))) atTop
    (𝓝 (Real.log answer.1 - answer.2))


Let $G$ be a group generated by two elements $A$ and $B$; i.e., every element of $G$ can be expressed as a finite word $A^{n_1}B^{n_2} \cdots A^{n_{k-1}}B^{n_k}$, where the $n_i$ can assume any integer values and $A^0 = B^0 = 1$. Further assume that $A^4 = B^7 = ABA^{-1}B = 1$, but $A^2 \ne 1$ and $B \ne 1$. Find the number of elements of $G$ than can be written as $C^2$ for some $C \in G$ and express each such square as a word in $A$ and $B$.

@Eq (Prod Nat (Set (List (Prod Int Int)))) answer
  (@Prod.mk Nat (Set (List (Prod Int Int))) (@OfNat.ofNat Nat (nat_lit 8) (instOfNatNat (nat_lit 8)))
    (@Insert.insert (List (Prod Int Int)) (Set (List (Prod Int Int))) (@Set.instInsert (List (Prod Int Int)))
      (@List.cons (Prod Int Int)
        (@Prod.mk Int Int (@OfNat.ofNat Int (nat_lit 0) (@instOfNat (nat_lit 0)))
          (@OfNat.ofNat Int (nat_lit 0) (@instOfNat (nat_lit 0))))
        (@List.nil (Prod Int Int)))
      (@Insert.insert (List (Prod Int Int)) (Set (List (Prod Int Int))) (@Set.instInsert (List (Prod Int Int)))
        (@List.cons (Prod Int Int)
          (@Prod.mk Int Int (@OfNat.ofNat Int (nat_lit 2) (@instOfNat (nat_lit 2)))
            (@OfNat.ofNat Int (nat_lit 0) (@instOfNat (nat_lit 0))))
          (@List.nil (Prod Int Int)))
        (@Insert.insert (List (Prod Int Int)) (Set (List (Prod Int Int))) (@Set.instInsert (List (Prod Int Int)))
          (@List.cons (Prod Int Int)
            (@Prod.mk Int Int (@OfNat.ofNat Int (nat_lit 0) (@instOfNat (nat_lit 0)))
              (@OfNat.ofNat Int (nat_lit 1) (@instOfNat (nat_lit 1))))
            (@List.nil (Prod Int Int)))
          (@Insert.insert (List (Prod Int Int)) (Set (List (Prod Int Int))) (@Set.instInsert (List (Prod Int Int)))
            (@List.cons (Prod Int Int)
              (@Prod.mk Int Int (@OfNat.ofNat Int (nat_lit 0) (@instOfNat (nat_lit 0)))
                (@OfNat.ofNat Int (nat_lit 2) (@instOfNat (nat_lit 2))))
              (@List.nil (Prod Int Int)))
            (@Insert.insert (List (Prod Int Int)) (Set (List (Prod Int Int))) (@Set.instInsert (List (Prod Int Int)))
              (@List.cons (Prod Int Int)
                (@Prod.mk Int Int (@OfNat.ofNat Int (nat_lit 0) (@instOfNat (nat_lit 0)))
                  (@OfNat.ofNat Int (nat_lit 3) (@instOfNat (nat_lit 3))))
                (@List.nil (Prod Int Int)))
              (@Insert.insert (List (Prod Int Int)) (Set (List (Prod Int Int))) (@Set.instInsert (List (Prod Int Int)))
                (@List.cons (Prod Int Int)
                  (@Prod.mk Int Int (@OfNat.ofNat Int (nat_lit 0) (@instOfNat (nat_lit 0)))
                    (@OfNat.ofNat Int (nat_lit 4) (@instOfNat (nat_lit 4))))
                  (@List.nil (Prod Int Int)))
                (@Insert.insert (List (Prod Int Int)) (Set (List (Prod Int Int)))
                  (@Set.instInsert (List (Prod Int Int)))
                  (@List.cons (Prod Int Int)
                    (@Prod.mk Int Int (@OfNat.ofNat Int (nat_lit 0) (@instOfNat (nat_lit 0)))
                      (@OfNat.ofNat Int (nat_lit 5) (@instOfNat (nat_lit 5))))
                    (@List.nil (Prod Int Int)))
                  (@Singleton.singleton (List (Prod Int Int)) (Set (List (Prod Int Int)))
                    (@Set.instSingletonSet (List (Prod Int Int)))
                    (@List.cons (Prod Int Int)
                      (@Prod.mk Int Int (@OfNat.ofNat Int (nat_lit 0) (@instOfNat (nat_lit 0)))
                        (@OfNat.ofNat Int (nat_lit 6) (@instOfNat (nat_lit 6))))
                      (@List.nil (Prod Int Int))))))))))))

hword

word = fun w : List (ℤ × ℤ) => (List.map (fun t : ℤ × ℤ => A^(t.1)*B^(t.2)) w).prod

S.ncard = answer.1 ∧ S = {word w | w ∈ answer.2}


open Polynomial Filter Topology ProbabilityTheory MeasureTheory

@Eq (Nat → @Polynomial Int Int.instSemiring) answer fun (n : Nat) =>
  @DFunLike.coe
    (@RingHom Int (@Polynomial Int Int.instSemiring) (@Semiring.toNonAssocSemiring Int Int.instSemiring)
      (@Semiring.toNonAssocSemiring (@Polynomial Int Int.instSemiring) (@Polynomial.semiring Int Int.instSemiring)))
    Int (fun (x : Int) => @Polynomial Int Int.instSemiring)
    (@RingHom.instFunLike Int (@Polynomial Int Int.instSemiring) (@Semiring.toNonAssocSemiring Int Int.instSemiring)
      (@Semiring.toNonAssocSemiring (@Polynomial Int Int.instSemiring) (@Polynomial.semiring Int Int.instSemiring)))
    (@Polynomial.C Int Int.instSemiring) (@Nat.cast Int instNatCastInt (Nat.factorial n))

∀ n : ℕ, ∑ k in Finset.range (n + 1), C ((-(1 : ℤ))^k * Nat.choose n k) * (X - (C (k : ℤ)))^n = answer n


Show that if four distinct points of the curve $y = 2x^4 + 7x^3 + 3x - 5$ are collinear, then their average $x$-coordinate is some constant $k$. Find $k$.

@Eq Real answer
  (@HDiv.hDiv Real Real Real (@instHDiv Real (@DivInvMonoid.toDiv Real Real.instDivInvMonoid))
    (@Neg.neg Real Real.instNeg
      (@OfNat.ofNat Real (nat_lit 7)
        (@instOfNatAtLeastTwo Real (nat_lit 7) Real.instNatCast
          (@instNatAtLeastTwo (@OfNat.ofNat Nat (nat_lit 5) (instOfNatNat (nat_lit 5)))))))
    (@OfNat.ofNat Real (nat_lit 8)
      (@instOfNatAtLeastTwo Real (nat_lit 8) Real.instNatCast
        (@instNatAtLeastTwo (@OfNat.ofNat Nat (nat_lit 6) (instOfNatNat (nat_lit 6)))))))

Collinear ℝ {P : Fin 2 → ℝ | P 0 ∈ S ∧ P 1 = y (P 0)}


Find all real solutions $(a, b, c, d)$ to the equations $a + b + c = d$, $\frac{1}{a} + \frac{1}{b} + \frac{1}{c} = \frac{1}{d}$.

$d = a \land b = -c \lor d = b \land a = -c \lor d = c \land a = -b$

Prove that the solutions are $d = a$ and $b = -c$, $d = b$ and $a = -c$, or $d = c$ and $a = -b$, with $a, b, c, d$ nonzero.

@Eq (Real → Real → Real → Real → Prop) answer fun (a_1 b_1 c_1 d_1 : Real) =>
  Or (And (@Eq Real d_1 a_1) (@Eq Real b_1 (@Neg.neg Real Real.instNeg c_1)))
    (Or (And (@Eq Real d_1 b_1) (@Eq Real a_1 (@Neg.neg Real Real.instNeg c_1)))
      (And (@Eq Real d_1 c_1) (@Eq Real a_1 (@Neg.neg Real Real.instNeg b_1))))

ℝ → ℝ → ℝ → ℝ → Prop

answer a b c d ↔
    a ≠ 0 → b ≠ 0 → c ≠ 0 → d ≠ 0 → (a + b + c = d ∧ 1 / a + 1 / b + 1 / c = 1 / d)


Let $f, g, h$ be functions $\mathbb{R} \to \mathbb{R}$. Find an expression for $h(x)$ in terms of $f$ and $g$ such that $f(x) = \frac{h(x + 1) + h(x - 1)}{2}$ and $g(x) = \frac{h(x + 4) + h(x - 4)}{2}$.

Prove that $h(x) = g(x) - f(x - 3) + f(x - 1) + f(x + 1) - f(x + 3)$ suffices.

@Eq ((Real → Real) → (Real → Real) → Real → Real) answer fun (f_1 g_1 : Real → Real) (x : Real) =>
  @HSub.hSub Real Real Real (@instHSub Real Real.instSub)
    (@HAdd.hAdd Real Real Real (@instHAdd Real Real.instAdd)
      (@HAdd.hAdd Real Real Real (@instHAdd Real Real.instAdd)
        (@HSub.hSub Real Real Real (@instHSub Real Real.instSub) (g_1 x)
          (f_1
            (@HSub.hSub Real Real Real (@instHSub Real Real.instSub) x
              (@OfNat.ofNat Real (nat_lit 3)
                (@instOfNatAtLeastTwo Real (nat_lit 3) Real.instNatCast
                  (@instNatAtLeastTwo (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))))))))
        (f_1
          (@HSub.hSub Real Real Real (@instHSub Real Real.instSub) x
            (@OfNat.ofNat Real (nat_lit 1) (@One.toOfNat1 Real Real.instOne)))))
      (f_1
        (@HAdd.hAdd Real Real Real (@instHAdd Real Real.instAdd) x
          (@OfNat.ofNat Real (nat_lit 1) (@One.toOfNat1 Real Real.instOne)))))
    (f_1
      (@HAdd.hAdd Real Real Real (@instHAdd Real Real.instAdd) x
        (@OfNat.ofNat Real (nat_lit 3)
          (@instOfNatAtLeastTwo Real (nat_lit 3) Real.instNatCast
            (@instNatAtLeastTwo (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))))))))

(ℝ → ℝ) → (ℝ → ℝ) → (ℝ → ℝ)


Find $\sum_{n=0}^{\infty} \frac{x^{2^n}}{1 - x^{2^{n+1}}}$ as a rational function of $x$ for $x \in (0, 1)$.

Prove that the sum equals $\frac{x}{1 - x}$.

@Eq (@RatFunc Real Real.commRing) answer
  (@HDiv.hDiv (@RatFunc Real Real.commRing) (@RatFunc Real Real.commRing) (@RatFunc Real Real.commRing)
    (@instHDiv (@RatFunc Real Real.commRing) (@RatFunc.instDiv Real Real.commRing Real.instIsDomain))
    (@RatFunc.X Real Real.commRing Real.instIsDomain)
    (@HSub.hSub (@RatFunc Real Real.commRing) (@RatFunc Real Real.commRing) (@RatFunc Real Real.commRing)
      (@instHSub (@RatFunc Real Real.commRing) (@RatFunc.instSub Real Real.commRing))
      (@OfNat.ofNat (@RatFunc Real Real.commRing) (nat_lit 1)
        (@One.toOfNat1 (@RatFunc Real Real.commRing) (@RatFunc.instOne Real Real.commRing)))
      (@RatFunc.X Real Real.commRing Real.instIsDomain)))


Let $X$ be the square $[0, 1] \times [0, 1]$, and let $f : X \to \mathbb{R}$ be continuous. If $\int_Y f(x, y) \, dx \, dy = 0$ for all squares $Y$ such that
\begin{itemize}
\item[(1)] $Y \subseteq X$,
\item[(2)] $Y$ has sides parallel to those of $X$,
\item[(3)] at least one of $Y$'s sides is contained in the boundary of $X$,
\end{itemize}
is it true that $f(x, y) = 0$ for all $x, y$?

Prove that $f(x,y)$ must be identically zero.

hroom

room = fun (a,b) ↦ min (min a (1 - a)) (min b (1 - b))

(∀ f : (ℝ × ℝ) → ℝ, Continuous f → (∀ P ∈ X, ∫ x in (P.1 - room P)..(P.1 + room P), ∫ y in (P.2 - room P)..(P.2 + room P), f (x, y) = 0) → (∀ P ∈ X, f P = 0)) ↔ answer


Prove that the product equals $\frac{2}{3}$.

@Eq Real answer
  (@HDiv.hDiv Real Real Real (@instHDiv Real (@DivInvMonoid.toDiv Real Real.instDivInvMonoid))
    (@OfNat.ofNat Real (nat_lit 2)
      (@instOfNatAtLeastTwo Real (nat_lit 2) Real.instNatCast
        (@instNatAtLeastTwo (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))))))
    (@OfNat.ofNat Real (nat_lit 3)
      (@instOfNatAtLeastTwo Real (nat_lit 3) Real.instNatCast
        (@instNatAtLeastTwo (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))))))

Tendsto (fun N ↦ ∏ n in Finset.Icc (2 : ℤ) N, ((n : ℝ) ^ 3 - 1) / (n ^ 3 + 1)) atTop (𝓝 answer)


An ordered triple $(a, b, c)$ of positive irrational numbers with $a + b + c = 1$ is considered $\textit{balanced}$ if all three elements are less than $\frac{1}{2}$. If a triple is not balanced, we can perform a ``balancing act'' $B$ defined by $B(a, b, c) = (f(a), f(b), f(c))$, where $f(x) = 2x - 1$ if $x > 1/2$ and $f(x) = 2x$ otherwise. Will finitely many iterations of this balancing act always eventually produce a balanced triple?

P

ℝ × ℝ × ℝ → Prop

balanced

ℝ × ℝ × ℝ → Prop

B

ℝ × ℝ × ℝ → ℝ × ℝ × ℝ

hP

P = fun (a, b, c) => Irrational a ∧ Irrational b ∧ Irrational c ∧ a > 0 ∧ b > 0 ∧ c > 0 ∧ a + b + c = 1

hbalanced

balanced = fun (a, b, c) => a < 1/2 ∧ b < 1/2 ∧ c < 1/2

(∀ t : ℝ × ℝ × ℝ, P t → ∃ n : ℕ, balanced (B^[n] t)) ↔ answer


Show that $I_k$ is smallest for $k = 2$.

@Eq Nat answer (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))

hp

p = 2 * (Polynomial.X ^ 6 + 1) + 4 * (Polynomial.X ^ 5 + Polynomial.X) + 3 * (Polynomial.X ^ 4 + Polynomial.X ^ 2) + 5 * Polynomial.X ^ 3

hI

I = fun k ↦ ∫ x in Ioi 0, x ^ k / p.eval x

IsLeast {y | ∃ k ∈ Ioo 0 5, I k = y} answer


Prove that the sum evaluates to $\frac{7}{4}$.

@Eq Rat answer
  (@HDiv.hDiv Rat Rat Rat (@instHDiv Rat Rat.instDiv) (@OfNat.ofNat Rat (nat_lit 7) (@Rat.instOfNat (nat_lit 7)))
    (@OfNat.ofNat Rat (nat_lit 4) (@Rat.instOfNat (nat_lit 4))))


Find the real polynomial $p(x)$ of degree $4$ with largest possible coefficient of $x^4$ such that $p([-1, 1]) \subseteq [0, 1]$.

open Set Real Filter Topology Polynomial

@Eq (@Polynomial Real Real.semiring) answer
  (@HAdd.hAdd (@Polynomial Real Real.semiring) (@Polynomial Real Real.semiring) (@Polynomial Real Real.semiring)
    (@instHAdd (@Polynomial Real Real.semiring) (@Polynomial.add' Real Real.semiring))
    (@HSub.hSub (@Polynomial Real Real.semiring) (@Polynomial Real Real.semiring) (@Polynomial Real Real.semiring)
      (@instHSub (@Polynomial Real Real.semiring) (@Polynomial.sub Real Real.instRing))
      (@HMul.hMul (@Polynomial Real Real.semiring) (@Polynomial Real Real.semiring) (@Polynomial Real Real.semiring)
        (@instHMul (@Polynomial Real Real.semiring) (@Polynomial.mul' Real Real.semiring))
        (@OfNat.ofNat (@Polynomial Real Real.semiring) (nat_lit 4)
          (@instOfNatAtLeastTwo (@Polynomial Real Real.semiring) (nat_lit 4)
            (@Polynomial.instNatCast Real Real.semiring)
            (@instNatAtLeastTwo (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2))))))
        (@HPow.hPow (@Polynomial Real Real.semiring) Nat (@Polynomial Real Real.semiring)
          (@instHPow (@Polynomial Real Real.semiring) Nat
            (@Monoid.toNatPow (@Polynomial Real Real.semiring)
              (@MonoidWithZero.toMonoid (@Polynomial Real Real.semiring)
                (@Semiring.toMonoidWithZero (@Polynomial Real Real.semiring)
                  (@Polynomial.semiring Real Real.semiring)))))
          (@Polynomial.X Real Real.semiring) (@OfNat.ofNat Nat (nat_lit 4) (instOfNatNat (nat_lit 4)))))
      (@HMul.hMul (@Polynomial Real Real.semiring) (@Polynomial Real Real.semiring) (@Polynomial Real Real.semiring)
        (@instHMul (@Polynomial Real Real.semiring) (@Polynomial.mul' Real Real.semiring))
        (@OfNat.ofNat (@Polynomial Real Real.semiring) (nat_lit 4)
          (@instOfNatAtLeastTwo (@Polynomial Real Real.semiring) (nat_lit 4)
            (@Polynomial.instNatCast Real Real.semiring)
            (@instNatAtLeastTwo (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2))))))
        (@HPow.hPow (@Polynomial Real Real.semiring) Nat (@Polynomial Real Real.semiring)
          (@instHPow (@Polynomial Real Real.semiring) Nat
            (@Monoid.toNatPow (@Polynomial Real Real.semiring)
              (@MonoidWithZero.toMonoid (@Polynomial Real Real.semiring)
                (@Semiring.toMonoidWithZero (@Polynomial Real Real.semiring)
                  (@Polynomial.semiring Real Real.semiring)))))
          (@Polynomial.X Real Real.semiring) (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2))))))
    (@OfNat.ofNat (@Polynomial Real Real.semiring) (nat_lit 1)
      (@One.toOfNat1 (@Polynomial Real Real.semiring) (@Polynomial.one Real Real.semiring))))

hS

S = {p : Polynomial ℝ | p.degree = 4 ∧ ∀ x ∈ Icc (-1 : ℝ) 1, p.eval x ∈ Icc 0 1}

answer ∈ S ∧ (∀ p ∈ S, p.coeff 4 ≤ answer.coeff 4)


For which positive integers $n$ and $a_1, a_2, \dots, a_n$ with $\sum_{i = 1}^{n} a_i = 1979$ does $\prod_{i = 1}^{n} a_i$ attain the greatest value?

$n$ equals $660$; all but one of the $a_i$ equal $3$ and the remaining $a_i$ equals $2$.

@Eq (Multiset Nat) answer
  (@HAdd.hAdd (Multiset Nat) (Multiset Nat) (Multiset Nat) (@instHAdd (Multiset Nat) (@Multiset.instAdd Nat))
    (@Multiset.replicate Nat (@OfNat.ofNat Nat (nat_lit 659) (instOfNatNat (nat_lit 659)))
      (@OfNat.ofNat Nat (nat_lit 3) (instOfNatNat (nat_lit 3))))
    (@Singleton.singleton Nat (Multiset Nat) (@Multiset.instSingleton Nat)
      (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))))

hP

∀ a, P a ↔ Multiset.card a > 0 ∧ (∀ i ∈ a, i > 0) ∧ a.sum = 1979

P answer ∧ ∀ a : Multiset ℕ, P a → answer.prod ≥ a.prod


For which real numbers $k$ does there exist a continuous function $f : \mathbb{R} \to \mathbb{R}$ such that $f(f(x)) = kx^9$ for all real $x$?

Such a function exists if and only if $k \ge 0$.

@Eq (Real → Prop) answer fun (k_1 : Real) =>
  @GE.ge Real Real.instLE k_1 (@OfNat.ofNat Real (nat_lit 0) (@Zero.toOfNat0 Real Real.instZero))

answer k ↔ ∃ f : ℝ → ℝ, Continuous f ∧ ∀ x : ℝ, f (f x) = k * x^9


Let $x_1, x_2, x_3, \dots$ be a sequence of nonzero real numbers such that $$x_n = \frac{x_{n-2}x_{n-1}}{2x_{n-2}-x_{n-1}}$$ for all $n \ge 3$. For which real values of $x_1$ and $x_2$ does $x_n$ attain integer values for infinitely many $n$?

We must have $x_1 = x_2 = m$ for some integer $m$.

@Eq (Prod Real Real → Prop) answer fun (x_1 : Prod Real Real) =>
  _example.match_1 (fun (x_2 : Prod Real Real) => Prop) x_1 fun (a b : Real) =>
    @Exists Int fun (m : Int) =>
      And (@Eq Real a (@Int.cast Real Real.instIntCast m)) (@Eq Real b (@Int.cast Real Real.instIntCast m))

(∀ m : ℕ, ∃ n : ℕ, n > m ∧ ∃ a : ℤ, a = x n) ↔ answer (x 1, x 2)


Let $A$ be a set of $2n$ points in the plane, $n$ colored red and $n$ colored blue, such that no three points in $A$ are collinear. Must there exist $n$ closed straight line segments, each connecting one red and one blue point in $A$, such that no two of the $n$ line segments intersect?

A

Finset (Fin 2 → ℝ) × Finset (Fin 2 → ℝ) → Prop

hA

A = fun (R, B) => R.card = B.card ∧ R ∩ B = ∅ ∧
    ∀ u : Finset (Fin 2 → ℝ), u ⊆ R ∪ B → u.card = 3 → ¬Collinear ℝ (u : Set (Fin 2 → ℝ))

w

(Fin 2 → ℝ) × (Fin 2 → ℝ) → ℝ → (Fin 2 → ℝ)

hw

w = fun (P, Q) => fun x : ℝ => fun i : Fin 2 => x * P i + (1 - x) * Q i

answer ↔
      (∀ R B, A (R, B) →
        ∃ v : Finset ((Fin 2 → ℝ) × (Fin 2 → ℝ)),
          (∀ L ∈ v, ∀ M ∈ v, L ≠ M → ∀ x ∈ Icc 0 1, ∀ y ∈ Icc 0 1,
          Real.sqrt ((w (L.1, L.2) x 0 - w (M.1, M.2) y 0)^2 + (w (L.1, L.2) x 1 - w (M.1, M.2) y 1)^2) ≠ 0) ∧
        v.card = R.card ∧ ∀ L ∈ v, L.1 ∈ R ∧ L.2 ∈ B)


If $0 < a < b$, find $$\lim_{t \to 0} \left( \int_{0}^{1}(bx + a(1-x))^t dx \right)^{\frac{1}{t}}$$ in terms of $a$ and $b$.

The limit equals $$e^{-1}\left(\frac{b^b}{a^a}\right)^{\frac{1}{b-a}}.$$

@Eq (Prod Real Real → Real) answer fun (x : Prod Real Real) =>
  _example.match_1 (fun (x_1 : Prod Real Real) => Real) x fun (a b : Real) =>
    @HMul.hMul Real Real Real (@instHMul Real Real.instMul)
      (Real.exp (@Neg.neg Real Real.instNeg (@OfNat.ofNat Real (nat_lit 1) (@One.toOfNat1 Real Real.instOne))))
      (@HPow.hPow Real Real Real (@instHPow Real Real Real.instPow)
        (@HDiv.hDiv Real Real Real (@instHDiv Real (@DivInvMonoid.toDiv Real Real.instDivInvMonoid))
          (@HPow.hPow Real Real Real (@instHPow Real Real Real.instPow) b b)
          (@HPow.hPow Real Real Real (@instHPow Real Real Real.instPow) a a))
        (@HDiv.hDiv Real Real Real (@instHDiv Real (@DivInvMonoid.toDiv Real Real.instDivInvMonoid))
          (@OfNat.ofNat Real (nat_lit 1) (@One.toOfNat1 Real Real.instOne))
          (@HSub.hSub Real Real Real (@instHSub Real Real.instSub) b a)))

∀ a b : ℝ, 0 < a ∧ a < b → Tendsto (fun t : ℝ => (∫ x in Icc 0 1, (b*x + a*(1 - x))^t)^(1/t)) (𝓝[≠] 0) (𝓝 (answer (a, b)))


Let $F$ be a finite field with $n$ elements, and assume $n$ is odd. Suppose $x^2 + bx + c$ is an irreducible polynomial over $F$. For how many elements $d \in F$ is $x^2 + bx + c + d$ irreducible?

Show that there are $\frac{n - 1}{2}$ such elements $d$.

@Eq (Nat → Int) answer fun (n_1 : Nat) =>
  @HDiv.hDiv Int Int Int (@instHDiv Int Int.instDiv)
    (@HSub.hSub Int Int Int (@instHSub Int Int.instSub) (@Nat.cast Int instNatCastInt n_1)
      (@OfNat.ofNat Int (nat_lit 1) (@instOfNat (nat_lit 1))))
    (@OfNat.ofNat Int (nat_lit 2) (@instOfNat (nat_lit 2)))

hp

p = X ^ 2 + (C b) * X + (C c) ∧ Irreducible p

{d : F | Irreducible (p + (C d))}.ncard = answer n


Let $r$ and $s$ be positive integers. Derive a formula for the number of ordered quadruples $(a,b,c,d)$ of positive integers such that $3^r \cdot 7^s=\text{lcm}[a,b,c]=\text{lcm}[a,b,d]=\text{lcm}[a,c,d]=\text{lcm}[b,c,d]$. The answer should be a function of $r$ and $s$. (Note that $\text{lcm}[x,y,z]$ denotes the least common multiple of $x,y,z$.)

Show that the number is $(1+4r+6r^2)(1+4s+6s^2)$.

@Eq (Nat → Nat → Nat) answer fun (r_1 s_1 : Nat) =>
  @HMul.hMul Nat Nat Nat (@instHMul Nat instMulNat)
    (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat)
      (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))
        (@HMul.hMul Nat Nat Nat (@instHMul Nat instMulNat) (@OfNat.ofNat Nat (nat_lit 4) (instOfNatNat (nat_lit 4)))
          r_1))
      (@HMul.hMul Nat Nat Nat (@instHMul Nat instMulNat) (@OfNat.ofNat Nat (nat_lit 6) (instOfNatNat (nat_lit 6)))
        (@HPow.hPow Nat Nat Nat (@instHPow Nat Nat (@Monoid.toNatPow Nat Nat.instMonoid)) r_1
          (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2))))))
    (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat)
      (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))
        (@HMul.hMul Nat Nat Nat (@instHMul Nat instMulNat) (@OfNat.ofNat Nat (nat_lit 4) (instOfNatNat (nat_lit 4)))
          s_1))
      (@HMul.hMul Nat Nat Nat (@instHMul Nat instMulNat) (@OfNat.ofNat Nat (nat_lit 6) (instOfNatNat (nat_lit 6)))
        (@HPow.hPow Nat Nat Nat (@instHPow Nat Nat (@Monoid.toNatPow Nat Nat.instMonoid)) s_1
          (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2))))))

abcdlcm

ℕ → ℕ → ℕ → ℕ → Prop

habcdlcm

∀ a b c d : ℕ, abcdlcm a b c d ↔
      (a > 0 ∧ b > 0 ∧ c > 0 ∧ d > 0 ∧
      (3 ^ r * 7 ^ s = Nat.lcm (Nat.lcm a b) c) ∧
      (3 ^ r * 7 ^ s = Nat.lcm (Nat.lcm a b) d) ∧
      (3 ^ r * 7 ^ s = Nat.lcm (Nat.lcm a c) d) ∧
      (3 ^ r * 7 ^ s = Nat.lcm (Nat.lcm b c) d))

{h : ℕ × ℕ × ℕ × ℕ | abcdlcm h.1 h.2.1 h.2.2.1 h.2.2.2}.encard = answer r s


@Eq Real answer
  (@HDiv.hDiv Real Real Real (@instHDiv Real (@DivInvMonoid.toDiv Real Real.instDivInvMonoid)) Real.pi
    (@OfNat.ofNat Real (nat_lit 4)
      (@instOfNatAtLeastTwo Real (nat_lit 4) Real.instNatCast
        (@instNatAtLeastTwo (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))))))

answer = ∫ x in Set.Ioo 0 (Real.pi / 2), 1 / (1 + (Real.tan x) ^ (Real.sqrt 2))


Let $C$ be the class of all real valued continuously differentiable functions $f$ on the interval $0 \leq x \leq 1$ with $f(0)=0$ and $f(1)=1$. Determine the largest real number $u$ such that $u \leq \int_0^1|f'(x)-f(x)|\,dx$ for all $f$ in $C$.

@Eq Real answer
  (@HDiv.hDiv Real Real Real (@instHDiv Real (@DivInvMonoid.toDiv Real Real.instDivInvMonoid))
    (@OfNat.ofNat Real (nat_lit 1) (@One.toOfNat1 Real Real.instOne))
    (Real.exp (@OfNat.ofNat Real (nat_lit 1) (@One.toOfNat1 Real Real.instOne))))

hC

C = {f : ℝ → ℝ | ContDiffOn ℝ 1 f (Set.Icc 0 1) ∧ f 0 = 0 ∧ f 1 = 1}

IsGreatest {u : ℝ | ∀ f ∈ C, u ≤ (∫ x in Set.Ioo 0 1, |deriv f x - f x|)} answer


For which real numbers $c$ is $(e^x+e^{-x})/2 \leq e^{cx^2}$ for all real $x$?

Show that the inequality holds if and only if $c \geq 1/2$.

@Eq (Set Real) answer
  (@setOf Real fun (c_1 : Real) =>
    @GE.ge Real Real.instLE c_1
      (@HDiv.hDiv Real Real Real (@instHDiv Real (@DivInvMonoid.toDiv Real Real.instDivInvMonoid))
        (@OfNat.ofNat Real (nat_lit 1) (@One.toOfNat1 Real Real.instOne))
        (@OfNat.ofNat Real (nat_lit 2)
          (@instOfNatAtLeastTwo Real (nat_lit 2) Real.instNatCast
            (@instNatAtLeastTwo (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))))))))

∀ x : ℝ, (exp x + exp (-x)) / 2 ≤ exp (c * x ^ 2) ↔ c ∈ answer


For which real numbers $a$ does the sequence defined by the initial condition $u_0=a$ and the recursion $u_{n+1}=2u_n-n^2$ have $u_n>0$ for all $n \geq 0$? (Express the answer in the simplest form.)

Show that $u_n>0$ for all $n \geq 0$ if and only if $a \geq 3$.

@Eq (Set Real) answer
  (@setOf Real fun (a_1 : Real) =>
    @GE.ge Real Real.instLE a_1
      (@OfNat.ofNat Real (nat_lit 3)
        (@instOfNatAtLeastTwo Real (nat_lit 3) Real.instNatCast
          (@instNatAtLeastTwo (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))))))


A function $f$ is convex on $[0, 1]$ if and only if $$f(su + (1-s)v) \le sf(u) + (1 - s)f(v)$$ for all $s \in [0, 1]$.
Let $S_t$ denote the set of all nonnegative increasing convex continuous functions $f : [0, 1] \rightarrow \mathbb{R}$ such that $$f(1) - 2f\left(\frac{2}{3}\right) + f\left(\frac{1}{3}\right) \ge t\left(f\left(\frac{2}{3}\right) - 2f\left(\frac{1}{3}\right) + f(0)\right).$$
For which real numbers $t \ge 0$ is $S_t$ closed under multiplication?

$S_t$ is closed under multiplication if and only if $1 \ge t$.

@Eq (Real → Prop) answer fun (t_1 : Real) =>
  @LE.le Real Real.instLE t_1 (@OfNat.ofNat Real (nat_lit 1) (@One.toOfNat1 Real Real.instOne))

P

ℝ → (ℝ → ℝ) → Prop

S

ℝ → Set (ℝ → ℝ)

∀ f, IsConvex f ↔ ∀ u ∈ T, ∀ v ∈ T, ∀ s ∈ T, f (s*u + (1 - s)*v) ≤ s*(f u) + (1 - s)*(f v)

hS

S = fun t : ℝ => {f : ℝ → ℝ | (∀ x ∈ T, f x ≥ 0) ∧ StrictMonoOn f T ∧ IsConvex f ∧ ContinuousOn f T ∧ P t f}

answer t ↔ (∀ f ∈ S t, ∀ g ∈ S t, f * g ∈ S t)


Let $E(n)$ be the greatest integer $k$ such that $5^k$ divides $1^1 2^2 3^3 \cdots n^n$. Find $\lim_{n \rightarrow \infty} \frac{E(n)}{n^2}$.

open Topology Filter Set Polynomial Function

@Eq Real answer
  (@HDiv.hDiv Real Real Real (@instHDiv Real (@DivInvMonoid.toDiv Real Real.instDivInvMonoid))
    (@OfNat.ofNat Real (nat_lit 1) (@One.toOfNat1 Real Real.instOne))
    (@OfNat.ofNat Real (nat_lit 8)
      (@instOfNatAtLeastTwo Real (nat_lit 8) Real.instNatCast
        (@instNatAtLeastTwo (@OfNat.ofNat Nat (nat_lit 6) (instOfNatNat (nat_lit 6)))))))

P

ℕ → ℕ → Prop

hP

∀ n k, P n k ↔ 5^k ∣ ∏ m in Finset.Icc 1 n, (m^m : ℤ)

hE

∀ n ∈ Ici 1, P n (E n) ∧ ∀ k : ℕ, P n k → k ≤ E n

Tendsto (fun n : ℕ => ((E n) : ℝ)/n^2) atTop (𝓝 answer)


Does the limit $$lim_{t \rightarrow \infty}e^{-t}\int_{0}^{t}\int_{0}^{t}\frac{e^x - e^y}{x - y} dx dy$$exist?

hf

f = fun t : ℝ => Real.exp (-t) * ∫ y in (Ico 0 t), ∫ x in (Ico 0 t), (Real.exp x - Real.exp y) / (x - y)

(∃ L : ℝ, Tendsto f atTop (𝓝 L)) ↔ answer


Let $P(x)$ be a polynomial with real coefficients; let $$Q(x) = (x^2 + 1)P(x)P'(x) + x((P(x))^2 + (P'(x))^2).$$
Given that $P$ has $n$ distinct real roots all greater than $1$, prove or disprove that $Q$ must have at least $2n - 1$ distinct real roots.

$Q(x)$ must have at least $2n - 1$ distinct real roots.

hQ

Q = fun P : Polynomial ℝ => (Polynomial.X^2 + 1) * P * (Polynomial.derivative P) + Polynomial.X * (P^2 + (Polynomial.derivative P)^2)

hn

n = fun P : Polynomial ℝ => ({x ∈ Ioi 1 | P.eval x = 0}.ncard : ℝ)

answer ↔ (∀ P : Polynomial ℝ, {x : ℝ | (Q P).eval x = 0}.ncard ≥ 2*(n P) - 1)


@Eq Real answer (@Neg.neg Real Real.instNeg (@OfNat.ofNat Real (nat_lit 1) (@One.toOfNat1 Real Real.instOne)))


Determine the minimum value attained by $$(r - 1)^2 + (\frac{s}{r} - 1)^2 + (\frac{t}{s} - 1)^2 + (\frac{4}{t} - 1)^2$$ across all choices of real $r$, $s$, and $t$ that satisfy $1 \le r \le s \le t \le 4$.

@Eq Real answer
  (@HSub.hSub Real Real Real (@instHSub Real Real.instSub)
    (@OfNat.ofNat Real (nat_lit 12)
      (@instOfNatAtLeastTwo Real (nat_lit 12) Real.instNatCast
        (@instNatAtLeastTwo (@OfNat.ofNat Nat (nat_lit 10) (instOfNatNat (nat_lit 10))))))
    (@HMul.hMul Real Real Real (@instHMul Real Real.instMul)
      (@OfNat.ofNat Real (nat_lit 8)
        (@instOfNatAtLeastTwo Real (nat_lit 8) Real.instNatCast
          (@instNatAtLeastTwo (@OfNat.ofNat Nat (nat_lit 6) (instOfNatNat (nat_lit 6))))))
      (Real.sqrt
        (@OfNat.ofNat Real (nat_lit 2)
          (@instOfNatAtLeastTwo Real (nat_lit 2) Real.instNatCast
            (@instNatAtLeastTwo (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0)))))))))

P

ℝ × ℝ × ℝ → Prop

hP

P = fun (r, s, t) => 1 ≤ r ∧ r ≤ s ∧ s ≤ t ∧ t ≤ 4

f

ℝ × ℝ × ℝ → ℝ

IsLeast {y | ∃ r s t, P (r, s, t) ∧ f (r, s, t) = y} answer


Let $V$ be a set of $5$ by $7$ matrices, with real entries and with the property that $rA+sB \in V$ whenever $A,B \in V$ and $r$ and $s$ are scalars (i.e., real numbers). \emph{Prove or disprove} the following assertion: If $V$ contains matrices of ranks $0$, $1$, $2$, $4$, and $5$, then it also contains a matrix of rank $3$. [The rank of a nonzero matrix $M$ is the largest $k$ such that the entries of some $k$ rows and some $k$ columns form a $k$ by $k$ matrix with a nonzero determinant.]

hVAB

∀ A ∈ V, ∀ B ∈ V, ∀ r s : ℝ, r • A + s • B ∈ V


Let $B(n)$ be the number of ones in the base two expression for the positive integer $n$. For example, $B(6)=B(110_2)=2$ and $B(15)=B(1111_2)=4$. Determine whether or not $\exp \left(\sum_{n=1}^\infty \frac{B(n)}{n(n+1)}\right)$ is a rational number. Here $\exp(x)$ denotes $e^x$.

Show that the expression is a rational number.

hsumbits

∀ bits : List ℕ, sumbits bits = ∑ i : Fin bits.length, (bits[i] : ℤ)

answer ↔ (∃ q : ℚ, Real.exp (∑' n : Set.Ici 1, B n / ((n : ℝ) * ((n : ℝ) + 1))) = q)


Let $B_n(x) = 1^x + 2^x + \dots + n^x$ and let $f(n) = \frac{B_n(\log_n 2)}{(n \log_2 n)^2}$. Does $f(2) + f(3) + f(4) + \dots$ converge?

open Set Function Filter Topology Polynomial Real

hB

B = fun (n : ℕ) (x : ℝ) ↦ ∑ k in Finset.Icc 1 n, (k : ℝ) ^ x

hf

f = fun n ↦ B n (logb n 2) / (n * logb 2 n) ^ 2

answer ↔ (∃ L : ℝ, Tendsto (fun N ↦ ∑ j in Finset.Icc 2 N, f j) atTop (𝓝 L))


Evaluate $\int_0^{\infty} \frac{\tan^{-1}(\pi x) - \tan^{-1} x}{x} \, dx$.

Show that the integral evaluates to $\frac{\pi}{2} \ln \pi$.

@Eq Real answer
  (@HMul.hMul Real Real Real (@instHMul Real Real.instMul)
    (@HDiv.hDiv Real Real Real (@instHDiv Real (@DivInvMonoid.toDiv Real Real.instDivInvMonoid)) Real.pi
      (@OfNat.ofNat Real (nat_lit 2)
        (@instOfNatAtLeastTwo Real (nat_lit 2) Real.instNatCast
          (@instNatAtLeastTwo (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0)))))))
    (Real.log Real.pi))

Tendsto (fun t ↦ ∫ x in (0)..t, (arctan (Real.pi * x) - arctan x) / x) atTop (𝓝 answer)


Let $b$ be a bijection from the positive integers to the positive integers. Also, let $x_1, x_2, x_3, \dots$ be an infinite sequence of real numbers with the following properties:
\begin{enumerate}
\item
$|x_n|$ is a strictly decreasing function of $n$;
\item
$\lim_{n \rightarrow \infty} |b(n) - n| \cdot |x_n| = 0$;
\item
$\lim_{n \rightarrow \infty}\sum_{k = 1}^{n} x_k = 1$.
\end{enumerate}
Prove or disprove: these conditions imply that $$\lim_{n \rightarrow \infty} \sum_{k = 1}^{n} x_{b(k)} = 1.$$

StrictAntiOn (fun n : ℕ => |x n|) (Ici 1)

Tendsto (fun n : ℕ => |b n - (n : ℤ)| * |x n|) atTop (𝓝 0)

Tendsto (fun n : ℕ => ∑ k in Finset.Icc 1 n, x k) atTop (𝓝 1)

(Tendsto (fun n : ℕ => ∑ k in Finset.Icc 1 n, x (b k)) atTop (𝓝 1)) ↔ answer


Let $A(x, y)$ denote the number of points $(m, n)$ with integer coordinates $m$ and $n$ where $m^2 + n^2 \le x^2 + y^2$. Also, let $g = \sum_{k = 0}^{\infty} e^{-k^2}$. Express the value $$\int_{-\infty}^{\infty}\int_{-\infty}^{\infty} A(x, y)e^{-x^2 - y^2} dx dy$$ as a polynomial in $g$.

The desired polynomial is $\pi(2g - 1)^2$.

@Eq (@Polynomial Real Real.semiring) answer
  (@HMul.hMul (@Polynomial Real Real.semiring) (@Polynomial Real Real.semiring) (@Polynomial Real Real.semiring)
    (@instHMul (@Polynomial Real Real.semiring) (@Polynomial.mul' Real Real.semiring))
    (@DFunLike.coe
      (@RingHom Real (@Polynomial Real Real.semiring) (@Semiring.toNonAssocSemiring Real Real.semiring)
        (@Semiring.toNonAssocSemiring (@Polynomial Real Real.semiring) (@Polynomial.semiring Real Real.semiring)))
      Real (fun (x : Real) => @Polynomial Real Real.semiring)
      (@RingHom.instFunLike Real (@Polynomial Real Real.semiring) (@Semiring.toNonAssocSemiring Real Real.semiring)
        (@Semiring.toNonAssocSemiring (@Polynomial Real Real.semiring) (@Polynomial.semiring Real Real.semiring)))
      (@Polynomial.C Real Real.semiring) Real.pi)
    (@HPow.hPow (@Polynomial Real Real.semiring) Nat (@Polynomial Real Real.semiring)
      (@instHPow (@Polynomial Real Real.semiring) Nat
        (@Monoid.toNatPow (@Polynomial Real Real.semiring)
          (@MonoidWithZero.toMonoid (@Polynomial Real Real.semiring)
            (@Semiring.toMonoidWithZero (@Polynomial Real Real.semiring) (@Polynomial.semiring Real Real.semiring)))))
      (@HSub.hSub (@Polynomial Real Real.semiring) (@Polynomial Real Real.semiring) (@Polynomial Real Real.semiring)
        (@instHSub (@Polynomial Real Real.semiring) (@Polynomial.sub Real Real.instRing))
        (@HMul.hMul (@Polynomial Real Real.semiring) (@Polynomial Real Real.semiring) (@Polynomial Real Real.semiring)
          (@instHMul (@Polynomial Real Real.semiring) (@Polynomial.mul' Real Real.semiring))
          (@OfNat.ofNat (@Polynomial Real Real.semiring) (nat_lit 2)
            (@instOfNatAtLeastTwo (@Polynomial Real Real.semiring) (nat_lit 2)
              (@Polynomial.instNatCast Real Real.semiring)
              (@instNatAtLeastTwo (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))))))
          (@Polynomial.X Real Real.semiring))
        (@OfNat.ofNat (@Polynomial Real Real.semiring) (nat_lit 1)
          (@One.toOfNat1 (@Polynomial Real Real.semiring) (@Polynomial.one Real Real.semiring))))
      (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))))

hI

I = ∫ y : ℝ, ∫ x : ℝ, A (x, y) * Real.exp (-x^2 - y^2)