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.
The constructors {lean}`Bool.true` and {lean}`Bool.false` are exported from the {lean}`Bool`namespace, so they can be written {lean}`true` and {lean}`false`.
Both {lean}`Bool` and {lean}`Prop` represent notions of truth.
316
407
From a purely logical perspective, they are equivalent: {tech}[propositional extensionality] means that there are fundamentally only two propositions, namely {lean}`True` and {lean}`False`.
317
408
However, there is an important pragmatic difference: {lean}`Bool` classifies _values_ that can be computed by programs, while {lean}`Prop` classifies statements for which code generation doesn't make sense.
318
409
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.
319
410
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.
The prefix operator `!` is notationfor {lean}`Bool.not`.
487
+
:::
488
+
489
+
前置演算子 `!` は {lean}`Bool.not` の表記です。
490
+
371
491
```grammar
372
492
!$_:term
373
493
```
374
-
:::
494
+
::::
375
495
376
496
497
+
:::comment
377
498
## API Reference
499
+
:::
378
500
501
+
## API リファレンス(API Reference)
502
+
503
+
504
+
:::comment
379
505
### Logical Operations
506
+
:::
507
+
508
+
### 論理演算子(Logical Operations)
509
+
380
510
381
511
```lean (show := false)
382
512
section ShortCircuit
383
513
384
514
axiomBIG_EXPENSIVE_COMPUTATION : Bool
385
515
```
386
516
517
+
:::comment
387
518
The functions {name}`cond`, {name Bool.and}`and`, and {name Bool.or}`or` are short-circuiting.
388
519
In other words, {lean}`false && BIG_EXPENSIVE_COMPUTATION` does not need to execute {lean}`BIG_EXPENSIVE_COMPUTATION` before returning `false`.
389
520
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.
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.
0 commit comments