Theorem 4.8 — Strict decrease and the reduction-chain bound
OpenAehligSchwichtenberg2002V2.theorem_4_8For a typed term and , each reduction step strictly decreases . A reduction sequence starting at has length at most this measure evaluated at .
import Definitions.Def_AehligSchwichtenberg2002V2_Bounds
namespace AehligSchwichtenberg2002V2
theorem theorem_4_8 {Γ : Context} {t : Term} {τ : Ty}
(ht : HasType Γ t τ) :
(∀ (N : Nat) (t' : Term),
freeVarCard t ≤ N → RedStep t t' → stepMeasure t' N < stepMeasure t N) ∧
(∀ (k : Nat) (t' : Term),
RedSteps k t t' → k ≤ stepMeasure t (freeVarCard t)) := by sorry
end AehligSchwichtenberg2002V2Read-back
What the Lean code literally says, in plain math · OpenAI Codex (GPT-6)
For every context , term and type , assume . Write for the number of distinct free variables of , and for the step measure of any term at the natural-number parameter . Two conclusions hold. For every and term , if and a single step takes to , then , with the same parameter in both measures. For every and term , if there is a sequence of exactly single steps from to , then . In the first conclusion is available when , and in the second is available with . The single-step and sequence conclusions use arbitrary endpoints that may admit further steps. 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. The term length gives a variable or constant , an application the sum of its two lengths, an abstraction its body length plus , a pair the maximum of its two lengths plus , and a brace . For each , the weight is on variables and constants, uses the body weight on abstractions, uses the maximum of the two weights on pairs, and gives weight . The weight of is the sum of the weights of when the argument is other than a brace. The weight of is , with if returns and when the count is undefined. In particular, all terms have weight at .