Documentation

DescriptiveComplexity.Counting.Digits.SetArith

Binary numbers as sets of positions, and sweeps along an order #

The semantic layer of the normal form of FP (DescriptiveComplexity.Counting.Digits): no formula appears here.

Carries #

The carry into the digit of rank i of M + N, by lookahead: some lower rank generates a carry, and every rank in between propagates it.

Equations
Instances For
    Dependency graph

    A digit of a sum: the exclusive or of the digits of the summands and of the carry.

    Dependency graph

    Numbers over a finite linear order of positions #

    The positions holding a digit 1 of N, the rank of a position being the rank of its digit.

    Equations
    Instances For
      Dependency graph
      theorem DescriptiveComplexity.Digits.bitsOf_congr {P : Type} [LinearOrder P] [Finite P] {M N : ℕ} (h : M % 2 ^ Nat.card P = N % 2 ^ Nat.card P) :

      Only the digits of rank below the number of positions are seen.

      Dependency graph

      Sums and products along an order #

      noncomputable def DescriptiveComplexity.Digits.sumUpTo {I : Type} [LinearOrder I] (f : I → ℕ) (u : I) :

      The sum of a family up to an index.

      Equations
      Instances For
        Dependency graph
        noncomputable def DescriptiveComplexity.Digits.prodBefore {I : Type} [LinearOrder I] (f : I → ℕ) (u : I) :

        The product of a family strictly before an index.

        Equations
        Instances For
          Dependency graph
          theorem DescriptiveComplexity.Digits.sumUpTo_top {I : Type} [LinearOrder I] (f : I → ℕ) {u : I} (hu : ∀ (c : I), c ≤ u) :
          sumUpTo f u = ∑ᶠ (u' : I), f u'
          Dependency graph
          theorem DescriptiveComplexity.Digits.prodBefore_bot {I : Type} [LinearOrder I] (f : I → ℕ) {u : I} (hu : ∀ (c : I), u ≤ c) :
          Dependency graph

          Reading a number back from its digits #

          Sweeps #

          theorem DescriptiveComplexity.Digits.sweep_stage {W Idx Pos : Type} [LinearOrder Idx] [Finite Idx] (Φ : W → Idx → (Idx → Pos → Prop) → Pos → Prop) (T : W → Idx → Pos → Prop) (hΦ : ∀ (w : W) (i : Idx) (R : Idx → Pos → Prop), (∀ i' < i, R i' = T w i') → Φ w i R = T w i) (Dn : ℕ → W → Idx → Prop) (Rw : ℕ → W → Idx → Pos → Prop) (hD0 : ∀ (w : W) (i : Idx), ¬Dn 0 w i) (hR0 : ∀ (w : W) (i : Idx) (p : Pos), ¬Rw 0 w i p) (hD : ∀ (s : ℕ) (w : W) (i : Idx), Dn (s + 1) w i ↔ Dn s w i ∨ (∀ (a : Idx), i ≤ a) ∨ ∃ (i₀ : Idx), i₀ ⋖ i ∧ Dn s w i₀) (hR : ∀ (s : ℕ) (w : W) (i : Idx) (p : Pos), Rw (s + 1) w i p ↔ Rw s w i p ∨ ¬Dn s w i ∧ ((∀ (a : Idx), i ≤ a) ∨ ∃ (i₀ : Idx), i₀ ⋖ i ∧ Dn s w i₀) ∧ Φ w i (Rw s w) p) (s : ℕ) (w : W) (i : Idx) :
          (Dn s w i ↔ orank i < s) ∧ ∀ (p : Pos), Rw s w i p ↔ orank i < s ∧ T w i p

          The stages of a sweep. Rows T w i indexed by a finite linear order, each determined by the rows before it through Φ, are computed by the iteration whose step marks a row done when it is the first or follows a done one, and writes a row under the same condition when it is not yet done: after s steps, the rows of rank below s are done and written, and nothing else is.

          Dependency graph
          theorem DescriptiveComplexity.Digits.sweep_limit {W Idx Pos : Type} [LinearOrder Idx] [Finite Idx] (Φ : W → Idx → (Idx → Pos → Prop) → Pos → Prop) (T : W → Idx → Pos → Prop) (hΦ : ∀ (w : W) (i : Idx) (R : Idx → Pos → Prop), (∀ i' < i, R i' = T w i') → Φ w i R = T w i) (Dn : ℕ → W → Idx → Prop) (Rw : ℕ → W → Idx → Pos → Prop) (hD0 : ∀ (w : W) (i : Idx), ¬Dn 0 w i) (hR0 : ∀ (w : W) (i : Idx) (p : Pos), ¬Rw 0 w i p) (hD : ∀ (s : ℕ) (w : W) (i : Idx), Dn (s + 1) w i ↔ Dn s w i ∨ (∀ (a : Idx), i ≤ a) ∨ ∃ (i₀ : Idx), i₀ ⋖ i ∧ Dn s w i₀) (hR : ∀ (s : ℕ) (w : W) (i : Idx) (p : Pos), Rw (s + 1) w i p ↔ Rw s w i p ∨ ¬Dn s w i ∧ ((∀ (a : Idx), i ≤ a) ∨ ∃ (i₀ : Idx), i₀ ⋖ i ∧ Dn s w i₀) ∧ Φ w i (Rw s w) p) (w : W) (i : Idx) (p : Pos) :
          (∃ (s : ℕ), Rw s w i p) ↔ T w i p

          The limit of a sweep: every row is eventually written, and written right.

          Dependency graph