Skip to content

Commit ada3bc9

Browse files
committed
fix typo in MetaM chapter
see leanprover-community#132
1 parent 0a21eb0 commit ada3bc9

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

lean/main/04_metam.lean

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ assigns `?b := f a`. Assigned metavariables are not considered open goals, so
127127
the only goal that remains is `?m3`.
128128
129129
Now the third `apply` comes in. Since `?b` has been assigned, the target of
130-
`?m3` is now `f (f a) = a`. Again, the application of `h` succeeds and the
130+
`?m3` is now `f a = a`. Again, the application of `h` succeeds and the
131131
tactic assigns `?m3 := h a`.
132132
133133
At this point, all metavariables are assigned as follows:
@@ -1235,9 +1235,9 @@ Notice that changing the type of the metavariable from `Nat` to, for example, `S
12351235
-- Instantiate `mvar1`, which should result in expression `2 + ?mvar2 + 1`
12361236
...
12371237
```
1238-
4. [**Metavariables**] Consider the theorem `red`, and tactic `explore` below.
1239-
**a)** What would be the `type` and `userName` of metavariable `mvarId`?
1240-
**b)** What would be the `type`s and `userName`s of all local declarations in this metavariable's local context?
1238+
4. [**Metavariables**] Consider the theorem `red`, and tactic `explore` below.
1239+
**a)** What would be the `type` and `userName` of metavariable `mvarId`?
1240+
**b)** What would be the `type`s and `userName`s of all local declarations in this metavariable's local context?
12411241
Print them all out.
12421242
12431243
```lean
@@ -1256,17 +1256,17 @@ Notice that changing the type of the metavariable from `Nat` to, for example, `S
12561256
sorry
12571257
```
12581258
5. [**Metavariables**] Write a tactic `solve` that proves the theorem `red`.
1259-
6. [**Computation**] What is the normal form of the following expressions:
1260-
**a)** `fun x => x` of type `Bool → Bool`
1261-
**b)** `(fun x => x) ((true && false) || true)` of type `Bool`
1259+
6. [**Computation**] What is the normal form of the following expressions:
1260+
**a)** `fun x => x` of type `Bool → Bool`
1261+
**b)** `(fun x => x) ((true && false) || true)` of type `Bool`
12621262
**c)** `800 + 2` of type `Nat`
12631263
7. [**Computation**] Show that `1` created with `Expr.lit (Lean.Literal.natVal 1)` is definitionally equal to an expression created with `Expr.app (Expr.const ``Nat.succ []) (Expr.const ``Nat.zero [])`.
1264-
8. [**Computation**] Determine whether the following expressions are definitionally equal. If `Lean.Meta.isDefEq` succeeds, and it leads to metavariable assignment, write down the assignments.
1265-
**a)** `5 =?= (fun x => 5) ((fun y : Nat → Nat => y) (fun z : Nat => z))`
1266-
**b)** `2 + 1 =?= 1 + 2`
1267-
**c)** `?a =?= 2`, where `?a` has a type `String`
1268-
**d)** `?a + Int =?= "hi" + ?b`, where `?a` and `?b` don't have a type
1269-
**e)** `2 + ?a =?= 3`
1264+
8. [**Computation**] Determine whether the following expressions are definitionally equal. If `Lean.Meta.isDefEq` succeeds, and it leads to metavariable assignment, write down the assignments.
1265+
**a)** `5 =?= (fun x => 5) ((fun y : Nat → Nat => y) (fun z : Nat => z))`
1266+
**b)** `2 + 1 =?= 1 + 2`
1267+
**c)** `?a =?= 2`, where `?a` has a type `String`
1268+
**d)** `?a + Int =?= "hi" + ?b`, where `?a` and `?b` don't have a type
1269+
**e)** `2 + ?a =?= 3`
12701270
**f)** `2 + ?a =?= 2 + 1`
12711271
9. [**Computation**] Write down what you expect the following code to output.
12721272
@@ -1300,14 +1300,14 @@ Notice that changing the type of the metavariable from `Nat` to, for example, `S
13001300
let reducedExpr ← Meta.reduce constantExpr
13011301
dbg_trace (← ppExpr reducedExpr) -- ...
13021302
```
1303-
10. [**Constructing Expressions**] Create expression `fun x, 1 + x` in two ways:
1304-
**a)** not idiomatically, with loose bound variables
1305-
**b)** idiomatically.
1303+
10. [**Constructing Expressions**] Create expression `fun x, 1 + x` in two ways:
1304+
**a)** not idiomatically, with loose bound variables
1305+
**b)** idiomatically.
13061306
In what version can you use `Lean.mkAppN`? In what version can you use `Lean.Meta.mkAppM`?
13071307
11. [**Constructing Expressions**] Create expression `∀ (yellow: Nat), yellow`.
1308-
12. [**Constructing Expressions**] Create expression `∀ (n : Nat), n = n + 1` in two ways:
1309-
**a)** not idiomatically, with loose bound variables
1310-
**b)** idiomatically.
1308+
12. [**Constructing Expressions**] Create expression `∀ (n : Nat), n = n + 1` in two ways:
1309+
**a)** not idiomatically, with loose bound variables
1310+
**b)** idiomatically.
13111311
In what version can you use `Lean.mkApp3`? In what version can you use `Lean.Meta.mkEq`?
13121312
13. [**Constructing Expressions**] Create expression `fun (f : Nat → Nat), ∀ (n : Nat), f n = f (n + 1)` idiomatically.
13131313
14. [**Constructing Expressions**] What would you expect the output of the following code to be?

0 commit comments

Comments
 (0)