File tree Expand file tree Collapse file tree 3 files changed +96
-0
lines changed
Expand file tree Collapse file tree 3 files changed +96
-0
lines changed Original file line number Diff line number Diff line change 1+ inductive L (α : Type u) : Type u where
2+ | nil : L α
3+ | cons : α → L α → L α
4+
5+ def L.eq [BEq α] (xs ys : L α) : Bool :=
6+ match _ : xs.ctorIdx == ys.ctorIdx with
7+ | false => false
8+ | true =>
9+ match xs, ys with
10+ | .nil, .nil => true
11+ | .cons x xs, .cons y ys => x == y && xs.eq ys
12+
13+ /--
14+ info: theorem L.eq.eq_def.{u_1} : ∀ {α : Type u_1} [inst : BEq α] (xs ys : L α),
15+ xs.eq ys =
16+ match h : xs.ctorIdx == ys.ctorIdx with
17+ | false => false
18+ | true =>
19+ match xs, ys, h with
20+ | L.nil, L.nil, h => true
21+ | L.cons x xs, L.cons y ys, h => x == y && xs.eq ys
22+ -/
23+ #guard_msgs in
24+ #print sig L.eq.eq_def
Original file line number Diff line number Diff line change 1+ inductive N where
2+ | zero : N
3+ | succ : N → N
4+
5+ def replace (f : N → Option N) (t : N) : N :=
6+ match f t with
7+ | some u => u
8+ | none =>
9+ match t with
10+ | .zero => .zero
11+ | .succ t' => replace f t'
12+
13+ /--
14+ info: equations:
15+ @[ defeq ] theorem replace.eq_1 : ∀ (f : N → Option N),
16+ replace f N.zero =
17+ match f N.zero with
18+ | some u => u
19+ | none => N.zero
20+ @[ defeq ] theorem replace.eq_2 : ∀ (f : N → Option N) (t' : N),
21+ replace f t'.succ =
22+ match f t'.succ with
23+ | some u => u
24+ | none => replace f t'
25+ -/
26+ #guard_msgs in
27+ #print equations replace
28+
29+ def replace2 (f : N → Option N) (t1 t2 : N) : N :=
30+ match f t1 with
31+ | some u => u
32+ | none =>
33+ match t2 with
34+ | .zero => .zero
35+ | .succ t' => replace2 f t1 t'
36+
37+ /--
38+ info: equations:
39+ @[ defeq ] theorem replace2.eq_1 : ∀ (f : N → Option N) (t1 : N),
40+ replace2 f t1 N.zero =
41+ match f t1 with
42+ | some u => u
43+ | none => N.zero
44+ @[ defeq ] theorem replace2.eq_2 : ∀ (f : N → Option N) (t1 t' : N),
45+ replace2 f t1 t'.succ =
46+ match f t1 with
47+ | some u => u
48+ | none => replace2 f t1 t'
49+ -/
50+ #guard_msgs in
51+ #print equations replace2
Original file line number Diff line number Diff line change 1+ def testMatch : Array α → Unit
2+ | #[_] => ()
3+ | _ => ()
4+
5+ /--
6+ error: Failed to realize constant testMatch.match_1.eq_1:
7+ failed to generate equality theorems for `match` expression `testMatch.match_1`
8+ case isTrue
9+ α✝ : Type u_1
10+ motive✝ : Array α✝ → Sort u_2
11+ x✝¹ : Array α✝
12+ h_1✝ : (head : α✝) → motive✝ #[ head ]
13+ h_2✝ : (x : Array α✝) → motive✝ x
14+ x✝ : ∀ (head : α✝), x✝¹ = #[ head ] → False
15+ h✝ : x✝¹.size = 1
16+ ⊢ (⋯ ▸ fun h => ⋯ ▸ h_1✝ (x✝¹.getLit 0 ⋯ ⋯)) ⋯ = h_2✝ x✝¹
17+ ---
18+ error: Unknown constant `testMatch.match_1.eq_1`
19+ -/
20+ #guard_msgs in
21+ #print testMatch.match_1.eq_1
You can’t perform that action at this time.
0 commit comments