File size: 1,548 Bytes
4a56cd6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import OAI.Algorithms.SubexponentialSAT.LeanCompat
import OAI.Algorithms.SubexponentialSAT.Subexp.BlockSearchEncoding
import OAI.Algorithms.SubexponentialSAT.Subexp.MatrixZeroSemantics

namespace OAI.Algorithms

/-! The concrete tail slice used by the block coefficient zero test. -/

namespace SubexponentialSAT.Subexp.BlockSearchTailSemantics

open BlockSearchEncoding

theorem ofFn_split {K : Type*} {N : ℕ} (d : Fin (N + 1)) (x : Fin N → K) :
    List.ofFn x = List.ofFn (headCoefficients d x) ++ List.ofFn (tailCoefficients d x) := by
  have hN : d.val + (N - d.val) = N := by have := d.isLt; omega
  rw [List.ofFn_congr hN.symm x, List.ofFn_add]
  rfl

theorem drop_ofFn_eq_tail {K : Type*} {N : ℕ} (d : Fin (N + 1)) (x : Fin N → K) :
    (List.ofFn x).drop d.val = List.ofFn (tailCoefficients d x) := by
  rw [ofFn_split d x]
  have h : (List.ofFn (headCoefficients d x) ++ List.ofFn (tailCoefficients d x)).drop
      (List.ofFn (headCoefficients d x)).length = List.ofFn (tailCoefficients d x) :=
    List.drop_left
  simpa only [List.length_ofFn] using h

theorem zero_tail_words (p : â„•) [Fact p.Prime] {N : â„•}
    (d : Fin (N + 1)) (x : Fin N → ZMod p) :
    BlockZeroProgram.isZero
      ((List.ofFn fun i => MatrixWordEncoding.word p (x i)).drop d.val) =
        decide (tailCoefficients d x = 0) := by
  rw [drop_ofFn_eq_tail d (fun i => MatrixWordEncoding.word p (x i))]
  exact MatrixZeroSemantics.zero_encoded_vector p (tailCoefficients d x)

end SubexponentialSAT.Subexp.BlockSearchTailSemantics

end OAI.Algorithms