Koch Snowflake

lean4-proofvisualizationfractal-geometry
Pn=3s(43)nP_n = 3s \left(\frac{4}{3}\right)^n

Statement

Starting from an equilateral triangle of side ss, the Koch snowflake is built by repeatedly replacing each edge segment with a four-segment Koch bump (each new segment one-third the original length). After nn steps:

Pn=3s(43)nnP_n = 3s \cdot \left(\frac{4}{3}\right)^n \xrightarrow{n \to \infty} \infty

The area converges:

A=235s2A = \frac{2\sqrt{3}}{5} s^2

The Hausdorff dimension of the Koch curve is:

dH=log4log31.2619d_H = \frac{\log 4}{\log 3} \approx 1.2619

Visualization

Each iteration replaces every edge with four edges of length 1/31/3 of the original, multiplying the total count by 44 and the perimeter by 4/34/3.

Level 0 (equilateral triangle, s = 1):
    *
   / \
  /   \
 *-----*

  P_0 = 3

Level 1 (Koch bump on each edge):
    *
   / \
  /   \
 *-*-*-*
   \/

  P_1 = 4

Level 2 (four bumps on each segment):
  P_2 = 16/3 ≈ 5.33

Level 3:
  P_3 = 64/9 ≈ 7.11

Perimeter table (with s=1s = 1):

Level nnPn=3(4/3)nP_n = 3 \cdot (4/3)^nEdge countEdge length
0333311
14412121/31/3
216/35.3316/3 \approx 5.3348481/91/9
364/97.1164/9 \approx 7.111921921/271/27
4256/279.48256/27 \approx 9.487687681/811/81
nn3(4/3)n3 \cdot (4/3)^n34n3 \cdot 4^n(1/3)n(1/3)^n
\infty\infty\infty00

The area converges because k=134k134(s/3k)2\sum_{k=1}^\infty 3 \cdot 4^{k-1} \cdot \frac{\sqrt{3}}{4} \cdot (s/3^k)^2 is a geometric series with ratio 4/9<14/9 < 1.

Proof Sketch

Perimeter recursion. At step nn, there are 34n3 \cdot 4^n edges each of length s/3ns/3^n, giving Pn=34ns/3n=3s(4/3)nP_n = 3 \cdot 4^n \cdot s/3^n = 3s \cdot (4/3)^n. The recursion Pn+1=(4/3)PnP_{n+1} = (4/3) P_n follows immediately.

Divergence. Since 4/3>14/3 > 1, the sequence PnP_n \to \infty.

Area. The area added at step kk is 34k13 \cdot 4^{k-1} new equilateral triangles each of side s/3ks/3^k, contributing 34k134(s/3k)23 \cdot 4^{k-1} \cdot \frac{\sqrt{3}}{4} \cdot (s/3^k)^2. Summing from k=1k=1 to \infty gives a geometric series of ratio 4/94/9.

Hausdorff dimension. Four self-similar pieces each scaled by 1/31/3: Moran equation 4(1/3)s=14 \cdot (1/3)^s = 1 gives s=log4/log3s = \log 4 / \log 3.

Connections

The Koch snowflake is an IFSIterated Function SystemsA=i=1Nfi(A)A = \bigcup_{i=1}^{N} f_i(A)Constructing fractals via contractive affine transformationsRead more → attractor on R2\mathbb{R}^2, with four contractions of ratio 1/31/3. Its Hausdorff DimensionHausdorff Dimensiond=logNlog(1/r)d = \frac{\log N}{\log (1/r)}Measuring the fractional dimension of self-similar setsRead more → log4/log31.26\log 4/\log 3 \approx 1.26 is strictly between 1 and 2. The Sierpinski TriangleSierpinski TriangledH=log3log2d_H = \frac{\log 3}{\log 2}Self-similar fractal built by three half-scale copies of itselfRead more → is a sibling IFS fractal with dimension log3/log21.585\log 3/\log 2 \approx 1.585. The Hausdorff DistanceHausdorff DistancedH(A,B)=max(supaAd(a,B), supbBd(b,A))d_H(A, B) = \max\left(\sup_{a \in A} d(a, B),\ \sup_{b \in B} d(b, A)\right)A metric on non-empty compact sets, foundation for the IFS attractor theoremRead more → between successive Koch iterates KnK_n and Kn+1K_{n+1} shrinks geometrically, which is precisely the IFS contraction rate. The Mandelbrot SetMandelbrot Setzn+1=zn2+cz_{n+1} = z_n^2 + cInteractive visualization of z_{n+1} = z_n^2 + c and its connectednessRead more → boundary is conjectured (but not proven) to have Hausdorff dimension 2.

Lean4 Proof

The proof establishes the perimeter recursion and its divergence to ++\infty, using tendsto_pow_atTop_atTop_of_one_lt from Mathlib.Analysis.SpecificLimits.Basic.

Key Mathlib lemmas used: tendsto_pow_atTop_atTop_of_one_lt (for base 4/3>14/3 > 1), Tendsto.const_mul_atTop (scaling by the positive constant 3s3s), and positivity for the sign of 3s3s.

Lean4 Proof

import Mathlib.Analysis.SpecificLimits.Basic

namespace MoonMath

open Filter Topology

/-- The perimeter of the Koch snowflake at iteration `n`,
    starting from a triangle of side `s`. -/
noncomputable def kochPerim (s : ) :   
  | 0     => 3 * s
  | n + 1 => (4 / 3) * kochPerim s n

/-- Closed form: `kochPerim s n = 3 * s * (4/3)^n`. -/
theorem koch_perim_formula (s : ) (n : ) :
    kochPerim s n = 3 * s * (4 / 3) ^ n := by
  induction n with
  | zero     => simp [kochPerim]
  | succ n ih => simp only [kochPerim, ih]; ring

/-- The Koch snowflake perimeter diverges to `+∞` for any positive side length. -/
theorem koch_perim_tendsto_atTop (s : ) (hs : 0 < s) :
    Tendsto (kochPerim s) atTop atTop := by
  have heq : kochPerim s = fun n => 3 * s * (4 / 3) ^ n := funext (koch_perim_formula s)
  rw [heq]
  apply Tendsto.const_mul_atTop (by positivity)
  exact tendsto_pow_atTop_atTop_of_one_lt (by norm_num : (1 : ) < 4 / 3)

end MoonMath