Redex Positions #
This module defines β-reduction at a given redex position and proves its basic properties.
Reference #
The number of β-redexes occurring in a term.
Equations
- (Cslib.LambdaCalculus.LocallyNameless.Untyped.Term.fvar a).countRedexes = 0
- (Cslib.LambdaCalculus.LocallyNameless.Untyped.Term.bvar a).countRedexes = 0
- m.abs.countRedexes = m.countRedexes
- (m.abs.app n).countRedexes = m.countRedexes + n.countRedexes + 1
- (m.app n).countRedexes = m.countRedexes + n.countRedexes
Instances For
BetaAt i M N reduces the redex at position i of M to obtain N;
positions are counted from left to right.
- outer
{Var : Type u}
{M N : Term Var}
: M.abs.LC → N.LC → BetaAt 0 (M.abs.app N) (M.open' N)
The outermost redex sits at position
0. - appL
{Var : Type u}
{i : ℕ}
{M M' N : Term Var}
: BetaAt i M M' → BetaAt (i + if M.IsAbs then 1 else 0) (M.app N) (M'.app N)
Reducing the operator advances the position by one when the operator is an abstraction.
- appR
{Var : Type u}
{i : ℕ}
{M M' N : Term Var}
: BetaAt i M M' → BetaAt (i + N.countRedexes + if N.IsAbs then 1 else 0) (N.app M) (N.app M')
Reducing the operand adds the operator's redex count, plus one when it is an abstraction.
- abs
{Var : Type u}
{i : ℕ}
{M M' : Term Var}
(xs : Finset Var)
: (∀ x ∉ xs, BetaAt i (M.open' (fvar x)) (M'.open' (fvar x))) → BetaAt i M.abs M'.abs
Reducing under a binder keeps the position.
Instances For
Opening with a free variable preserves the number of redexes.
Opening the outermost binder with a free variable preserves the number of redexes.
An application has at least as many redexes as its operator and operand combined.
An application with an abstraction operator has one more redex than its parts.
Renaming a free variable preserves the number of redexes.
A BetaAt step is a full β-step.
Contracting a redex preserves local closure.
Closing a variable and abstracting preserves the position of the contracted redex.