You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/-Copyright (c) 2020 Microsoft Corporation. All rights reserved.Released under Apache 2.0 license as described in the file LICENSE.Authors: Leonardo de Moura, Mario CarneiroNotation for operators defined at Prelude.lean-/preludeimport Init.Prelude
import Init.Coe
set_option linter.missingDocs true -- keep it documentednamespace Lean
/--Auxiliary type used to represent syntax categories. We mainly use auxiliarydefinitions with this type to attach doc strings to syntax categories.-/structureParser.CategorynamespaceParser.Category/-- `command` is the syntax category for things that appear at the top levelof a lean file. For example, `def foo := 1` is a `command`, as is`namespace Foo` and `end Foo`. Commands generally have an effect on the state ofadding something to the environment (like a new definition), as well ascommands like `variable` which modify future commands within a scope. -/defcommand : Category := {}
/-- `term` is the builtin syntax category for terms. A term denotes an expressionin lean's type theory, for example `2 + 2` is a term. The difference between`Term` and `Expr` is that the former is a kind of syntax, while the latter isthe result of elaboration. For example `by simp` is also a `Term`, but it elaboratesto different `Expr`s depending on the context. -/defterm : Category := {}
/-- `tactic` is the builtin syntax category for tactics. These appear after`by` in proofs, and they are programs that take in the proof context(the hypotheses in scope plus the type of the term to synthesize) and constructa term of the expected type. For example, `simp` is a tactic, used in:\```example : 2 + 2 = 4 := by simp\```-/deftactic : Category := {}
/-- `doElem` is a builtin syntax category for elements that can appear in the `do` notation.For example, `let x ← e` is a `doElem`, and a `do` block consists of a list of `doElem`s. -/defdoElem : Category := {}
/-- `structInstFieldDecl` is the syntax category for value declarations for fields in structure instance notation.For example, the `:= 1` and `| 0 => 0 | n + 1 => n` in `{ x := 1, f | 0 => 0 | n + 1 => n }` are in the `structInstFieldDecl` class. -/defstructInstFieldDecl : Category := {}
/-- `level` is a builtin syntax category for universe levels.This is the `u` in `Sort u`: it can contain `max` and `imax`, addition withconstants, and variables. -/deflevel : Category := {}
/-- `attr` is a builtin syntax category for attributes.Declarations can be annotated with attributes using the `@[...]` notation. -/defattr : Category := {}
/-- `stx` is a builtin syntax category for syntax. This is the abbreviatedparser notation used inside `syntax` and `macro` declarations. -/defstx : Category := {}
/-- `prio` is a builtin syntax category for priorities.Priorities are used in many different attributes.Higher numbers denote higher priority, and for example typeclass search willtry high priority instances before low priority.In addition to literals like `37`, you can also use `low`, `mid`, `high`, as well asadd and subtract priorities. -/defprio : Category := {}
/-- `prec` is a builtin syntax category for precedences. A precedence is a valuethat expresses how tightly a piece of syntax binds: for example `1 + 2 * 3` isparsed as `1 + (2 * 3)` because `*` has a higher precedence than `+`.Higher numbers denote higher precedence.In addition to literals like `37`, there are some special named precedence levels:* `arg` for the precedence of function arguments* `max` for the highest precedence used in term parsers (not actually the maximum possible value)* `lead` for the precedence of terms not supposed to be used as argumentsand you can also add and subtract precedences. -/defprec : Category := {}
end Parser.Category
The text was updated successfully, but these errors were encountered:
組み込みの syntax category がたくさん定義されているファイルがある。
ドキュメントがたくさん書かれていて参考になる。
see: https://github.com/leanprover/lean4/blob/master/src/Init/Notation.lean
The text was updated successfully, but these errors were encountered: