Padded Support-Novelty Rank and Capacity — Definitions
DefinitionAPFPaper1_RanksExtend inserts list members into a finite prefix. NovelCount counts support-novel additions over each current prefix; AllNovel requires every addition to be novel. Padded and pure candidate values range over duplicate-free ordered subfamilies. Their natural suprema define padded and pure ranks. Novelty retains the inherited all-protocol positive near-optimality window.
import Definitions.Def_APFPaper1_Foundation
import Mathlib.Data.Finset.Card
import Mathlib.Order.Lattice.Nat
import Mathlib.Order.ConditionallyCompleteLattice.Finset
open Classical
namespace APFPaper1.Ranks
open Foundation
def extend {D : Type*} [DecidableEq D] : Finset D → List D → Finset D
| S, [] => S
| S, d :: ds => extend (insert d S) ds
noncomputable def novelCount {D P : Type*} [DecidableEq D] (L : Ledger D P) : Finset D → List D → ℕ
| _, [] => 0
| S, d :: ds => (if SupportNovel L S d then 1 else 0) + novelCount L (insert d S) ds
def AllNovel {D P : Type*} [DecidableEq D] (L : Ledger D P) : Finset D → List D → Prop
| _, [] => True
| S, d :: ds => SupportNovel L S d ∧ AllNovel L (insert d S) ds
def paddedValues {D P : Type*} [DecidableEq D] (L : Ledger D P) (S : Finset D) : Set ℕ :=
{k | ∃ ds : List D, ds.Nodup ∧ ds.toFinset ⊆ S ∧ novelCount L ∅ ds = k}
def pureValues {D P : Type*} [DecidableEq D] (L : Ledger D P) (S : Finset D) : Set ℕ :=
{k | ∃ ds : List D, ds.Nodup ∧ ds.toFinset ⊆ S ∧ AllNovel L ∅ ds ∧ ds.length = k}
noncomputable def paddedRank {D P : Type*} [DecidableEq D] (L : Ledger D P) (S : Finset D) : ℕ :=
sSup (paddedValues L S)
noncomputable def pureRank {D P : Type*} [DecidableEq D] (L : Ledger D P) (S : Finset D) : ℕ :=
sSup (pureValues L S)
end APFPaper1.Ranks
Read-back
What the Lean code literally says, in plain math · Codex (GPT-6)
Definition read-backs
extend. For any type with decidable equality, any finite set of elements of , and any finite list of elements of , is the finite set obtained by starting with and inserting the list entries in order: the empty list returns , and a list with first entry and remaining list returns . Repeated list entries are allowed and insertion does not create repeated set elements; neither a nonempty list nor a nonempty initial set is required.
novelCount. For arbitrary types , with decidable equality on , let consist of a nonnegative real price for each , a relation saying that serves a finite subset of , and a relation saying that carries an element of , subject to these requirements: serving a set implies serving every subset, serving a set implies carrying each of its elements, and some protocol serves the empty set at price zero. For any finite and finite list in , is a natural number computed as follows. At each entry , with the initial set together with all earlier entries, add one exactly when there exists a real such that every protocol serving whose price satisfies does not carry , and otherwise add zero; then insert into regardless of which case occurred. Here is the real infimum of the set of prices of protocols serving , with the real infimum of the empty set equal to zero. The empty list has count zero; repeated entries are permitted. No feasibility condition is required for , and when no protocol serves the stated condition for adding one holds vacuously.
AllNovel. For arbitrary types , with decidable equality on , let assign each protocol a nonnegative real price , specify which finite subsets of it serves and which elements it carries, require that serving a set implies serving each subset and carrying each member, and require a protocol that serves the empty set at price zero. For every finite and finite list in , is true precisely when at every list entry , with equal to together with all preceding entries, there exists a real such that every protocol serving with does not carry . Here is the real infimum of prices of protocols serving , interpreted as zero when no protocol serves . Each entry is inserted into the current set before processing the remaining entries. The empty list satisfies this predicate, repeated entries are not excluded by a separate hypothesis, and there is no required feasibility of any intermediate or final set; the condition at an unserved intermediate set holds vacuously.
paddedValues. For arbitrary types , with decidable equality on , let provide nonnegative real protocol prices , serving relations on finite subsets of , and carrying relations on elements of , such that serving a set implies serving every subset and carrying every member, and some protocol serves the empty set at price zero. For a finite , is the set of natural numbers for which there exists a finite list of distinct elements of whose following count equals : start with , process entries in order, add one for an entry exactly when some real makes every protocol serving with price at most fail to carry , add zero otherwise, and insert into in either case. Here is the real infimum of all prices serving , with value zero for an empty set of prices. The list may omit any elements of , may be empty, and need not satisfy the counting condition at every entry; its intermediate and final sets need not be served by any protocol. The condition is vacuously true when has no serving protocol. In particular, zero belongs to this set, and each member is at most the number of elements of .
pureValues. For arbitrary types , with decidable equality on , let provide nonnegative real prices for protocols in , serving relations on finite subsets of , and carrying relations on elements of , with serving closed under taking subsets, serving implying carrying each member, and some protocol serving the empty set at price zero. For a finite , is the set of natural numbers for which a finite list of distinct elements of has length and satisfies the following condition at every entry : writing for the set of earlier entries, there exists a real such that every protocol serving with price at most does not carry , where is the real infimum of prices of protocols serving , and is zero if there are none. The list may omit elements of , including all of them, and neither its intermediate sets nor its final set are required to have a serving protocol; an unserved intermediate set makes the condition vacuously true. The empty list witnesses membership of zero, and all members are at most the number of elements of .
paddedRank. For arbitrary types , with decidable equality on , let specify nonnegative real protocol prices, serving of finite subsets of , and carrying of elements of , requiring that serving a set implies serving each subset and carrying each member, and that some protocol serves the empty set at price zero. For each finite , is the supremum in the natural numbers of the counts obtainable from finite lists of distinct elements chosen from , where a count starts at zero with and increases by one at an entry if and only if there exists a real such that every protocol serving with price at most does not carry ; is then enlarged by whether or not the count increased. Here is the real infimum of prices of protocols serving , taking value zero when there are none. Lists may omit elements of , and there is no feasibility requirement on their intermediate or final sets; the counting condition holds vacuously at unserved sets. These counts contain zero by the empty list and are bounded by the number of elements of , so this supremum is their largest member; for empty it is zero.
pureRank. For arbitrary types , with decidable equality on , let specify nonnegative real prices of protocols, which finite subsets of each protocol serves, and which elements it carries, requiring serving to be closed under taking subsets, serving to imply carrying every member, and a protocol serving the empty set at price zero. For each finite , is the supremum in the natural numbers of the lengths of finite lists of distinct elements selected from for which, at every entry , there exists a real such that every protocol serving the set of preceding entries and having price at most does not carry . Here is the real infimum of prices of protocols serving , taking value zero when no such protocol exists. Lists may omit elements of , no intermediate or final set must be served by a protocol, and the condition at an unserved intermediate set is vacuous. The empty list is permitted, so the set of lengths contains zero; since all lengths are at most the number of elements of , the supremum is its largest member and is zero for empty .