feat/fix(library/data/nat,int): add power to int, add trans attributes, power notation

This commit is contained in:
Jeremy Avigad 2015-05-23 15:38:42 +10:00
parent a662f925cb
commit f65a49b2c3
7 changed files with 41 additions and 4 deletions

View file

@ -5,4 +5,4 @@ Released under Apache 2.0 license as described in the file LICENSE.
Module: data.int.default Module: data.int.default
Author: Jeremy Avigad Author: Jeremy Avigad
-/ -/
import .basic .order .div import .basic .order .div .power

View file

@ -6,3 +6,4 @@ The integers.
* [basic](basic.lean) : the integers, with basic operations * [basic](basic.lean) : the integers, with basic operations
* [order](order.lean) : the order relations and the sign function * [order](order.lean) : the order relations and the sign function
* [div](div.lean) : div, mod, gcd, lcm * [div](div.lean) : div, mod, gcd, lcm
* [power](power.lean)

View file

@ -259,6 +259,9 @@ section migrate_algebra
migrate from algebra with int migrate from algebra with int
replacing has_le.ge → ge, has_lt.gt → gt, sign → sign, abs → abs, dvd → dvd, sub → sub replacing has_le.ge → ge, has_lt.gt → gt, sign → sign, abs → abs, dvd → dvd, sub → sub
attribute le.trans ge.trans lt.trans gt.trans [trans]
attribute lt_of_lt_of_le lt_of_le_of_lt gt_of_gt_of_ge gt_of_ge_of_gt [trans]
end migrate_algebra end migrate_algebra
/- more facts specific to int -/ /- more facts specific to int -/

View file

@ -0,0 +1,30 @@
/-
Copyright (c) 2015 Jeremy Avigad. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: Jeremy Avigad
The power function on the integers.
-/
import data.int.basic data.int.order data.int.div algebra.group_power
namespace int
section migrate_algebra
open [classes] algebra
local attribute int.integral_domain [instance]
local attribute int.linear_ordered_comm_ring [instance]
local attribute int.decidable_linear_ordered_comm_ring [instance]
definition pow (a : ) (n : ) : := algebra.pow a n
infix ^ := pow
migrate from algebra with int
replacing dvd → dvd, has_le.ge → ge, has_lt.gt → gt, pow → pow
hiding add_pos_of_pos_of_nonneg, add_pos_of_nonneg_of_pos,
add_eq_zero_iff_eq_zero_and_eq_zero_of_nonneg_of_nonneg, le_add_of_nonneg_of_le,
le_add_of_le_of_nonneg, lt_add_of_nonneg_of_lt, lt_add_of_lt_of_nonneg,
lt_of_mul_lt_mul_left, lt_of_mul_lt_mul_right, pos_of_mul_pos_left, pos_of_mul_pos_right
end migrate_algebra
end int

View file

@ -175,6 +175,9 @@ section migrate_algebra
le_add_of_le_of_nonneg, lt_add_of_nonneg_of_lt, lt_add_of_lt_of_nonneg, le_add_of_le_of_nonneg, lt_add_of_nonneg_of_lt, lt_add_of_lt_of_nonneg,
lt_of_mul_lt_mul_left, lt_of_mul_lt_mul_right, pos_of_mul_pos_left, pos_of_mul_pos_right lt_of_mul_lt_mul_left, lt_of_mul_lt_mul_right, pos_of_mul_pos_left, pos_of_mul_pos_right
attribute le.trans ge.trans lt.trans gt.trans [trans]
attribute lt_of_lt_of_le lt_of_le_of_lt gt_of_gt_of_ge gt_of_ge_of_gt [trans]
theorem add_pos_left : ∀{a : }, 0 < a → ∀b : , 0 < a + b := theorem add_pos_left : ∀{a : }, 0 < a → ∀b : , 0 < a + b :=
take a H b, @algebra.add_pos_of_pos_of_nonneg _ _ a b H !zero_le take a H b, @algebra.add_pos_of_pos_of_nonneg _ _ a b H !zero_le
theorem add_pos_right : ∀{a : }, 0 < a → ∀b : , 0 < b + a := theorem add_pos_right : ∀{a : }, 0 < a → ∀b : , 0 < b + a :=

View file

@ -15,6 +15,8 @@ section migrate_algebra
local attribute nat.linear_ordered_semiring [instance] local attribute nat.linear_ordered_semiring [instance]
definition pow (a : ) (n : ) : := algebra.pow a n definition pow (a : ) (n : ) : := algebra.pow a n
infix ^ := pow
migrate from algebra with nat migrate from algebra with nat
replacing dvd → dvd, has_le.ge → ge, has_lt.gt → gt, pow → pow replacing dvd → dvd, has_le.ge → ge, has_lt.gt → gt, pow → pow
hiding add_pos_of_pos_of_nonneg, add_pos_of_nonneg_of_pos, hiding add_pos_of_pos_of_nonneg, add_pos_of_nonneg_of_pos,

View file

@ -1,8 +1,6 @@
/- /-
Copyright (c) 2014 Microsoft Corporation. All rights reserved. Copyright (c) 2014 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE. Released under Apache 2.0 license as described in the file LICENSE.
Module: data.rat.default
Author: Jeremy Avigad Author: Jeremy Avigad
-/ -/
import .basic import .basic .order