Built with
doc-gen4, running Lean4.
Bubbles (
) indicate interactive fragments: hover for details, tap to reveal contents.
Use
Ctrl+โCtrl+โto navigate,
Ctrl+๐ฑ๏ธto focus.
On Mac, use
Cmdinstead of
Ctrl.
/-
Copyright (c) 2022 Jannis Limperg. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jannis Limperg
-/
import Std.Lean.Meta.Basic
open Lean Lean.Meta
namespace Lean.Meta
/--
Description of a hypothesis for `Lean.MVarId.assertHypotheses'`.
-/
structure Hypothesis' extends Hypothesis where
/-- The hypothesis' `BinderInfo` -/
binderInfo : BinderInfo
/-- The hypothesis' `LocalDeclKind` -/
kind : LocalDeclKind
/--
Add the given hypotheses to the local context. This is a generalisation of
`Lean.MVarId.assertHypotheses` which lets you specify
-/
def _root_.Lean.MVarId.assertHypotheses' (mvarId : MVarId)
(hs : Array Hypothesis') : MetaM (Array FVarId ร MVarId) := do
let (fvarIds, mvarId) โ mvarId.assertHypotheses $ hs.map (ยท.toHypothesis)
mvarId.modifyLCtx ฮป lctx => Id.run: {ฮฑ : Type ?u.637} โ Id ฮฑ โ ฮฑ
Id.run do
let mut lctx := lctx
for h : i in [:hs.size] do
let h := hs[i]'h.2
if h.kind != .default then
lctx := lctx.setKind fvarIds[i]! h.kind
if h.binderInfo != .default then
lctx := lctx.setBinderInfo fvarIds[i]! h.binderInfo
pure: {f : Type ?u.1529 โ Type ?u.1528} โ [self : Pure f] โ {ฮฑ : Type ?u.1529} โ ฮฑ โ f ฮฑ
pure lctx
return (fvarIds, mvarId)
end Lean.Meta