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: Manual/Language/InductiveTypes/LogicalModel.lean
+20-20Lines changed: 20 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -38,7 +38,7 @@ tag := "recursor-types"
38
38
The recursor takes the following parameters:
39
39
: The inductivetype's {tech}[parameters]
40
40
41
-
Because parameters are consistent, they can be abstracted over the entire recursor
41
+
Because parameters are consistent, they can be abstracted over the entire recursor.
42
42
43
43
: The {deftech}_motive_
44
44
@@ -48,23 +48,23 @@ The recursor takes the following parameters:
48
48
49
49
For each constructor, the recursor expects a function that satisfies the motive for an arbitrary application of the constructor.
50
50
Each minor premise abstracts over all of the constructor's parameters.
51
-
If the constructor's parameter's type is the inductivetypeitself,thenthecaseadditionallytakesaparameterwhosetypeisthemotiveappliedtothatparameter'svalue—thiswillreceivetheresultofrecursivelyprocessingtherecursiveparameter.
51
+
If the constructor's parameter's type is the inductivetypeitself,thentheminorpremiseadditionallytakesaparameterwhosetypeisthemotiveappliedtothatparameter'svalue—thiswillreceivetheresultofrecursivelyprocessingtherecursiveparameter.
52
52
53
53
: The {deftech}_major premise_, or target
54
54
55
55
Finally, the recursor takes an instanceofthetypeasanargument,alongwith any index values.
56
56
57
-
The result type of the recursor is the motive applied to these indices and the target.
57
+
The result type of the recursor is the motive applied to these indices and the major premise.
58
58
:::
59
59
60
60
:::example"The recursor for {lean}`Bool`"
61
61
{lean}`Bool`'s recursor {name}`Bool.rec` has the following parameters:
62
62
63
63
* The motive computes a type in any universe, given a {lean}`Bool`.
64
-
* There are casesfor both constructors, in which the motive is satisfied for both {lean}`false` and {lean}`true`.
65
-
* The target is some {lean}`Bool`.
64
+
* There are minor premisesfor both constructors, in which the motive is satisfied for both {lean}`false` and {lean}`true`.
65
+
* The major premise is some {lean}`Bool`.
66
66
67
-
The return type is the motive applied to the target.
67
+
The return type is the motive applied to the major premise.
* The parameter {lean}`α` comes first, because the parameter and the cases need to refer to it
85
+
* The parameter {lean}`α` comes first, because the motive, minor premises, and major premise need to refer to it.
86
86
* The motive computes a type in any universe, given a {lean}`List α`. There is no connection between the universe levels `u` and `v`.
87
-
* There are casesfor both constructors:
87
+
* There are minor premisesfor both constructors:
88
88
- The motive is satisfied for {name}`List.nil`
89
89
- The motive should be satisfiable for any application of {name}`List.cons`, given that it is satisfiable for the tail. The extra parameter `motive tail` is because `tail`'s type is a recursive occurrence of {name}`List`.
90
-
* The target is some {lean}`List α`.
90
+
* The major premise is some {lean}`List α`.
91
91
:::
92
92
93
-
Once again, the return type is the motive applied to the target.
93
+
Once again, the return type is the motive applied to the major premise.
94
94
95
95
```signature
96
96
List.rec.{u, v} {α : Type v} {motive : List α → Sort u}
@@ -114,9 +114,9 @@ inductive EvenOddList (α : Type u) : Bool → Type u where
114
114
The recursor {name}`EvenOddList.rec` is very similar to that for`List`.
115
115
The difference comes from the presence of the index:
116
116
* The motive now abstracts over any arbitrary choice of index.
117
-
* The casefor {name EvenOddList.nil}`nil` applies the motive to {name EvenOddList.nil}`nil`'s index value `true`.
118
-
* The case for {name EvenOddList.cons}`cons` abstracts over the index value used in its recursive occurrence, and instantiates the motive with its negation.
119
-
* The target additionally abstracts over an arbitrary choice of index.
117
+
* The minor premisefor {name EvenOddList.nil}`nil` applies the motive to {name EvenOddList.nil}`nil`'s index value `true`.
118
+
* The minor premise {name EvenOddList.cons}`cons` abstracts over the index value used in its recursive occurrence, and instantiates the motive with its negation.
119
+
* The major premise additionally abstracts over an arbitrary choice of index.
120
120
121
121
```signature
122
122
EvenOddList.rec.{u, v} {α : Type v}
@@ -132,7 +132,7 @@ EvenOddList.rec.{u, v} {α : Type v}
132
132
:::::
133
133
134
134
When using a predicate (that is, a function that returns a {lean}`Prop`)for the motive, recursors express induction.
135
-
The cases for non-recursive constructors are the base cases, and the additional arguments supplied to constructors with recursive arguments are the induction hypotheses.
135
+
The minor premises for non-recursive constructors are the base cases, and the additional arguments supplied to minor premises for constructors with recursive arguments are the induction hypotheses.
136
136
137
137
### Subsingleton Elimination
138
138
%%%
@@ -218,11 +218,11 @@ tag := "iota-reduction"
218
218
219
219
220
220
In addition to adding new constants to the logic, inductivetypedeclarationsalsoaddnewreductionrules.
When the recursor's target is a constructor with no recursive parameters, the recursor application reduces to an application of the constructor's case to the constructor's arguments.
225
-
If there are recursive parameters, then these arguments to the case are found by applying the recursor to the recursive occurrence.
224
+
When the recursor's major premise is a constructor with no recursive parameters, the recursor application reduces to an application of the constructor's minor premise to the constructor's arguments.
225
+
If there are recursive parameters, then these arguments to the minor premise are found by applying the recursor to the recursive occurrence.
226
226
227
227
# Well-Formedness Requirements
228
228
%%%
@@ -367,9 +367,9 @@ tag := "recursor-elaboration-helpers"
367
367
368
368
In addition to the type constructor, constructors, and recursors that Lean's core type theory prescribes forinductivetypes,Leanconstructsanumberofusefulhelpers.
369
369
First,theequationcompiler (which translates recursive functions with pattern matching in to applications of recursors) makes use of these additional constructs:
370
-
* `recOn` is a version of the recursor in which the target is prior to the casesfor each constructor.
371
-
* `casesOn` is a version of the recursor in which the target is prior to the casesfor each constructor, and recursive arguments do not yield induction hypotheses. It expresses case analysis rather than primitive recursion.
372
-
* `below` computes a type that, for some motive, expresses that _all_ inhabitants of the inductivetypethataresubtreesofthetargetsatisfythemotive.Ittransformsamotiveforinductionorprimitiverecursionintoamotiveforstrongrecursionorstronginduction.
370
+
* `recOn` is a version of the recursor in which the major premise is prior to the minor premisefor each constructor.
371
+
* `casesOn` is a version of the recursor in which the major premise is prior to the minor premisefor each constructor, and recursive arguments do not yield induction hypotheses. It expresses case analysis rather than primitive recursion.
372
+
* `below` computes a type that, for some motive, expresses that _all_ inhabitants of the inductivetypethataresubtreesofthemajorpremisesatisfythemotive.Ittransformsamotiveforinductionorprimitiverecursionintoamotiveforstrongrecursionorstronginduction.
* `noConfusionType`isthemotiveusedfor `noConfusion`thatdetermineswhattheconsequencesoftwoconstructorsbeingequalwouldbe.Forseparateconstructors,thisis {lean}`False`;if both constructors are the same, then the consequence is the equality of their respective parameters.
0 commit comments