refactor(library): move nat lemmas to library/init/data/nat/lemmas.lean

This commit is contained in:
Leonardo de Moura 2017-01-17 17:39:37 -08:00
parent 767ac42dfe
commit 97b98c58d0
6 changed files with 10 additions and 48 deletions

View file

@ -6,7 +6,6 @@ Authors: Parikshit Khanna, Jeremy Avigad, Leonardo de Moura, Floris van Doorn
Basic properties of lists.
-/
import init.data.list.basic
import data.nat.order
universe variables u v w

View file

@ -6,7 +6,6 @@ Authors: Leonardo de Moura, Haitao Zhang, Floris van Doorn
List combinators.
-/
import init.data.list.basic
import data.nat.order
universe variables u v w

View file

@ -1,9 +0,0 @@
/-
Copyright (c) 2014 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: Jeremy Avigad
This is a minimal port of functions from the lean2 library.
-/
import data.nat.order .sub

View file

@ -1,19 +0,0 @@
/-
Copyright (c) 2014 Floris van Doorn. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Floris van Doorn, Leonardo de Moura, Jeremy Avigad
The order relation on the natural numbers.
This is a minimal port of functions from the lean2 library.
-/
namespace nat
/- min -/
theorem zero_min (a : ) : min 0 a = 0 := min_eq_left (zero_le a)
theorem min_zero (a : ) : min a 0 = 0 := min_eq_right (zero_le a)
end nat

View file

@ -1,18 +0,0 @@
/-
Copyright (c) 2014 Floris van Doorn. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Floris van Doorn, Jeremy Avigad
Subtraction on the natural numbers, as well as min, max, and distance.
-/
namespace nat
/- subtraction -/
-- defined in data/nat/sub.lean
protected theorem sub_le_sub_right {n m : } (H : n ≤ m) : Πk, n - k ≤ m - k
| 0 := H
| (succ z) := pred_le_pred (sub_le_sub_right z)
end nat

View file

@ -415,6 +415,10 @@ lt_succ_of_le (sub_le a b)
lemma sub_lt_succ_iff_true (a b : ) : a - b < succ a ↔ true :=
iff_true_intro (sub_lt_succ a b)
protected theorem sub_le_sub_right {n m : } (h : n ≤ m) : ∀ k, n - k ≤ m - k
| 0 := h
| (succ z) := pred_le_pred (sub_le_sub_right z)
/- bit0/bit1 properties -/
protected lemma bit0_succ_eq (n : ) : bit0 (succ n) = succ (succ (bit0 n)) :=
@ -683,6 +687,12 @@ min_eq_left (zero_le a)
lemma min_zero_right (a : ) : min a 0 = 0 :=
min_eq_right (zero_le a)
theorem zero_min (a : ) : min 0 a = 0 :=
min_zero_left a
theorem min_zero (a : ) : min a 0 = 0 :=
min_zero_right a
-- Distribute succ over min
lemma min_succ_succ (x y : ) : min (succ x) (succ y) = succ (min x y) :=
have f : x ≤ y → min (succ x) (succ y) = succ (min x y), from λp,