feat(nat): add unfold attributes to add, mul, sub and of_num in namespace nat_esimp in both libraries

This commit is contained in:
Floris van Doorn 2015-08-04 13:20:13 +02:00
parent 747d12a385
commit 11b1f416f6
6 changed files with 17 additions and 5 deletions

View file

@ -290,3 +290,9 @@ namespace nat
lemma sub_lt_succ (a b : ) : a - b < succ a := lt_succ_of_le (sub_le a b)
end nat
namespace nat_esimp
open nat
attribute add mul sub [unfold 2]
attribute of_num [unfold 1]
end nat_esimp

View file

@ -130,4 +130,4 @@ namespace nat
num.rec zero
(λ n, pos_num.rec (succ zero) (λ n r, r + r + (succ zero)) (λ n r, r + r) n) n
end nat
attribute nat.of_num [reducible] [constructor] -- of_num is also reducible if namespace "nat" is not opened
attribute nat.of_num [reducible] -- of_num is also reducible if namespace "nat" is not opened

View file

@ -247,3 +247,9 @@ namespace nat
theorem sub_lt_succ_iff_true [simp] (a b : ) : a - b < succ a ↔ true :=
iff_true_intro !sub_lt_succ
end nat
namespace nat_esimp
open nat
attribute add mul sub [unfold 2]
attribute of_num [unfold 1]
end nat_esimp

View file

@ -127,4 +127,4 @@ namespace nat
num.rec zero
(λ n, pos_num.rec (succ zero) (λ n r, r + r + (succ zero)) (λ n r, r + r) n) n
end nat
attribute nat.of_num [reducible] [constructor] -- of_num is also reducible if namespace "nat" is not opened
attribute nat.of_num [reducible] -- of_num is also reducible if namespace "nat" is not opened

View file

@ -1,4 +1,4 @@
open nat
open nat nat_esimp
definition foo [unfold 1 3] (a : nat) (b : nat) (c :nat) : nat :=
(a + c) * b

View file

@ -1,7 +1,7 @@
693.lean:10:2: proof state
c : ,
h : c = 1
(1 + 0) * c = (1 + 0) * 1
1 * c = 1
693.lean:18:2: proof state
b c : ,
h : c = 1
@ -13,4 +13,4 @@ h : c = 1
693.lean:34:2: proof state
b c : ,
h : c = 1
(1 + 1) * c = foo c 1 1
2 * c = foo c 1 1