AFTD Auto-Formalizing Theoretical Domains

Cslib.LambdaCalculus.Named.Term.rename

defimported Lean

Renaming, or variable substitution. m.rename x y renames x into y in m.

Statement

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
universe u in
variable {Var : Type u} in
def Cslib.LambdaCalculus.Named.Term.rename [DecidableEq Var] (m : Term Var) (x y : Var) : Term Var
Defined in
CSLib, `Cslib.LambdaCalculus.Named.Term.rename`
Lean proof
By Fabrizio Montesi, from github.com/leanprover/cslib at 3951377e5a3f (Copyright (c) 2025 Fabrizio Montesi. All rights reserved, Apache-2.0). Compiled here against leanprover/lean4:v4.33.1, Mathlib v4.33.1; written for leanprover/lean4:v4.33.0.
Verified
08 Oct 2026
Axioms
none listed
Built on 1
Used by 1

Lean source view module on GitHub

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
universe u in
variable {Var : Type u} in
/-- Renaming, or variable substitution. `m.rename x y` renames `x` into `y` in `m`. -/
def Cslib.LambdaCalculus.Named.Term.rename [DecidableEq Var] (m : Term Var) (x y : Var) : Term Var :=
  match m with
  | var z => if z = x then (var y) else (var z)
  | abs z m' =>
    if z = x then
      -- Shadowing
      abs z m'
    else
      abs z (m'.rename x y)
  | app n1 n2 => app (n1.rename x y) (n2.rename x y)
See it in the graphDiscuss this resultChallenge it