chore: add helper functions
This commit is contained in:
parent
2eeeab68b3
commit
920bdead01
1 changed files with 10 additions and 0 deletions
|
|
@ -370,6 +370,11 @@ match e with
|
|||
| forallE n bi d b => updateForall (forallE n bi d b) newBinfo newDomain newBody rfl
|
||||
| _ => panic! "forall expected"
|
||||
|
||||
@[inline] def updateForallE! (e : Expr) (newDomain : Expr) (newBody : Expr) : Expr :=
|
||||
match e with
|
||||
| forallE n bi d b => updateForall (forallE n bi d b) bi newDomain newBody rfl
|
||||
| _ => panic! "forall expected"
|
||||
|
||||
@[extern "lean_expr_update_lambda"]
|
||||
def updateLambda (e : Expr) (newBinfo : BinderInfo) (newDomain : Expr) (newBody : Expr) (h : e.isLambda = true) : Expr :=
|
||||
lam e.bindingName newBinfo newDomain newBody
|
||||
|
|
@ -379,6 +384,11 @@ match e with
|
|||
| lam n bi d b => updateLambda (lam n bi d b) newBinfo newDomain newBody rfl
|
||||
| _ => panic! "lambda expected"
|
||||
|
||||
@[inline] def updateLambdaE! (e : Expr) (newDomain : Expr) (newBody : Expr) : Expr :=
|
||||
match e with
|
||||
| lam n bi d b => updateLambda (lam n bi d b) bi newDomain newBody rfl
|
||||
| _ => panic! "lambda expected"
|
||||
|
||||
@[extern "lean_expr_update_let"]
|
||||
def updateLet (e : Expr) (newType : Expr) (newVal : Expr) (newBody : Expr) (h : e.isLet = true) : Expr :=
|
||||
letE e.letName newType newVal newBody
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue