Diagonal Record Processes and Retained Words — Definitions
DefinitionAPFPaper1_RecordKernelsFinite real kernel matrices, diagonal embeddings of response functions, column-substochastic kernels, normalized outcome instruments, residual outcome completion, finite matrix-product chains and their statistics, the matrix reading of a supplied record signature, and retained word derivations generated by its unit, singleton labels and declared product triples. General real response functions are permitted; substochasticity requires the explicit effect bounds.
import Definitions.Def_APFPaper1_RecordConstraints
import Mathlib.Data.Matrix.Basic
import Mathlib.Data.Matrix.Mul
import Mathlib.Algebra.BigOperators.Group.List.Basic
set_option autoImplicit false
open Classical
noncomputable section
namespace APFPaper1.RecordKernels
abbrev Kernel (A : Type) := Matrix A A ℝ
def diagonal {A : Type} (r : A → ℝ) : Kernel A :=
Matrix.diagonal r
def Substochastic {A : Type} [Fintype A] (K : Kernel A) : Prop :=
(∀ b a, 0 ≤ K b a) ∧ ∀ a, ∑ b, K b a ≤ 1
def Instrument {A O : Type} [Fintype A] [Fintype O] (K : O → Kernel A) : Prop :=
(∀ o b a, 0 ≤ K o b a) ∧ ∀ a, ∑ o, ∑ b, K o b a = 1
def completeResponses {A O : Type} [Fintype O] (r : O → A → ℝ) : Option O → A → ℝ
| none => fun a => 1 - ∑ o, r o a
| some o => r o
def chain {A : Type} [Fintype A] (rs : List (A → ℝ)) : Kernel A :=
(rs.map diagonal).prod
def chainStatistic {A : Type} [Fintype A] (μ : A → ℝ)
(rs : List (A → ℝ)) (e : A → ℝ) : ℝ :=
∑ a, Matrix.mulVec (chain rs) μ a * e a
def KernelConstraints {W P A : Type} [Fintype W] [Fintype P] [Fintype A]
(D : APFPaper1.RecordConstraints.Signature W P) (K : W → Kernel A) : Prop :=
K D.unit = 1 ∧
(∀ t ∈ D.products, K t.1 = K t.2.1 * K t.2.2) ∧
(∀ c ∈ D.linearRelations, ∑ w, c w • K w = 0) ∧
(∀ t ∈ D.orderRelations, ∀ b a, K t.1 b a ≤ K t.2 b a) ∧
(∀ w ∈ D.sharp, K w * K w = K w) ∧
(∀ w ∈ D.effects, Substochastic (K w))
inductive RetainedWord {W P : Type} [Fintype W] [Fintype P]
(D : APFPaper1.RecordConstraints.Signature W P) : List W → W → Prop
| empty : RetainedWord D [] D.unit
| single (w : W) : RetainedWord D [w] w
| compose {xs ys : List W} {x y z : W} (hx : RetainedWord D xs x)
(hy : RetainedWord D ys y) (ht : (z,x,y) ∈ D.products) : RetainedWord D (xs ++ ys) z
end APFPaper1.RecordKernels
Read-back
What the Lean code literally says, in plain math · Codex (GPT-6)
Literal read-backs of RecordKernels/Definitions.lean
Model identity exposed in this session: GPT-6. No more specific serving-model variant is exposed.
Kernel. For any type , a kernel on means an -by- matrix with real entries, equivalently a function assigning a real number to every ordered pair of elements of . There is no finiteness, nonemptiness, nonnegativity, or normalization requirement on or on the matrix; in particular, this definition also applies to infinite and empty .
diagonal. For any type and any real-valued function on , the diagonal matrix associated with is the real -by- matrix whose entry in row and column is if , and otherwise. Neither finiteness nor nonemptiness of is required, and the values of may be arbitrary real numbers; when is empty, this is the unique matrix with no entries.
Substochastic. For any type equipped with a finite enumeration of all its elements and any real -by- matrix , this predicate means that for every and that for every . The sums are column sums, and no equality to or strict inequality is required. If is empty, both universal conditions hold vacuously.
Instrument. For any types and , each equipped with a finite enumeration of all its elements, and any family of real -by- matrices, this predicate means that for every and , and that for every . Normalization is required after summing over both and the row index for each fixed column . If is empty, the predicate holds vacuously for any such family; if is nonempty and is empty, it cannot hold because each required total would be .
completeResponses. For any types and , with a finite enumeration of all elements of , and any family , this definition produces a real-valued family indexed by and by the disjoint union of with one additional symbol . At an existing index , its value at is ; at the added symbol, its value is . The type need not be finite or nonempty, and no nonnegativity, upper bound, or normalization assumption is imposed on , so the added value can be negative. If is empty, the added symbol is the only index and its value is for every .
chain. For any type equipped with a finite enumeration of all its elements and any finite list of real-valued functions on , where may be zero, this definition is the real -by- matrix in the order of the list, where if and otherwise. Multiplication is ordinary matrix multiplication with the intermediate index summed over all of ; the product of an empty list is the identity matrix, whose diagonal entries are and off-diagonal entries are . No sign or normalization assumptions are imposed on the functions. Empty is allowed, in which case the resulting matrix is the unique matrix with no entries, including when the list is empty.
chainStatistic. For any type equipped with a finite enumeration of all its elements, arbitrary functions , and any finite list of functions , this definition is the real number , where is the ordered matrix product and is when and otherwise. Matrix multiplication uses summation over all of , and the product for is the identity matrix, so the empty-list value is . No nonnegativity or normalization is assumed for , , or any . If is empty, the value is for every list.
KernelConstraints. Let be types, each equipped with a finite enumeration of all its elements. Let consist of a distinguished element , a finite set of triples, a finite set of real-valued functions on , finite sets and , an equivalence relation on , a finite set such that every has for every and , and a function . For any family of real -by- matrices, this predicate is the conjunction of the following six conditions: ; for every ; for every , where real scalar multiplication acts on every matrix entry and is the zero matrix; for every and every ; for every ; and, for every , for every and for every . Here has diagonal entries and off-diagonal entries , and all matrix products sum over the intermediate index in . The equivalence relation, , its two stated properties, and are part of the supplied data but impose no further conditions in this predicate. The element excludes empty ; empty is permitted and then must be empty. Any of the designated finite sets may be empty, making its associated conditions vacuous. Empty is permitted, and then every matrix equality and every entry condition holds, so the predicate holds for every such family.
RetainedWord. Let and be types, each equipped with a finite enumeration of all its elements, and let consist of a distinguished , a finite set , a finite set of real-valued functions on , a finite set of pairs in , two finite subsets of , an equivalence relation on , a finite set whose every member satisfies for all and , and a real-valued function on . This definition gives the least relation between finite lists of elements of and elements of generated by three rules: the empty list is related to ; for every , the singleton list is related to ; and, for all finite lists and all , if is related to , is related to , and , then the concatenated list is related to . Thus membership is generated by a finite application of these rules; it does not require uniqueness of the related element. Either list in the third rule may be empty, so that rule can also generate relations involving empty lists. All components of other than and are supplied data unused by these rules. Empty is excluded by , whereas empty is allowed and then is empty; if is empty, only the empty-list and singleton rules can generate relations.