The q( )
and Q( )
macros #
This file provides the main feature of Qq
; the q( )
and Q( )
macros,
which are available with open scoped Qq
.
- quoted: Lean.Expr → Qq.Impl.ExprBackSubstResult
- unquoted: Lean.Expr → Qq.Impl.ExprBackSubstResult
Instances For
- term: Lean.Expr → Lean.MVarId → Qq.Impl.MVarSynth
- type: Lean.MVarId → Qq.Impl.MVarSynth
- level: Lean.LMVarId → Qq.Impl.MVarSynth
Instances For
- mvars : List (Lean.Expr × Qq.Impl.MVarSynth)
Quoted mvars in the outside lctx (of type
Level
,Quoted _
, orType
). The outside mvars can also be of the form?m x y z
. - levelSubst : Std.HashMap Lean.Expr Lean.Level
Maps quoted expressions (of type Level) in the old context to level parameter names in the new context
- exprSubst : Std.HashMap Lean.Expr Lean.Expr
Maps quoted expressions (of type Expr) in the old context to expressions in the new context
- unquoted : Lean.LocalContext
New unquoted local context
- exprBackSubst : Std.HashMap Lean.Expr Qq.Impl.ExprBackSubstResult
Maps free variables in the new context to expressions in the old context (of type Expr)
- levelBackSubst : Std.HashMap Lean.Level Lean.Expr
Maps free variables in the new context to levels in the old context (of type Level)
- abstractedFVars : Array Lean.FVarId
New free variables in the new context that were newly introduced for irreducible expressions.
- mayPostpone : Bool
Instances For
Instances For
Equations
Instances For
Equations
- Qq.Impl.instMonadLiftQuoteMUnquoteM = { monadLift := fun {α : Type} (k : Qq.Impl.QuoteM α) => do let __do_lift ← get liftM (k __do_lift) }
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Qq.Impl.addDollar Lean.Name.anonymous = `«$»
- Qq.Impl.addDollar (Lean.Name.anonymous.str s) = Lean.Name.anonymous.str ("$" ++ s)
- Qq.Impl.addDollar (n.str s) = (Qq.Impl.addDollar n).str s
- Qq.Impl.addDollar (n.num i) = (Qq.Impl.addDollar n).num i
Instances For
Equations
- Qq.Impl.removeDollar Lean.Name.anonymous = none
- Qq.Impl.removeDollar `«$» = some Lean.Name.anonymous
- Qq.Impl.removeDollar (Lean.Name.anonymous.str s) = if s.startsWith "$" = true then some (Lean.Name.anonymous.str (s.drop 1)) else none
- Qq.Impl.removeDollar (n.str s) = Option.map (fun (x : Lean.Name) => x.str s) (Qq.Impl.removeDollar n)
- Qq.Impl.removeDollar (n.num i) = Option.map (fun (x : Lean.Name) => x.num i) (Qq.Impl.removeDollar n)
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Qq.Impl.stripDollars Lean.Name.anonymous = Lean.Name.anonymous
- Qq.Impl.stripDollars (n.str "$") = Qq.Impl.stripDollars n
- Qq.Impl.stripDollars (n.str s) = (Qq.Impl.stripDollars n).str s
- Qq.Impl.stripDollars (n.num i) = (Qq.Impl.stripDollars n).num i
Instances For
Equations
- Qq.Impl.addSyntaxDollar (Lean.Syntax.ident info rawVal val preresolved) = Lean.Syntax.ident info rawVal (Qq.Impl.addDollar val) preresolved
- Qq.Impl.addSyntaxDollar x = panicWithPosWithDecl "Qq.Macro" "Qq.Impl.addSyntaxDollar" 104 11 (toString "addSyntaxDollar " ++ toString x ++ toString "")
Instances For
Equations
- Qq.Impl.mkAbstractedLevelName e = do let __do_lift ← Lean.mkFreshId pure (e.getAppFn.constName?.getD `udummy ++ __do_lift)
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Qq.Impl.quoteLevel Lean.Level.zero = pure (Lean.Expr.const `Lean.Level.zero [])
- Qq.Impl.quoteLevel u.succ = do let __do_lift ← Qq.Impl.quoteLevel u pure (Lean.mkApp (Lean.Expr.const `Lean.Level.succ []) __do_lift)
- Qq.Impl.quoteLevel (a.max b) = do let __do_lift ← Qq.Impl.quoteLevel a let __do_lift_1 ← Qq.Impl.quoteLevel b pure (Lean.mkApp2 (Lean.Expr.const `Lean.Level.max []) __do_lift __do_lift_1)
- Qq.Impl.quoteLevel (a.imax b) = do let __do_lift ← Qq.Impl.quoteLevel a let __do_lift_1 ← Qq.Impl.quoteLevel b pure (Lean.mkApp2 (Lean.Expr.const `Lean.Level.imax []) __do_lift __do_lift_1)
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Qq.Impl.quoteLevelList [] = pure (Lean.mkApp (Lean.Expr.const `List.nil [Lean.Level.zero]) (Lean.Expr.const `Lean.Level []))
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Qq.Impl.unquoteMVar mvar = do Qq.Impl.unquoteLCtx Qq.Impl.unquoteMVarCore mvar
Instances For
Equations
- (Qq.Impl.MVarSynth.term quotedType newMVar).isAssigned = newMVar.isAssigned
- (Qq.Impl.MVarSynth.type newMVar).isAssigned = newMVar.isAssigned
- (Qq.Impl.MVarSynth.level newMVar).isAssigned = Lean.isLevelMVarAssigned newMVar
Instances For
Equations
- One or more equations did not get rendered due to their size.
- (Qq.Impl.MVarSynth.level newMVar).synth = do let __do_lift ← Lean.instantiateLevelMVars (Lean.Level.mvar newMVar) Qq.Impl.quoteLevel __do_lift
Instances For
Equations
- Qq.Impl.lctxHasMVar = do let __do_lift ← Lean.getLCtx __do_lift.anyM fun (decl : Lean.LocalDecl) => do let __do_lift ← Lean.instantiateLocalDeclMVars decl pure __do_lift.hasExprMVar
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
ql(u)
quotes the universe level u
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
a =QL b
says that the levels a
and b
are definitionally equal.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
q(t)
quotes the Lean expression t
into a Q(α)
(if t : α
)
Equations
- One or more equations did not get rendered due to their size.
Instances For
Q(α)
is the type of Lean expressions having type α
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
a =Q b
says that a
and b
are definitionally equal.
Equations
- Qq.«term_=Q_» = Lean.ParserDescr.trailingNode `Qq.term_=Q_ 1022 50 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " =Q ") (Lean.ParserDescr.cat `term 51))