File size: 3,839 Bytes
9dbc64e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | import OAI.Computability.DepthThree.AlgebraQuotient
import OAI.Computability.DepthThree.Language
namespace OAI
noncomputable section
open scoped BigOperators
namespace DepthThreeLowerBound
namespace ParsedInput
abbrev QuotientRing (q : ParsedInput) := AdjoinRoot q.modulus
instance quotientRingFintype (q : ParsedInput) : Fintype q.QuotientRing :=
BinaryAlgebra.inputQuotientFintype
(fun i => BinaryAlgebra.bitValue (q.polynomial i))
def quotientHash (q : ParsedInput) : q.QuotientRing :=
AdjoinRoot.mk q.modulus q.hashPolynomial
def quotientCoefficient (q : ParsedInput) (j : Fin q.coefficientCount) : q.QuotientRing :=
AdjoinRoot.mk q.modulus (q.coefficientPolynomial j)
def quotientEvaluation (q : ParsedInput) : q.QuotientRing :=
∑ j : Fin q.coefficientCount, q.quotientCoefficient j * q.quotientHash ^ j.val
theorem quotientHash_eq_encode (q : ParsedInput) :
q.quotientHash = BinaryAlgebra.encode
(fun i => BinaryAlgebra.bitValue (q.polynomial i))
(fun i => BinaryAlgebra.bitValue (BinaryHash.hashBool q.hashSeed q.data i)) := rfl
theorem quotientCoefficient_eq_encode (q : ParsedInput) (j : Fin q.coefficientCount) :
q.quotientCoefficient j = BinaryAlgebra.encode
(fun i => BinaryAlgebra.bitValue (q.polynomial i))
(fun i => BinaryAlgebra.bitValue (q.coefficients j i)) := rfl
def coefficientBitsEquiv (q : ParsedInput) :
(Fin q.ringDegree → Bool) ≃ q.QuotientRing :=
(BinaryAlgebra.bitsEquivF2 (Fin q.ringDegree)).trans
(BinaryAlgebra.coordinates
(fun i => BinaryAlgebra.bitValue (q.polynomial i))).toEquiv.symm
@[simp] theorem coefficientBitsEquiv_apply (q : ParsedInput)
(v : Fin q.ringDegree → Bool) :
q.coefficientBitsEquiv v = BinaryAlgebra.encode
(fun i => BinaryAlgebra.bitValue (q.polynomial i))
(fun i => BinaryAlgebra.bitValue (v i)) := rfl
@[simp] theorem coefficientBitsEquiv_coefficient (q : ParsedInput)
(j : Fin q.coefficientCount) :
q.coefficientBitsEquiv (q.coefficients j) = q.quotientCoefficient j := rfl
@[simp] theorem quotientRing_card (q : ParsedInput) :
Fintype.card q.QuotientRing = 2 ^ q.ringDegree :=
BinaryAlgebra.bitQuotient_card q.polynomial
theorem quotientEvaluation_eq_mk (q : ParsedInput) :
q.quotientEvaluation = AdjoinRoot.mk q.modulus q.evaluationPolynomial := by
simp only [quotientEvaluation, evaluationPolynomial, quotientCoefficient, quotientHash,
map_sum, map_mul, map_pow]
theorem representative_quotientEvaluation (q : ParsedInput) :
BinaryAlgebra.quotientRepresentative q.modulus_monic q.quotientEvaluation =
q.evaluationRemainder := by
rw [quotientEvaluation_eq_mk, BinaryAlgebra.quotientRepresentative_mk]
rfl
theorem degreeZero_quotientEvaluation (q : ParsedInput) :
BinaryAlgebra.degreeZero q.modulus_monic q.quotientEvaluation =
q.evaluationRemainder.coeff 0 := by
rw [BinaryAlgebra.degreeZero_apply, representative_quotientEvaluation]
theorem quotient_degreeZero_one (q : ParsedInput) (hr : 0 < q.ringDegree) :
BinaryAlgebra.degreeZero q.modulus_monic (1 : q.QuotientRing) = 1 := by
apply BinaryAlgebra.degreeZero_one
change 0 < (BinaryAlgebra.inputPolynomialBits q.polynomial).natDegree
rw [BinaryAlgebra.inputPolynomialBits_natDegree]
exact hr
theorem evaluate_eq_true_iff_degreeZero (q : ParsedInput) :
q.evaluate = true ↔
BinaryAlgebra.degreeZero q.modulus_monic q.quotientEvaluation = 0 := by
rw [evaluate_eq_true_iff, degreeZero_quotientEvaluation]
end ParsedInput
theorem language_eq_true_iff_quotient (w : List Bool) :
language w = true ↔ InputFits w ∧
BinaryAlgebra.degreeZero (decodeInput w).modulus_monic
(decodeInput w).quotientEvaluation = 0 := by
rw [language_eq_true_iff, ParsedInput.degreeZero_quotientEvaluation]
end DepthThreeLowerBound
end
end OAI
|