Documentation

Complexitylib.RationalHitting.Internal.Affine

Rational hitting lists: affine #

Adapted from OpenAI's formalization at revision adc7f1241b42e322a6451854ab7e4b4c146bf78a. Source: https://github.com/openai/math/blob/adc7f1241b42e322a6451854ab7e4b4c146bf78a/lean/OAI/Computability/RationalHitting/Affine.lean

Imports, namespaces, module visibility, documentation, and formatting are adapted for complexitylib. The source theorem statements and mathematical arguments are retained.

@[reducible, inline]

A constant coefficient and one rational coefficient per variable.

Equations
Instances For

    The affine form with the given constant and zero variable coefficients.

    Equations
    Instances For

      The affine coordinate form for one variable.

      Equations
      Instances For
        def Complexity.RationalHitting.Affine.eval {n : ℕ} {R : Type u_1} [Ring R] (c : ℚ →+* R) (X : Fin n → R) :

        Evaluate an affine form in a rational algebra, with coefficients on the left.

        Equations
        Instances For
          @[simp]
          theorem Complexity.RationalHitting.Affine.eval_constant {n : ℕ} {R : Type u_1} [Ring R] (c : ℚ →+* R) (X : Fin n → R) (a : ℚ) :
          (eval c X) (constant a) = c a
          @[simp]
          theorem Complexity.RationalHitting.Affine.eval_variable {n : ℕ} {R : Type u_1} [Ring R] (c : ℚ →+* R) (X : Fin n → R) (i : Fin n) :
          (eval c X) (varForm i) = X i
          def Complexity.RationalHitting.Affine.constMatrix {n : ℕ} {ι : Type u_2} {κ : Type u_3} (A : Matrix ι κ ℚ) :
          Matrix ι κ (Form n)

          Regard a rational matrix as a matrix of constant affine forms.

          Equations
          Instances For
            @[simp]
            theorem Complexity.RationalHitting.Affine.eval_constMatrix {n : ℕ} {R : Type u_1} [Ring R] {ι : Type u_2} {κ : Type u_3} (c : ℚ →+* R) (X : Fin n → R) (A : Matrix ι κ ℚ) :
            (constMatrix A).map ⇑(eval c X) = A.map ⇑c
            @[reducible]

            The finite row and column index type of the formula's linear realization.

            Equations
            Instances For

              The affine matrix pencil built recursively from a rational formula.

              Equations
              Instances For
                @[reducible, inline]
                abbrev Complexity.RationalHitting.Formula.realized {n : ℕ} {R : Type u_1} [Ring R] (c : ℚ →+* R) (X : Fin n → R) (f : Formula n) :

                Evaluate all entries of the formula's affine pencil.

                Equations
                Instances For
                  @[reducible, inline]
                  abbrev Complexity.RationalHitting.Formula.rowR {n : ℕ} {R : Type u_1} [Ring R] (c : ℚ →+* R) (f : Formula n) :

                  Map the realization's rational row into the target ring.

                  Equations
                  Instances For
                    @[reducible, inline]
                    abbrev Complexity.RationalHitting.Formula.colR {n : ℕ} {R : Type u_1} [Ring R] (c : ℚ →+* R) (f : Formula n) :

                    Map the realization's rational column into the target ring.

                    Equations
                    Instances For
                      @[reducible, inline]

                      Represent a scalar as a one-by-one matrix.

                      Equations
                      Instances For
                        theorem Complexity.RationalHitting.Formula.realized_add {n : ℕ} {R : Type u_1} [Ring R] (c : ℚ →+* R) (X : Fin n → R) (f g : Formula n) :
                        realized c X (f.add g) = Matrix.fromBlocks (realized c X f) 0 0 (realized c X g)
                        theorem Complexity.RationalHitting.Formula.realized_mul {n : ℕ} {R : Type u_1} [Ring R] (c : ℚ →+* R) (X : Fin n → R) (f g : Formula n) :
                        realized c X (f.mul g) = Matrix.fromBlocks (realized c X f) (-colR c f * rowR c g) 0 (realized c X g)
                        theorem Complexity.RationalHitting.Formula.realized_inv {n : ℕ} {R : Type u_1} [Ring R] (c : ℚ →+* R) (X : Fin n → R) (f : Formula n) :
                        realized c X f.inv = Matrix.fromBlocks (realized c X f) (colR c f) (rowR c f) 0
                        theorem Complexity.RationalHitting.Formula.rowR_add {n : ℕ} {R : Type u_1} [Ring R] (c : ℚ →+* R) (f g : Formula n) :
                        rowR c (f.add g) = (rowR c f).fromCols (rowR c g)
                        theorem Complexity.RationalHitting.Formula.colR_add {n : ℕ} {R : Type u_1} [Ring R] (c : ℚ →+* R) (f g : Formula n) :
                        colR c (f.add g) = (colR c f).fromRows (colR c g)
                        theorem Complexity.RationalHitting.Formula.rowR_mul {n : ℕ} {R : Type u_1} [Ring R] (c : ℚ →+* R) (f g : Formula n) :
                        rowR c (f.mul g) = (rowR c f).fromCols 0
                        theorem Complexity.RationalHitting.Formula.colR_mul {n : ℕ} {R : Type u_1} [Ring R] (c : ℚ →+* R) (f g : Formula n) :
                        colR c (f.mul g) = Matrix.fromRows 0 (colR c g)
                        theorem Complexity.RationalHitting.Formula.rowR_inv {n : ℕ} {R : Type u_1} [Ring R] (c : ℚ →+* R) (f : Formula n) :
                        theorem Complexity.RationalHitting.Formula.Eval.realization {n : ℕ} {R : Type u_1} [Ring R] (c : ℚ →+* R) (X : Fin n → R) {f : Formula n} {a : R} (ha : Eval c X f a) :
                        ∃ (M : Matrix f.Index f.Index R), realized c X f * M = 1 ∧ M * realized c X f = 1 ∧ rowR c f * M * colR c f = scalar a

                        Exact affine realization of every defined original subtree.

                        .inv f here denotes the root augmentation pencil, not a new counted gate.

                        Equations
                        Instances For
                          theorem Complexity.RationalHitting.Formula.Eval.pencil_isUnit {n : ℕ} {R : Type u_1} [Ring R] (c : ℚ →+* R) (X : Fin n → R) {f : Formula n} {a : R} (ha : Eval c X f a) :
                          theorem Complexity.RationalHitting.Formula.Eval.augmented_isUnit_iff {n : ℕ} {R : Type u_1} [Ring R] (c : ℚ →+* R) (X : Fin n → R) {f : Formula n} {a : R} (ha : Eval c X f a) :
                          theorem Complexity.RationalHitting.Formula.Eval.inverseNodes_units {n : ℕ} {R : Type u_1} [Ring R] (c : ℚ →+* R) (X : Fin n → R) {f : Formula n} {a : R} (ha : Eval c X f a) (h : Formula n) :
                          theorem Complexity.RationalHitting.Formula.eval_of_inverseNodes_units {n : ℕ} {R : Type u_1} [Ring R] (c : ℚ →+* R) (X : Fin n → R) (f : Formula n) (hu : ∀ h ∈ f.inverseNodes, IsUnit (realized c X h)) :
                          ∃ (a : R), Eval c X f a
                          theorem Complexity.RationalHitting.Formula.certificates_iff {n : ℕ} {R : Type u_1} [Ring R] (c : ℚ →+* R) (X : Fin n → R) (f : Formula n) :
                          (∀ h ∈ f.certificates, IsUnit (realized c X h)) ↔ ∃ (a : R), Eval c X f a ∧ IsUnit a

                          Full original-tree definedness and invertible final value are equivalent to all affine-pencil certificates. No rational cancellation is performed.

                          The homogeneous coefficient, with index zero reserved for the constant term.

                          Equations
                          Instances For
                            def Complexity.RationalHitting.Affine.homogeneous {n : ℕ} {R : Type u_1} [Ring R] (c : ℚ →+* R) (Z : Fin (n + 1) → R) (a : Form n) :
                            R

                            Evaluate the homogeneous form on an extra constant coordinate.

                            Equations
                            Instances For
                              theorem Complexity.RationalHitting.Affine.homogeneous_one {n : ℕ} {R : Type u_1} [Ring R] (c : ℚ →+* R) (X : Fin n → R) (a : Form n) :
                              homogeneous c (fun (i : Fin (n + 1)) => Fin.cases 1 X i) a = (eval c X) a
                              theorem Complexity.RationalHitting.Affine.normalized {n : ℕ} {R : Type u_1} [Ring R] [Algebra ℚ R] (Z : Fin (n + 1) → R) (u : R) (hu : Z 0 * u = 1) (a : Form n) :
                              homogeneous (algebraMap ℚ R) Z a = Z 0 * (eval (algebraMap ℚ R) fun (i : Fin n) => u * Z i.succ) a
                              theorem Complexity.RationalHitting.Affine.normalized_pencil {n : ℕ} {R : Type u_1} [Ring R] {ι : Type u_2} [Fintype ι] [DecidableEq ι] [Algebra ℚ R] (L : Matrix ι ι (Form n)) (Z : Fin (n + 1) → R) (u : R) (hu : Z 0 * u = 1) :
                              L.map (homogeneous (algebraMap ℚ R) Z) = (Matrix.scalar ι) (Z 0) * L.map ⇑(eval (algebraMap ℚ R) fun (i : Fin n) => u * Z i.succ)
                              theorem Complexity.RationalHitting.Affine.normalized_pencil_unit {n : ℕ} {R : Type u_1} [Ring R] {ι : Type u_2} [Fintype ι] [DecidableEq ι] [Algebra ℚ R] (L : Matrix ι ι (Form n)) (Z : Fin (n + 1) → R) (z : Rˣ) (hz : ↑z = Z 0) (hL : IsUnit (L.map (homogeneous (algebraMap ℚ R) Z))) :
                              IsUnit (L.map ⇑(eval (algebraMap ℚ R) fun (i : Fin n) => ↑z⁻¹ * Z i.succ))
                              theorem Complexity.RationalHitting.Affine.eval_reindex {n : ℕ} {K : Type v_2} [Field K] [CharZero K] {ι : Type v_3} {κ : Type v_4} [Fintype κ] [DecidableEq κ] (L : Matrix ι ι (Form n)) (X : Fin n → Matrix κ κ K) {ι' : Type v_5} (e : ι ≃ ι') :
                              ((Matrix.reindex e e) L).map ⇑(eval (algebraMap ℚ (Matrix κ κ K)) X) = (Matrix.reindex e e) (L.map ⇑(eval (algebraMap ℚ (Matrix κ κ K)) X))

                              Reindexing a pencil's coefficients does not alter its matrix evaluation.

                              theorem Complexity.RationalHitting.Affine.homogeneous_flat {n : ℕ} {K : Type v_2} [Field K] [CharZero K] {ι : Type v_3} {κ : Type v_4} [Fintype ι] [Fintype κ] [DecidableEq κ] (L : Matrix ι ι (Form n)) (Z : Fin (n + 1) → Matrix κ κ K) :
                              (Matrix.compRingEquiv ι κ K) (L.map (homogeneous (algebraMap ℚ (Matrix κ κ K)) Z)) = fun (a b : ι × κ) => ∑ r : Fin (n + 1), (algebraMap ℚ K) (coeff (L a.1 b.1) r) * Z r a.2 b.2

                              Homogeneous affine coefficients give exactly the ordinary Kronecker pencil.