Documentation

LeanPool.ConwaySoifer.Geometry.Support

Support forms and orientations of equilateral triangles in triangular coordinates #

The support value of a direction e at a point q is the determinant cross e q; the three edge directions of an equilateral triangle are e, rot e, rot (rot e) where rot is the rotation by 120 degrees, rot (a, b) = (-a-b, a). The Orientation structure records an exact description of a nondegenerate filled triangle as the intersection of three halfspaces with these normals; the sum of the three offsets equals side · |e|. This is the geometric fact behind the certificate checker: three chosen mandatory points give a lower bound for the side of any triangle of this orientation containing them, and the endpoint/forbidden-point contact conditions are inherited from Halfspaces.lean.

The algebra of the cone lemma (support_bound_on_cone) is adapted from SevenTriangles/Geometry/Support.lean (commit b17ca52a) to the metric a² + ab + b².

Rotation by 120 degrees.

Equations
Instances For

    Rotation by 60 degrees.

    Equations
    Instances For

      Rotation by -60 degrees.

      Equations
      Instances For
        @[simp]
        theorem ConwaySoifer.rotPow_zero (p : Point) :
        rotPow 0 p = p
        @[simp]
        @[simp]
        theorem ConwaySoifer.rotPow_two (p : Point) :
        rotPow 2 p = rot (rot p)
        theorem ConwaySoifer.rot_add (p q : Point) :
        rot (p + q) = rot p + rot q
        theorem ConwaySoifer.rot_sub (p q : Point) :
        rot (p - q) = rot p - rot q
        theorem ConwaySoifer.rot_smul (t : ℝ) (p : Point) :
        rot (t • p) = t • rot p
        theorem ConwaySoifer.rot_sum (p : Point) :
        p + rot p + rot (rot p) = 0
        theorem ConwaySoifer.rotPow_add (j : Fin 3) (p q : Point) :
        rotPow j (p + q) = rotPow j p + rotPow j q
        theorem ConwaySoifer.rotPow_smul (j : Fin 3) (t : ℝ) (p : Point) :
        rotPow j (t • p) = t • rotPow j p

        Bilinearity of cross and the metric #

        theorem ConwaySoifer.cross_add_left (u v w : Point) :
        cross (u + v) w = cross u w + cross v w
        theorem ConwaySoifer.cross_add_right (u v w : Point) :
        cross u (v + w) = cross u v + cross u w
        theorem ConwaySoifer.cross_sub_right (u v w : Point) :
        cross u (v - w) = cross u v - cross u w
        theorem ConwaySoifer.cross_sub_left (u v w : Point) :
        cross (u - v) w = cross u w - cross v w
        theorem ConwaySoifer.cross_smul_left (t : ℝ) (u v : Point) :
        cross (t • u) v = t * cross u v
        theorem ConwaySoifer.cross_smul_right (t : ℝ) (u v : Point) :
        cross u (t • v) = t * cross u v
        theorem ConwaySoifer.cross_rot (u v : Point) :
        cross (rot u) (rot v) = cross u v
        theorem ConwaySoifer.cross_rotPow (j : Fin 3) (u v : Point) :
        cross (rotPow j u) (rotPow j v) = cross u v

        Squared length of a vector.

        Equations
        Instances For
          theorem ConwaySoifer.normSq_smul (t : ℝ) (u : Point) :
          normSq (t • u) = t ^ 2 * normSq u
          noncomputable def ConwaySoifer.metricInner (u v : Point) :

          The metric inner product.

          Equations
          Instances For
            theorem ConwaySoifer.lagrange (u v : Point) :
            normSq u * normSq v - metricInner u v ^ 2 = 3 / 4 * cross u v ^ 2
            noncomputable def ConwaySoifer.len (u : Point) :

            Euclidean length.

            Equations
            Instances For
              theorem ConwaySoifer.len_add_le (u v : Point) :
              len (u + v) ≤ len u + len v
              theorem ConwaySoifer.len_smul_nonneg {t : ℝ} (ht : 0 ≤ t) (u : Point) :
              len (t • u) = t * len u
              theorem ConwaySoifer.len_rotPow (j : Fin 3) (u : Point) :
              len (rotPow j u) = len u

              Cones #

              theorem ConwaySoifer.exists_nonneg_combo_of_cross {u v l : Point} (huv : 0 < cross u v) (hul : 0 ≤ cross u l) (hlv : 0 ≤ cross l v) :
              ∃ (a : ℝ) (b : ℝ), 0 ≤ a ∧ 0 ≤ b ∧ l = a • u + b • v

              Nonnegative coordinates of a vector inside a two-dimensional cone.

              def ConwaySoifer.supportNum (e p₀ p₁ p₂ : Point) :

              The support numerator of a direction for three chosen points.

              Equations
              Instances For
                theorem ConwaySoifer.supportNum_add (e f p₀ p₁ p₂ : Point) :
                supportNum (e + f) p₀ p₁ p₂ = supportNum e p₀ p₁ p₂ + supportNum f p₀ p₁ p₂
                theorem ConwaySoifer.supportNum_smul (t : ℝ) (e p₀ p₁ p₂ : Point) :
                supportNum (t • e) p₀ p₁ p₂ = t * supportNum e p₀ p₁ p₂
                theorem ConwaySoifer.support_bound_on_cone {u v l p₀ p₁ p₂ : Point} (hu : len u ≤ supportNum u p₀ p₁ p₂) (hv : len v ≤ supportNum v p₀ p₁ p₂) (huv : 0 < cross u v) (hul : 0 ≤ cross u l) (hlv : 0 ≤ cross l v) :
                len l ≤ supportNum l p₀ p₁ p₂

                Endpoint support certificates propagate to every direction of their cone.

                The two chiralities of an equilateral triangle #

                theorem ConwaySoifer.point_eq_of_inner_cross_eq {e p q : Point} (he : 0 < normSq e) (hinner : metricInner e p = metricInner e q) (hcross : cross e p = cross e q) :
                p = q

                The third vertex of an equilateral triangle is obtained from the first edge by a rotation of ±60 degrees.

                Orientations #

                theorem ConwaySoifer.forall_fin3 {P : Fin 3 → Prop} :
                (∀ (j : Fin 3), P j) ↔ P 0 ∧ P 1 ∧ P 2
                theorem ConwaySoifer.vec3_zero (a b c : ℝ) :
                ![a, b, c] 0 = a
                theorem ConwaySoifer.vec3_one (a b c : ℝ) :
                ![a, b, c] 1 = b
                theorem ConwaySoifer.vec3_two (a b c : ℝ) :
                ![a, b, c] 2 = c

                An exact halfspace description of a filled triangle whose outward edge directions are the three successive 120-degree rotations of dir, together with the side identity.

                Instances For

                  Consequences used by the checker #

                  theorem ConwaySoifer.Orientation.supportNum_le {T : EquilateralTriangle} (O : Orientation T) {p₀ p₁ p₂ : Point} (h₀ : p₀ ∈ T.carrier) (h₁ : p₁ ∈ T.carrier) (h₂ : p₂ ∈ T.carrier) :
                  supportNum O.dir p₀ p₁ p₂ ≤ T.side * len O.dir

                  Three contained points bound the side from below.

                  theorem ConwaySoifer.Orientation.one_le_side_of_bound {T : EquilateralTriangle} (O : Orientation T) {p₀ p₁ p₂ : Point} (h₀ : p₀ ∈ T.carrier) (h₁ : p₁ ∈ T.carrier) (h₂ : p₂ ∈ T.carrier) (hb : len O.dir ≤ supportNum O.dir p₀ p₁ p₂) :
                  1 ≤ T.side

                  Any direction-form certificate len l ≤ supportNum l … for three contained points forces 1 ≤ side, provided l is a positive multiple of the orientation direction.

                  The halfspace system of an orientation.

                  Equations
                  Instances For
                    theorem ConwaySoifer.Orientation.full_endpoint {T : EquilateralTriangle} (O : Orientation T) {v d : Point} (hv : v ∈ T.carrier) (hd : sqDist d (0, 0) = 1) :
                    ∃ (j : Fin 3), 0 < cross (rotPow j O.dir) d ∧ ∀ q ∈ T.carrier, cross (rotPow j O.dir) q ≤ cross (rotPow j O.dir) (linePoint v d (rayLen T v d))

                    A full ray endpoint has an outward edge direction with positive exit derivative that is supported at the endpoint.

                    theorem ConwaySoifer.Orientation.forbidden {T : EquilateralTriangle} (O : Orientation T) {v d : Point} (hv : v ∈ T.carrier) {t : ℝ} (ht : 0 < t) (hout : linePoint v d t ∉ T.carrier) :
                    ∃ (j : Fin 3), 0 < cross (rotPow j O.dir) d ∧ ∀ q ∈ T.carrier, cross (rotPow j O.dir) q < cross (rotPow j O.dir) (linePoint v d t)

                    A forbidden point on a positive ray from a contained point has a strictly separating outward edge direction with positive exit derivative.

                    The three 120-degree cones cover the plane #

                    The constant east vector in triangular coordinates.

                    Equations
                    Instances For

                      Relabelling the faces and choosing a representative in the first cone #

                      theorem ConwaySoifer.rotPow_succ (j : Fin 3) (p : Point) :
                      rotPow j (rot p) = rotPow (j + 1) p

                      The same triangle with the faces relabelled cyclically: dir ↦ rot dir.

                      Equations
                      Instances For

                        Every nondegenerate triangle has an orientation whose direction lies in the closed cone from eastDir to rot eastDir.

                        Parallel vectors inside the first cone #

                        theorem ConwaySoifer.exists_parallel_of_cross_eq_zero {u l : Point} (hu : u ≠ 0) (h : cross u l = 0) :
                        ∃ (t : ℝ), l = t • u
                        theorem ConwaySoifer.pos_of_parallel_in_arc {u l : Point} (hu : u ≠ 0) (hl : l ≠ 0) (hu₁ : 0 ≤ cross eastDir u) (hu₂ : 0 ≤ cross u (rot eastDir)) (hl₁ : 0 ≤ cross eastDir l) (hl₂ : 0 ≤ cross l (rot eastDir)) (h : cross u l = 0) :
                        ∃ (t : ℝ), 0 < t ∧ l = t • u

                        In the closed cone from eastDir to rot eastDir, a nonzero vector parallel to another nonzero vector of the cone is a positive multiple of it.