Corollary 4.4 — Non-size-increasing property on binary lists
OpenAehligSchwichtenberg2002V2.corollary_4_4Let be a closed term of type . If applying to a canonical binary list of length reduces to a normal term, that term is a list of length at most .
import Definitions.Def_AehligSchwichtenberg2002V2_Bounds
namespace AehligSchwichtenberg2002V2
/-- The binary-list case of Corollary 4.4 (p. 11).
A closed `f : L(B) ⊸ L(B)` applied to a canonical list with `n` entries reduces to
no normal form other than a list with at most `n` entries. -/
theorem corollary_4_4 {f l w : Term} {n : Nat}
(hf : HasType [] f (.lolli Ty.bin Ty.bin))
(hl : IsCanonicalListInput .bool l n)
(hred : RedStar (.app f l) w)
(hnorm : IsNormal w) :
∃ m : Nat, listEntryCount w = some m ∧ m ≤ n := by sorry
end AehligSchwichtenberg2002V2Read-back
What the Lean code literally says, in plain math · OpenAI Codex (GPT-6)
For all terms and natural number , suppose has type in the empty context and is a canonical list input of Boolean elements and count . If zero or more single steps go from to and is normal, there exists such that returns and . Zero reduction steps permit , and forces a returned count of , so is a nil constant. The types are generated by , , arrows , tensors , products , and lists . A variable is a pair of a natural-number identifier and a type. Equality of variables compares both entries. The terms are variables, constants, abstractions , pairs , applications , and braces . Successive applications associate to the left and arrow chains associate to the right. The constants and have declared type . For every type , the constants and have declared types and . For all types , has declared type . Contexts are lists of variables. A context is a union of two operand contexts if each variable belongs to the result exactly when it belongs to at least one operand. A disjoint union additionally requires that the operands have no common variable. These relations permit arbitrary ordering and repetitions within a context. The typing relation is generated by the variable rule in any context containing that variable, and the constant rule in any context with the declared constant type. An abstraction has type in if has declared type and has type in a union of and the singleton list . An application has type in a disjoint union of contexts typing at and at . The pair has type if has type and has type in the same context. A term of product type gives applications and of types and in its context. If has Boolean type and both and have type in a shared context disjoint from the context of , then has type in their disjoint union. For distinct variables of types , respectively, has type in a disjoint union of a context typing at and a context disjoint from , provided has type in a union of and . If has type and has type in the empty context, has type in the context of . The optional list entry count returns on any , returns on if returns a number, and is undefined otherwise. It looks at the rightmost tail argument of each fully applied , permits any parameters on the constructors along that chain, and ignores the contents of the other two arguments. The free occurrences of a variable term are its singleton list and a constant contributes none. An abstraction filters the occurrences of its binder from those of its body, a pair or application concatenates the two occurrence lists from left to right, and braces use the occurrence list of their contents. The list retains the first occurrence of each distinct variable in the resulting list. For a term , is the maximum of and every variable identifier in , including the identifiers of abstraction binders. For variables and a term , renaming free to in replaces each variable node equal to by , leaves constants as they are and recurses into pairs, applications and braces. At an abstraction with binder it returns that abstraction as it is. At other abstractions it keeps the binder and recurses into the body, which permits the new occurrences of to be bound by an existing binder. For a natural bound , term , variable and replacement term , the substitution auxiliary function replaces a variable node by exactly when its variable equals , preserves constants, and recurses with bound into both children of pairs and applications and into the contents of braces. At a binder it returns the whole abstraction if . If and occurs free in , it gives the binder a new identifier and keeps its type. It renames free occurrences of in the body to the new variable, and recurses on the renamed body with bound . In the remaining case it preserves the binder and recurses on the body with bound . Write for substitution of for in , starting the auxiliary function with bound . A binder may be freshened by this operation even when has no free occurrence in its body. For terms and variables , the two-variable substitution returns if is absent from the free occurrences of . If occurs free in , it chooses of 's type and identifier . It renames free to in , substitutes for in that result, then substitutes for . This function accepts any , including . The direct conversions are , , , and . They also include converting to the two-variable substitution in of for and for , for distinct with respective types . The iteration conversions are and , with the latter requiring to return a number. The term arguments in these patterns range over raw terms. A single step performs one direct conversion at the root or at a subterm reached by descending through any number of application nodes, on either side of each application. A term is normal if it has no outgoing single step. In particular, abstractions, pairs and braces are normal at the root regardless of their contents. For a type , a term and , a canonical list input of type and count means there is a context consisting entirely of variables of type with , normal, and returning . The context can be empty. The case is a nil constant of the given list type.