Skip to content

Commit 5d9e10f

Browse files
committed
Create ctorIdx for Bool
1 parent e47fd6a commit 5d9e10f

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/Init/Prelude.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2216,6 +2216,7 @@ theorem Nat.mod_lt : (x : Nat) → {y : Nat} → (hy : LT.lt 0 y) → LT.lt (HM
22162216
| .isFalse h => Nat.lt_of_not_le h
22172217

22182218
attribute [gen_constructor_elims] Nat
2219+
attribute [gen_constructor_elims] Bool
22192220

22202221
/--
22212222
Gets the word size of the current platform. The word size may be 64 or 32 bits.

tests/lean/run/issue10749.lean

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ info: def test3.match_1.{u_1} : (motive : List Nat → Bool → Sort u_1) →
5252
(b : Bool) →
5353
((x : List Nat) → motive x true) →
5454
((x : Bool) → motive [] x) → ((x : List Nat) → (x_1 : Bool) → motive x x_1) → motive a b :=
55-
fun motive a b h_1 h_2 h_3 => Bool.casesOn b (test3._sparseCasesOn_1 a (h_2 false) fun h_0 => h_3 a false) (h_1 a)
55+
fun motive a b h_1 h_2 h_3 =>
56+
test3._sparseCasesOn_1 b (h_1 a) fun h_0 => test3._sparseCasesOn_2 a (h_2 b) fun h_0 => h_3 a b
5657
-/
5758
#guard_msgs in #print test3.match_1
5859

@@ -79,14 +80,11 @@ info: def test4.match_1.{u_1} : (motive : Bool → Bool → Bool → Bool → Bo
7980
((x x_5 x_6 x_7 : Bool) → motive true x x_5 x_6 x_7) →
8081
((x x_5 x_6 x_7 x_8 : Bool) → motive x x_5 x_6 x_7 x_8) → motive x x_1 x_2 x_3 x_4 :=
8182
fun motive x x_1 x_2 x_3 x_4 h_1 h_2 h_3 h_4 h_5 h_6 =>
82-
Bool.casesOn x_4
83-
(Bool.casesOn x_3
84-
(Bool.casesOn x_2
85-
(Bool.casesOn x_1 (Bool.casesOn x (h_6 false false false false false) (h_5 false false false false))
86-
(h_4 x false false false))
87-
(h_3 x x_1 false false))
88-
(h_2 x x_1 x_2 false))
89-
(h_1 x x_1 x_2 x_3)
83+
test3._sparseCasesOn_1 x_4 (h_1 x x_1 x_2 x_3) fun h_0 =>
84+
test3._sparseCasesOn_1 x_3 (h_2 x x_1 x_2 x_4) fun h_0 =>
85+
test3._sparseCasesOn_1 x_2 (h_3 x x_1 x_3 x_4) fun h_0 =>
86+
test3._sparseCasesOn_1 x_1 (h_4 x x_2 x_3 x_4) fun h_0 =>
87+
test3._sparseCasesOn_1 x (h_5 x_1 x_2 x_3 x_4) fun h_0 => h_6 x x_1 x_2 x_3 x_4
9088
-/
9189
#guard_msgs in
9290
#print test4.match_1
@@ -134,7 +132,7 @@ def testOld (a : List Nat) : Nat :=
134132
/--
135133
info: def testOld.match_1.{u_1} : (motive : List Nat → Sort u_1) →
136134
(a : List Nat) → ((x : List Nat) → motive x) → (Unit → motive []) → motive a :=
137-
fun motive a h_1 h_2 => test3._sparseCasesOn_1 a (h_1 []) fun h_0 => h_1 a
135+
fun motive a h_1 h_2 => test3._sparseCasesOn_2 a (h_1 []) fun h_0 => h_1 a
138136
-/
139137
#guard_msgs in
140138
#print testOld.match_1

0 commit comments

Comments
 (0)