fix(tests/lean): adjust remaining tests to changes in the standard library

This commit is contained in:
Leonardo de Moura 2015-10-13 18:35:16 -07:00
parent 6779cb4fc6
commit 4e78e35f77
83 changed files with 252 additions and 3350 deletions

View file

@ -57,10 +57,10 @@ The command =import= loads existing libraries and extensions.
#+BEGIN_SRC lean #+BEGIN_SRC lean
import data.nat import data.nat
check nat.ge check nat.gcd
#+END_SRC #+END_SRC
We say =nat.ge= is a hierarchical name comprised of two parts: =nat= and =ge=. We say =nat.gcd= is a hierarchical name comprised of two parts: =nat= and =gcd=.
The command =open= creates aliases based on a given prefix. The The command =open= creates aliases based on a given prefix. The
command also imports notation, hints, and other features. We will command also imports notation, hints, and other features. We will
@ -71,7 +71,7 @@ the following command creates aliases for all objects starting with
#+BEGIN_SRC lean #+BEGIN_SRC lean
import data.nat import data.nat
open nat open nat
check ge -- display the type of nat.ge check gcd -- display the type of nat.gcd
#+END_SRC #+END_SRC
The command =constant= assigns a type to an identifier. The following command postulates/assumes The command =constant= assigns a type to an identifier. The following command postulates/assumes
@ -370,18 +370,19 @@ examples.
check λ (x : nat) (p : Prop), x = 0 p check λ (x : nat) (p : Prop), x = 0 p
#+END_SRC #+END_SRC
In many cases, Lean can automatically infer the type of the variable. Actually, In many cases, Lean can automatically infer the type of the variable.
in all examples above, the type can be inferred automatically.
#+BEGIN_SRC lean #+BEGIN_SRC lean
import data.nat import data.nat
open nat open nat
check fun x, x + 1 check fun x, x + (1:nat)
check fun x y, x + 2 * y check fun x : nat, x + 1
check fun x, (x:nat) + 1
check fun x y, x + (2:nat) * y
check fun x y, not (x ∧ y) check fun x y, not (x ∧ y)
check λ x, x + 1 check λ x, x + (1:nat)
check λ x p, x = 0 p check λ x p, x = (0:nat) p
#+END_SRC #+END_SRC
However, Lean will complain that it cannot infer the type of the However, Lean will complain that it cannot infer the type of the
@ -393,8 +394,8 @@ function applications
#+BEGIN_SRC lean #+BEGIN_SRC lean
import data.nat import data.nat
open nat open nat
check (fun x y, x + 2 * y) 1 check (fun x y, x + 2 * y) (1:nat)
check (fun x y, x + 2 * y) 1 2 check (fun x y, x + 2 * y) (1:nat) 2
check (fun x y, not (x ∧ y)) true false check (fun x y, not (x ∧ y)) true false
#+END_SRC #+END_SRC

View file

@ -4,5 +4,5 @@ variable A : Type
variables a b : A variables a b : A
variable H : a = b variable H : a = b
check H⁻¹ check H⁻¹
check -1 check -(1:int)
check 1 + -2 check (1:int) + -2

View file

@ -12,7 +12,7 @@ open nat
check foo nat 10 check foo nat 10
definition test : foo' = 10 := rfl definition test : foo' = (10:nat) := rfl
set_option pp.implicit true set_option pp.implicit true
print test print test

View file

@ -1,5 +1,5 @@
foo : Π (A : Type) [H : inhabited A], A → A foo : Π (A : Type) [H : inhabited A], A → A
foo' : Π {A : Type} [H : inhabited A] {x : A}, A foo' : Π {A : Type} [H : inhabited A] {x : A}, A
foo 10 : foo 10 :
definition test : ∀ {A : Type} [H : inhabited A], @foo' num num.is_inhabited 10 = 10 := definition test : ∀ {A : Type} [H : inhabited A], @foo' nat.is_inhabited (@has_add.add nat_has_add 5 5) = 10 :=
λ (A : Type) (H : inhabited A), @rfl num (@foo' num num.is_inhabited 10) λ (A : Type) (H : inhabited A), @rfl (@foo' nat.is_inhabited (@has_add.add nat_has_add 5 5))

View file

@ -2,7 +2,7 @@ section
parameter {A : Type} parameter {A : Type}
definition relation : A → A → Type := λa b, a = b definition relation : A → A → Type := λa b, a = b
local abbreviation R := relation local abbreviation R := relation
local abbreviation S [parsing-only] := relation local abbreviation S [parsing_only] := relation
variable {a : A} variable {a : A}
check relation a a check relation a a
check R a a check R a a
@ -13,7 +13,7 @@ section
parameter {A : Type} parameter {A : Type}
definition relation' : A → A → Type := λa b, a = b definition relation' : A → A → Type := λa b, a = b
local infix ` ~1 `:50 := relation' local infix ` ~1 `:50 := relation'
local infix [parsing-only] ` ~2 `:50 := relation' local infix [parsing_only] ` ~2 `:50 := relation'
variable {a : A} variable {a : A}
check relation' a a check relation' a a
check a ~1 a check a ~1 a
@ -23,7 +23,7 @@ end
section section
parameter {A : Type} parameter {A : Type}
definition relation'' : A → A → Type := λa b, a = b definition relation'' : A → A → Type := λa b, a = b
local infix [parsing-only] ` ~2 `:50 := relation'' local infix [parsing_only] ` ~2 `:50 := relation''
variable {a : A} variable {a : A}
check relation'' a a check relation'' a a
check a ~2 a check a ~2 a
@ -33,7 +33,7 @@ end
section section
parameter {A : Type} parameter {A : Type}
definition relation''' : A → A → Type := λa b, a = b definition relation''' : A → A → Type := λa b, a = b
local abbreviation S [parsing-only] := relation''' local abbreviation S [parsing_only] := relation'''
variable {a : A} variable {a : A}
check relation''' a a check relation''' a a
check S a a check S a a

View file

@ -1,2 +1,2 @@
abbreviation bar [parsing-only] := @eq abbreviation bar [parsing_only] := @eq
check @bar check @bar

View file

@ -1,2 +1,2 @@
definition nat.add : := protected definition nat.add : :=
λ (a b : ), nat.rec_on b a (λ (b₁ : ), nat.succ) λ (a : ), nat.rec a (λ (b₁ : ), nat.succ)

View file

@ -1,4 +1,4 @@
open classical open classical
eval if true then 1 else 0 eval if true then 1 else (0:num)
attribute prop_decidable [priority 0] attribute prop_decidable [priority 0]
eval if true then 1 else 0 eval if true then 1 else (0:num)

View file

@ -1,237 +0,0 @@
/-
Copyright (c) 2015 Robert Y. Lewis. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: Robert Y. Lewis
The real numbers, constructed as equivalence classes of Cauchy sequences of rationals.
This construction follows Bishop and Bridges (1985).
To do:
o Break positive naturals into their own file and fill in sorry's
o Fill in sorrys for helper lemmas that will not be handled by simplifier
o Rename things and possibly make theorems private
-/
import data.nat data.rat.order data.pnat
open nat eq eq.ops pnat
open -[coercions] rat
local notation 0 := rat.of_num 0
local notation 1 := rat.of_num 1
----------------------------------------------------------------------------------------------------
-------------------------------------
-- theorems to add to (ordered) field and/or rat
-- this can move to pnat once sorry is filled in
theorem find_midpoint {a b : } (H : a > b) : ∃ c : , a > b + c ∧ c > 0 :=
sorry
theorem add_sub_comm (a b c d : ) : a + b - (c + d) = (a - c) + (b - d) :=
sorry
theorem s_mul_assoc_lemma_4 {n : +} {ε q : } (Hε : ε > 0) (Hq : q > 0) (H : n ≥ pceil (q / ε)) :
q * n⁻¹ ≤ ε :=
sorry
theorem s_mul_assoc_lemma_3 (a b n : +) (p : ) :
p * ((a * n)⁻¹ + (b * n)⁻¹) = p * (a⁻¹ + b⁻¹) * n⁻¹ :=
sorry
theorem find_thirds (a b : ) : ∃ n : +, a + n⁻¹ + n⁻¹ + n⁻¹ < a + b := sorry
theorem squeeze {a b : } (H : ∀ j : +, a ≤ b + j⁻¹ + j⁻¹ + j⁻¹) : a ≤ b :=
sorry
theorem squeeze_2 {a b : } (H : ∀ ε : , ε > 0 → a ≥ b - ε) : a ≥ b :=
sorry
theorem rewrite_helper (a b c d : ) : a * b - c * d = a * (b - d) + (a - c) * d :=
sorry
theorem rewrite_helper3 (a b c d e f g: ) : a * (b + c) - (d * e + f * g) =
(a * b - d * e) + (a * c - f * g) :=
sorry
theorem rewrite_helper4 (a b c d : ) : a * b - c * d = (a * b - a * d) + (a * d - c * d) := sorry
theorem rewrite_helper5 (a b x y : ) : a - b = (a - x) + (x - y) + (y - b) := sorry
theorem rewrite_helper7 (a b c d x : ) :
a * b * c - d = (b * c) * (a - x) + (x * b * c - d) := sorry
theorem ineq_helper (a b : ) (k m n : +) (H : a ≤ (k * 2 * m)⁻¹ + (k * 2 * n)⁻¹)
(H2 : b ≤ (k * 2 * m)⁻¹ + (k * 2 * n)⁻¹) :
(rat_of_pnat k) * a + b * (rat_of_pnat k) ≤ m⁻¹ + n⁻¹ := sorry
theorem factor_lemma (a b c d e : ) : abs (a + b + c - (d + (b + e))) = abs ((a - d) + (c - e)) :=
sorry
theorem factor_lemma_2 (a b c d : ) : (a + b) + (c + d) = (a + c) + (d + b) := sorry
namespace s
notation `seq` := + →
definition regular (s : seq) := ∀ m n : +, abs (s m - s n) ≤ m⁻¹ + n⁻¹
definition equiv (s t : seq) := ∀ n : +, abs (s n - t n) ≤ n⁻¹ + n⁻¹
infix `≡` := equiv
theorem equiv.refl (s : seq) : s ≡ s :=
sorry
theorem equiv.symm (s t : seq) (H : s ≡ t) : t ≡ s :=
sorry
theorem bdd_of_eq {s t : seq} (H : s ≡ t) :
∀ j : +, ∀ n : +, n ≥ 2 * j → abs (s n - t n) ≤ j⁻¹ :=
sorry
theorem eq_of_bdd {s t : seq} (Hs : regular s) (Ht : regular t)
(H : ∀ j : +, ∃ Nj : +, ∀ n : +, Nj ≤ n → abs (s n - t n) ≤ j⁻¹) : s ≡ t :=
sorry
theorem eq_of_bdd_var {s t : seq} (Hs : regular s) (Ht : regular t)
(H : ∀ ε : , ε > 0 → ∃ Nj : +, ∀ n : +, Nj ≤ n → abs (s n - t n) ≤ ε) : s ≡ t :=
sorry
set_option pp.beta false
theorem pnat_bound {ε : } (Hε : ε > 0) : ∃ p : +, p⁻¹ ≤ ε :=
sorry
theorem bdd_of_eq_var {s t : seq} (Hs : regular s) (Ht : regular t) (Heq : s ≡ t) :
∀ ε : , ε > 0 → ∃ Nj : +, ∀ n : +, Nj ≤ n → abs (s n - t n) ≤ ε :=
sorry
theorem equiv.trans (s t u : seq) (Hs : regular s) (Ht : regular t) (Hu : regular u)
(H : s ≡ t) (H2 : t ≡ u) : s ≡ u :=
sorry
-----------------------------------
-- define operations on cauchy sequences. show operations preserve regularity
definition K (s : seq) : + := pnat.pos (ubound (abs (s pone)) + 1 + 1) dec_trivial
theorem canon_bound {s : seq} (Hs : regular s) (n : +) : abs (s n) ≤ rat_of_pnat (K s) :=
sorry
definition K₂ (s t : seq) := max (K s) (K t)
theorem K₂_symm (s t : seq) : K₂ s t = K₂ t s :=
sorry
theorem canon_2_bound_left (s t : seq) (Hs : regular s) (n : +) :
abs (s n) ≤ rat_of_pnat (K₂ s t) :=
sorry
theorem canon_2_bound_right (s t : seq) (Ht : regular t) (n : +) :
abs (t n) ≤ rat_of_pnat (K₂ s t) :=
sorry
definition sadd (s t : seq) : seq := λ n, (s (2 * n)) + (t (2 * n))
theorem reg_add_reg {s t : seq} (Hs : regular s) (Ht : regular t) : regular (sadd s t) :=
sorry
definition smul (s t : seq) : seq := λ n : +, (s ((K₂ s t) * 2 * n)) * (t ((K₂ s t) * 2 * n))
theorem reg_mul_reg {s t : seq} (Hs : regular s) (Ht : regular t) : regular (smul s t) :=
sorry
definition sneg (s : seq) : seq := λ n : +, - (s n)
theorem reg_neg_reg {s : seq} (Hs : regular s) : regular (sneg s) :=
sorry
-----------------------------------
-- show properties of +, *, -
definition zero : seq := λ n, 0
definition one : seq := λ n, 1
theorem s_add_comm (s t : seq) : sadd s t ≡ sadd t s :=
sorry
theorem s_add_assoc (s t u : seq) (Hs : regular s) (Hu : regular u) :
sadd (sadd s t) u ≡ sadd s (sadd t u) :=
sorry
theorem s_mul_comm (s t : seq) : smul s t ≡ smul t s :=
sorry
definition DK (s t : seq) := (K₂ s t) * 2
theorem DK_rewrite (s t : seq) : (K₂ s t) * 2 = DK s t := rfl
definition TK (s t u : seq) := (DK (λ (n : +), s (mul (DK s t) n) * t (mul (DK s t) n)) u)
theorem TK_rewrite (s t u : seq) :
(DK (λ (n : +), s (mul (DK s t) n) * t (mul (DK s t) n)) u) = TK s t u := rfl
theorem s_mul_assoc_lemma (s t u : seq) (a b c d : +) :
abs (s a * t a * u b - s c * t d * u d) ≤ abs (t a) * abs (u b) * abs (s a - s c) +
abs (s c) * abs (t a) * abs (u b - u d) + abs (s c) * abs (u d) * abs (t a - t d) :=
sorry
definition Kq (s : seq) := rat_of_pnat (K s) + 1
theorem Kq_bound {s : seq} (H : regular s) : ∀ n, abs (s n) ≤ Kq s :=
sorry
theorem Kq_bound_nonneg {s : seq} (H : regular s) : 0 ≤ Kq s :=
rat.le.trans !abs_nonneg (Kq_bound H 2)
theorem Kq_bound_pos {s : seq} (H : regular s) : 0 < Kq s :=
sorry
theorem s_mul_assoc_lemma_5 {s t u : seq} (Hs : regular s) (Ht : regular t) (Hu : regular u)
(a b c : +) : abs (t a) * abs (u b) * abs (s a - s c) ≤ (Kq t) * (Kq u) * (a⁻¹ + c⁻¹) :=
sorry
theorem s_mul_assoc_lemma_2 {s t u : seq} (Hs : regular s) (Ht : regular t) (Hu : regular u)
(a b c d : +) :
abs (t a) * abs (u b) * abs (s a - s c) + abs (s c) * abs (t a) * abs (u b - u d)
+ abs (s c) * abs (u d) * abs (t a - t d) ≤
(Kq t) * (Kq u) * (a⁻¹ + c⁻¹) + (Kq s) * (Kq t) * (b⁻¹ + d⁻¹) + (Kq s) * (Kq u) * (a⁻¹ + d⁻¹) :=
sorry
theorem s_mul_assoc {s t u : seq} (Hs : regular s) (Ht : regular t) (Hu : regular u) :
smul (smul s t) u ≡ smul s (smul t u) :=
sorry
theorem zero_is_reg : regular zero :=
sorry
theorem s_zero_add (s : seq) (H : regular s) : sadd zero s ≡ s :=
sorry
theorem s_add_zero (s : seq) (H : regular s) : sadd s zero ≡ s :=
sorry
theorem s_neg_cancel (s : seq) (H : regular s) : sadd (sneg s) s ≡ zero :=
sorry
theorem neg_s_cancel (s : seq) (H : regular s) : sadd s (sneg s) ≡ zero :=
sorry
theorem add_well_defined {s t u v : seq} (Hs : regular s) (Ht : regular t) (Hu : regular u)
(Hv : regular v) (Esu : s ≡ u) (Etv : t ≡ v) : sadd s t ≡ sadd u v :=
sorry
theorem mul_bound_helper {s t : seq} (Hs : regular s) (Ht : regular t) (a b c : +) (j : +) :
∃ N : +, ∀ n : +, n ≥ N → abs (s (a * n) * t (b * n) - s (c * n) * t (c * n)) ≤ j⁻¹ :=
begin
existsi pceil (((rat_of_pnat (K s)) * (b⁻¹ + c⁻¹) + (a⁻¹ + c⁻¹) *
(rat_of_pnat (K t))) * (rat_of_pnat j)),
intros n Hn,
rewrite rewrite_helper4,
apply rat.le.trans,
apply abs_add_le_abs_add_abs,
apply rat.le.trans,
rotate 1,
show n⁻¹ * ((rat_of_pnat (K s)) * (b⁻¹ + c⁻¹)) +
n⁻¹ * ((a⁻¹ + c⁻¹) * (rat_of_pnat (K t))) ≤ j⁻¹, begin
rewrite -rat.left_distrib,
apply rat.le.trans,
apply rat.mul_le_mul_of_nonneg_right,
apply pceil_helper Hn,
repeat (apply rat.mul_pos | apply rat.add_pos | apply inv_pos | apply rat_of_pnat_is_pos),
end
end
end s

View file

@ -1,43 +0,0 @@
737.lean:235:5: error: 2 unsolved subgoals
s t : + → ,
Hs : regular s,
Ht : regular t,
a b c j n : +,
Hn : pceil ((rat_of_pnat (K s) * (b⁻¹ + c⁻¹) + (a⁻¹ + c⁻¹) * rat_of_pnat (K t)) * rat_of_pnat j) ≤ n
⊢ 0 ≤ rat_of_pnat (K s) * (b⁻¹ + c⁻¹) + (a⁻¹ + c⁻¹) * rat_of_pnat (K t)
s t : + → ,
Hs : regular s,
Ht : regular t,
a b c j n : +,
Hn : pceil ((rat_of_pnat (K s) * (b⁻¹ + c⁻¹) + (a⁻¹ + c⁻¹) * rat_of_pnat (K t)) * rat_of_pnat j) ≤ n
⊢ 1 / ((rat_of_pnat (K s) * (b⁻¹ + c⁻¹) + (a⁻¹ + c⁻¹) * rat_of_pnat (K t)) * rat_of_pnat j) * (rat_of_pnat
(K s) * (b⁻¹ + c⁻¹) + (a⁻¹ + c⁻¹) * rat_of_pnat (K t)) ≤ j⁻¹
737.lean:228:4: error:invalid 'exact' tactic, term still contains metavariables after elaboration
show n⁻¹ * (rat_of_pnat (K s) * (b⁻¹ + c⁻¹)) + n⁻¹ * ((a⁻¹ + c⁻¹) * rat_of_pnat
(K t)) ≤ j⁻¹, from
?M_1
proof state:
s t : + → ,
Hs : regular s,
Ht : regular t,
a b c j n : +,
Hn : pceil ((rat_of_pnat (K s) * (b⁻¹ + c⁻¹) + (a⁻¹ + c⁻¹) * rat_of_pnat (K t)) * rat_of_pnat j) ≤ n
⊢ ?M_1 ≤ j⁻¹
s t : + → ,
Hs : regular s,
Ht : regular t,
a b c j n : +,
Hn : pceil ((rat_of_pnat (K s) * (b⁻¹ + c⁻¹) + (a⁻¹ + c⁻¹) * rat_of_pnat (K t)) * rat_of_pnat j) ≤ n
⊢ abs (s (a * n) * t (b * n) - s (a * n) * t (c * n)) + abs (s (a * n) * t (c * n) - s (c * n) * t (c * n)) ≤ ?M_1
737.lean:236:0: error: don't know how to synthesize placeholder
s t : + → ,
Hs : regular s,
Ht : regular t,
a b c j : +
⊢ ∃ (N : +), ∀ (n : +),
N ≤ n → abs (s (a * n) * t (b * n) - s (c * n) * t (c * n)) ≤ j⁻¹
737.lean:236:0: error: failed to add declaration 's.mul_bound_helper' to environment, value has metavariables
remark: set 'formatter.hide_full_terms' to false to see the complete term
?M_1

View file

@ -1,15 +1,14 @@
import data.rat import data.rat
check 4.0
check 2.3
check 1.00
check 10.213
open rat open rat
check -0.3 check (4.0:rat)
check 10.213 check (2.3:rat)
check 2.3 check (1.00:rat)
check 1.0 check (10.213:rat)
eval (λ v, 1.0) 2 check -(0.3:rat)
check (10.213:rat)
check (2.3:rat)
check (1.0:rat)
eval (λ v, (1.0:rat)) (2:nat)

View file

@ -1,9 +1,9 @@
rat.of_num 4 : 4 :
rat.divide (rat.of_num 23) (rat.of_num 10) : 23 / 10 :
rat.of_num 1 : 1 :
rat.divide (rat.of_num 10213) (rat.of_num 1000) : 10213 / 1000 :
-(3 / 10) : -(3 / 10) :
10213 / 1000 : 10213 / 1000 :
23 / 10 : 23 / 10 :
1 : 1 :
quot.mk (prerat.mk (int.of_nat (nat.succ nat.zero)) (int.of_nat (nat.succ nat.zero)) (int.of_nat_succ_pos nat.zero)) quot.mk (prerat.mk (int.of_nat 1) (int.of_nat 1) (int.of_nat_succ_pos 0))

View file

@ -14,4 +14,4 @@ check M[row,col]
notation M `[` i `,` `:` `]` := get_row M i notation M `[` i `,` `:` `]` := get_row M i
check M[row,:] check M[row,:]
check M[row,col] check M[row,col]
check [1, 2, 3] check [(1:nat), 2, 3]

View file

@ -1,4 +1,4 @@
M[row,col] : A M[row,col] : A
M[row,:] : row_vector A n M[row,:] : row_vector A n
M[row,col] : A M[row,col] : A
[1, 2, 3] : list num [1, 2, 3] : list

View file

@ -1,6 +0,0 @@
K_bug.lean:14:24: error: type mismatch at term
pred_succ n⁻¹
has type
pred (succ n⁻¹) = n⁻¹
but is expected to have type
n = pred (succ n)

View file

@ -1,5 +1,5 @@
import data.num import data.num
definition x.y := 10 definition x.y : nat := 10
definition x.1 := 10 definition x.1 :nat := 10

View file

@ -1,7 +1,7 @@
{x : ∈ S | x > 0} : set {x : ∈ S | x > 0} : set
{x : ∈ s | x > 0} : finset {x : ∈ s | x > 0} : finset
@set.sep.{1} nat (λ (x : nat), nat.gt x (nat.of_num 0)) S : set.{1} nat @set.sep.{1} nat (λ (x : nat), @gt.{1} nat 11.source.to.has_lt x 0) S : set.{1} nat
@finset.sep.{1} nat (λ (a b : nat), nat.has_decidable_eq a b) (λ (x : nat), nat.gt x (nat.of_num 0)) @finset.sep.{1} nat (λ (a b : nat), nat.has_decidable_eq a b) (λ (x : nat), @gt.{1} nat 11.source.to.has_lt x 0)
(λ (a : nat), nat.decidable_ge a (nat.succ (nat.of_num 0))) (λ (a : nat), nat.decidable_lt 0 a)
s : s :
finset.{1} nat finset.{1} nat

View file

@ -9,7 +9,7 @@ definition tst2 : nat → nat → nat :=
begin begin
intro a, intro a,
intro b, intro b,
cases add wth (a, b), -- ERROR cases nat.add wth (a, b), -- ERROR
exact a, exact a,
exact b, exact b,
end end

View file

@ -1,6 +1,6 @@
errors.lean:4:0: error: unknown identifier 'a' errors.lean:4:0: error: unknown identifier 'a'
tst1 : tst1 :
errors.lean:12:8: error: unknown identifier 'add' errors.lean:12:16: error: unknown identifier 'wth'
errors.lean:22:12: error: unknown identifier 'b' errors.lean:22:12: error: unknown identifier 'b'
tst3 : A → A → A tst3 : A → A → A
foo.tst1 : foo.tst1 :

View file

@ -6,7 +6,7 @@ Author: Leonardo de Moura
Finite bags. Finite bags.
-/ -/
import data.nat data.list.perm algebra.binary import data.nat data.list.perm algebra.binary
open nat quot list subtype binary function eq.ops open nat quot list subtype binary function eq.ops algebra
open [declarations] perm open [declarations] perm
variable {A : Type} variable {A : Type}

View file

@ -2,7 +2,7 @@ open nat
notation `foo` a := notation `foo` a :=
match a with match a with
(c, d) := c + d (c, d) := c +[nat] d
end end
eval foo (2, 3) eval foo (2, 3)

View file

@ -1,5 +1,3 @@
LEAN_INFORMATION LEAN_INFORMATION
definition int.mul : definition mul : Π {A : Type} [c : has_mul A], A → A → A
definition nat.mul :
END_LEAN_INFORMATION END_LEAN_INFORMATION

View file

@ -1,5 +1,3 @@
LEAN_INFORMATION LEAN_INFORMATION
definition int.mul : definition mul : Π {A : Type} [c : has_mul A], A → A → A
definition nat.mul :
END_LEAN_INFORMATION END_LEAN_INFORMATION

View file

@ -1,5 +1,3 @@
LEAN_INFORMATION LEAN_INFORMATION
_ `+`:65 _:65 := _ `+`:65 _:65 := add #1 #0
| nat.add #1 #0
| [priority 999] int.add #1 #0
END_LEAN_INFORMATION END_LEAN_INFORMATION

View file

@ -1,5 +1,3 @@
LEAN_INFORMATION LEAN_INFORMATION
definition int.add : definition add : Π {A : Type} [c : has_add A], A → A → A
definition nat.add :
END_LEAN_INFORMATION END_LEAN_INFORMATION

View file

@ -1,5 +1,3 @@
LEAN_INFORMATION LEAN_INFORMATION
_ `+`:65 _:65 := _ `+`:65 _:65 := add #1 #0
| nat.add #1 #0
| [priority 999] int.add #1 #0
END_LEAN_INFORMATION END_LEAN_INFORMATION

View file

@ -6,6 +6,6 @@ h₂ : b = 0,
aeq0 : a = 0, aeq0 : a = 0,
h₃ : succ c = 1, h₃ : succ c = 1,
h₄ : d = c - 1, h₄ : d = c - 1,
a_eq : c = 0 a_1 : c = 0
⊢ c = 0 ⊢ c = 0
END_LEAN_INFORMATION END_LEAN_INFORMATION

View file

@ -15,11 +15,11 @@ begin
rewrite add_zero at h₃, rewrite add_zero at h₃,
rewrite add_succ at h₃, rewrite add_succ at h₃,
rewrite add_zero at h₃, rewrite add_zero at h₃,
injection h₃, assumption injection h₃, exact a_1
end, end,
rewrite ceq at h₄, rewrite ceq at h₄,
repeat (esimp [sub, pred] at h₄), repeat (esimp [sub, pred] at h₄),
assumption exact h₄
end, end,
exact deq0 exact deq0
end end

View file

@ -5,7 +5,6 @@ open eq algebra
definition foo {A : Type} (a b c : A) (H₁ : a = c) (H₂ : c = b) : a = b := definition foo {A : Type} (a b c : A) (H₁ : a = c) (H₂ : c = b) : a = b :=
begin begin
apply concat, apply concat,
rotate 1, apply H₁,
apply H₂, apply H₂,
apply H₁
end end

View file

@ -2,11 +2,11 @@
-- ENDWAIT -- ENDWAIT
-- BEGINFINDP -- BEGINFINDP
le.rec_on|le ?a ?a → (Π (a : nat), ?C a a) → ?C ?a ?a le.rec_on|le ?a ?a → (Π (a : nat), ?C a a) → ?C ?a ?a
nat.rec_on|Π (n : nat), ?C zero → (Π (a : nat), ?C a → ?C (succ a)) → ?C n nat.rec_on|Π (n : nat), ?C 0 → (Π (a : nat), ?C a → ?C (succ a)) → ?C n
bool.rec_on|Π (n : bool), ?C bool.ff → ?C bool.tt → ?C n bool.rec_on|Π (n : bool), ?C bool.ff → ?C bool.tt → ?C n
-- ENDFINDP -- ENDFINDP
-- BEGINFINDP -- BEGINFINDP
nat.le.rec_on|nat.le ?a ?a → (Π (a : nat), ?C a a) → ?C ?a ?a nat.le.rec_on|nat.le ?a ?a → (Π (a : nat), ?C a a) → ?C ?a ?a
nat.rec_on|Π (n : nat), ?C nat.zero → (Π (a : nat), ?C a → ?C (nat.succ a)) → ?C n nat.rec_on|Π (n : nat), ?C 0 → (Π (a : nat), ?C a → ?C (nat.succ a)) → ?C n
bool.rec_on|Π (n : bool), ?C bool.ff → ?C bool.tt → ?C n bool.rec_on|Π (n : bool), ?C bool.ff → ?C bool.tt → ?C n
-- ENDFINDP -- ENDFINDP

View file

@ -27,7 +27,6 @@ true
-- ACK -- ACK
-- ENDINFO -- ENDINFO
-- BEGINFINDG -- BEGINFINDG
add.assoc|∀ (n m k : ), n + m + k = n + (m + k)
-- ENDFINDG -- ENDFINDG
-- BEGINWAIT -- BEGINWAIT
-- ENDWAIT -- ENDWAIT

View file

@ -49,7 +49,15 @@ nat.add.assoc
-- TYPE|7|43 -- TYPE|7|43
a + c + b = a + (c + b) → a + (c + b) = a + c + b a + c + b = a + (c + b) → a + (c + b) = a + c + b
-- ACK -- ACK
-- OVERLOAD|7|43
eq.symm #0
--
inv #0
-- ACK
-- SYMBOL|7|43 -- SYMBOL|7|43
⁻¹ ⁻¹
-- ACK -- ACK
-- IDENTIFIER|7|43
eq.symm
-- ACK
-- ENDINFO -- ENDINFO

View file

@ -9,15 +9,15 @@ false.rec_on|Π (C : Type), false → C
false.cases_on|Π (C : Type), false → C false.cases_on|Π (C : Type), false → C
false.induction_on|∀ (C : Prop), false → C false.induction_on|∀ (C : Prop), false → C
true_ne_false|¬true = false true_ne_false|¬true = false
nat.lt_self_iff_false|∀ (n : ), nat.lt n n ↔ false nat.lt_self_iff_false|∀ (n : ), n < n ↔ false
not_of_is_false|is_false ?c → ¬?c not_of_is_false|is_false ?c → ¬?c
not_of_iff_false|(?a ↔ false) → ¬?a not_of_iff_false|(?a ↔ false) → ¬?a
is_false|Π (c : Prop) [H : decidable c], Prop is_false|Π (c : Prop) [H : decidable c], Prop
classical.eq_true_or_eq_false|∀ (a : Prop), a = true a = false classical.eq_true_or_eq_false|∀ (a : Prop), a = true a = false
classical.eq_false_or_eq_true|∀ (a : Prop), a = false a = true classical.eq_false_or_eq_true|∀ (a : Prop), a = false a = true
nat.lt_zero_iff_false|∀ (a : ), nat.lt a nat.zero ↔ false nat.lt_zero_iff_false|∀ (a : ), a < 0 ↔ false
not_of_eq_false|?p = false → ¬?p not_of_eq_false|?p = false → ¬?p
nat.succ_le_self_iff_false|∀ (n : ), nat.le (nat.succ n) n ↔ false nat.succ_le_self_iff_false|∀ (n : ), nat.succ n ≤ n ↔ false
decidable.rec_on_false|Π (H3 : ¬?p), ?H2 H3 → decidable.rec_on ?H ?H1 ?H2 decidable.rec_on_false|Π (H3 : ¬?p), ?H2 H3 → decidable.rec_on ?H ?H1 ?H2
not_false|¬false not_false|¬false
decidable_false|decidable false decidable_false|decidable false
@ -25,6 +25,6 @@ of_not_is_false|¬is_false ?c → ?c
classical.cases_true_false|∀ (P : Prop → Prop), P true → P false → (∀ (a : Prop), P a) classical.cases_true_false|∀ (P : Prop → Prop), P true → P false → (∀ (a : Prop), P a)
iff_false_intro|¬?a → (?a ↔ false) iff_false_intro|¬?a → (?a ↔ false)
ne_false_of_self|?p → ?p ≠ false ne_false_of_self|?p → ?p ≠ false
nat.succ_le_zero_iff_false|∀ (n : ), nat.le (nat.succ n) nat.zero ↔ false nat.succ_le_zero_iff_false|∀ (n : ), nat.succ n ≤ 0 ↔ false
tactic.exfalso|tactic tactic.exfalso|tactic
-- ENDFINDP -- ENDFINDP

View file

@ -27,7 +27,10 @@ pos_num.lt|pos_num → pos_num → bool
pos_num.rec_on|Π (n : pos_num), ?C pos_num.one → (Π (a : pos_num), ?C a → ?C (pos_num.bit1 a)) → (Π (a : pos_num), ?C a → ?C (pos_num.bit0 a)) → ?C n pos_num.rec_on|Π (n : pos_num), ?C pos_num.one → (Π (a : pos_num), ?C a → ?C (pos_num.bit1 a)) → (Π (a : pos_num), ?C a → ?C (pos_num.bit0 a)) → ?C n
pos_num.brec_on|Π (n : pos_num), (Π (n : pos_num), pos_num.below n → ?C n) → ?C n pos_num.brec_on|Π (n : pos_num), (Π (n : pos_num), pos_num.below n → ?C n) → ?C n
pos_num.add|pos_num → pos_num → pos_num pos_num.add|pos_num → pos_num → pos_num
pos_num_has_mul|has_mul pos_num
pos_num|Type pos_num|Type
pos_num_has_one|has_one pos_num
pos_num_has_add|has_add pos_num
-- ENDFINDP -- ENDFINDP
-- BEGINWAIT -- BEGINWAIT
-- ENDWAIT -- ENDWAIT
@ -57,7 +60,10 @@ pos_num.lt|pos_num → pos_num → bool
pos_num.rec_on|Π (n : pos_num), ?C pos_num.one → (Π (a : pos_num), ?C a → ?C (pos_num.bit1 a)) → (Π (a : pos_num), ?C a → ?C (pos_num.bit0 a)) → ?C n pos_num.rec_on|Π (n : pos_num), ?C pos_num.one → (Π (a : pos_num), ?C a → ?C (pos_num.bit1 a)) → (Π (a : pos_num), ?C a → ?C (pos_num.bit0 a)) → ?C n
pos_num.brec_on|Π (n : pos_num), (Π (n : pos_num), pos_num.below n → ?C n) → ?C n pos_num.brec_on|Π (n : pos_num), (Π (n : pos_num), pos_num.below n → ?C n) → ?C n
pos_num.add|pos_num → pos_num → pos_num pos_num.add|pos_num → pos_num → pos_num
pos_num_has_mul|has_mul pos_num
pos_num|Type pos_num|Type
pos_num_has_one|has_one pos_num
pos_num_has_add|has_add pos_num
-- ENDFINDP -- ENDFINDP
-- BEGINFINDP -- BEGINFINDP
pos_num.size|pos_num → pos_num pos_num.size|pos_num → pos_num
@ -83,5 +89,8 @@ pos_num.lt|pos_num → pos_num → bool
pos_num.rec_on|Π (n : pos_num), ?C pos_num.one → (Π (a : pos_num), ?C a → ?C (pos_num.bit1 a)) → (Π (a : pos_num), ?C a → ?C (pos_num.bit0 a)) → ?C n pos_num.rec_on|Π (n : pos_num), ?C pos_num.one → (Π (a : pos_num), ?C a → ?C (pos_num.bit1 a)) → (Π (a : pos_num), ?C a → ?C (pos_num.bit0 a)) → ?C n
pos_num.brec_on|Π (n : pos_num), (Π (n : pos_num), pos_num.below n → ?C n) → ?C n pos_num.brec_on|Π (n : pos_num), (Π (n : pos_num), pos_num.below n → ?C n) → ?C n
pos_num.add|pos_num → pos_num → pos_num pos_num.add|pos_num → pos_num → pos_num
pos_num_has_mul|has_mul pos_num
pos_num|Type pos_num|Type
pos_num_has_one|has_one pos_num
pos_num_has_add|has_add pos_num
-- ENDFINDP -- ENDFINDP

View file

@ -4,7 +4,7 @@ open nat num
variable a : nat variable a : nat
variable b : num variable b : num
variable c : bool variable c : bool
check a + b check a + of_num b
check add a c check add a c
WAIT WAIT
INFO 5 INFO 5

View file

@ -10,37 +10,30 @@ a
-- TYPE|5|8 -- TYPE|5|8
-- ACK -- ACK
-- OVERLOAD|5|8
num.add #1 #0
--
nat.add #1 #0
-- ACK
-- SYMBOL|5|8 -- SYMBOL|5|8
+ +
-- ACK -- ACK
-- IDENTIFIER|5|8
nat.add
-- ACK
-- TYPE|5|10 -- TYPE|5|10
num num →
-- ACK
-- COERCION|5|10
of_num b
--
-- ACK -- ACK
-- IDENTIFIER|5|10 -- IDENTIFIER|5|10
nat.of_num
-- ACK
-- TYPE|5|17
num
-- ACK
-- IDENTIFIER|5|17
b b
-- ACK -- ACK
-- ENDINFO -- ENDINFO
-- BEGININFO STALE -- BEGININFO STALE
-- TYPE|6|6 -- TYPE|6|6
num → num → num
-- ACK -- ACK
-- OVERLOAD|6|6 -- OVERLOAD|6|6
num.add add
-- --
nat.add num.add
-- ACK -- ACK
-- TYPE|6|10 -- TYPE|6|10

View file

@ -4,12 +4,12 @@ inductive tree (A : Type) :=
leaf : A → tree A, leaf : A → tree A,
node : tree A → tree A → tree A node : tree A → tree A → tree A
set_option elaborator.lift_coercions false -- set_option elaborator.lift_coercions false
definition size {A : Type} (t : tree A) := definition size {A : Type} (t : tree A) :nat:=
tree.rec (λ a, 1) (λ t₁ t₂ n₁ n₂, n₁ + n₂) t tree.rec (λ a, 1) (λ t₁ t₂ n₁ n₂, n₁ + n₂) t
set_option elaborator.lift_coercions true --set_option elaborator.lift_coercions true
definition size {A : Type} (t : tree A) := definition size2 {A : Type} (t : tree A) :nat:=
tree.rec (λ a, 1) (λ t₁ t₂ n₁ n₂, n₁ + n₂) t tree.rec (λ a, 1) (λ t₁ t₂ n₁ n₂, n₁ + n₂) t

View file

@ -1,10 +0,0 @@
lift_coe_off.lean:10:0: error: type mismatch at application
tree.rec (λ (a : A), 1) (λ (t₁ t₂ : tree A) (n₁ : ?M_1) (n₂ : ?M_2), ?M_3 + ?M_4)
term
λ (t₁ t₂ : tree A) (n₁ : ?M_1) (n₂ : ?M_2),
?M_3 + ?M_4
has type
Π (t₁ t₂ : tree A) (n₁ : ?M_1),
?M_2 →
but is expected to have type
tree A → tree A → num → num → num

View file

@ -1,6 +1,5 @@
f a b : A f a b : A
f a b : A f a b : A
nat ↣ bool : foo nat ↣ bool : foo
bla : num 10 : ?M_1
local_notation_bug.lean:22:8: error: invalid expression local_notation_bug.lean:22:8: error: invalid expression
num ↣ nat : nat.of_num

View file

@ -1,3 +1,4 @@
definition id {A : Type} {a : A} := a definition id {A : Type} {a : A} := a
definition o : num := 1
check @id nat 1 check @id nat o

View file

@ -1,7 +1,7 @@
mismatch.lean:3:7: error: type mismatch at application mismatch.lean:4:7: error: type mismatch at application
@id 1 @id o
term term
1 o
has type has type
num num
but is expected to have type but is expected to have type

View file

@ -1 +1,8 @@
namespace_bug.lean:3:7: error: invalid expression namespace_bug.lean:3:6: error: type mismatch at application
@bit0 ?A
term
?A
has type
Type.{l_2}
but is expected to have type
Type.{l_3}

View file

@ -1,13 +1,13 @@
import data.list data.examples.vector import data.list data.examples.vector
open nat list vector open nat list vector
check [1, 2, 3] check [(1:nat), 2, 3]
check ([1, 2, 3] : vector nat _) check ([1, 2, 3] : vector nat _)
check ([1, 2, 3] : list nat) check ([1, 2, 3] : list nat)
check (#list [1, 2, 3]) check (#list [(1:nat), 2, 3])
check (#vector [1, 2, 3]) check (#vector [(1:nat), 2, 3])
example : (#vector [1, 2, 3]) = [1, 2, 3] := example : (#vector [1, 2, 3]) = [(1:nat), 2, 3] :=
rfl rfl
example : (#vector [1, 2, 3]) = ([1, 2, 3] : vector nat _) := example : (#vector [1, 2, 3]) = ([1, 2, 3] : vector nat _) :=

View file

@ -1,5 +1,5 @@
[1, 2, 3] : list num [1, 2, 3] : list
[1, 2, 3] : vector 3 [1, 2, 3] : vector 3
[1, 2, 3] : list [1, 2, 3] : list
[1, 2, 3] : list num [1, 2, 3] : list
[1, 2, 3] : vector num 3 [1, 2, 3] : vector 3

View file

@ -1,3 +1,3 @@
nat.succ (nat.succ (nat.succ (nat.succ (nat.succ (nat.succ (nat.succ (nat.succ (nat.succ nat.zero)))))))) 9
9 9
9 9

View file

@ -1 +1 @@
noncomputable definition a := 2 noncomputable definition a :nat := 2

View file

@ -1,5 +1,5 @@
noncomp_theory.lean:4:0: error: definition 'f' is noncomputable, it depends on 'real.divide' noncomp_theory.lean:4:0: error: definition 'f' is noncomputable, it depends on 'real.real_has_division'
noncomputable definition g : := noncomputable definition g : :=
λ (a : ), divide (a + a) λ (a : ), division (a + a)
definition r : := definition r : :=
λ (a : ), a λ (a : ), a

View file

@ -4,10 +4,10 @@ constant b : num
check b + b + b check b + b + b
check true ∧ false ∧ true check true ∧ false ∧ true
check (true ∧ false) ∧ true check (true ∧ false) ∧ true
check 2 + (2 + 2) check (2:num) + (2 + 2)
check (2 + 2) + 2 check (2 + 2) + (2:num)
check 1 = (2 + 3)*2 check (1:num) = (2 + 3)*2
check 2 + 3 * 2 = 3 * 2 + 2 check (2:num) + 3 * 2 = 3 * 2 + 2
check (true false) = (true false) ∧ true check (true false) = (true false) ∧ true
check true ∧ (false true) check true ∧ (false true)
constant A : Type₁ constant A : Type₁

View file

@ -1,5 +1,5 @@
import data.num import data.num
inductive list (T : Type) : Type := nil {} : list T | cons : T → list T → list T open list notation h :: t := cons h t notation `[` l:(foldr `,` (h t, cons h t) nil) `]` := l inductive list (T : Type) : Type := nil {} : list T | cons : T → list T → list T open list notation h :: t := cons h t notation `[` l:(foldr `,` (h t, cons h t) nil) `]` := l
infixr `::` := cons infixr `::` := cons
check 1 :: 2 :: nil check (1:num) :: 2 :: nil
check 1 :: 2 :: 3 :: 4 :: 5 :: nil check (1:num) :: 2 :: 3 :: 4 :: 5 :: nil

View file

@ -5,4 +5,4 @@ constants a b : num
check [a, b, b] check [a, b, b]
check (a, true, a = b, b) check (a, true, a = b, b)
check (a, b) check (a, b)
check [1, 2+2, 3] check [(1:num), 2+2, 3]

View file

@ -1,9 +1,9 @@
import logic data.num import logic data.num
open num open num
notation `o` := 10 notation `o` := (10:num)
check 11 check 11
constant f : num → num constant f : num → num
check o + 1 check o + 1
check f o + o + o check f o + o + o
eval 9 + 1 eval 9 + (1:num)
eval o+4 eval o+4

View file

@ -1,5 +1,5 @@
11 : num 11 : ?M_1
o + 1 : num 10 + 1 : num
f o + o + o : num f 10 + 10 + 10 : num
o 10
14 14

View file

@ -1,4 +1,4 @@
nat.add a b : nat @add.{1} nat 11.source.to.has_add a b : nat
int.add i j : int @add.{1} int 11.source.to.has_add_1 i j : int
nat.add a b : nat @add.{1} nat 11.source.to.has_add a b : nat
int.add i j : int @add.{1} int 11.source.to.has_add_1 i j : int

View file

@ -1,12 +1,12 @@
10 : num 10 : ?M_1
20 : num 20 : ?M_1
3 : num 3 : ?M_1
1 : num 1 : ?M_1
0 : num 0 : ?M_1
12 : num 12 : ?M_1
13 : num 13 : ?M_1
12138 : num 12138 : ?M_1
1221 : num 1221 : ?M_1
11 : num 11 : ?M_1
5 : num 5 : ?M_1
21 : num 21 : ?M_1

View file

@ -12,3 +12,4 @@ notation 1 := o
check a = 0 check a = 0
check 2 = 1 check 2 = 1
check (2:num) = 1

View file

@ -1,2 +1,3 @@
@eq N a z : Prop @eq N a z : Prop
@eq ?M_1 2 1 : Prop
@eq num 2 1 : Prop @eq num 2 1 : Prop

View file

@ -13,7 +13,7 @@ namespace foo
check a = 0 check a = 0
end foo end foo
check 2 = 1 check (2:nat) = 1
check #foo foo.a = 1 check #foo foo.a = 1
open foo open foo

View file

@ -1,4 +1,4 @@
@eq N a z : Prop @eq N a z : Prop
@eq num 2 1 : Prop @eq nat 2 1 : Prop
@eq foo.N foo.a foo.o : Prop @eq foo.N foo.a foo.o : Prop
@eq N a o : Prop @eq N a o : Prop

View file

@ -1,7 +1,7 @@
import data.num import data.num
open num open num
eval 3+2 eval 3+(2:num)
eval 3+2*5 eval 3+2*(5:num)
eval 5*5 eval 5*(5:num)
eval eq.rec (eq.refl 2) (eq.refl 2) eval eq.rec (eq.refl (2:num)) (eq.refl (2:num))

View file

@ -1,15 +1,13 @@
section section
open [notations] [coercions] nat check (1:nat) + 2
check 1 + 2 check add
check add -- Error aliases were not created
end end
section section
open [declarations] [notations] nat
variable a : nat variable a : nat
check a + a check a + a
check add a a check add a a
check a + 1 -- Error coercion from num to nat was not loaded check a + 1
end end
section section
@ -26,7 +24,6 @@ section
open - [classes] [decls] nat open - [classes] [decls] nat
variable a : nat variable a : nat
check a + a check a + a
check add a a -- Error aliases were not created
check a + 1 check a + 1
definition foo2 : inhabited nat := definition foo2 : inhabited nat :=
_ -- Error inhabited instances was not loaded _ -- Error inhabited instances was not loaded
@ -38,5 +35,5 @@ section
_ _
variable a : nat variable a : nat
check a + a -- Error notation declarations were not loaded check a + a
end end

View file

@ -1,31 +1,23 @@
1 + 2 : 1 + 2 :
open_tst.lean:4:8: error: unknown identifier 'add' add : ?A → ?A → ?A
a + a :
a + a :
open_tst.lean:12:10: error: type mismatch at application
a + 1
term
1
has type
num
but is expected to have type
a + a : a + a :
a + a : a + a :
a + 1 : a + 1 :
open_tst.lean:22:2: error: don't know how to synthesize placeholder a + a :
a + a :
a + 1 :
open_tst.lean:20:2: error: don't know how to synthesize placeholder
⊢ inhabited ⊢ inhabited
open_tst.lean:22:2: error: failed to add declaration 'foo1' to environment, value has metavariables open_tst.lean:20:2: error: failed to add declaration 'foo1' to environment, value has metavariables
remark: set 'formatter.hide_full_terms' to false to see the complete term remark: set 'formatter.hide_full_terms' to false to see the complete term
?M_1 ?M_1
a + a : a + a :
open_tst.lean:29:8: error: unknown identifier 'add'
a + 1 : a + 1 :
open_tst.lean:32:2: error: don't know how to synthesize placeholder open_tst.lean:29:2: error: don't know how to synthesize placeholder
⊢ inhabited ⊢ inhabited
open_tst.lean:32:2: error: failed to add declaration 'foo2' to environment, value has metavariables open_tst.lean:29:2: error: failed to add declaration 'foo2' to environment, value has metavariables
remark: set 'formatter.hide_full_terms' to false to see the complete term remark: set 'formatter.hide_full_terms' to false to see the complete term
?M_1 ?M_1
open_tst.lean:41:10: error: invalid expression a + a :

View file

@ -1,7 +1,7 @@
import data.num import data.num
open num open num
definition foo1 a b c := a + b + c definition foo1 a b c := a + b + (c:num)
definition foo2 (a : num) b c := a + b + c definition foo2 (a : num) b c := a + b + c

View file

@ -3,7 +3,7 @@ import logic
constant f : num → num constant f : num → num
constant g : num → num constant g : num → num
notation a `+++` := f a notation a `+++` := f a
notation [parsing-only] a `***` := g a notation [parsing_only] a `***` := g a
check 10 +++ check 10 +++
check 10 *** check 10 ***
check Type.{8} -- Type₊ should not be used check Type.{8} -- Type₊ should not be used

View file

@ -1,4 +1,4 @@
1 * 1 * a : A 1 * 1 * a : A
has_mul.mul (has_one.one A) a : A mul 1 a : A
0 + a : A 0 + a : A
has_add.add (has_zero.zero A) a : A add 0 a : A

View file

@ -1,9 +1,10 @@
import data.nat
open nat open nat
variables {a : nat} variables {a : nat}
abbreviation b := 2 abbreviation b : num := 2
check (λ x, x) a + b = 10 check (λ x, x) a + of_num b = 10
set_option pp.all true set_option pp.all true
check (λ x, x) a + b = 10 check (λ x, x) a + of_num b = 10

View file

@ -1,2 +1,2 @@
a + b = 10 : Prop a + of_num b = 10 : Prop
@eq.{1} nat (nat.add ((λ (x : nat), x) a) (nat.of_num 2)) (nat.of_num 10) : Prop @eq.{1} nat (@add.{1} nat 11.source.to.has_add ((λ (x : nat), x) a) (nat.of_num 2)) 10 : Prop

View file

@ -1,13 +1,13 @@
theorem foo1 : 0 = 0 := theorem foo1 : 0 = (0:num) :=
rfl rfl
theorem foo2 : 0 = 0 := theorem foo2 : 0 = (0:num) :=
rfl rfl
theorem foo3 : 0 = 0 := theorem foo3 : 0 = (0:num) :=
foo2 foo2
definition foo4 : 0 = 0 := definition foo4 : 0 = (0:num) :=
eq.trans foo2 foo1 eq.trans foo2 foo1
print axioms foo4 print axioms foo4

View file

@ -1,7 +1,7 @@
protected_test.lean:2:8: error: unknown identifier 'induction_on' protected_test.lean:2:8: error: unknown identifier 'induction_on'
protected_test.lean:3:8: error: unknown identifier 'rec_on' protected_test.lean:3:8: error: unknown identifier 'rec_on'
nat.induction_on : ∀ (n : ), ?C 0 → (∀ (a : ), ?C a → ?C (succ a)) → ?C n nat.induction_on : ∀ (n : ), ?C 0 → (∀ (a : ), ?C a → ?C (succ a)) → ?C n
le.rec_on : ?a ?a_1 → ?C ?a → (∀ {b : }, ?a b → ?C b → ?C (succ b)) → ?C ?a_1 le.rec_on : le ?a ?a_1 → ?C ?a → (∀ {b : }, le ?a b → ?C b → ?C (succ b)) → ?C ?a_1
le.rec_on : ?a ?a_1 → ?C ?a → (∀ {b : }, ?a b → ?C b → ?C (succ b)) → ?C ?a_1 le.rec_on : le ?a ?a_1 → ?C ?a → (∀ {b : }, le ?a b → ?C b → ?C (succ b)) → ?C ?a_1
protected_test.lean:8:10: error: unknown identifier 'rec_on' protected_test.lean:8:10: error: unknown identifier 'rec_on'
le.rec_on : ?a ?a_1 → ?C ?a → (∀ {b : }, ?a b → ?C b → ?C (succ b)) → ?C ?a_1 le.rec_on : le ?a ?a_1 → ?C ?a → (∀ {b : }, le ?a b → ?C b → ?C (succ b)) → ?C ?a_1

View file

@ -3,4 +3,4 @@ open nat int rat
attribute rat.of_int [coercion] attribute rat.of_int [coercion]
eval (8 * 6⁻¹) + 1 eval (8 * 6⁻¹) + (1:rat)

View file

@ -1 +1,13 @@
quot.mk (prerat.mk 14 6 (mul_denom_pos (prerat.mul (prerat.of_int 8) (prerat.inv (prerat.of_int 6))) (prerat.of_int 1))) quot.mk
(prerat.mk 14 6
(mul_denom_pos
(prerat.mul
(prerat.add
(prerat.add (prerat.add (prerat.of_int 1) (prerat.of_int 1))
(prerat.add (prerat.of_int 1) (prerat.of_int 1)))
(prerat.add (prerat.add (prerat.of_int 1) (prerat.of_int 1))
(prerat.add (prerat.of_int 1) (prerat.of_int 1))))
(prerat.inv
(prerat.add (prerat.add (prerat.add (prerat.of_int 1) (prerat.of_int 1)) (prerat.of_int 1))
(prerat.add (prerat.add (prerat.of_int 1) (prerat.of_int 1)) (prerat.of_int 1)))))
(prerat.of_int 1)))

View file

@ -49,7 +49,7 @@ definition rec_measure {dom codom : Type} (default : codom) (measure : dom →
(rec_val : dom → (dom → codom) → codom) (x : dom) : codom := (rec_val : dom → (dom → codom) → codom) (x : dom) : codom :=
rec_measure_aux default measure rec_val (succ (measure x)) x rec_measure_aux default measure rec_val (succ (measure x)) x
attribute decidable [multiple-instances] attribute decidable [multiple_instances]
theorem rec_measure_aux_spec {dom codom : Type} (default : codom) (measure : dom → ) theorem rec_measure_aux_spec {dom codom : Type} (default : codom) (measure : dom → )
(rec_val : dom → (dom → codom) → codom) (rec_val : dom → (dom → codom) → codom)

View file

@ -7,12 +7,6 @@ infix [priority 20] + := g
variables a b : nat variables a b : nat
example : a + b = g a b := rfl
infix [priority 5] + := g
example : a + b = f a b := rfl
infix [priority 15] + := g
example : a + b = g a b := rfl
infix [priority std.priority.default+1] + := f infix [priority std.priority.default+1] + := f
infix + := g infix + := g
example : a + b = f a b := rfl example : a + b = f a b := rfl
@ -21,7 +15,6 @@ example : a + b = g a b := rfl
infix + := f infix + := f
infix + := g infix + := g
example : a + b = f a b := rfl
infix [priority std.priority.default+1] + := g infix [priority std.priority.default+1] + := g
example : a + b = g a b := rfl example : a + b = g a b := rfl

View file

@ -1,8 +1,5 @@
import logic import logic
structure has_mul [class] (A : Type) :=
(mul : A → A → A)
structure semigroup [class] (A : Type) extends has_mul A := structure semigroup [class] (A : Type) extends has_mul A :=
(assoc : ∀ a b c, mul (mul a b) c = mul a (mul b c)) (assoc : ∀ a b c, mul (mul a b) c = mul a (mul b c))

View file

@ -17,8 +17,14 @@ namespace nat
definition plus (x y : ) : definition plus (x y : ) :
:= nat.rec x (λ n r, succ r) y := nat.rec x (λ n r, succ r) y
definition to_nat [coercion] (n : num) : definition nat_has_zero [reducible] [instance] [priority nat.prio] : has_zero nat :=
:= num.rec zero (λ n, pos_num.rec (succ zero) (λ n r, plus r (plus r (succ zero))) (λ n r, plus r r) n) n has_zero.mk nat.zero
definition nat_has_one [reducible] [instance] [priority nat.prio] : has_one nat :=
has_one.mk (nat.succ (nat.zero))
definition nat_has_add [reducible] [instance] [priority nat.prio] : has_add nat :=
has_add.mk plus
print "==================" print "=================="
theorem nat_rec_zero {P : → Type} (x : P 0) (f : ∀m, P m → P (succ m)) : nat.rec x f 0 = x := theorem nat_rec_zero {P : → Type} (x : P 0) (f : ∀m, P m → P (succ m)) : nat.rec x f 0 = x :=

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,17 @@
decidable : Prop → Type₁ decidable : Prop → Type₁
has_add : Type → Type
has_divide : Type → Type
has_division : Type → Type
has_dvd : Type → Type
has_inv : Type → Type
has_le : Type → Type
has_lt : Type → Type
has_modulo : Type → Type
has_mul : Type → Type
has_neg : Type → Type
has_one : Type → Type
has_sub : Type → Type
has_zero : Type → Type
inhabited : Type → Type inhabited : Type → Type
measurable : Type → Type measurable : Type → Type
nonempty : Type → Prop nonempty : Type → Prop
@ -7,6 +20,19 @@ setoid : Type → Type
subsingleton : Type → Prop subsingleton : Type → Prop
well_founded : Π {A : Type}, (A → A → Prop) → Prop well_founded : Π {A : Type}, (A → A → Prop) → Prop
decidable : Prop → Type₁ decidable : Prop → Type₁
has_add : Type → Type
has_divide : Type → Type
has_division : Type → Type
has_dvd : Type → Type
has_inv : Type → Type
has_le : Type → Type
has_lt : Type → Type
has_modulo : Type → Type
has_mul : Type → Type
has_neg : Type → Type
has_one : Type → Type
has_sub : Type → Type
has_zero : Type → Type
inhabited : Type → Type inhabited : Type → Type
measurable : Type → Type measurable : Type → Type
nonempty : Type → Prop nonempty : Type → Prop

View file

@ -7,7 +7,6 @@ variable {n : nat}
theorem tst1 : ∀ n m, succ n + succ m = succ (succ (n + m)) := theorem tst1 : ∀ n m, succ n + succ m = succ (succ (n + m)) :=
begin begin
intro n m, intro n m,
esimp [add],
state, state,
rewrite [succ_add] rewrite [succ_add]
end end

View file

@ -1,14 +1,14 @@
unfold_rec.lean:11:2: proof state unfold_rec.lean:10:2: proof state
n m : n m :
⊢ succ (succ n + m) = succ (succ (n + m)) ⊢ succ n + succ m = succ (succ (n + m))
unfold_rec.lean:24:2: proof state unfold_rec.lean:23:2: proof state
n m : n m :
⊢ succ (n + succ m) = succ (succ (n + m)) ⊢ succ (n + succ m) = succ (succ (n + m))
unfold_rec.lean:39:2: proof state unfold_rec.lean:38:2: proof state
fibgt0 : ∀ (b n c : ), fib b n c > 0, fibgt0 : ∀ (b n c : ), fib b n c > 0,
b m c : b m c :
⊢ fib b m c + fib b (succ m) c > 0 ⊢ fib b m c + fib b (succ m) c > 0
unfold_rec.lean:48:2: proof state unfold_rec.lean:47:2: proof state
A : Type, A : Type,
B : Type, B : Type,
unzip_zip : ∀ {n : } (v₁ : vector A n) (v₂ : vector B n), unzip (zip v₁ v₂) = (v₁, v₂), unzip_zip : ∀ {n : } (v₁ : vector A n) (v₂ : vector B n), unzip (zip v₁ v₂) = (v₁, v₂),

View file

@ -1,6 +1,6 @@
open nat open nat
definition id [unfold-full] {A : Type} (a : A) := a definition id [unfold_full] {A : Type} (a : A) := a
definition compose {A B C : Type} (g : B → C) (f : A → B) (a : A) := g (f a) definition compose {A B C : Type} (g : B → C) (f : A → B) (a : A) := g (f a)
notation g ∘ f := compose g f notation g ∘ f := compose g f
@ -18,7 +18,7 @@ begin
exact H exact H
end end
attribute compose [unfold-full] attribute compose [unfold_full]
example (a b : nat) (H : a = b) : (id ∘ id) a = b := example (a b : nat) (H : a = b) : (id ∘ id) a = b :=
begin begin

View file

@ -6,9 +6,9 @@ variables {A B : Type}
definition unzip : Π {n : nat}, vector (A × B) n → vector A n × vector B n definition unzip : Π {n : nat}, vector (A × B) n → vector A n × vector B n
| unzip nil := (nil, nil) | unzip nil := (nil, nil)
| unzip ((a, b) :: v) := | unzip ((a, b) :: v) :=
match unzip v with match unzip v with -- ERROR
(va, vb) := (a :: va, b :: vb) (va, vb) := (a :: va, b :: vb)
end end
example : unzip ((1, 20) :: (2, 30) :: nil) = (1 :: 2 :: nil, 20 :: 30 :: nil) := example : unzip ((1, 20) :: (2, 30) :: nil) = ((1 :: 2 :: nil, 20 :: 30 :: nil) : vector nat 2 × vector nat 2) :=
rfl rfl

View file

@ -21,7 +21,7 @@ recursor information
dep. elimination: 1 dep. elimination: 1
vector.induction_on.{l_1} : vector.induction_on.{l_1} :
∀ {A : Type.{l_1}} {C : Π (a : ), vector.{l_1} A a → Prop} {a : } (n : vector.{l_1} A a), ∀ {A : Type.{l_1}} {C : Π (a : ), vector.{l_1} A a → Prop} {a : } (n : vector.{l_1} A a),
C nat.zero (@vector.nil.{l_1} A) → C 0 (@vector.nil.{l_1} A) →
(∀ {n : } (a : A) (a_1 : vector.{l_1} A n), C n a_1 → C (nat.succ n) (@vector.cons.{l_1} A n a a_1)) → (∀ {n : } (a : A) (a_1 : vector.{l_1} A n), C n a_1 → C (nat.succ n) (@vector.cons.{l_1} A n a a_1)) →
C a n C a n
recursor information recursor information

View file

@ -1,7 +1,7 @@
open nat open nat
eval [whnf] (fun x, x + 1) 2 eval [whnf] (fun x, x + 1) (2:nat)
eval (fun x, x + 1) 2 eval (fun x, x + 1) (2:nat)
variable a : nat variable a : nat
eval [whnf] a + succ zero eval [whnf] a + succ zero