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
{{ message }}
This repository was archived by the owner on Jan 5, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: Manual/Elaboration.lean
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -431,7 +431,7 @@ To provide a uniform interface to functions defined via structural and well-foun
431
431
In the function's namespace, `eq_unfold` relates the function directly to its definition, `eq_def` relates it to the definition after instantiating implicit parameters, and $`N` lemmas `eq_N` relate each case of its pattern-matching to the corresponding right-hand side, including sufficient assumptions to indicate that earlier branches were not taken.
Copy file name to clipboardExpand all lines: Manual/IO.lean
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@ tag := "io"
32
32
33
33
34
34
Lean is a pure functional programming language.
35
-
While Lean code is strictly evaluated at run time, the order of evaluation that is used during type checking, especially while checking {tech}[definitional equality], is formally unspecified and makes use of a number of heuristics that improve performance but are subject to change.
35
+
While Lean code is strictly evaluated at run time, the order of evaluation that is used during type checking, especially while checking {tech}[定義上の等価性]definitional equality, is formally unspecified and makes use of a number of heuristics that improve performance but are subject to change.
36
36
This means that simply adding operations that perform side effects (such as file I/O, exceptions, or mutable references) would lead to programs in which the order of effects is unspecified.
37
37
During type checking, even terms with free variables are reduced; this would make side effects even more difficult to predict.
38
38
Finally, a basic principle of Lean's logic is that functions are _functions_ that map each element of the domain to a unique element of the range.
Copy file name to clipboardExpand all lines: Manual/Language/RecursiveDefs.lean
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -21,10 +21,10 @@ tag := "recursive-definitions"
21
21
%%%
22
22
23
23
Allowing arbitrary recursive function definitions would make Lean's logic inconsistent.
24
-
General recursion makes it possible to write circular proofs: "{tech}[proposition] $`P` is true because proposition $`P` is true".
24
+
General recursion makes it possible to write circular proofs: "{tech}[命題]proposition $`P` is true because proposition $`P` is true".
25
25
Outside of proofs, an infinite loop could be assigned the type {name}`Empty`, which can be used with {keywordOf Lean.Parser.Term.nomatch}`nomatch` or {name Empty.rec}`Empty.rec` to prove any theorem.
26
26
27
-
Banning recursive function definitions outright would render Lean far less useful: {tech}[inductivetypes]arekeytodefiningbothpredicatesanddata,andtheyhavearecursivestructure.
27
+
Banning recursive function definitions outright would render Lean far less useful: {tech}[帰納型]inductivetypesarekeytodefiningbothpredicatesanddata,andtheyhavearecursivestructure.
Whileelaboratingrecursivedefinitions,theLeanelaboratoralsoproducesajustificationthatthefunctionbeingdefinedissafe.{margin}[The section on {ref "elaboration-results"}[the elaborator's output] in the overview of elaboration contextualizes the elaboration of recursive definitions in the overall context of the elaborator.]
@@ -33,15 +33,15 @@ There are four main kinds of recursive functions that can be defined:
33
33
34
34
: Structurally recursive functions
35
35
36
-
Structurally recursive functions take an argument such that the function makes recursive calls only on strict sub-components of said argument.{margin}[Strictly speaking, arguments whose types are {tech}[indexed families] are grouped together with their indices, with the whole collection considered as a unit.]
37
-
The elaborator translates the recursion into uses of the argument's {tech}[recursor].
36
+
Structurally recursive functions take an argument such that the function makes recursive calls only on strict sub-components of said argument.{margin}[Strictly speaking, arguments whose types are {tech}[添字族]indexed families are grouped together with their indices, with the whole collection considered as a unit.]
37
+
The elaborator translates the recursion into uses of the argument's {tech}[再帰子]recursor.
38
38
Because every type-correct use of a recursor is guaranteed to avoid infinite regress, this translation is evidence that the function terminates.
39
39
Applications of functions defined via recursors are definitionally equal to the result of the recursion, and are typically relatively efficient inside the kernel.
40
40
41
41
: Recursion over well-founded relations
42
42
43
43
Many functions are also difficult to convert to structural recursion; forinstance, a function may terminate because the difference between an array index and the size of the array decreases as the index increases, but {name}`Nat.rec` isn't applicable because the index that increases is the function's argument.
44
-
Here, there is a {tech}[measure] of termination that decreases at each recursive call, but the measure is not itself an argument to the function.
44
+
Here, there is a {tech}[測度]measure of termination that decreases at each recursive call, but the measure is not itself an argument to the function.
45
45
In these cases, {tech}[well-founded recursion] can be used to define the function.
46
46
Well-founded recursion is a technique for systematically transforming recursive functions with a decreasing measure into recursive functions over proofs that every sequence of reductions to the measure eventually terminates at a minimum.
47
47
Applications of functions defined via well-founded recursion are not necessarily definitionally equal to their return values, but this equality can be proved as a proposition.
The `below` construction is a mapping from each value of a type to the results of some function call on _all_ smaller values; it can be understood as a memoization table that already contains the results for all smaller values.
40
-
Recursors expect an argument for each of the inductivetype'sconstructors;theseargumentsarecalledwith the constructor's arguments (and the result of recursion on recursive parameters) during {tech}[ι-reduction].
40
+
Recursors expect an argument for each of the inductivetype'sconstructors;theseargumentsarecalledwith the constructor's arguments (and the result of recursion on recursive parameters) during {tech}[ι簡約]ι-reduction.
41
41
The course-of-values recursion operator `brecOn`, on the other hand, expects just a single case that covers all constructors at once.
42
42
This case is provided with a value and a `below` table that contains the results of recursion on all values smaller than the given value; it should use the contents of the table to satisfy the motive for the provided value.
43
43
If the function is structurally recursive over a given parameter (or parameter group), then the results of all recursive calls will be present in this table already.
Copy file name to clipboardExpand all lines: Manual/Monads/Syntax.lean
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -532,7 +532,7 @@ for $[$[$h :]? $x in $y],* do
532
532
:::
533
533
534
534
A {keywordOf Lean.Parser.Term.doFor}`for``…`{keywordOf Lean.Parser.Term.doFor}`in` loop requires at least one clause that specifies the iteration to be performed, which consists of an optional membership proof name followed by a colon (`:`), a pattern to bind, the keyword {keywordOf Lean.Parser.Term.doFor}`in`, and a collection term.
535
-
The pattern, which may just be an {tech}[identifier], must match any element of the collection; patterns in this position cannot be used as implicit filters.
535
+
The pattern, which may just be an {tech}[識別子]identifier, must match any element of the collection; patterns in this position cannot be used as implicit filters.
536
536
Further clauses may be provided by separating them with commas.
537
537
Each collection is iterated over at the same time, and iteration stops when any of the collections runs out of elements.
Copy file name to clipboardExpand all lines: Manual/Monads/Zoo.lean
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -157,8 +157,8 @@ For example, there might be a mutable {lean}`Nat` and a mutable {lean}`String` o
157
157
As long as they have different types, it should be convenient to access both.
158
158
In typical use, some monadic operations that are overloaded in type classes have type information available for {tech key:="synthesis"}[instancesynthesis],whileothersdonot.
159
159
Forexample,theargumentpassedto {name MonadState.set}`set` determines the type of the state to be used, while {name MonadState.get}`get` takes no such argument.
160
-
The type information present in applications of {name MonadState.set}`set` can be used to pick the correct instancewhenmultiplestatesareavailable,whichsuggeststhatthetypeofthemutablestateshouldbeaninputparameteror {tech}[semi-output parameter] so that it can be used to select instances.
161
-
The lack of type information present in uses of {name MonadState.get}`get`, on the other hand, suggests that the type of the mutable state should be an {tech}[output parameter]in {lean}`MonadState`, so type classsynthesisdeterminesthestate'stypefromthemonaditself.
160
+
The type information present in applications of {name MonadState.set}`set` can be used to pick the correct instancewhenmultiplestatesareavailable,whichsuggeststhatthetypeofthemutablestateshouldbeaninputparameteror {tech}[半出力パラメータ]semi-output parameter so that it can be used to select instances.
161
+
The lack of type information present in uses of {name MonadState.get}`get`, on the other hand, suggests that the type of the mutable state should be an {tech}[出力パラメータ]output parameter in {lean}`MonadState`, so type classsynthesisdeterminesthestate'stypefromthemonaditself.
Copy file name to clipboardExpand all lines: Manual/Monads/Zoo/Combined.lean
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -60,7 +60,7 @@ In one ordering, state changes are rolled back when exceptions are caught; in th
60
60
The latter option matches the semantics of most imperative programming languages, but the former is very useful for search-based problems.
61
61
Often, some but not all state should be rolled back; this can be achieved by “sandwiching” {name}`ExceptT` between two separate uses of {name}`StateT`.
62
62
63
-
To avoid yet another layer of indirection via the use of {lean}`StateT σ (EStateM ε σ') α`, {name}`EStateM` offers the {name}`EStateM.Backtrackable` {tech}[type class].
63
+
To avoid yet another layer of indirection via the use of {lean}`StateT σ (EStateM ε σ') α`, {name}`EStateM` offers the {name}`EStateM.Backtrackable` {tech}[型クラス]type class.
64
64
This classspecifiessomepartofthestatethatcanbesavedandrestored.
65
65
{name}`EStateM`then arranges for the saving and restoring to take place around error handling.
0 commit comments