feat: simpLambda
This commit is contained in:
parent
27f532c3bb
commit
3a369938c8
3 changed files with 21 additions and 1 deletions
|
|
@ -391,6 +391,10 @@ def mkArbitrary (α : Expr) : MetaM Expr :=
|
|||
def mkSyntheticSorry (type : Expr) : MetaM Expr :=
|
||||
return mkApp2 (mkConst `sorryAx [← getLevel type]) type (mkConst `Bool.true)
|
||||
|
||||
/-- Return `funext h` -/
|
||||
def mkFunExt (h : Expr) : MetaM Expr :=
|
||||
mkAppM `funext #[h]
|
||||
|
||||
builtin_initialize registerTraceClass `Meta.appBuilder
|
||||
|
||||
end Lean.Meta
|
||||
|
|
|
|||
|
|
@ -141,7 +141,15 @@ where
|
|||
return r
|
||||
|
||||
simpLambda (e : Expr) : M σ Result :=
|
||||
return { expr := e } -- TODO
|
||||
lambdaTelescope e fun xs e => do
|
||||
-- TODO: cfg.contextual
|
||||
let r ← simp e
|
||||
match r.proof? with
|
||||
| none => return { expr := (← mkLambdaFVars xs r.expr) }
|
||||
| some h =>
|
||||
let p ← xs.foldrM (init := h) fun x h => do
|
||||
mkFunExt (← mkLambdaFVars #[x] h)
|
||||
return { expr := (← mkLambdaFVars xs r.expr), proof? := p }
|
||||
|
||||
simpForall (e : Expr) : M σ Result :=
|
||||
return { expr := e } -- TODO
|
||||
|
|
|
|||
|
|
@ -10,3 +10,11 @@ constant g (x : Nat) : Nat
|
|||
@[simp] theorem add1 (x : Nat) : x + 1 = x.succ := rfl
|
||||
|
||||
theorem ex3 (x : Nat) : g (x + 1) = 2 := by simp
|
||||
|
||||
theorem ex4 (x : Nat) : (fun x => x + 1) = (fun x => x.succ) := by simp
|
||||
|
||||
@[simp] theorem comm (x y : Nat) : x + y = y + x := Nat.addComm ..
|
||||
@[simp] theorem addZ (x : Nat) : x + 0 = x := rfl
|
||||
@[simp] theorem zAdd (x : Nat) : 0 + x = x := Nat.zeroAdd ..
|
||||
|
||||
theorem ex5 (x y : Nat) : (fun x y : Nat => x + 0 + y) = (fun x y : Nat => y + x + 0) := by simp
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue