fix(tests/lean): adjust remaining tests to changes in the standard library
This commit is contained in:
parent
6779cb4fc6
commit
4e78e35f77
83 changed files with 252 additions and 3350 deletions
|
@ -57,10 +57,10 @@ The command =import= loads existing libraries and extensions.
|
|||
|
||||
#+BEGIN_SRC lean
|
||||
import data.nat
|
||||
check nat.ge
|
||||
check nat.gcd
|
||||
#+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
|
||||
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
|
||||
import data.nat
|
||||
open nat
|
||||
check ge -- display the type of nat.ge
|
||||
check gcd -- display the type of nat.gcd
|
||||
#+END_SRC
|
||||
|
||||
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
|
||||
#+END_SRC
|
||||
|
||||
In many cases, Lean can automatically infer the type of the variable. Actually,
|
||||
in all examples above, the type can be inferred automatically.
|
||||
In many cases, Lean can automatically infer the type of the variable.
|
||||
|
||||
#+BEGIN_SRC lean
|
||||
import data.nat
|
||||
open nat
|
||||
|
||||
check fun x, x + 1
|
||||
check fun x y, x + 2 * y
|
||||
check fun x, x + (1:nat)
|
||||
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 λ x, x + 1
|
||||
check λ x p, x = 0 ∨ p
|
||||
check λ x, x + (1:nat)
|
||||
check λ x p, x = (0:nat) ∨ p
|
||||
#+END_SRC
|
||||
|
||||
However, Lean will complain that it cannot infer the type of the
|
||||
|
@ -393,8 +394,8 @@ function applications
|
|||
#+BEGIN_SRC lean
|
||||
import data.nat
|
||||
open nat
|
||||
check (fun x y, x + 2 * y) 1
|
||||
check (fun x y, x + 2 * y) 1 2
|
||||
check (fun x y, x + 2 * y) (1:nat)
|
||||
check (fun x y, x + 2 * y) (1:nat) 2
|
||||
check (fun x y, not (x ∧ y)) true false
|
||||
#+END_SRC
|
||||
|
||||
|
|
|
@ -4,5 +4,5 @@ variable A : Type
|
|||
variables a b : A
|
||||
variable H : a = b
|
||||
check H⁻¹
|
||||
check -1
|
||||
check 1 + -2
|
||||
check -(1:int)
|
||||
check (1:int) + -2
|
||||
|
|
|
@ -12,7 +12,7 @@ open nat
|
|||
|
||||
check foo nat 10
|
||||
|
||||
definition test : foo' = 10 := rfl
|
||||
definition test : foo' = (10:nat) := rfl
|
||||
|
||||
set_option pp.implicit true
|
||||
print test
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
foo : Π (A : Type) [H : inhabited A], A → A
|
||||
foo' : Π {A : Type} [H : inhabited A] {x : A}, A
|
||||
foo ℕ 10 : ℕ
|
||||
definition test : ∀ {A : Type} [H : inhabited A], @foo' num num.is_inhabited 10 = 10 :=
|
||||
λ (A : Type) (H : inhabited A), @rfl num (@foo' num num.is_inhabited 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 ℕ (@foo' ℕ nat.is_inhabited (@has_add.add ℕ nat_has_add 5 5))
|
||||
|
|
|
@ -2,7 +2,7 @@ section
|
|||
parameter {A : Type}
|
||||
definition relation : A → A → Type := λa b, a = b
|
||||
local abbreviation R := relation
|
||||
local abbreviation S [parsing-only] := relation
|
||||
local abbreviation S [parsing_only] := relation
|
||||
variable {a : A}
|
||||
check relation a a
|
||||
check R a a
|
||||
|
@ -13,7 +13,7 @@ section
|
|||
parameter {A : Type}
|
||||
definition relation' : A → A → Type := λa b, a = b
|
||||
local infix ` ~1 `:50 := relation'
|
||||
local infix [parsing-only] ` ~2 `:50 := relation'
|
||||
local infix [parsing_only] ` ~2 `:50 := relation'
|
||||
variable {a : A}
|
||||
check relation' a a
|
||||
check a ~1 a
|
||||
|
@ -23,7 +23,7 @@ end
|
|||
section
|
||||
parameter {A : Type}
|
||||
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}
|
||||
check relation'' a a
|
||||
check a ~2 a
|
||||
|
@ -33,7 +33,7 @@ end
|
|||
section
|
||||
parameter {A : Type}
|
||||
definition relation''' : A → A → Type := λa b, a = b
|
||||
local abbreviation S [parsing-only] := relation'''
|
||||
local abbreviation S [parsing_only] := relation'''
|
||||
variable {a : A}
|
||||
check relation''' a a
|
||||
check S a a
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
abbreviation bar [parsing-only] := @eq
|
||||
abbreviation bar [parsing_only] := @eq
|
||||
check @bar
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
definition nat.add : ℕ → ℕ → ℕ :=
|
||||
λ (a b : ℕ), nat.rec_on b a (λ (b₁ : ℕ), nat.succ)
|
||||
protected definition nat.add : ℕ → ℕ → ℕ :=
|
||||
λ (a : ℕ), nat.rec a (λ (b₁ : ℕ), nat.succ)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
open classical
|
||||
eval if true then 1 else 0
|
||||
eval if true then 1 else (0:num)
|
||||
attribute prop_decidable [priority 0]
|
||||
eval if true then 1 else 0
|
||||
eval if true then 1 else (0:num)
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -1,15 +1,14 @@
|
|||
import data.rat
|
||||
|
||||
check 4.0
|
||||
check 2.3
|
||||
check 1.00
|
||||
check 10.213
|
||||
|
||||
open rat
|
||||
|
||||
check -0.3
|
||||
check 10.213
|
||||
check 2.3
|
||||
check 1.0
|
||||
check (4.0:rat)
|
||||
check (2.3:rat)
|
||||
check (1.00:rat)
|
||||
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)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
rat.of_num 4 : ℚ
|
||||
rat.divide (rat.of_num 23) (rat.of_num 10) : ℚ
|
||||
rat.of_num 1 : ℚ
|
||||
rat.divide (rat.of_num 10213) (rat.of_num 1000) : ℚ
|
||||
4 : ℚ
|
||||
23 / 10 : ℚ
|
||||
1 : ℚ
|
||||
10213 / 1000 : ℚ
|
||||
-(3 / 10) : ℚ
|
||||
10213 / 1000 : ℚ
|
||||
23 / 10 : ℚ
|
||||
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))
|
||||
|
|
|
@ -14,4 +14,4 @@ check M[row,col]
|
|||
notation M `[` i `,` `:` `]` := get_row M i
|
||||
check M[row,:]
|
||||
check M[row,col]
|
||||
check [1, 2, 3]
|
||||
check [(1:nat), 2, 3]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
M[row,col] : A
|
||||
M[row,:] : row_vector A n
|
||||
M[row,col] : A
|
||||
[1, 2, 3] : list num
|
||||
[1, 2, 3] : list ℕ
|
||||
|
|
|
@ -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)
|
|
@ -1,5 +1,5 @@
|
|||
import data.num
|
||||
|
||||
definition x.y := 10
|
||||
definition x.y : nat := 10
|
||||
|
||||
definition x.1 := 10
|
||||
definition x.1 :nat := 10
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{x : ℕ ∈ S | x > 0} : set ℕ
|
||||
{x : ℕ ∈ s | x > 0} : finset ℕ
|
||||
@set.sep.{1} nat (λ (x : nat), nat.gt x (nat.of_num 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))
|
||||
(λ (a : nat), nat.decidable_ge a (nat.succ (nat.of_num 0)))
|
||||
@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), @gt.{1} nat 11.source.to.has_lt x 0)
|
||||
(λ (a : nat), nat.decidable_lt 0 a)
|
||||
s :
|
||||
finset.{1} nat
|
||||
|
|
|
@ -9,7 +9,7 @@ definition tst2 : nat → nat → nat :=
|
|||
begin
|
||||
intro a,
|
||||
intro b,
|
||||
cases add wth (a, b), -- ERROR
|
||||
cases nat.add wth (a, b), -- ERROR
|
||||
exact a,
|
||||
exact b,
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
errors.lean:4:0: error: unknown identifier 'a'
|
||||
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'
|
||||
tst3 : A → A → A
|
||||
foo.tst1 : ℕ → ℕ → ℕ
|
||||
|
|
|
@ -6,7 +6,7 @@ Author: Leonardo de Moura
|
|||
Finite bags.
|
||||
-/
|
||||
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
|
||||
|
||||
variable {A : Type}
|
||||
|
|
|
@ -2,7 +2,7 @@ open nat
|
|||
|
||||
notation `foo` a :=
|
||||
match a with
|
||||
(c, d) := c + d
|
||||
(c, d) := c +[nat] d
|
||||
end
|
||||
|
||||
eval foo (2, 3)
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
LEAN_INFORMATION
|
||||
definition int.mul : ℤ → ℤ → ℤ
|
||||
|
||||
definition nat.mul : ℕ → ℕ → ℕ
|
||||
definition mul : Π {A : Type} [c : has_mul A], A → A → A
|
||||
END_LEAN_INFORMATION
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
LEAN_INFORMATION
|
||||
definition int.mul : ℤ → ℤ → ℤ
|
||||
|
||||
definition nat.mul : ℕ → ℕ → ℕ
|
||||
definition mul : Π {A : Type} [c : has_mul A], A → A → A
|
||||
END_LEAN_INFORMATION
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
LEAN_INFORMATION
|
||||
_ `+`:65 _:65 :=
|
||||
| nat.add #1 #0
|
||||
| [priority 999] int.add #1 #0
|
||||
_ `+`:65 _:65 := add #1 #0
|
||||
END_LEAN_INFORMATION
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
LEAN_INFORMATION
|
||||
definition int.add : ℤ → ℤ → ℤ
|
||||
|
||||
definition nat.add : ℕ → ℕ → ℕ
|
||||
definition add : Π {A : Type} [c : has_add A], A → A → A
|
||||
END_LEAN_INFORMATION
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
LEAN_INFORMATION
|
||||
_ `+`:65 _:65 :=
|
||||
| nat.add #1 #0
|
||||
| [priority 999] int.add #1 #0
|
||||
_ `+`:65 _:65 := add #1 #0
|
||||
END_LEAN_INFORMATION
|
||||
|
|
|
@ -6,6 +6,6 @@ h₂ : b = 0,
|
|||
aeq0 : a = 0,
|
||||
h₃ : succ c = 1,
|
||||
h₄ : d = c - 1,
|
||||
a_eq : c = 0
|
||||
a_1 : c = 0
|
||||
⊢ c = 0
|
||||
END_LEAN_INFORMATION
|
||||
|
|
|
@ -15,11 +15,11 @@ begin
|
|||
rewrite add_zero at h₃,
|
||||
rewrite add_succ at h₃,
|
||||
rewrite add_zero at h₃,
|
||||
injection h₃, assumption
|
||||
injection h₃, exact a_1
|
||||
end,
|
||||
rewrite ceq at h₄,
|
||||
repeat (esimp [sub, pred] at h₄),
|
||||
assumption
|
||||
exact h₄
|
||||
end,
|
||||
exact deq0
|
||||
end
|
||||
|
|
|
@ -5,7 +5,6 @@ open eq algebra
|
|||
definition foo {A : Type} (a b c : A) (H₁ : a = c) (H₂ : c = b) : a = b :=
|
||||
begin
|
||||
apply concat,
|
||||
rotate 1,
|
||||
apply H₁,
|
||||
apply H₂,
|
||||
apply H₁
|
||||
end
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
-- ENDWAIT
|
||||
-- BEGINFINDP
|
||||
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
|
||||
-- ENDFINDP
|
||||
-- BEGINFINDP
|
||||
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
|
||||
-- ENDFINDP
|
||||
|
|
|
@ -27,7 +27,6 @@ true
|
|||
-- ACK
|
||||
-- ENDINFO
|
||||
-- BEGINFINDG
|
||||
add.assoc|∀ (n m k : ℕ), n + m + k = n + (m + k)
|
||||
-- ENDFINDG
|
||||
-- BEGINWAIT
|
||||
-- ENDWAIT
|
||||
|
|
|
@ -49,7 +49,15 @@ nat.add.assoc
|
|||
-- TYPE|7|43
|
||||
a + c + b = a + (c + b) → a + (c + b) = a + c + b
|
||||
-- ACK
|
||||
-- OVERLOAD|7|43
|
||||
eq.symm #0
|
||||
--
|
||||
inv #0
|
||||
-- ACK
|
||||
-- SYMBOL|7|43
|
||||
⁻¹
|
||||
-- ACK
|
||||
-- IDENTIFIER|7|43
|
||||
eq.symm
|
||||
-- ACK
|
||||
-- ENDINFO
|
||||
|
|
|
@ -9,15 +9,15 @@ false.rec_on|Π (C : Type), false → C
|
|||
false.cases_on|Π (C : Type), false → C
|
||||
false.induction_on|∀ (C : Prop), false → C
|
||||
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_iff_false|(?a ↔ false) → ¬?a
|
||||
is_false|Π (c : Prop) [H : decidable c], Prop
|
||||
classical.eq_true_or_eq_false|∀ (a : Prop), a = true ∨ a = false
|
||||
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
|
||||
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
|
||||
not_false|¬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)
|
||||
iff_false_intro|¬?a → (?a ↔ 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
|
||||
-- ENDFINDP
|
||||
|
|
|
@ -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.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_has_mul|has_mul pos_num
|
||||
pos_num|Type
|
||||
pos_num_has_one|has_one pos_num
|
||||
pos_num_has_add|has_add pos_num
|
||||
-- ENDFINDP
|
||||
-- BEGINWAIT
|
||||
-- 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.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_has_mul|has_mul pos_num
|
||||
pos_num|Type
|
||||
pos_num_has_one|has_one pos_num
|
||||
pos_num_has_add|has_add pos_num
|
||||
-- ENDFINDP
|
||||
-- BEGINFINDP
|
||||
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.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_has_mul|has_mul pos_num
|
||||
pos_num|Type
|
||||
pos_num_has_one|has_one pos_num
|
||||
pos_num_has_add|has_add pos_num
|
||||
-- ENDFINDP
|
||||
|
|
|
@ -4,7 +4,7 @@ open nat num
|
|||
variable a : nat
|
||||
variable b : num
|
||||
variable c : bool
|
||||
check a + b
|
||||
check a + of_num b
|
||||
check add a c
|
||||
WAIT
|
||||
INFO 5
|
||||
|
|
|
@ -10,37 +10,30 @@ a
|
|||
-- TYPE|5|8
|
||||
ℕ → ℕ → ℕ
|
||||
-- ACK
|
||||
-- OVERLOAD|5|8
|
||||
num.add #1 #0
|
||||
--
|
||||
nat.add #1 #0
|
||||
-- ACK
|
||||
-- SYMBOL|5|8
|
||||
+
|
||||
-- ACK
|
||||
-- IDENTIFIER|5|8
|
||||
nat.add
|
||||
-- ACK
|
||||
-- TYPE|5|10
|
||||
num
|
||||
-- ACK
|
||||
-- COERCION|5|10
|
||||
of_num b
|
||||
--
|
||||
ℕ
|
||||
num → ℕ
|
||||
-- ACK
|
||||
-- IDENTIFIER|5|10
|
||||
nat.of_num
|
||||
-- ACK
|
||||
-- TYPE|5|17
|
||||
num
|
||||
-- ACK
|
||||
-- IDENTIFIER|5|17
|
||||
b
|
||||
-- ACK
|
||||
-- ENDINFO
|
||||
-- BEGININFO STALE
|
||||
-- TYPE|6|6
|
||||
ℕ → ℕ → ℕ
|
||||
num → num → num
|
||||
-- ACK
|
||||
-- OVERLOAD|6|6
|
||||
num.add
|
||||
add
|
||||
--
|
||||
nat.add
|
||||
num.add
|
||||
-- ACK
|
||||
-- TYPE|6|10
|
||||
ℕ
|
||||
|
|
|
@ -4,12 +4,12 @@ inductive tree (A : Type) :=
|
|||
leaf : 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
|
||||
|
||||
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
|
||||
|
|
|
@ -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
|
|
@ -1,6 +1,5 @@
|
|||
f a b : A
|
||||
f a b : A
|
||||
nat ↣ bool : foo
|
||||
bla : num
|
||||
10 : ?M_1
|
||||
local_notation_bug.lean:22:8: error: invalid expression
|
||||
num ↣ nat : nat.of_num
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
definition id {A : Type} {a : A} := a
|
||||
definition o : num := 1
|
||||
|
||||
check @id nat 1
|
||||
check @id nat o
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
mismatch.lean:3:7: error: type mismatch at application
|
||||
@id ℕ 1
|
||||
mismatch.lean:4:7: error: type mismatch at application
|
||||
@id ℕ o
|
||||
term
|
||||
1
|
||||
o
|
||||
has type
|
||||
num
|
||||
but is expected to have type
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import data.list data.examples.vector
|
||||
open nat list vector
|
||||
|
||||
check [1, 2, 3]
|
||||
check [(1:nat), 2, 3]
|
||||
check ([1, 2, 3] : vector nat _)
|
||||
check ([1, 2, 3] : list nat)
|
||||
check (#list [1, 2, 3])
|
||||
check (#vector [1, 2, 3])
|
||||
check (#list [(1:nat), 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
|
||||
|
||||
example : (#vector [1, 2, 3]) = ([1, 2, 3] : vector nat _) :=
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[1, 2, 3] : list num
|
||||
[1, 2, 3] : list ℕ
|
||||
[1, 2, 3] : vector ℕ 3
|
||||
[1, 2, 3] : list ℕ
|
||||
[1, 2, 3] : list num
|
||||
[1, 2, 3] : vector num 3
|
||||
[1, 2, 3] : list ℕ
|
||||
[1, 2, 3] : vector ℕ 3
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1 +1 @@
|
|||
noncomputable definition a := 2
|
||||
noncomputable definition a :nat := 2
|
||||
|
|
|
@ -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 : ℝ → ℝ → ℝ :=
|
||||
λ (a : ℝ), divide (a + a)
|
||||
λ (a : ℝ), division (a + a)
|
||||
definition r : ℕ → ℕ :=
|
||||
λ (a : ℕ), a
|
||||
|
|
|
@ -4,10 +4,10 @@ constant b : num
|
|||
check b + b + b
|
||||
check true ∧ false ∧ true
|
||||
check (true ∧ false) ∧ true
|
||||
check 2 + (2 + 2)
|
||||
check (2 + 2) + 2
|
||||
check 1 = (2 + 3)*2
|
||||
check 2 + 3 * 2 = 3 * 2 + 2
|
||||
check (2:num) + (2 + 2)
|
||||
check (2 + 2) + (2:num)
|
||||
check (1:num) = (2 + 3)*2
|
||||
check (2:num) + 3 * 2 = 3 * 2 + 2
|
||||
check (true ∨ false) = (true ∨ false) ∧ true
|
||||
check true ∧ (false ∨ true)
|
||||
constant A : Type₁
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
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
|
||||
infixr `::` := cons
|
||||
check 1 :: 2 :: nil
|
||||
check 1 :: 2 :: 3 :: 4 :: 5 :: nil
|
||||
check (1:num) :: 2 :: nil
|
||||
check (1:num) :: 2 :: 3 :: 4 :: 5 :: nil
|
||||
|
|
|
@ -5,4 +5,4 @@ constants a b : num
|
|||
check [a, b, b]
|
||||
check (a, true, a = b, b)
|
||||
check (a, b)
|
||||
check [1, 2+2, 3]
|
||||
check [(1:num), 2+2, 3]
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import logic data.num
|
||||
open num
|
||||
notation `o` := 10
|
||||
notation `o` := (10:num)
|
||||
check 11
|
||||
constant f : num → num
|
||||
check o + 1
|
||||
check f o + o + o
|
||||
eval 9 + 1
|
||||
eval 9 + (1:num)
|
||||
eval o+4
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
11 : num
|
||||
o + 1 : num
|
||||
f o + o + o : num
|
||||
o
|
||||
11 : ?M_1
|
||||
10 + 1 : num
|
||||
f 10 + 10 + 10 : num
|
||||
10
|
||||
14
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
nat.add a b : nat
|
||||
int.add i j : int
|
||||
nat.add a b : nat
|
||||
int.add i j : int
|
||||
@add.{1} nat 11.source.to.has_add a b : nat
|
||||
@add.{1} int 11.source.to.has_add_1 i j : int
|
||||
@add.{1} nat 11.source.to.has_add a b : nat
|
||||
@add.{1} int 11.source.to.has_add_1 i j : int
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
10 : num
|
||||
20 : num
|
||||
3 : num
|
||||
1 : num
|
||||
0 : num
|
||||
12 : num
|
||||
13 : num
|
||||
12138 : num
|
||||
1221 : num
|
||||
11 : num
|
||||
5 : num
|
||||
21 : num
|
||||
10 : ?M_1
|
||||
20 : ?M_1
|
||||
3 : ?M_1
|
||||
1 : ?M_1
|
||||
0 : ?M_1
|
||||
12 : ?M_1
|
||||
13 : ?M_1
|
||||
12138 : ?M_1
|
||||
1221 : ?M_1
|
||||
11 : ?M_1
|
||||
5 : ?M_1
|
||||
21 : ?M_1
|
||||
|
|
|
@ -12,3 +12,4 @@ notation 1 := o
|
|||
|
||||
check a = 0
|
||||
check 2 = 1
|
||||
check (2:num) = 1
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
@eq N a z : Prop
|
||||
@eq ?M_1 2 1 : Prop
|
||||
@eq num 2 1 : Prop
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace foo
|
|||
check a = 0
|
||||
end foo
|
||||
|
||||
check 2 = 1
|
||||
check (2:nat) = 1
|
||||
check #foo foo.a = 1
|
||||
|
||||
open foo
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@eq N a z : Prop
|
||||
@eq num 2 1 : Prop
|
||||
@eq nat 2 1 : Prop
|
||||
@eq foo.N foo.a foo.o : Prop
|
||||
@eq N a o : Prop
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import data.num
|
||||
open num
|
||||
|
||||
eval 3+2
|
||||
eval 3+2*5
|
||||
eval 5*5
|
||||
eval eq.rec (eq.refl 2) (eq.refl 2)
|
||||
eval 3+(2:num)
|
||||
eval 3+2*(5:num)
|
||||
eval 5*(5:num)
|
||||
eval eq.rec (eq.refl (2:num)) (eq.refl (2:num))
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
section
|
||||
open [notations] [coercions] nat
|
||||
check 1 + 2
|
||||
check add -- Error aliases were not created
|
||||
check (1:nat) + 2
|
||||
check add
|
||||
end
|
||||
|
||||
section
|
||||
open [declarations] [notations] nat
|
||||
variable a : nat
|
||||
check a + a
|
||||
check add a a
|
||||
check a + 1 -- Error coercion from num to nat was not loaded
|
||||
check a + 1
|
||||
end
|
||||
|
||||
section
|
||||
|
@ -26,7 +24,6 @@ section
|
|||
open - [classes] [decls] nat
|
||||
variable a : nat
|
||||
check a + a
|
||||
check add a a -- Error aliases were not created
|
||||
check a + 1
|
||||
definition foo2 : inhabited nat :=
|
||||
_ -- Error inhabited instances was not loaded
|
||||
|
@ -38,5 +35,5 @@ section
|
|||
_
|
||||
|
||||
variable a : nat
|
||||
check a + a -- Error notation declarations were not loaded
|
||||
check a + a
|
||||
end
|
||||
|
|
|
@ -1,31 +1,23 @@
|
|||
1 + 2 : ℕ
|
||||
open_tst.lean:4:8: error: unknown identifier 'add'
|
||||
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
|
||||
ℕ
|
||||
add : ?A → ?A → ?A
|
||||
a + a : ℕ
|
||||
a + a : ℕ
|
||||
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 ℕ
|
||||
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
|
||||
?M_1
|
||||
a + a : ℕ
|
||||
open_tst.lean:29:8: error: unknown identifier 'add'
|
||||
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 ℕ
|
||||
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
|
||||
?M_1
|
||||
open_tst.lean:41:10: error: invalid expression
|
||||
a + a : ℕ
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import data.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
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import logic
|
|||
constant f : num → num
|
||||
constant g : num → num
|
||||
notation a `+++` := f a
|
||||
notation [parsing-only] a `***` := g a
|
||||
notation [parsing_only] a `***` := g a
|
||||
check 10 +++
|
||||
check 10 ***
|
||||
check Type.{8} -- Type₊ should not be used
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
1 * 1 * a : A
|
||||
has_mul.mul (has_one.one A) a : A
|
||||
mul 1 a : A
|
||||
0 + a : A
|
||||
has_add.add (has_zero.zero A) a : A
|
||||
add 0 a : A
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import data.nat
|
||||
open 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
|
||||
check (λ x, x) a + b = 10
|
||||
check (λ x, x) a + of_num b = 10
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
a + b = 10 : Prop
|
||||
@eq.{1} nat (nat.add ((λ (x : nat), x) a) (nat.of_num 2)) (nat.of_num 10) : Prop
|
||||
a + of_num b = 10 : Prop
|
||||
@eq.{1} nat (@add.{1} nat 11.source.to.has_add ((λ (x : nat), x) a) (nat.of_num 2)) 10 : Prop
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
theorem foo1 : 0 = 0 :=
|
||||
theorem foo1 : 0 = (0:num) :=
|
||||
rfl
|
||||
|
||||
theorem foo2 : 0 = 0 :=
|
||||
theorem foo2 : 0 = (0:num) :=
|
||||
rfl
|
||||
|
||||
theorem foo3 : 0 = 0 :=
|
||||
theorem foo3 : 0 = (0:num) :=
|
||||
foo2
|
||||
|
||||
definition foo4 : 0 = 0 :=
|
||||
definition foo4 : 0 = (0:num) :=
|
||||
eq.trans foo2 foo1
|
||||
|
||||
print axioms foo4
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
protected_test.lean:2:8: error: unknown identifier 'induction_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
|
||||
le.rec_on : ?a ≤ ?a_1 → ?C ?a → (∀ {b : ℕ}, ?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
|
||||
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'
|
||||
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
|
||||
|
|
|
@ -3,4 +3,4 @@ open nat int rat
|
|||
|
||||
attribute rat.of_int [coercion]
|
||||
|
||||
eval (8 * 6⁻¹) + 1
|
||||
eval (8 * 6⁻¹) + (1:rat)
|
||||
|
|
|
@ -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)))
|
||||
|
|
|
@ -49,7 +49,7 @@ definition rec_measure {dom codom : Type} (default : codom) (measure : dom →
|
|||
(rec_val : dom → (dom → codom) → codom) (x : dom) : codom :=
|
||||
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 → ℕ)
|
||||
(rec_val : dom → (dom → codom) → codom)
|
||||
|
|
|
@ -7,12 +7,6 @@ infix [priority 20] + := g
|
|||
|
||||
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 + := g
|
||||
example : a + b = f a b := rfl
|
||||
|
@ -21,7 +15,6 @@ example : a + b = g a b := rfl
|
|||
|
||||
infix + := f
|
||||
infix + := g
|
||||
example : a + b = f a b := rfl
|
||||
|
||||
infix [priority std.priority.default+1] + := g
|
||||
example : a + b = g a b := rfl
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
import logic
|
||||
|
||||
structure has_mul [class] (A : Type) :=
|
||||
(mul : A → A → A)
|
||||
|
||||
structure semigroup [class] (A : Type) extends has_mul A :=
|
||||
(assoc : ∀ a b c, mul (mul a b) c = mul a (mul b c))
|
||||
|
||||
|
|
|
@ -17,8 +17,14 @@ namespace nat
|
|||
definition plus (x y : ℕ) : ℕ
|
||||
:= nat.rec x (λ n r, succ r) y
|
||||
|
||||
definition to_nat [coercion] (n : num) : ℕ
|
||||
:= num.rec zero (λ n, pos_num.rec (succ zero) (λ n r, plus r (plus r (succ zero))) (λ n r, plus r r) n) n
|
||||
definition nat_has_zero [reducible] [instance] [priority nat.prio] : has_zero nat :=
|
||||
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 "=================="
|
||||
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
|
@ -1,4 +1,17 @@
|
|||
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
|
||||
measurable : Type → Type
|
||||
nonempty : Type → Prop
|
||||
|
@ -7,6 +20,19 @@ setoid : Type → Type
|
|||
subsingleton : Type → Prop
|
||||
well_founded : Π {A : Type}, (A → A → Prop) → Prop
|
||||
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
|
||||
measurable : Type → Type
|
||||
nonempty : Type → Prop
|
||||
|
|
|
@ -7,7 +7,6 @@ variable {n : nat}
|
|||
theorem tst1 : ∀ n m, succ n + succ m = succ (succ (n + m)) :=
|
||||
begin
|
||||
intro n m,
|
||||
esimp [add],
|
||||
state,
|
||||
rewrite [succ_add]
|
||||
end
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
unfold_rec.lean:11:2: proof state
|
||||
unfold_rec.lean:10:2: proof state
|
||||
n m : ℕ
|
||||
⊢ succ (succ n + m) = succ (succ (n + m))
|
||||
unfold_rec.lean:24:2: proof state
|
||||
⊢ succ n + succ m = succ (succ (n + m))
|
||||
unfold_rec.lean:23:2: proof state
|
||||
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,
|
||||
b m c : ℕ
|
||||
⊢ 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,
|
||||
B : Type,
|
||||
unzip_zip : ∀ {n : ℕ} (v₁ : vector A n) (v₂ : vector B n), unzip (zip v₁ v₂) = (v₁, v₂),
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
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)
|
||||
notation g ∘ f := compose g f
|
||||
|
||||
|
@ -18,7 +18,7 @@ begin
|
|||
exact H
|
||||
end
|
||||
|
||||
attribute compose [unfold-full]
|
||||
attribute compose [unfold_full]
|
||||
|
||||
example (a b : nat) (H : a = b) : (id ∘ id) a = b :=
|
||||
begin
|
||||
|
|
|
@ -6,9 +6,9 @@ variables {A B : Type}
|
|||
definition unzip : Π {n : nat}, vector (A × B) n → vector A n × vector B n
|
||||
| unzip nil := (nil, nil)
|
||||
| unzip ((a, b) :: v) :=
|
||||
match unzip v with
|
||||
match unzip v with -- ERROR
|
||||
(va, vb) := (a :: va, b :: vb)
|
||||
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
|
||||
|
|
|
@ -21,7 +21,7 @@ recursor information
|
|||
dep. elimination: 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),
|
||||
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)) →
|
||||
C a n
|
||||
recursor information
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
open nat
|
||||
|
||||
eval [whnf] (fun x, x + 1) 2
|
||||
eval (fun x, x + 1) 2
|
||||
eval [whnf] (fun x, x + 1) (2:nat)
|
||||
eval (fun x, x + 1) (2:nat)
|
||||
|
||||
variable a : nat
|
||||
eval [whnf] a + succ zero
|
||||
|
|
Loading…
Reference in a new issue