Operational profile equivalence and complete quotient representations
DefinitionAPFPaper10_HeldQuotientsOperational equivalence is the kernel of a full observation-function map. Completeness of an encoding means equality of encoded values if and only if the source descriptions are related by a specified equivalence relation. Projection is the quotient-class map. CommonAgreement for optional observations compares returned values only when a test is defined on both descriptions. The gap readout has three descriptions and one test, returning false, no value, and true respectively. Full-profile equality and common agreement are distinct predicates.
import Mathlib.Data.Setoid.Basic
set_option autoImplicit false
namespace APFPaper10.HeldQuotients
def operationalSetoid {X T R : Type*} (observe : X → T → R) : Setoid X :=
Setoid.ker observe
def Complete {X L : Type*} (s : Setoid X) (encode : X → L) : Prop :=
∀ x y, encode x = encode y ↔ s.r x y
def projection {X : Type*} (s : Setoid X) : X → Quotient s := Quotient.mk s
def CommonAgreement {X T R : Type*} (observe : X → T → Option R) (x y : X) : Prop :=
∀ t a b, observe x t = some a → observe y t = some b → a = b
def gapReadout : Fin 3 → Unit → Option Bool :=
fun x _ => if x = 0 then some false else if x = 1 then none else some true
end APFPaper10.HeldQuotients
Read-back
What the Lean code literally says, in plain math · GPT-6 (Codex independent sub-agent)
operationalSetoid. For arbitrary types , , and , in arbitrary universes and with no nonemptiness assumptions, and a function , this declaration defines an equivalence relation on : two elements are related exactly when the functions and are equal. Equivalently, they are related exactly when for every . The supplied relation includes proofs of reflexivity, symmetry, and transitivity, inherited from equality of the function values. If is empty, every pair of elements of is related because the functions have no arguments on which they can differ; if is empty, there are no pairs to test. The function must still exist: in particular, an empty with nonempty and cannot supply such a function. There are no additional restrictions on the types or on .
Complete. For arbitrary types and , in arbitrary universes and possibly empty, an equivalence relation on supplied with its reflexivity, symmetry, and transitivity proofs, and a function , this declaration defines the proposition that, for every , the equality holds if and only if and are related by . Thus the proposition requires both that related elements receive equal values and that equal values imply the elements are related. It imposes no requirement that every element of occur as a value of . If is empty, the proposition holds vacuously; if is nonempty and is empty, the required function does not exist. If has exactly one element, the proposition holds exactly when every pair of elements of is related by .
projection. For an arbitrary type , in any universe and possibly empty, and an equivalence relation on supplied with its reflexivity, symmetry, and transitivity proofs, this declaration defines the function that sends each to its equivalence class in the quotient by . In this quotient, exactly when and are related by . The definition does not choose a representative of a quotient class; its input is an element of and its output is the class containing that element. If is empty, the quotient is empty and this is the empty function. No additional structure on or on its equivalence classes is assumed.
CommonAgreement. For arbitrary types , , and , in arbitrary universes and with no nonemptiness assumptions, a function , and elements , this declaration defines the following proposition: for every and every , if and , then . Here consists of a distinguished value and values for . Consequently, a test at which either observation is imposes no equality condition; the proposition requires neither any shared test with two returned values nor equality of the two optional observations at every test. It holds vacuously if is empty, if is empty, or if there is no test at which both observations are of the form . Supplying and entails that is inhabited; when is empty there are no such arguments at which to evaluate this predicate.
gapReadout. This declaration defines a function from the three-element type to functions from the one-element type to . The boolean type has the values and , and its optional extension also has the distinct value . For the unique unit input , the function returns at , at , and at ; the unit input is ignored. The definition first tests whether the finite input equals , then, if it does not, whether it equals , and uses the final value otherwise. Since the input belongs to the fixed three-element type, the final case is exactly and no other natural-number input is admitted. In particular, is a present boolean value and is distinct from the missing-value constructor .