Documentation

HexPermGroup.Budget

Independent cumulative work allowances. These count logical operations and slots, not bytes or elapsed time. sifts counts visited chain levels (including terminal levels); points counts point visits; pairs counts Schreier pairs. images counts permutation-image slots. certificates counts program and certificate nodes, including reserved copies. storage counts auxiliary container slots. Search nodes and refinement tests have their own counters.

Instances For
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For

      Cumulative producer reservations. Batches may reserve an upper bound before execution; unused reservations are retained, so surplus budget never changes the reported usage. Image slots count permutation storage separately from program nodes and traversal work.

      Instances For
        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          Equations
          Instances For
            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                @[simp]
                theorem Hex.PermGroup.Execution.Work.get_add (w : Work) (r s : Resource) (k : Nat) :
                (w.add r k).get s = w.get s + if s = r then k else 0

                Counters never exceed the supplied allowances. Every successful charge retains this invariant, including when a later operation exhausts its budget.

                Instances For
                  Equations
                  Instances For
                    Equations
                    Instances For
                      def Hex.PermGroup.Execution.Meter.charge {budget : Budget} (m : Meter budget) (r : Resource) (k : Nat) (h : k ≤ m.available r) :
                      Meter budget
                      Equations
                      Instances For
                        theorem Hex.PermGroup.Execution.Meter.charge_mono {budget : Budget} (m : Meter budget) (r : Resource) (k : Nat) (h : k ≤ m.available r) (s : Resource) :
                        m.used.get s ≤ (m.charge r k h).used.get s
                        @[simp]
                        theorem Hex.PermGroup.Execution.Meter.available_charge {budget : Budget} (m : Meter budget) (r : Resource) (k : Nat) (h : k ≤ m.available r) :
                        (m.charge r k h).available r = m.available r - k

                        An unmet charge identifies both the exhausted resource and the counters at the stopping point. It makes no claim that the search has finished.

                        Instances For
                          def Hex.PermGroup.Execution.Meter.spend {budget : Budget} (m : Meter budget) (r : Resource) (k : Nat) :
                          Except (Exhausted budget) (Meter budget)
                          Equations
                          Instances For
                            inductive Hex.PermGroup.Execution.Measured (budget : Budget) (α : Type) :

                            A primitive operation either returns its result and updated counters or the exact stopping point. Both alternatives retain the budget invariant.

                            Instances For
                              @[reducible, inline]
                              abbrev Hex.PermGroup.Execution.Run (budget : Budget) (α : Type) :

                              A computation threads one meter through all nested operations. Failure retains the counters at the first reservation that could not be met.

                              Equations
                              Instances For
                                def Hex.PermGroup.Execution.Meter.execute {α : Type} {budget : Budget} (meter : Meter budget) (computation : Run budget α) :
                                Measured budget α

                                Continue an operation with an existing meter; nested work never receives fresh allowances.

                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For
                                  def Hex.PermGroup.Execution.reserve {budget : Budget} (r : Resource) (k : Nat) :
                                  Run budget Unit

                                  Reserve work before invoking the operation that uses it.

                                  Equations
                                  Instances For
                                    def Hex.PermGroup.Execution.run {α : Type} (budget : Budget) (computation : Run budget α) :
                                    Measured budget α

                                    Evaluate a producer from zero usage. Replay uses a separate invocation and its own allowances; it cannot consume a producer's remaining budget.

                                    Equations
                                    Instances For