Documentation

CslibFrontier.Computability.Circuit.SlpCostPow

Costs of straight-line programs in powers of one number #

The costs of Cslib.Circuits.Cost and Cslib.Circuits.CostP are counted here in powers of one number Y, the base (Cslib.Circuits.StepBase D Y): 3 ≤ Y, and the alphabet Fin D holds all numbers below Y ^ 4. Then a binary operation, a relation or a connective raises the exponent of the cost by one; a sum, a count or a bounded quantifier over at most Y elements and a choice raise it by two. A family of at most Y ^ e functions, each computed in Y ^ a steps with a + e ≤ k, is added to a straight-line program in one stage of Y ^ k gates (Cslib.Circuits.StepBase.stage). The functions and indicators that are computed already cost nothing (Cslib.Circuits.Cost.of_mem, Cslib.Circuits.CostP.of_mem).

Main definitions #

Main results #

References #

theorem Cslib.Circuits.Cost.of_mem {Inp : Type} {D : ℕ} {H : Set (Inp → ℕ)} {f : Inp → ℕ} {c : ℕ} (hf : f ∈ H) :
Cost D H c f

A function of H is computed from H in any number of steps.

theorem Cslib.Circuits.CostP.of_mem {Inp : Type} {D : ℕ} {H : Set (Inp → ℕ)} {P : Inp → Prop} {c : ℕ} (hP : {x : Inp | P x}.indicator 1 ∈ H) :
CostP D H c P

A property whose indicator is a function of H is decided from H in any number of steps.

structure Cslib.Circuits.StepBase (D Y : ℕ) :

The base Y of the costs of programs over the alphabet Fin D: 3 ≤ Y, and the alphabet holds all numbers below Y ^ 4.

  • three_le : 3 ≤ Y
  • pow_four_le : Y ^ 4 ≤ D
theorem Cslib.Circuits.StepBase.pos {D Y : ℕ} (hY : StepBase D Y) :
0 < Y
theorem Cslib.Circuits.StepBase.lt_of_le_two_mul_pow_three {D Y : ℕ} (hY : StepBase D Y) {k : ℕ} (hk : k ≤ 2 * Y ^ 3) :
k < D

The numbers up to 2 * Y ^ 3 are letters.

theorem Cslib.Circuits.StepBase.lt_of_le {D Y : ℕ} (hY : StepBase D Y) {k : ℕ} (hk : k ≤ Y) :
k < D

The numbers up to Y are letters.

theorem Cslib.Circuits.StepBase.one_lt {D Y : ℕ} (hY : StepBase D Y) :
1 < D
theorem Cslib.Circuits.StepBase.zero_lt {D Y : ℕ} (hY : StepBase D Y) :
0 < D

Functions #

theorem Cslib.Circuits.StepBase.const {Inp : Type} {D Y a : ℕ} {H : Set (Inp → ℕ)} (hY : StepBase D Y) (c : ℕ) (hc : c < D) :
Cost D H (Y ^ a) fun (x : Inp) => c
theorem Cslib.Circuits.StepBase.op {Inp : Type} {D Y a : ℕ} {H : Set (Inp → ℕ)} {f g : Inp → ℕ} (hY : StepBase D Y) (φ : ℕ → ℕ → ℕ) (hf : Cost D H (Y ^ a) f) (hg : Cost D H (Y ^ a) g) (hb : ∀ (x : Inp), φ (f x) (g x) < D) :
Cost D H (Y ^ (a + 1)) fun (x : Inp) => φ (f x) (g x)
theorem Cslib.Circuits.StepBase.op1 {Inp : Type} {D Y a : ℕ} {H : Set (Inp → ℕ)} {f : Inp → ℕ} (hY : StepBase D Y) (φ : ℕ → ℕ) (hf : Cost D H (Y ^ a) f) (hb : ∀ (x : Inp), φ (f x) < D) :
Cost D H (Y ^ (a + 1)) fun (x : Inp) => φ (f x)
theorem Cslib.Circuits.StepBase.sum {Inp : Type} {D Y a : ℕ} {H : Set (Inp → ℕ)} (hY : StepBase D Y) {κ : Type u_1} (s : Finset κ) {f : κ → Inp → ℕ} (hs : s.card ≤ Y) (hf : ∀ i ∈ s, Cost D H (Y ^ a) (f i)) (hb : ∀ (x : Inp), ∑ i ∈ s, f i x < D) :
Cost D H (Y ^ (a + 2)) fun (x : Inp) => ∑ i ∈ s, f i x
theorem Cslib.Circuits.StepBase.ite {Inp : Type} {D Y a : ℕ} {H : Set (Inp → ℕ)} {f g : Inp → ℕ} {P : Inp → Prop} (hY : StepBase D Y) [DecidablePred P] (hP : CostP D H (Y ^ a) P) (hf : Cost D H (Y ^ a) f) (hg : Cost D H (Y ^ a) g) (hf' : ∀ (x : Inp), f x < D) (hg' : ∀ (x : Inp), g x < D) :
Cost D H (Y ^ (a + 2)) fun (x : Inp) => if P x then f x else g x

Properties #

theorem Cslib.Circuits.StepBase.constP {Inp : Type} {D Y a : ℕ} {H : Set (Inp → ℕ)} (hY : StepBase D Y) (P : Prop) :
CostP D H (Y ^ a) fun (x : Inp) => P
theorem Cslib.Circuits.StepBase.rel {Inp : Type} {D Y a : ℕ} {H : Set (Inp → ℕ)} {f g : Inp → ℕ} (hY : StepBase D Y) (r : ℕ → ℕ → Prop) (hf : Cost D H (Y ^ a) f) (hg : Cost D H (Y ^ a) g) :
CostP D H (Y ^ (a + 1)) fun (x : Inp) => r (f x) (g x)
theorem Cslib.Circuits.StepBase.rel1 {Inp : Type} {D Y a : ℕ} {H : Set (Inp → ℕ)} {f : Inp → ℕ} (hY : StepBase D Y) (r : ℕ → Prop) (hf : Cost D H (Y ^ a) f) :
CostP D H (Y ^ (a + 1)) fun (x : Inp) => r (f x)
theorem Cslib.Circuits.StepBase.and {Inp : Type} {D Y a : ℕ} {H : Set (Inp → ℕ)} {P Q : Inp → Prop} (hY : StepBase D Y) (hP : CostP D H (Y ^ a) P) (hQ : CostP D H (Y ^ a) Q) :
CostP D H (Y ^ (a + 1)) fun (x : Inp) => P x ∧ Q x
theorem Cslib.Circuits.StepBase.or {Inp : Type} {D Y a : ℕ} {H : Set (Inp → ℕ)} {P Q : Inp → Prop} (hY : StepBase D Y) (hP : CostP D H (Y ^ a) P) (hQ : CostP D H (Y ^ a) Q) :
CostP D H (Y ^ (a + 1)) fun (x : Inp) => P x ∨ Q x
theorem Cslib.Circuits.StepBase.not {Inp : Type} {D Y a : ℕ} {H : Set (Inp → ℕ)} {P : Inp → Prop} (hY : StepBase D Y) (hP : CostP D H (Y ^ a) P) :
CostP D H (Y ^ (a + 1)) fun (x : Inp) => ¬P x
theorem Cslib.Circuits.StepBase.exists_mem {Inp : Type} {D Y a : ℕ} {H : Set (Inp → ℕ)} (hY : StepBase D Y) {κ : Type u_1} (s : Finset κ) {P : κ → Inp → Prop} (hs : s.card ≤ Y) (hP : ∀ i ∈ s, CostP D H (Y ^ a) (P i)) :
CostP D H (Y ^ (a + 2)) fun (x : Inp) => ∃ i ∈ s, P i x
theorem Cslib.Circuits.StepBase.forall_mem {Inp : Type} {D Y a : ℕ} {H : Set (Inp → ℕ)} (hY : StepBase D Y) {κ : Type u_1} (s : Finset κ) {P : κ → Inp → Prop} (hs : s.card ≤ Y) (hP : ∀ i ∈ s, CostP D H (Y ^ a) (P i)) :
CostP D H (Y ^ (a + 2)) fun (x : Inp) => ∀ i ∈ s, P i x
theorem Cslib.Circuits.StepBase.exists_univ {Inp : Type} {D Y a : ℕ} {H : Set (Inp → ℕ)} (hY : StepBase D Y) {κ : Type u_1} [Fintype κ] {P : κ → Inp → Prop} (hs : Fintype.card κ ≤ Y) (hP : ∀ (i : κ), CostP D H (Y ^ a) (P i)) :
CostP D H (Y ^ (a + 2)) fun (x : Inp) => ∃ (i : κ), P i x
theorem Cslib.Circuits.StepBase.forall_univ {Inp : Type} {D Y a : ℕ} {H : Set (Inp → ℕ)} (hY : StepBase D Y) {κ : Type u_1} [Fintype κ] {P : κ → Inp → Prop} (hs : Fintype.card κ ≤ Y) (hP : ∀ (i : κ), CostP D H (Y ^ a) (P i)) :
CostP D H (Y ^ (a + 2)) fun (x : Inp) => ∀ (i : κ), P i x
theorem Cslib.Circuits.StepBase.card_filter {Inp : Type} {D Y a : ℕ} {H : Set (Inp → ℕ)} (hY : StepBase D Y) {κ : Type u_1} (s : Finset κ) {P : κ → Inp → Prop} [(i : κ) → (x : Inp) → Decidable (P i x)] (hs : s.card ≤ Y) (hP : ∀ i ∈ s, CostP D H (Y ^ a) (P i)) :
Cost D H (Y ^ (a + 2)) fun (x : Inp) => {i ∈ s | P i x}.card

Counting: the number of elements of a set of at most Y elements with a property.

Stages #

theorem Cslib.Circuits.StepBase.stage {Inp : Type} {D Y a : ℕ} {H : Set (Inp → ℕ)} (hY : StepBase D Y) {n : ℕ} {inp : Fin n → Inp → Fin D} {p c k : ℕ} (h : SlpN inp (p + c * Y ^ k) H) {κ : Type u_1} [Fintype κ] (f : κ → Inp → ℕ) {e : ℕ} (hκ : Fintype.card κ ≤ Y ^ e) (hf : ∀ (i : κ), Cost D H (Y ^ a) (f i)) (hae : a + e ≤ k) :
∃ (H' : Set (Inp → ℕ)), SlpN inp (p + (c + 1) * Y ^ k) H' ∧ H ⊆ H' ∧ ∀ (i : κ), f i ∈ H'

One stage. A family of at most Y ^ e functions, each computed in Y ^ a steps from the functions of H with a + e ≤ k, is computed by Y ^ k more gates.