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
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,7 +73,7 @@ In addition to what Verso provides, there are a number of additional roles, code
73
73
Please use the following roles where they make sense:
74
74
75
75
*`` {lean}`TERM` `` - `TERM` is a Lean term, to be elaborated as such and included it in the rendered document with appropriate highlighting.
76
-
The optional named argument `type` specifies an expected type, e.g. `` {lean type:="Nat"}`.succ .zero` ``
76
+
The optional named argument `type` specifies an expected type, e.g. `` {lean (type := "Nat")}`.succ .zero` ``
77
77
78
78
*`` {name}`X` `` - `X` is a constant in the Lean environment.
79
79
The optional positional argument can be used to override name resolution; if it is provided, then the positional argument is used to resolve the name but the contents of the directive are rendered.
Copy file name to clipboardExpand all lines: Manual/BasicProps.lean
+13-13Lines changed: 13 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -99,7 +99,7 @@ However, it should not be confused with {name}`PProd`: using non-computable reas
99
99
100
100
In a {ref "tactics"}[tactic] proof, conjunctions can be proved using {name}`And.intro` explicitly via {tactic}`apply`, but {tactic}`constructor` is more common.
101
101
When multiple conjunctions are nested in a proof goal, {tactic}`and_intros` can be used to apply {name}`And.intro`in each relevant location.
102
-
Assumptions of conjunctions in the context can be simplified using {tactic}`cases`, pattern matching with {tactic}`let` or {tactic show:="match"}`Lean.Parser.Tactic.match`, or {tactic}`rcases`.
102
+
Assumptions of conjunctions in the context can be simplified using {tactic}`cases`, pattern matching with {tactic}`let` or {tactic (show := "match")}`Lean.Parser.Tactic.match`, or {tactic}`rcases`.
103
103
104
104
{docstring And}
105
105
@@ -113,7 +113,7 @@ Because {lean}`Sum` is a type, it is possible to check _which_ constructor was u
113
113
In other words, because {lean}`Or` is not a {tech}[subsingleton], its proofs cannot be used as part of a computation.
114
114
115
115
In a {ref "tactics"}[tactic] proof, disjunctions can be proved using either constructor ({name}`Or.inl` or {name}`Or.inr`) explicitly via {tactic}`apply`.
116
-
Assumptions of disjunctions in the context can be simplified using {tactic}`cases`, pattern matching with {tactic show:="match"}`Lean.Parser.Tactic.match`, or {tactic}`rcases`.
116
+
Assumptions of disjunctions in the context can be simplified using {tactic}`cases`, pattern matching with {tactic (show := "match")}`Lean.Parser.Tactic.match`, or {tactic}`rcases`.
117
117
118
118
{docstring Or}
119
119
@@ -125,14 +125,14 @@ This is because the decision procedure's result provides a suitable branch condi
125
125
{docstring Or.by_cases'}
126
126
127
127
128
-
```lean(show := false)
128
+
```lean-show
129
129
section
130
130
variable {P : Prop}
131
131
```
132
132
Rather than encoding negation as an inductivetype, {lean}`¬P` is defined to mean {lean}`P → False`.
133
133
In other words, to prove a negation, it suffices to assume the negated statement and derive a contradiction.
134
134
This also means that {lean}`False` can be derived immediately from a proof of a proposition and its negation, and then used to prove any proposition or inhabit any type.
@@ -239,7 +239,7 @@ Unlike both {name}`Subtype` and {name}`Sigma`, it is a {tech}[proposition]; this
239
239
240
240
When writing a proof, the {tactic}`exists` tactic allows one (or more) witness(es) to be specified for a (potentially nested) existential statement.
241
241
The {tactic}`constructor` tactic, on the other hand, creates a {tech}[metavariable] for the witness; providing a proof of the predicate may solve the metavariable as well.
242
-
The components of an existential assumption can be made available individually by pattern matching with {tactic}`let` or {tactic show:="match"}`Lean.Parser.Tactic.match`, as well as by using {tactic}`cases` or {tactic}`rcases`.
242
+
The components of an existential assumption can be made available individually by pattern matching with {tactic}`let` or {tactic (show := "match")}`Lean.Parser.Tactic.match`, as well as by using {tactic}`cases` or {tactic}`rcases`.
243
243
244
244
:::example"Proving Existential Statements"
245
245
@@ -402,12 +402,12 @@ In these cases, the built-in automation has no choice but to use heterogeneous e
402
402
$_ ≍ $_
403
403
```
404
404
405
-
```lean(show := false)
405
+
```lean-show
406
406
section
407
407
variable (x : α) (y : β)
408
408
```
409
409
Heterogeneous equality {lean}`HEq x y` can be written {lean}`x ≍ y`.
Copy file name to clipboardExpand all lines: Manual/BasicTypes.lean
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -69,7 +69,7 @@ In functional programming, {lean}`Unit` is the return type of things that "retur
69
69
Mathematically, this is represented by a single completely uninformative value, as opposed to an empty type such as {lean}`Empty`, which represents unreachable code.
70
70
71
71
:::leanSection
72
-
```lean(show := false)
72
+
```lean-show
73
73
variable {m : Type → Type} [Monad m] {α : Type}
74
74
```
75
75
@@ -85,7 +85,7 @@ There are two variants of the unit type:
85
85
86
86
* {lean}`Unit` is a {lean}`Type` that exists in the smallest non-propositional {tech}[universe].
87
87
88
-
* {lean}`PUnit` is {tech key:="universe polymorphism"}[universe polymorphic] and can be used in any non-propositional {tech}[universe].
88
+
* {lean}`PUnit` is {tech (key := "universe polymorphism")}[universe polymorphic] and can be used in any non-propositional {tech}[universe].
89
89
90
90
Behind the scenes, {lean}`Unit` is actually defined as {lean}`PUnit.{1}`.
91
91
{lean}`Unit` should be preferred over {name}`PUnit` when possible to avoid unnecessary universe parameters.
@@ -101,7 +101,7 @@ If in doubt, use {lean}`Unit` until universe errors occur.
101
101
102
102
{deftech}_Unit-like types_ are inductivetypesthathaveasingleconstructorwhichtakesnonon-proofparameters.
103
103
{lean}`PUnit` is one such type.
104
-
All elements of unit-like types are {tech key:="definitional equality"}[definitionally equal] to all other elements.
104
+
All elements of unit-like types are {tech (key := "definitional equality")}[definitionally equal] to all other elements.
105
105
106
106
:::example"Definitional Equality of {lean}`Unit`"
107
107
Every term with type {lean}`Unit` is definitionally equal to every other term with type {lean}`Unit`:
@@ -143,7 +143,7 @@ inductive NotUnitLike where
143
143
| mk (u : Unit)
144
144
```
145
145
146
-
```lean(error:=true) (name := NotUnitLike)
146
+
```lean+error (name := NotUnitLike)
147
147
example (e1 e2 : NotUnitLike) : e1 = e2 := rfl
148
148
```
149
149
```leanOutput NotUnitLike
@@ -186,7 +186,7 @@ However, there is an important pragmatic difference: {lean}`Bool` classifies _va
186
186
In other words, {lean}`Bool` is the notion of truth and falsehood that's appropriate for programs, while {lean}`Prop` is the notion that's appropriate for mathematics.
187
187
Because proofs are erased from compiled programs, keeping {lean}`Bool` and {lean}`Prop` distinct makes it clear which parts of a Lean file are intended for computation.
188
188
189
-
```lean(show := false)
189
+
```lean-show
190
190
section BoolProp
191
191
192
192
axiomb : Bool
@@ -211,7 +211,7 @@ These propositions are called {tech}_decidable_ propositions, and have instances
211
211
The function {name}`Decidable.decide` converts a proof-carrying {lean}`Decidable` result into a {lean}`Bool`.
212
212
This function is also a coercion from decidable propositions to {lean}`Bool`, so {lean}`(2 = 2 : Bool)` evaluates to {lean}`true`.
213
213
214
-
```lean(show := false)
214
+
```lean-show
215
215
/-- info: true -/
216
216
#check_msgs in
217
217
#eval (2 = 2 : Bool)
@@ -246,7 +246,7 @@ The prefix operator `!` is notation for {lean}`Bool.not`.
246
246
247
247
### Logical Operations
248
248
249
-
```lean(show := false)
249
+
```lean-show
250
250
section ShortCircuit
251
251
252
252
axiomBIG_EXPENSIVE_COMPUTATION : Bool
@@ -256,7 +256,7 @@ The functions {name}`cond`, {name Bool.and}`and`, and {name Bool.or}`or` are sho
256
256
In other words, {lean}`false && BIG_EXPENSIVE_COMPUTATION` does not need to execute {lean}`BIG_EXPENSIVE_COMPUTATION` before returning `false`.
257
257
These functions are defined using the {attr}`macro_inline` attribute, which causes the compiler to replace calls to them with their definitions while generating code, and the definitions use nested pattern matching to achieve the short-circuiting behavior.
:::example"No Kernel Reasoning About Floating-Point Numbers"
47
-
The Lean kernel can compare expressions of type {lean}`Float`for syntactic equality, so {lean type:="Float"}`0.0` is definitionally equal to itself.
47
+
The Lean kernel can compare expressions of type {lean}`Float`for syntactic equality, so {lean (type := "Float")}`0.0` is definitionally equal to itself.
48
48
```lean
49
49
example : (0.0 : Float) = (0.0 : Float) := by rfl
50
50
```
51
51
52
52
Terms that require reduction to become syntactically equal cannot be checked by the kernel:
53
-
```lean(error := true) (name := zeroPlusZero)
53
+
```lean+error (name := zeroPlusZero)
54
54
example : (0.0 : Float) = (0.0 + 0.0 : Float) := by rfl
55
55
```
56
56
```leanOutput zeroPlusZero
@@ -63,7 +63,7 @@ is not definitionally equal to the right-hand side
63
63
```
64
64
65
65
Similarly, the kernel cannot evaluate {lean}`Bool`-valued comparisons of floating-point numbers while checking definitional equality:
0 commit comments