@[extern c inline "LEAN_VERSION_IS_RELEASE"]
Equations
@[extern c inline "lean_mk_string(LEAN_SPECIAL_VERSION_DESC)"]
Equations
Equations
- Lean.versionString = if Lean.version.specialDesc ≠ "" then Lean.versionStringCore ++ "-" ++ Lean.version.specialDesc else if Lean.version.isRelease = true then Lean.versionStringCore else Lean.versionStringCore ++ ", commit " ++ Lean.githash
Equations
- Lean.toolchain = if Lean.version.specialDesc ≠ "" then if Lean.version.isRelease = true then Lean.origin ++ ":" ++ Lean.versionStringCore ++ "-" ++ Lean.version.specialDesc else Lean.origin ++ ":" ++ Lean.version.specialDesc else if Lean.version.isRelease = true then Lean.origin ++ ":" ++ Lean.versionStringCore else ""
Equations
- Lean.isLetterLike c = (decide (945 ≤ c.val) && decide (c.val ≤ 969) && decide (c.val ≠ 955) || decide (913 ≤ c.val) && decide (c.val ≤ 937) && decide (c.val ≠ 928) && decide (c.val ≠ 931) || decide (970 ≤ c.val) && decide (c.val ≤ 1019) || decide (7936 ≤ c.val) && decide (c.val ≤ 8190) || decide (8448 ≤ c.val) && decide (c.val ≤ 8527) || decide (119964 ≤ c.val) && decide (c.val ≤ 120223))
Equations
- Lean.isIdFirst c = (Char.isAlpha c || decide (c = Char.ofNat 95) || Lean.isLetterLike c)
Equations
- Lean.isIdRest c = (Char.isAlphanum c || decide (c = Char.ofNat 95) || decide (c = Char.ofNat 39) || c == Char.ofNat 33 || c == Char.ofNat 63 || Lean.isLetterLike c || Lean.isSubScriptAlnum c)
Equations
Equations
Equations
- Lean.Name.getRoot Lean.Name.anonymous = Lean.Name.anonymous
- Lean.Name.getRoot (Lean.Name.str Lean.Name.anonymous x_1 x_2) = Lean.Name.str Lean.Name.anonymous x_1 x_2
- Lean.Name.getRoot (Lean.Name.num Lean.Name.anonymous x_1 x_2) = Lean.Name.num Lean.Name.anonymous x_1 x_2
- Lean.Name.getRoot (Lean.Name.str n x_1 x_2) = Lean.Name.getRoot n
- Lean.Name.getRoot (Lean.Name.num n x_1 x_2) = Lean.Name.getRoot n
Equations
- Lean.Name.isInaccessibleUserName (Lean.Name.str x_1 s x_2) = (String.contains s (Char.ofNat 10013) || s == "_inaccessible")
- Lean.Name.isInaccessibleUserName (Lean.Name.num p idx x_1) = Lean.Name.isInaccessibleUserName p
- Lean.Name.isInaccessibleUserName x = false
Equations
- Lean.Name.escapePart s = if (decide (String.length s > 0) && Lean.isIdFirst (String.getOp s 0) && Substring.all (Substring.drop (String.toSubstring s) 1) Lean.isIdRest) = true then some s else if String.any s Lean.isIdEndEscape = true then none else some (Char.toString Lean.idBeginEscape ++ s ++ Char.toString Lean.idEndEscape)
Equations
- Lean.Name.toStringWithSep sep escape Lean.Name.anonymous = (fun maybeEscape => "[anonymous]") (Lean.Name.toStringWithSep.maybeEscape escape)
- Lean.Name.toStringWithSep sep escape (Lean.Name.str Lean.Name.anonymous s x_1) = (fun maybeEscape => maybeEscape s) (Lean.Name.toStringWithSep.maybeEscape escape)
- Lean.Name.toStringWithSep sep escape (Lean.Name.num Lean.Name.anonymous v x_1) = (fun maybeEscape => toString v) (Lean.Name.toStringWithSep.maybeEscape escape)
- Lean.Name.toStringWithSep sep escape (Lean.Name.str n s x_1) = (fun maybeEscape => Lean.Name.toStringWithSep sep escape n ++ sep ++ maybeEscape s) (Lean.Name.toStringWithSep.maybeEscape escape)
- Lean.Name.toStringWithSep sep escape (Lean.Name.num n v x_1) = (fun maybeEscape => Lean.Name.toStringWithSep sep escape n ++ sep ++ Nat.repr v) (Lean.Name.toStringWithSep.maybeEscape escape)
Equations
- Lean.Name.toStringWithSep.maybeEscape escape s = if escape = true then Option.getD (Lean.Name.escapePart s) s else s
Equations
- Lean.Name.toString n escape = (fun maybePseudoSyntax => Lean.Name.toStringWithSep "." (escape && !Lean.Name.isInaccessibleUserName n && !Lean.Name.hasMacroScopes n && !maybePseudoSyntax) n) (Lean.Name.toString.maybePseudoSyntax n)
Equations
- Lean.Name.toString.maybePseudoSyntax n = match Lean.Name.getRoot n with | Lean.Name.str x s x_1 => String.isPrefixOf "#" s || String.isPrefixOf "?" s | x => false
Equations
- Lean.Name.instToStringName = { toString := fun n => Lean.Name.toString n }
Equations
- Lean.Name.reprPrec Lean.Name.anonymous prec = Std.Format.text "Lean.Name.anonymous"
- Lean.Name.reprPrec (Lean.Name.num x_1 x_2 x_3) prec = Repr.addAppParen (Std.Format.text "Lean.Name.mkNum " ++ Lean.Name.reprPrec x_1 1024 ++ Std.Format.text " " ++ repr x_2) prec
- Lean.Name.reprPrec (Lean.Name.str p x_1 x_2) prec = if Lean.Name.hasNum p = true then Repr.addAppParen (Std.Format.text "Lean.Name.mkStr " ++ Lean.Name.reprPrec p 1024 ++ Std.Format.text " " ++ repr x_1) prec else Std.Format.text "`" ++ Std.Format.text (Lean.Name.toString (Lean.Name.str p x_1 x_2))
Equations
- Lean.Name.instReprName = { reprPrec := Lean.Name.reprPrec }
Equations
- Lean.Name.instReprSyntax = { reprPrec := [anonymous] }
Equations
- Lean.Name.capitalize x = match x with | Lean.Name.str p s x => Lean.Name.mkStr p (String.capitalize s) | n => n
Equations
- Lean.Name.replacePrefix Lean.Name.anonymous Lean.Name.anonymous x = x
- Lean.Name.replacePrefix Lean.Name.anonymous x x = Lean.Name.anonymous
- Lean.Name.replacePrefix (Lean.Name.str p s x_3) x x = if (Lean.Name.str p s x_3 == x) = true then x else Lean.Name.mkStr (Lean.Name.replacePrefix p x x) s
- Lean.Name.replacePrefix (Lean.Name.num p s x_3) x x = if (Lean.Name.num p s x_3 == x) = true then x else Lean.Name.mkNum (Lean.Name.replacePrefix p x x) s
@[inline]
Equations
- Lean.Name.modifyBase n f = if Lean.Name.hasMacroScopes n = true then let view := Lean.extractMacroScopes n; Lean.MacroScopesView.review { name := f view.name, imported := view.imported, mainModule := view.mainModule, scopes := view.scopes } else f n
Equations
- Lean.Name.appendAfter n suffix = Lean.Name.modifyBase n fun x => match x with | Lean.Name.str p s x => Lean.Name.mkStr p (s ++ suffix) | n => Lean.Name.mkStr n suffix
Equations
- Lean.Name.appendIndexAfter n idx = Lean.Name.modifyBase n fun x => match x with | Lean.Name.str p s x => Lean.Name.mkStr p (s ++ "_" ++ toString idx) | n => Lean.Name.mkStr n ("_" ++ toString idx)
Equations
- Lean.Name.appendBefore n pre = Lean.Name.modifyBase n fun x => match x with | Lean.Name.anonymous => Lean.Name.mkStr Lean.Name.anonymous pre | Lean.Name.str p s x => Lean.Name.mkStr p (pre ++ s) | Lean.Name.num p n x => Lean.Name.mkNum (Lean.Name.mkStr p pre) n
Equations
- Lean.instInhabitedNameGenerator = { default := { namePrefix := default, idx := default } }
@[inline]
Equations
- Lean.NameGenerator.curr g = Lean.Name.mkNum g.namePrefix g.idx
@[inline]
Equations
- Lean.NameGenerator.next g = { namePrefix := g.namePrefix, idx := g.idx + 1 }
@[inline]
Equations
- Lean.NameGenerator.mkChild g = ({ namePrefix := Lean.Name.mkNum g.namePrefix g.idx, idx := 1 }, { namePrefix := g.namePrefix, idx := g.idx + 1 })
- getNGen : m Lean.NameGenerator
- setNGen : Lean.NameGenerator → m Unit
Equations
- Lean.mkFreshId = do let ngen ← Lean.getNGen let r : Lean.Name := Lean.NameGenerator.curr ngen Lean.setNGen (Lean.NameGenerator.next ngen) pure r
instance
Lean.monadNameGeneratorLift
(m : Type → Type)
(n : Type → Type)
[inst : MonadLift m n]
[inst : Lean.MonadNameGenerator m]
:
Equations
- Lean.monadNameGeneratorLift m n = { getNGen := liftM Lean.getNGen, setNGen := fun ngen => liftM (Lean.setNGen ngen) }
Equations
- Lean.Syntax.instBEqSyntax = { beq := Lean.Syntax.structEq }
Equations
Equations
- Lean.Syntax.getTrailingSize stx = match Lean.Syntax.getTailInfo? stx with | some (Lean.SourceInfo.original x x_1 trailing x_2) => Substring.bsize trailing | x => 0
def
Lean.Syntax.getSubstring?
(stx : Lean.Syntax)
(withLeading : optParam Bool true)
(withTrailing : optParam Bool true)
:
Equations
- Lean.Syntax.getSubstring? stx withLeading withTrailing = let _discr := Lean.Syntax.getTailInfo stx; match Lean.Syntax.getHeadInfo stx, Lean.Syntax.getTailInfo stx with | Lean.SourceInfo.original lead startPos x x_1, Lean.SourceInfo.original x_2 x_3 trail stopPos => some { str := lead.str, startPos := if withLeading = true then lead.startPos else startPos, stopPos := if withTrailing = true then trail.stopPos else stopPos } | x, x_1 => none
Equations
- Lean.Syntax.setTailInfo stx info = match Lean.Syntax.setTailInfoAux info stx with | some stx => stx | none => stx
Equations
- Lean.Syntax.unsetTrailing stx = match Lean.Syntax.getTailInfo stx with | Lean.SourceInfo.original lead pos trail endPos => Lean.Syntax.setTailInfo stx (Lean.SourceInfo.original lead pos (String.toSubstring "") endPos) | x => stx
Equations
- Lean.Syntax.setHeadInfo stx info = match Lean.Syntax.setHeadInfoAux info stx with | some stx => stx | none => stx
Equations
- Lean.Syntax.setInfo info x = match x with | Lean.Syntax.atom x val => Lean.Syntax.atom info val | Lean.Syntax.ident x rawVal val pre => Lean.Syntax.ident info rawVal val pre | Lean.Syntax.node x kind args => Lean.Syntax.node info kind args | Lean.Syntax.missing => Lean.Syntax.missing
Equations
- Lean.Syntax.copyHeadTailInfoFrom target source = Lean.Syntax.setTailInfo (Lean.Syntax.setHeadInfo target (Lean.Syntax.getHeadInfo source)) (Lean.Syntax.getTailInfo source)
@[inline]
def
Lean.withHeadRefOnly
{m : Type → Type}
[inst : Monad m]
[inst : Lean.MonadRef m]
{α : Type}
(x : m α)
:
m α
Equations
- Lean.withHeadRefOnly x = do let a ← Lean.getRef match Lean.Syntax.getHead? a with | none => x | some ref => Lean.withRef ref x
@[inline]
Equations
- Lean.mkNode k args = Lean.Syntax.node Lean.SourceInfo.none k args
Equations
- Lean.mkIdentFrom src val = Lean.Syntax.ident (Lean.SourceInfo.fromRef src) (String.toSubstring (toString val)) val []
def
Lean.mkIdentFromRef
{m : Type → Type}
[inst : Monad m]
[inst : Lean.MonadRef m]
(val : Lean.Name)
:
Equations
- Lean.mkIdentFromRef val = do let a ← Lean.getRef pure (Lean.mkIdentFrom a val)
Equations
- Lean.mkCIdentFrom src c = let id := Lean.addMacroScope `_internal c Lean.reservedMacroScope; Lean.Syntax.ident (Lean.SourceInfo.fromRef src) (String.toSubstring (toString id)) id [(c, [])]
def
Lean.mkCIdentFromRef
{m : Type → Type}
[inst : Monad m]
[inst : Lean.MonadRef m]
(c : Lean.Name)
:
Equations
- Lean.mkCIdentFromRef c = do let a ← Lean.getRef pure (Lean.mkCIdentFrom a c)
Equations
Equations
- Lean.mkIdent val = Lean.Syntax.ident Lean.SourceInfo.none (String.toSubstring (toString val)) val []
@[inline]
Equations
- Lean.mkNullNode args = Lean.mkNode Lean.nullKind args
@[inline]
Equations
- Lean.mkGroupNode args = Lean.mkNode Lean.groupKind args
Equations
- Lean.mkSepArray as sep = Id.run (let i := 0; let r := #[]; do let r ← forIn as { fst := r, snd := i } fun a r => let r_1 := r.fst; let i := r.snd; let _do_jp := fun r i y => let i := i + 1; do pure PUnit.unit pure (ForInStep.yield { fst := r, snd := i }); if i > 0 then let r := Array.push (Array.push r_1 sep) a; do let y ← pure PUnit.unit _do_jp r i y else let r := Array.push r_1 a; do let y ← pure PUnit.unit _do_jp r i y let x : MProd (Array Lean.Syntax) Nat := r match x with | { fst := r, snd := i } => pure r)
Equations
- Lean.mkOptionalNode arg = match arg with | some arg => Lean.mkNullNode #[arg] | none => Lean.mkNullNode
Equations
- Lean.mkHole ref = Lean.mkNode `Lean.Parser.Term.hole #[Lean.mkAtomFrom ref "_"]
Equations
- Lean.Syntax.mkSep a sep = Lean.mkNullNode (Lean.mkSepArray a sep)
Equations
- Lean.Syntax.SepArray.ofElems elems = { elemsAndSeps := Lean.mkSepArray elems (Lean.mkAtom sep) }
def
Lean.Syntax.SepArray.ofElemsUsingRef
{m : Type → Type}
[inst : Monad m]
[inst : Lean.MonadRef m]
{sep : String}
(elems : Array Lean.Syntax)
:
m (Lean.Syntax.SepArray sep)
Equations
- Lean.Syntax.SepArray.ofElemsUsingRef elems = do let ref ← Lean.getRef pure { elemsAndSeps := Lean.mkSepArray elems (Lean.mkAtomFrom ref sep) }
instance
Lean.Syntax.instCoeArraySyntaxSepArray
(sep : String)
:
Coe (Array Lean.Syntax) (Lean.Syntax.SepArray sep)
Equations
- Lean.Syntax.instCoeArraySyntaxSepArray sep = { coe := Lean.Syntax.SepArray.ofElems }
Equations
- Lean.Syntax.mkApp fn x = match x with | #[] => fn | args => Lean.mkNode `Lean.Parser.Term.app #[fn, Lean.mkNullNode args]
Equations
- Lean.Syntax.mkCApp fn args = Lean.Syntax.mkApp (Lean.mkCIdent fn) args
def
Lean.Syntax.mkLit
(kind : Lean.SyntaxNodeKind)
(val : String)
(info : optParam Lean.SourceInfo Lean.SourceInfo.none)
:
Equations
- Lean.Syntax.mkLit kind val info = let atom := Lean.Syntax.atom info val; Lean.mkNode kind #[atom]
Equations
- Lean.Syntax.mkStrLit val info = Lean.Syntax.mkLit Lean.strLitKind (String.quote val) info
Equations
- Lean.Syntax.mkNumLit val info = Lean.Syntax.mkLit Lean.numLitKind val info
def
Lean.Syntax.mkScientificLit
(val : String)
(info : optParam Lean.SourceInfo Lean.SourceInfo.none)
:
Equations
- Lean.Syntax.mkScientificLit val info = Lean.Syntax.mkLit Lean.scientificLitKind val info
Equations
- Lean.Syntax.mkNameLit val info = Lean.Syntax.mkLit Lean.nameLitKind val info
Equations
- Lean.Syntax.decodeNatLitVal? s = let len := String.length s; if (len == 0) = true then none else let c := String.get s 0; if (c == Char.ofNat 48) = true then if (len == 1) = true then some 0 else let c := String.get s 1; if (c == Char.ofNat 120 || c == Char.ofNat 88) = true then Lean.Syntax.decodeHexLitAux s 2 0 else if (c == Char.ofNat 98 || c == Char.ofNat 66) = true then Lean.Syntax.decodeBinLitAux s 2 0 else if (c == Char.ofNat 111 || c == Char.ofNat 79) = true then Lean.Syntax.decodeOctalLitAux s 2 0 else if Char.isDigit c = true then Lean.Syntax.decodeDecimalLitAux s 0 0 else none else if Char.isDigit c = true then Lean.Syntax.decodeDecimalLitAux s 0 0 else none
Equations
- Lean.Syntax.isLit? litKind stx = match stx with | Lean.Syntax.node x k args => if (k == litKind && Array.size args == 1) = true then match Array.get! args 0 with | Lean.Syntax.atom x val => some val | x => none else none | x => none
Equations
Equations
Equations
- Lean.Syntax.decodeScientificLitVal? s = (fun decodeAfterExp decodeAfterDot decode => let len := String.length s; if (len == 0) = true then none else let c := String.get s 0; if Char.isDigit c = true then decode 0 0 else none) (Lean.Syntax.decodeScientificLitVal?.decodeAfterExp s) (Lean.Syntax.decodeScientificLitVal?.decodeExp s) (Lean.Syntax.decodeScientificLitVal?.decodeAfterDot s) (Lean.Syntax.decodeScientificLitVal?.decode s)
def
Lean.Syntax.decodeScientificLitVal?.decodeExp
(s : String)
(i : String.Pos)
(val : Nat)
(e : Nat)
:
Equations
- Lean.Syntax.decodeScientificLitVal?.decodeExp s i val e = let c := String.get s i; if (c == Char.ofNat 45) = true then Lean.Syntax.decodeScientificLitVal?.decodeAfterExp s (String.next s i) val e true 0 else Lean.Syntax.decodeScientificLitVal?.decodeAfterExp s i val e false 0
Equations
- Lean.Syntax.isScientificLit? stx = match Lean.Syntax.isLit? Lean.scientificLitKind stx with | some val => Lean.Syntax.decodeScientificLitVal? val | x => none
Equations
- Lean.Syntax.isIdOrAtom? x = match x with | Lean.Syntax.atom x val => some val | Lean.Syntax.ident x rawVal x_1 x_2 => some (Substring.toString rawVal) | x => none
Equations
- Lean.Syntax.toNat stx = match Lean.Syntax.isNatLit? stx with | some val => val | none => 0
Equations
- Lean.Syntax.decodeQuotedChar s i = OptionM.run (let c := String.get s i; let i := String.next s i; if (c == Char.ofNat 92) = true then pure (Char.ofNat 92, i) else if c = Char.ofNat 34 then pure (Char.ofNat 34, i) else if c = Char.ofNat 39 then pure (Char.ofNat 39, i) else if c = Char.ofNat 114 then pure (Char.ofNat 13, i) else if c = Char.ofNat 110 then pure (Char.ofNat 10, i) else if c = Char.ofNat 116 then pure (Char.ofNat 9, i) else if c = Char.ofNat 120 then do let discr ← Lean.Syntax.decodeHexDigit s i let x : Nat × String.Pos := discr match x with | (d₁, i) => do let discr ← Lean.Syntax.decodeHexDigit s i let x : Nat × String.Pos := discr match x with | (d₂, i) => pure (Char.ofNat (16 * d₁ + d₂), i) else if c = Char.ofNat 117 then do let discr ← Lean.Syntax.decodeHexDigit s i let x : Nat × String.Pos := discr match x with | (d₁, i) => do let discr ← Lean.Syntax.decodeHexDigit s i let x : Nat × String.Pos := discr match x with | (d₂, i) => do let discr ← Lean.Syntax.decodeHexDigit s i let x : Nat × String.Pos := discr match x with | (d₃, i) => do let discr ← Lean.Syntax.decodeHexDigit s i let x : Nat × String.Pos := discr match x with | (d₄, i) => pure (Char.ofNat (16 * (16 * (16 * d₁ + d₂) + d₃) + d₄), i) else none)
Equations
Equations
- Lean.Syntax.isStrLit? stx = match Lean.Syntax.isLit? Lean.strLitKind stx with | some val => Lean.Syntax.decodeStrLit val | x => none
Equations
- Lean.Syntax.decodeCharLit s = OptionM.run (let c := String.get s 1; if (c == Char.ofNat 92) = true then do let discr ← Lean.Syntax.decodeQuotedChar s 2 let x : Char × String.Pos := discr match x with | (c, x) => pure c else pure c)
Equations
- Lean.Syntax.isCharLit? stx = match Lean.Syntax.isLit? Lean.charLitKind stx with | some val => Lean.Syntax.decodeCharLit val | x => none
Equations
Equations
- Lean.Syntax.decodeNameLit s = if (String.get s 0 == Char.ofNat 96) = true then match Lean.Syntax.splitNameLitAux (Substring.drop (String.toSubstring s) 1) [] with | [] => none | comps => some (List.foldr (fun comp n => let comp := Substring.toString comp; if Lean.isIdBeginEscape (String.front comp) = true then Lean.Name.mkStr n (String.dropRight (String.drop comp 1) 1) else if Char.isDigit (String.front comp) = true then match Lean.Syntax.decodeNatLitVal? comp with | some k => Lean.Name.mkNum n k | x => panicWithPosWithDecl "Init.Meta" "Lean.Syntax.decodeNameLit" 719 12 "unreachable code has been reached" else Lean.Name.mkStr n comp) Lean.Name.anonymous comps) else none
Equations
- Lean.Syntax.isNameLit? stx = match Lean.Syntax.isLit? Lean.nameLitKind stx with | some val => Lean.Syntax.decodeNameLit val | x => none
Equations
- Lean.Syntax.hasArgs x = match x with | Lean.Syntax.node x x_1 args => decide (Array.size args > 0) | x => false
Equations
- Lean.Syntax.isAtom x = match x with | Lean.Syntax.atom x x_1 => true | x => false
Equations
- Lean.Syntax.isToken token x = match x with | Lean.Syntax.atom x val => String.trim val == String.trim token | x => false
Equations
- Lean.Syntax.isNone stx = match stx with | Lean.Syntax.node x k args => k == Lean.nullKind && Array.size args == 0 | Lean.Syntax.missing => true | x => false
Equations
- Lean.Syntax.getOptional? stx = match stx with | Lean.Syntax.node x k args => if (k == Lean.nullKind && Array.size args == 1) = true then some (Array.get! args 0) else none | x => none
Equations
- Lean.Syntax.getOptionalIdent? stx = match Lean.Syntax.getOptional? stx with | some stx => some (Lean.Syntax.getId stx) | none => none
Equations
- Lean.Syntax.find? stx p = Lean.Syntax.findAux p stx
- quote : α → Lean.Syntax
Equations
- Lean.instQuoteSyntax = { quote := id }
Equations
- Lean.instQuoteBool = { quote := fun x => match x with | true => Lean.mkCIdent `Bool.true | false => Lean.mkCIdent `Bool.false }
Equations
- Lean.instQuoteString = { quote := fun val => Lean.Syntax.mkStrLit val }
Equations
- Lean.instQuoteNat = { quote := fun n => Lean.Syntax.mkNumLit (toString n) }
Equations
- Lean.instQuoteSubstring = { quote := fun s => Lean.Syntax.mkCApp `String.toSubstring #[Lean.quote (Substring.toString s)] }
Equations
- Lean.instQuoteName = { quote := fun n => match Lean.getEscapedNameParts? [] n with | some ss => Lean.mkNode `Lean.Parser.Term.quotedName #[Lean.Syntax.mkNameLit ("`" ++ String.intercalate "." ss)] | none => Lean.quoteNameMk n }
instance
Lean.instQuoteProd
{α : Type}
{β : Type}
[inst : Lean.Quote α]
[inst : Lean.Quote β]
:
Lean.Quote (α × β)
Equations
- Lean.instQuoteProd = { quote := fun x => match x with | (a, b) => Lean.Syntax.mkCApp `Prod.mk #[Lean.quote a, Lean.quote b] }
Equations
- Lean.instQuoteList = { quote := Lean.quoteList }
Equations
- Lean.instQuoteArray = { quote := fun xs => Lean.Syntax.mkCApp `List.toArray #[Lean.quote (Array.toList xs)] }
Equations
- Lean.Option.hasQuote = { quote := Lean.quoteOption }
Equations
- Lean.evalPrec stx = Lean.Macro.withIncRecDepth stx do let stx ← Lean.expandMacros stx let discr : Lean.Syntax := stx cond (Lean.Syntax.isOfKind discr `numLit) (let num := discr; pure (Option.getD (Lean.Syntax.isNatLit? num) 0)) (let discr := stx; Lean.Macro.throwErrorAt stx "unexpected precedence")
Equations
- Lean.termEval_prec_ = Lean.ParserDescr.node `Lean.termEval_prec_ 1022 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "eval_prec ") (Lean.ParserDescr.cat `prec 1024))
Equations
- Lean.evalPrio stx = Lean.Macro.withIncRecDepth stx do let stx ← Lean.expandMacros stx let discr : Lean.Syntax := stx cond (Lean.Syntax.isOfKind discr `numLit) (let num := discr; pure (Option.getD (Lean.Syntax.isNatLit? num) 0)) (let discr := stx; Lean.Macro.throwErrorAt stx "unexpected priority")
Equations
- Lean.termEval_prio_ = Lean.ParserDescr.node `Lean.termEval_prio_ 1022 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "eval_prio ") (Lean.ParserDescr.cat `prio 1024))
Equations
- Lean.evalOptPrio x = match x with | some prio => Lean.evalPrio prio | none => pure 1000
@[inline]
Equations
def
Array.filterSepElemsM
{m : Type → Type}
[inst : Monad m]
(a : Array Lean.Syntax)
(p : Lean.Syntax → m Bool)
:
m (Array Lean.Syntax)
Equations
- Array.filterSepElemsM a p = Array.filterSepElemsMAux a p 0 #[]
Equations
- Array.filterSepElems a p = Id.run (Array.filterSepElemsM a p)
def
Array.mapSepElemsM
{m : Type → Type}
[inst : Monad m]
(a : Array Lean.Syntax)
(f : Lean.Syntax → m Lean.Syntax)
:
m (Array Lean.Syntax)
Equations
- Array.mapSepElemsM a f = Array.mapSepElemsMAux a f 0 #[]
Equations
- Array.mapSepElems a f = Id.run (Array.mapSepElemsM a f)
Equations
- Lean.Syntax.SepArray.getElems sa = Array.getSepElems sa.elemsAndSeps
instance
Lean.Syntax.SepArray.instCoeTailSepArrayArraySyntax
(sep : String)
:
CoeTail (Lean.Syntax.SepArray sep) (Array Lean.Syntax)
Equations
- Lean.Syntax.SepArray.instCoeTailSepArrayArraySyntax sep = { coe := Lean.Syntax.SepArray.getElems }
@[inline]
Equations
- Lean.Syntax.isInterpolatedStrLit? stx = match Lean.Syntax.isLit? Lean.interpolatedStrLitKind stx with | none => none | some val => Lean.Syntax.decodeInterpStrLit val
def
Lean.Syntax.expandInterpolatedStrChunks
(chunks : Array Lean.Syntax)
(mkAppend : Lean.Syntax → Lean.Syntax → Lean.MacroM Lean.Syntax)
(mkElem : Lean.Syntax → Lean.MacroM Lean.Syntax)
:
Equations
- Lean.Syntax.expandInterpolatedStrChunks chunks mkAppend mkElem = let i := 0; let result := Lean.Syntax.missing; do let r ← forIn chunks { fst := i, snd := result } fun elem r => let i := r.fst; let result := r.snd; let _do_jp := fun i result elem => let _do_jp := fun i result y => let i := i + 1; do pure PUnit.unit pure (ForInStep.yield { fst := i, snd := result }); if (i == 0) = true then let result := elem; do let y ← pure PUnit.unit _do_jp i result y else do let r ← mkAppend result elem let result : Lean.Syntax := r let y ← pure PUnit.unit _do_jp i result y; match Lean.Syntax.isInterpolatedStrLit? elem with | none => do let y ← mkElem elem _do_jp i result y | some str => do let y ← mkElem (Lean.Syntax.mkStrLit str) _do_jp i result y let x : MProd Nat Lean.Syntax := r match x with | { fst := i, snd := result } => pure result
def
Lean.Syntax.expandInterpolatedStr
(interpStr : Lean.Syntax)
(type : Lean.Syntax)
(toTypeFn : Lean.Syntax)
:
Equations
- Lean.Syntax.expandInterpolatedStr interpStr type toTypeFn = let ref := interpStr; do let r ← Lean.Syntax.expandInterpolatedStrChunks (Lean.Syntax.getArgs interpStr) (fun a b => do let info ← Lean.MonadRef.mkInfoFromRefPos let _ ← Lean.getCurrMacroScope let _ ← Lean.getMainModule pure (Lean.Syntax.node Lean.SourceInfo.none `«term_++_» #[a, Lean.Syntax.atom info "++", b])) fun a => do let _ ← Lean.MonadRef.mkInfoFromRefPos let _ ← Lean.getCurrMacroScope let _ ← Lean.getMainModule pure (Lean.Syntax.node Lean.SourceInfo.none `Lean.Parser.Term.app #[toTypeFn, Lean.Syntax.node Lean.SourceInfo.none `null #[a]]) let info ← Lean.MonadRef.mkInfoFromRefPos let _ ← Lean.getCurrMacroScope let _ ← Lean.getMainModule pure (Lean.Syntax.node Lean.SourceInfo.none `Lean.Parser.Term.paren #[Lean.Syntax.atom info "(", Lean.Syntax.node Lean.SourceInfo.none `null #[r, Lean.Syntax.node Lean.SourceInfo.none `null #[Lean.Syntax.node Lean.SourceInfo.none `Lean.Parser.Term.typeAscription #[Lean.Syntax.atom info ":", type]]], Lean.Syntax.atom info ")"])
Equations
- all: Lean.Meta.TransparencyMode
- default: Lean.Meta.TransparencyMode
- reducible: Lean.Meta.TransparencyMode
- instances: Lean.Meta.TransparencyMode
Equations
Equations
- Lean.Meta.instBEqTransparencyMode = { beq := [anonymous] }
Equations
- Lean.Meta.instReprTransparencyMode = { reprPrec := [anonymous] }
Equations
- Lean.Meta.Simp.instBEqConfig = { beq := [anonymous] }
Equations
- Lean.Meta.Simp.instReprConfig = { reprPrec := [anonymous] }
Equations
- Lean.Meta.Simp.instInhabitedConfig = { default := { maxSteps := default, maxDischargeDepth := default, contextual := default, memoize := default, singlePass := default, zeta := default, beta := default, eta := default, etaStruct := default, iota := default, proj := default, decide := default } }
- transparency : Lean.Meta.TransparencyMode
- offsetCnstrs : Bool
Equations
- Lean.Parser.Tactic.tacticErw__ = Lean.ParserDescr.node `Lean.Parser.Tactic.tacticErw__ 1022 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.nonReservedSymbol "erw " false) Lean.Parser.Tactic.rwRuleSeq) (Lean.ParserDescr.unary `optional Lean.Parser.Tactic.location))