fix(tests/lean/run): adjust some tests to changes in the standard library
This commit is contained in:
parent
38c433dbec
commit
81618e30f3
79 changed files with 214 additions and 265 deletions
|
@ -6,7 +6,7 @@ node : tree A → tree A → tree A
|
||||||
|
|
||||||
check tree.node
|
check tree.node
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
check size
|
check size
|
||||||
|
|
|
@ -9,7 +9,7 @@ open nat
|
||||||
check less.rec_on
|
check less.rec_on
|
||||||
|
|
||||||
namespace foo1
|
namespace foo1
|
||||||
protected definition foo2.bar := 10
|
protected definition foo2.bar : nat := 10
|
||||||
end foo1
|
end foo1
|
||||||
|
|
||||||
example : foo1.foo2.bar = 10 :=
|
example : foo1.foo2.bar = 10 :=
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import data.set
|
import data.set
|
||||||
open set
|
open set nat
|
||||||
|
|
||||||
section
|
section
|
||||||
variable {A : Type}
|
variable {A : Type}
|
||||||
|
@ -13,8 +13,8 @@ section
|
||||||
notation `⦃` s:(foldr `,` (a t, insert a t) ∅) `⦄` := s
|
notation `⦃` s:(foldr `,` (a t, insert a t) ∅) `⦄` := s
|
||||||
notation `{` `{` s:(foldr `,` (a t, insert a t) ∅) `}` `}` := s
|
notation `{` `{` s:(foldr `,` (a t, insert a t) ∅) `}` `}` := s
|
||||||
|
|
||||||
check ⦃1, 2, 3⦄
|
check ⦃(1:nat), 2, 3⦄
|
||||||
check {{1, 2, 3}}
|
check {{(1:nat), 2, 3}}
|
||||||
|
|
||||||
definition foo {X : Type} {{ x : X }} : X := x
|
definition foo {X : Type} {{ x : X }} : X := x
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,7 +5,7 @@ example (a b : nat) (f : nat → nat) (h : f (succ a) = 0) : f (a+1) = 0 :=
|
||||||
by rewrite [add_one, h]
|
by rewrite [add_one, h]
|
||||||
|
|
||||||
example (a b : nat) (f : nat → nat) (h : f (succ a) = 0) : f (a+1) = 0 :=
|
example (a b : nat) (f : nat → nat) (h : f (succ a) = 0) : f (a+1) = 0 :=
|
||||||
by xrewrite h
|
by krewrite h
|
||||||
|
|
||||||
definition g (a : nat) := a + 1
|
definition g (a : nat) := a + 1
|
||||||
definition h (a : nat) := a
|
definition h (a : nat) := a
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
namespace f1
|
namespace f1
|
||||||
definition flip := 20
|
definition flip := (20:num)
|
||||||
end f1
|
end f1
|
||||||
|
|
||||||
namespace f2
|
namespace f2
|
||||||
definition flip := 10
|
definition flip := (10:num)
|
||||||
end f2
|
end f2
|
||||||
|
|
||||||
namespace f3
|
namespace f3
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace Nat
|
||||||
constant Nat : Type₁
|
constant Nat : Type₁
|
||||||
constant num2Nat : num → Nat
|
constant num2Nat : num → Nat
|
||||||
attribute num2Nat [coercion]
|
attribute num2Nat [coercion]
|
||||||
check (0 : Nat)
|
definition foo : Nat := (0:num)
|
||||||
end Nat
|
end Nat
|
||||||
|
|
||||||
constant Int : Type₁
|
constant Int : Type₁
|
||||||
|
@ -13,8 +13,8 @@ namespace Int
|
||||||
open Nat
|
open Nat
|
||||||
constant Nat2Int : Nat → Int
|
constant Nat2Int : Nat → Int
|
||||||
attribute Nat2Int [coercion]
|
attribute Nat2Int [coercion]
|
||||||
check (0 : Int)
|
definition foo : Int := (0:num)
|
||||||
end Int
|
end Int
|
||||||
|
|
||||||
open Int
|
open Int
|
||||||
check (0 : Int)
|
definition foo : Int := (0:num)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import data.nat
|
||||||
open nat
|
open nat
|
||||||
example (n : ℕ) : n + 1 = succ n :=
|
example (n : ℕ) : n + 1 = succ n :=
|
||||||
by rewrite [<d n+1]
|
by rewrite [-add_one]
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
definition foo.bar := 10
|
open nat
|
||||||
definition boo.bla.foo := 20
|
definition foo.bar : nat := 10
|
||||||
|
definition boo.bla.foo : nat := 20
|
||||||
|
|
||||||
open foo
|
open foo
|
||||||
open boo.bla
|
open boo.bla
|
||||||
|
|
|
@ -3,7 +3,7 @@ definition seq_diagram (A : ℕ → Type) : Type := (Πn, A n → A (succ n))
|
||||||
variables (A : ℕ → Type) (f : seq_diagram A)
|
variables (A : ℕ → Type) (f : seq_diagram A)
|
||||||
include f
|
include f
|
||||||
|
|
||||||
definition shift_diag [unfold-full] (k : ℕ) : seq_diagram (λn, A (k + n)) :=
|
definition shift_diag [unfold_full] (k : ℕ) : seq_diagram (λn, A (k + n)) :=
|
||||||
λn a, f (k + n) a
|
λn a, f (k + n) a
|
||||||
|
|
||||||
example (n k : ℕ) (b : A (k + n)) : shift_diag A f k n b = sorry :=
|
example (n k : ℕ) (b : A (k + n)) : shift_diag A f k n b = sorry :=
|
||||||
|
|
|
@ -3,7 +3,7 @@ open finset num nat int algebra
|
||||||
|
|
||||||
check @finset.insert _ _ 1 (@finset.empty ℕ)
|
check @finset.insert _ _ 1 (@finset.empty ℕ)
|
||||||
|
|
||||||
check '{1, 2, 3} -- finset num
|
check '{(1:nat), 2, 3}
|
||||||
check ('{1, 2, 3} : finset ℕ)
|
check ('{1, 2, 3} : finset ℕ)
|
||||||
check ('{1, 2, 3} : finset ℕ) -- finset ℕ
|
check ('{1, 2, 3} : finset ℕ) -- finset ℕ
|
||||||
check ('{1, 2, 3} : finset ℤ) -- finset ℤ
|
check ('{1, 2, 3} : finset ℤ) -- finset ℤ
|
||||||
|
|
|
@ -10,14 +10,11 @@ section
|
||||||
mul_one 1
|
mul_one 1
|
||||||
end
|
end
|
||||||
|
|
||||||
definition one [reducible] (A : Type) [s : has_one A] : A :=
|
|
||||||
!has_one.one
|
|
||||||
|
|
||||||
section
|
section
|
||||||
variable {A : Type}
|
variable {A : Type}
|
||||||
variable [s : comm_group A]
|
variable [s : comm_group A]
|
||||||
include s
|
include s
|
||||||
|
|
||||||
theorem one_mul_one2 : (one A) * 1 = 1 :=
|
theorem one_mul_one2 : (one : A) * 1 = 1 :=
|
||||||
by rewrite one_mul_one
|
by rewrite one_mul_one
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,14 +1,5 @@
|
||||||
import logic
|
import logic
|
||||||
|
|
||||||
structure has_mul [class] (A : Type) :=
|
|
||||||
(mul : A → A → A)
|
|
||||||
|
|
||||||
structure has_one [class] (A : Type) :=
|
|
||||||
(one : A)
|
|
||||||
|
|
||||||
structure has_inv [class] (A : Type) :=
|
|
||||||
(inv : A → A)
|
|
||||||
|
|
||||||
infixl `*` := has_mul.mul
|
infixl `*` := has_mul.mul
|
||||||
postfix `⁻¹` := has_inv.inv
|
postfix `⁻¹` := has_inv.inv
|
||||||
notation 1 := has_one.one
|
notation 1 := has_one.one
|
||||||
|
|
|
@ -7,6 +7,5 @@ attribute nat.rec_on [unfold 2]
|
||||||
example (a b c : nat) : a + 0 = 0 + a ∧ b + 0 = 0 + b :=
|
example (a b c : nat) : a + 0 = 0 + a ∧ b + 0 = 0 + b :=
|
||||||
begin
|
begin
|
||||||
apply and.intro,
|
apply and.intro,
|
||||||
all_goals esimp[of_num],
|
|
||||||
all_goals (state; rewrite zero_add)
|
all_goals (state; rewrite zero_add)
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,6 +18,6 @@ example (a b c : nat) : (a + 0 = 0 + a ∧ b + 0 = 0 + b) ∧ c = c :=
|
||||||
|
|
||||||
begin
|
begin
|
||||||
apply and.intro,
|
apply and.intro,
|
||||||
apply and.intro ;; (esimp[of_num]; state; rewrite zero_add),
|
apply and.intro ;; (state; rewrite zero_add),
|
||||||
apply rfl
|
apply rfl
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
definition a := 10
|
definition a :num := 10
|
||||||
|
|
||||||
constant b : num
|
constant b : num
|
||||||
constant c : num
|
constant c : num
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import data.nat
|
import data.nat
|
||||||
open nat eq.ops
|
open nat eq.ops algebra
|
||||||
|
|
||||||
theorem lcm_dvd {m n k : nat} (H1 : m ∣ k) (H2 : (n ∣ k)) : (lcm m n ∣ k) :=
|
theorem lcm_dvd {m n k : nat} (H1 : m ∣ k) (H2 : (n ∣ k)) : (lcm m n ∣ k) :=
|
||||||
match eq_zero_or_pos k with
|
match eq_zero_or_pos k with
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import logic data.num
|
import logic data.num
|
||||||
open num
|
open num
|
||||||
constant f : num → num
|
constant f : num → num
|
||||||
notation `o`:1 := 10
|
notation `o`:1 := (10:num)
|
||||||
check o + 1
|
check o + 1
|
||||||
check f o + o + o
|
check f o + o + o
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import data.nat.bquant
|
import data.nat.bquant
|
||||||
open nat
|
open nat
|
||||||
|
|
||||||
example : is_true (∀ x, x ≤ 4 → x ≠ 6) :=
|
example : is_true (∀ x : nat, x ≤ 4 → x ≠ 6) :=
|
||||||
trivial
|
trivial
|
||||||
|
|
||||||
example : is_false (∀ x, x ≤ 5 → ∀ y, y < x → y * y ≠ x) :=
|
example : is_false (∀ x : nat, x ≤ 5 → ∀ y, y < x → y * y ≠ x) :=
|
||||||
trivial
|
trivial
|
||||||
|
|
||||||
example : is_true (∀ x, x < 5 → ∃ y, y ≤ x + 5 ∧ y = 2*x) :=
|
example : is_true (∀ x : nat, x < 5 → ∃ y, y ≤ x + 5 ∧ y = 2*x) :=
|
||||||
trivial
|
trivial
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import data.encodable
|
import data.encodable
|
||||||
open nat encodable
|
open nat encodable
|
||||||
|
|
||||||
theorem ex : ∃ x, x > 3 :=
|
theorem ex : ∃ x : nat, x > 3 :=
|
||||||
exists.intro 6 dec_trivial
|
exists.intro 6 dec_trivial
|
||||||
|
|
||||||
reveal ex
|
reveal ex
|
||||||
|
|
|
@ -44,7 +44,7 @@ section
|
||||||
-- check mul_struct nat << This is an error, we opened only the notation from algebra
|
-- check mul_struct nat << This is an error, we opened only the notation from algebra
|
||||||
variables a b c : nat
|
variables a b c : nat
|
||||||
check a*b*c
|
check a*b*c
|
||||||
definition tst3 : nat := #nat a*b*c
|
definition tst3 : nat := a*b*c
|
||||||
end
|
end
|
||||||
|
|
||||||
section
|
section
|
||||||
|
|
|
@ -40,12 +40,6 @@ check x + i
|
||||||
check n + x
|
check n + x
|
||||||
check x + n
|
check x + n
|
||||||
check x + i + n
|
check x + i + n
|
||||||
check n + 0
|
|
||||||
check 0 + n
|
|
||||||
check 0 + i
|
|
||||||
check i + 0
|
|
||||||
check 0 + x
|
|
||||||
check x + 0
|
|
||||||
namespace foo
|
namespace foo
|
||||||
constant eq {A : Type} : A → A → Prop
|
constant eq {A : Type} : A → A → Prop
|
||||||
infixl `=` := eq
|
infixl `=` := eq
|
||||||
|
|
|
@ -45,7 +45,7 @@ end
|
||||||
|
|
||||||
open nat
|
open nat
|
||||||
|
|
||||||
example (a : nat) : a > 0 → ∃ x, x > 0 :=
|
example (a : nat) : a > 0 → ∃ x : nat, x > 0 :=
|
||||||
begin
|
begin
|
||||||
intro Ha,
|
intro Ha,
|
||||||
existsi a,
|
existsi a,
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
|
open nat
|
||||||
|
|
||||||
example (a b : nat) (h : false) : a = b :=
|
example (a b : nat) (h : false) : a = b :=
|
||||||
by contradiction
|
by contradiction
|
||||||
|
|
||||||
example : ∀ (a b : nat), false → a = b :=
|
example : ∀ (a b : nat), false → a = b :=
|
||||||
by contradiction
|
by contradiction
|
||||||
|
|
||||||
example : ∀ (a b : nat), 0 = 1 → a = b :=
|
example : ∀ (a b : nat), (0:nat) = 1 → a = b :=
|
||||||
by contradiction
|
by contradiction
|
||||||
|
|
||||||
definition id {A : Type} (a : A) := a
|
definition id {A : Type} (a : A) := a
|
||||||
|
@ -12,5 +14,5 @@ definition id {A : Type} (a : A) := a
|
||||||
example : ∀ (a b : nat), id false → a = b :=
|
example : ∀ (a b : nat), id false → a = b :=
|
||||||
by contradiction
|
by contradiction
|
||||||
|
|
||||||
example : ∀ (a b : nat), id (0 = 1) → a = b :=
|
example : ∀ (a b : nat), id ((0:nat) = 1) → a = b :=
|
||||||
by contradiction
|
by contradiction
|
||||||
|
|
|
@ -11,7 +11,7 @@ nat.rec_on n
|
||||||
let t₁ : vector (vector A n₁) n₁ := map tail (tail v) in
|
let t₁ : vector (vector A n₁) n₁ := map tail (tail v) in
|
||||||
h₁ :: r t₁)
|
h₁ :: r t₁)
|
||||||
|
|
||||||
example : diag ((1 :: 2 :: 3 :: nil) :: (4 :: 5 :: 6 :: nil) :: (7 :: 8 :: 9 :: nil) :: nil) = 1 :: 5 :: 9 :: nil :=
|
example : diag ((1 :: 2 :: 3 :: nil) :: (4 :: 5 :: 6 :: nil) :: (7 :: 8 :: 9 :: nil) :: nil) = (1 :: 5 :: 9 :: nil : vector num 3) :=
|
||||||
rfl
|
rfl
|
||||||
|
|
||||||
end vector
|
end vector
|
||||||
|
|
|
@ -26,7 +26,7 @@ rfl
|
||||||
-- The actual definitional package would not do that.
|
-- The actual definitional package would not do that.
|
||||||
-- It will always pack things.
|
-- It will always pack things.
|
||||||
|
|
||||||
definition pair_nat.lt := lex lt lt -- Could also be (lex lt empty_rel)
|
definition pair_nat.lt := lex nat.lt nat.lt -- Could also be (lex lt empty_rel)
|
||||||
definition pair_nat.lt.wf [instance] : well_founded pair_nat.lt :=
|
definition pair_nat.lt.wf [instance] : well_founded pair_nat.lt :=
|
||||||
prod.lex.wf lt.wf lt.wf
|
prod.lex.wf lt.wf lt.wf
|
||||||
infixl `≺`:50 := pair_nat.lt
|
infixl `≺`:50 := pair_nat.lt
|
||||||
|
|
|
@ -13,5 +13,5 @@ rfl
|
||||||
theorem append_cons {A : Type} (h : A) (t l : list A) : append (h :: t) l = h :: (append t l) :=
|
theorem append_cons {A : Type} (h : A) (t l : list A) : append (h :: t) l = h :: (append t l) :=
|
||||||
rfl
|
rfl
|
||||||
|
|
||||||
example : append (1 :: 2 :: nil) (3 :: 4 :: 5 :: nil) = (1 :: 2 :: 3 :: 4 :: 5 :: nil) :=
|
example : append ((1:nat) :: 2 :: nil) (3 :: 4 :: 5 :: nil) = (1 :: 2 :: 3 :: 4 :: 5 :: nil) :=
|
||||||
rfl
|
rfl
|
||||||
|
|
|
@ -14,5 +14,5 @@ rfl
|
||||||
theorem append_cons (h : A) (t l : list A) : append (h :: t) l = h :: (append t l) :=
|
theorem append_cons (h : A) (t l : list A) : append (h :: t) l = h :: (append t l) :=
|
||||||
rfl
|
rfl
|
||||||
|
|
||||||
example : append (1 :: 2 :: nil) (3 :: 4 :: 5 :: nil) = (1 :: 2 :: 3 :: 4 :: 5 :: nil) :=
|
example : append ((1:num) :: 2 :: nil) (3 :: 4 :: 5 :: nil) = (1 :: 2 :: 3 :: 4 :: 5 :: nil) :=
|
||||||
rfl
|
rfl
|
||||||
|
|
|
@ -6,6 +6,6 @@ definition Nat := N
|
||||||
|
|
||||||
open N
|
open N
|
||||||
|
|
||||||
definition add : Nat → Nat → Nat
|
definition add1 : Nat → Nat → Nat
|
||||||
| add O b := b
|
| add1 O b := b
|
||||||
| add (S a) b := S (add a b)
|
| add1 (S a) b := S (add1 a b)
|
||||||
|
|
|
@ -11,5 +11,5 @@ rfl
|
||||||
theorem append_cons {A : Type} (h : A) (t l : list A) : append (h :: t) l = h :: (append t l) :=
|
theorem append_cons {A : Type} (h : A) (t l : list A) : append (h :: t) l = h :: (append t l) :=
|
||||||
rfl
|
rfl
|
||||||
|
|
||||||
example : append (1 :: 2 :: nil) (3 :: 4 :: 5 :: nil) = (1 :: 2 :: 3 :: 4 :: 5 :: nil) :=
|
example : append ((1:nat) :: 2 :: nil) (3 :: 4 :: 5 :: nil) = (1 :: 2 :: 3 :: 4 :: 5 :: nil) :=
|
||||||
rfl
|
rfl
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
import standard
|
import standard
|
||||||
set_option pp.implicit true
|
set_option pp.implicit true
|
||||||
check ∃x, x = 0
|
check ∃x, x = (0:num)
|
||||||
|
check ∃x:num, x = 0
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
open nat
|
open nat
|
||||||
|
|
||||||
definition foo := 30
|
definition foo : nat := 30
|
||||||
|
|
||||||
namespace foo
|
namespace foo
|
||||||
definition x : nat := 10
|
definition x : nat := 10
|
||||||
|
|
|
@ -19,9 +19,9 @@ namespace nat
|
||||||
definition fib (n : nat) :=
|
definition fib (n : nat) :=
|
||||||
nat.brec_on n (λ (n : nat),
|
nat.brec_on n (λ (n : nat),
|
||||||
nat.cases_on n
|
nat.cases_on n
|
||||||
(λ (b₀ : nat.below zero), succ zero)
|
(λ (b₀ : nat.below 0), succ 0)
|
||||||
(λ (n₁ : nat), nat.cases_on n₁
|
(λ (n₁ : nat), nat.cases_on n₁
|
||||||
(λ b₁ : nat.below (succ zero), succ zero)
|
(λ b₁ : nat.below (succ 0), succ zero)
|
||||||
(λ (n₂ : nat) (b₂ : nat.below (succ (succ n₂))), pr₁ b₂ + pr₁ (pr₂ b₂))))
|
(λ (n₂ : nat) (b₂ : nat.below (succ (succ n₂))), pr₁ b₂ + pr₁ (pr₂ b₂))))
|
||||||
|
|
||||||
theorem fib_0 : fib 0 = 1 :=
|
theorem fib_0 : fib 0 = 1 :=
|
||||||
|
|
|
@ -167,7 +167,7 @@ namespace finset
|
||||||
theorem empty_union {A : Type} (s : finset A) : ∅ ∪ s = s :=
|
theorem empty_union {A : Type} (s : finset A) : ∅ ∪ s = s :=
|
||||||
quot.induction_on s (λ l, quot.sound (λ a, by rewrite append_nil_left))
|
quot.induction_on s (λ l, quot.sound (λ a, by rewrite append_nil_left))
|
||||||
|
|
||||||
example : to_finset (1::2::nil) ∪ to_finset (2::3::nil) = ⟦1 :: 2 :: 2 :: 3 :: nil⟧ :=
|
example : to_finset ((1:nat)::2::nil) ∪ to_finset (2::3::nil) = ⟦1 :: 2 :: 2 :: 3 :: nil⟧ :=
|
||||||
rfl
|
rfl
|
||||||
|
|
||||||
example : to_finset [(1:nat), 1, 2, 3] = to_finset [2, 3, 1, 2, 2, 3] :=
|
example : to_finset [(1:nat), 1, 2, 3] = to_finset [2, 3, 1, 2, 2, 3] :=
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import data.nat data.sum data.sigma data.bool
|
import data.nat data.sum data.sigma data.bool
|
||||||
open nat sigma
|
open nat sigma algebra
|
||||||
|
|
||||||
inductive tree (A : Type) : Type :=
|
inductive tree (A : Type) : Type :=
|
||||||
| node : A → forest A → tree A
|
| node : A → forest A → tree A
|
||||||
|
|
|
@ -4,7 +4,7 @@ open nat well_founded decidable prod eq.ops
|
||||||
namespace playground
|
namespace playground
|
||||||
|
|
||||||
-- Setup
|
-- Setup
|
||||||
definition pair_nat.lt := lex lt lt
|
definition pair_nat.lt := lex nat.lt nat.lt
|
||||||
definition pair_nat.lt.wf [instance] : well_founded pair_nat.lt :=
|
definition pair_nat.lt.wf [instance] : well_founded pair_nat.lt :=
|
||||||
intro_k (prod.lex.wf lt.wf lt.wf) 20 -- the '20' is for being able to execute the examples... it means 20 recursive call without proof computation
|
intro_k (prod.lex.wf lt.wf lt.wf) 20 -- the '20' is for being able to execute the examples... it means 20 recursive call without proof computation
|
||||||
infixl `≺`:50 := pair_nat.lt
|
infixl `≺`:50 := pair_nat.lt
|
||||||
|
|
|
@ -26,10 +26,10 @@ definition group_to_struct [instance] (g : group) : group_struct (carrier g)
|
||||||
|
|
||||||
check group_struct
|
check group_struct
|
||||||
|
|
||||||
definition mul {A : Type} {s : group_struct A} (a b : A) : A
|
definition mul1 {A : Type} {s : group_struct A} (a b : A) : A
|
||||||
:= group_struct.rec (λ mul one inv h1 h2 h3, mul) s a b
|
:= group_struct.rec (λ mul one inv h1 h2 h3, mul) s a b
|
||||||
|
|
||||||
infixl `*` := mul
|
infixl `*` := mul1
|
||||||
|
|
||||||
constant G1 : group.{1}
|
constant G1 : group.{1}
|
||||||
constant G2 : group.{1}
|
constant G2 : group.{1}
|
||||||
|
|
|
@ -28,10 +28,10 @@ definition group_to_struct [instance] (g : group) : group_struct (carrier g)
|
||||||
|
|
||||||
check group_struct
|
check group_struct
|
||||||
|
|
||||||
definition mul {A : Type} [s : group_struct A] (a b : A) : A
|
definition mul1 {A : Type} [s : group_struct A] (a b : A) : A
|
||||||
:= group_struct.rec (λ mul one inv h1 h2 h3, mul) s a b
|
:= group_struct.rec (λ mul one inv h1 h2 h3, mul) s a b
|
||||||
|
|
||||||
infixl `*` := mul
|
infixl `*` := mul1
|
||||||
|
|
||||||
section
|
section
|
||||||
variable G1 : group
|
variable G1 : group
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import data.num
|
import data.num
|
||||||
check (λ {A : Type.{1}} (a : A), a) 10
|
check (λ {A : Type.{1}} (a : A), a) (10:num)
|
||||||
check (λ {A} a, a) 10
|
check (λ {A} a, a) 10
|
||||||
check (λ a, a) 10
|
check (λ a, a) (10:num)
|
||||||
|
|
|
@ -8,7 +8,7 @@ inductive univ :=
|
||||||
|
|
||||||
open univ
|
open univ
|
||||||
|
|
||||||
definition interp : univ → Type₁
|
definition interp [reducible] : univ → Type₁
|
||||||
| ubool := bool
|
| ubool := bool
|
||||||
| unat := nat
|
| unat := nat
|
||||||
| (uarrow fr to) := interp fr → interp to
|
| (uarrow fr to) := interp fr → interp to
|
||||||
|
@ -23,7 +23,7 @@ definition is_even : nat → bool
|
||||||
| zero := tt
|
| zero := tt
|
||||||
| (succ n) := bnot (is_even n)
|
| (succ n) := bnot (is_even n)
|
||||||
|
|
||||||
example : foo unat 10 = 11 := rfl
|
example : foo unat (10:nat) = 11 := rfl
|
||||||
example : foo ubool tt = ff := rfl
|
example : foo ubool tt = ff := rfl
|
||||||
example : foo (uarrow unat ubool) (λ x : nat, is_even x) 3 = tt := rfl
|
example : foo (uarrow unat ubool) (λ x : nat, is_even x) 3 = tt := rfl
|
||||||
example : foo (uarrow unat ubool) (λ x : nat, is_even x) 4 = ff := rfl
|
example : foo (uarrow unat ubool) (λ x : nat, is_even x) 4 = ff := rfl
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import data.nat
|
import data.nat
|
||||||
open nat
|
open nat
|
||||||
|
|
||||||
example : is_true (2 = 2) := trivial
|
example : is_true (2 = (2:nat)) := trivial
|
||||||
example : is_false (3 = 2) := trivial
|
example : is_false (3 = (2:nat)) := trivial
|
||||||
example : is_true (2 < 3) := trivial
|
example : is_true (2 < (3:nat)) := trivial
|
||||||
example : is_true (3 ∣ 9) := trivial
|
example : is_true (3 ∣ (9:nat)) := trivial
|
||||||
example : is_false (3 ∣ 7) := trivial
|
example : is_false (3 ∣ (7:nat)) := trivial
|
||||||
|
|
|
@ -7,5 +7,5 @@ intro a, exact a
|
||||||
end
|
end
|
||||||
check @foo
|
check @foo
|
||||||
|
|
||||||
example : foo 10 = 10 :=
|
example : foo 10 = (10:num) :=
|
||||||
rfl
|
rfl
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import data.nat
|
import data.nat
|
||||||
|
open algebra
|
||||||
|
|
||||||
example (a b : Prop) : a → b → a ∧ b :=
|
example (a b : Prop) : a → b → a ∧ b :=
|
||||||
begin
|
begin
|
||||||
|
|
|
@ -12,5 +12,6 @@ section
|
||||||
|
|
||||||
local attribute foo [coercion]
|
local attribute foo [coercion]
|
||||||
|
|
||||||
check s 10
|
check let a : nat := 10 in s a
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,18 +2,18 @@ import logic
|
||||||
|
|
||||||
constant matrix.{l} : Type.{l} → Type.{l}
|
constant matrix.{l} : Type.{l} → Type.{l}
|
||||||
constant same_dim {A : Type} : matrix A → matrix A → Prop
|
constant same_dim {A : Type} : matrix A → matrix A → Prop
|
||||||
constant add {A : Type} (m1 m2 : matrix A) {H : same_dim m1 m2} : matrix A
|
constant add1 {A : Type} (m1 m2 : matrix A) {H : same_dim m1 m2} : matrix A
|
||||||
|
|
||||||
theorem same_dim_irrel {A : Type} {m1 m2 : matrix A} {H1 H2 : same_dim m1 m2} : @add A m1 m2 H1 = @add A m1 m2 H2 :=
|
theorem same_dim_irrel {A : Type} {m1 m2 : matrix A} {H1 H2 : same_dim m1 m2} : @add1 A m1 m2 H1 = @add1 A m1 m2 H2 :=
|
||||||
rfl
|
rfl
|
||||||
open eq
|
open eq
|
||||||
theorem same_dim_eq_args {A : Type} {m1 m2 m1' m2' : matrix A} (H1 : m1 = m1') (H2 : m2 = m2') (H : same_dim m1 m2) : same_dim m1' m2' :=
|
theorem same_dim_eq_args {A : Type} {m1 m2 m1' m2' : matrix A} (H1 : m1 = m1') (H2 : m2 = m2') (H : same_dim m1 m2) : same_dim m1' m2' :=
|
||||||
subst H1 (subst H2 H)
|
subst H1 (subst H2 H)
|
||||||
|
|
||||||
theorem add_congr {A : Type} (m1 m2 m1' m2' : matrix A) (H1 : m1 = m1') (H2 : m2 = m2') (H : same_dim m1 m2) : @add A m1 m2 H = @add A m1' m2' (same_dim_eq_args H1 H2 H) :=
|
theorem add1_congr {A : Type} (m1 m2 m1' m2' : matrix A) (H1 : m1 = m1') (H2 : m2 = m2') (H : same_dim m1 m2) : @add1 A m1 m2 H = @add1 A m1' m2' (same_dim_eq_args H1 H2 H) :=
|
||||||
have base : ∀ (H1 : m1 = m1) (H2 : m2 = m2), @add A m1 m2 H = @add A m1 m2 (eq.rec (eq.rec H H1) H2), from
|
have base : ∀ (H1 : m1 = m1) (H2 : m2 = m2), @add1 A m1 m2 H = @add1 A m1 m2 (eq.rec (eq.rec H H1) H2), from
|
||||||
assume H1 H2, rfl,
|
assume H1 H2, rfl,
|
||||||
have general : ∀ (H1 : m1 = m1') (H2 : m2 = m2'), @add A m1 m2 H = @add A m1' m2' (eq.rec (eq.rec H H1) H2), from
|
have general : ∀ (H1 : m1 = m1') (H2 : m2 = m2'), @add1 A m1 m2 H = @add1 A m1' m2' (eq.rec (eq.rec H H1) H2), from
|
||||||
subst H1 (subst H2 base),
|
subst H1 (subst H2 base),
|
||||||
calc @add A m1 m2 H = @add A m1' m2' (eq.rec (eq.rec H H1) H2) : general H1 H2
|
calc @add1 A m1 m2 H = @add1 A m1' m2' (eq.rec (eq.rec H H1) H2) : general H1 H2
|
||||||
... = @add A m1' m2' (same_dim_eq_args H1 H2 H) : same_dim_irrel
|
... = @add1 A m1' m2' (same_dim_eq_args H1 H2 H) : same_dim_irrel
|
||||||
|
|
|
@ -2,14 +2,14 @@ import logic
|
||||||
|
|
||||||
constant matrix.{l} : Type.{l} → Type.{l}
|
constant matrix.{l} : Type.{l} → Type.{l}
|
||||||
constant same_dim {A : Type} : matrix A → matrix A → Prop
|
constant same_dim {A : Type} : matrix A → matrix A → Prop
|
||||||
constant add {A : Type} (m1 m2 : matrix A) {H : same_dim m1 m2} : matrix A
|
constant add1 {A : Type} (m1 m2 : matrix A) {H : same_dim m1 m2} : matrix A
|
||||||
open eq
|
open eq
|
||||||
theorem same_dim_eq_args {A : Type} {m1 m2 m1' m2' : matrix A} (H1 : m1 = m1') (H2 : m2 = m2') (H : same_dim m1 m2) : same_dim m1' m2' :=
|
theorem same_dim_eq_args {A : Type} {m1 m2 m1' m2' : matrix A} (H1 : m1 = m1') (H2 : m2 = m2') (H : same_dim m1 m2) : same_dim m1' m2' :=
|
||||||
subst H1 (subst H2 H)
|
subst H1 (subst H2 H)
|
||||||
|
|
||||||
theorem add_congr {A : Type} (m1 m2 m1' m2' : matrix A) (H1 : m1 = m1') (H2 : m2 = m2') (H : same_dim m1 m2) : @add A m1 m2 H = @add A m1' m2' (same_dim_eq_args H1 H2 H) :=
|
theorem add1_congr {A : Type} (m1 m2 m1' m2' : matrix A) (H1 : m1 = m1') (H2 : m2 = m2') (H : same_dim m1 m2) : @add1 A m1 m2 H = @add1 A m1' m2' (same_dim_eq_args H1 H2 H) :=
|
||||||
have base : ∀ (H1 : m1 = m1) (H2 : m2 = m2), @add A m1 m2 H = @add A m1 m2 (eq.rec (eq.rec H H1) H2), from
|
have base : ∀ (H1 : m1 = m1) (H2 : m2 = m2), @add1 A m1 m2 H = @add1 A m1 m2 (eq.rec (eq.rec H H1) H2), from
|
||||||
assume H1 H2, rfl,
|
assume H1 H2, rfl,
|
||||||
have general : ∀ (H1 : m1 = m1') (H2 : m2 = m2'), @add A m1 m2 H = @add A m1' m2' (eq.rec (eq.rec H H1) H2), from
|
have general : ∀ (H1 : m1 = m1') (H2 : m2 = m2'), @add1 A m1 m2 H = @add1 A m1' m2' (eq.rec (eq.rec H H1) H2), from
|
||||||
subst H1 (subst H2 base),
|
subst H1 (subst H2 base),
|
||||||
general H1 H2
|
general H1 H2
|
||||||
|
|
|
@ -3,5 +3,5 @@ open prod nat
|
||||||
example (a b : nat) : size_of (a, true, bool.tt, (λ c d : nat, c + d), option.some b) = a + b :=
|
example (a b : nat) : size_of (a, true, bool.tt, (λ c d : nat, c + d), option.some b) = a + b :=
|
||||||
rfl
|
rfl
|
||||||
|
|
||||||
example : size_of (pair (pair (pair 2 true) (λ a : nat, a)) (option.some 3)) = 5 :=
|
example : size_of (pair (pair (pair (2:nat) true) (λ a : nat, a)) (option.some (3:nat))) = 5 :=
|
||||||
rfl
|
rfl
|
||||||
|
|
|
@ -20,7 +20,7 @@ axiom add_one (n:nat) : n + (succ zero) = succ n
|
||||||
axiom add_le_right {n m : nat} (H : n ≤ m) (k : nat) : n + k ≤ m + k
|
axiom add_le_right {n m : nat} (H : n ≤ m) (k : nat) : n + k ≤ m + k
|
||||||
|
|
||||||
theorem succ_le {n m : nat} (H : n ≤ m) : succ n ≤ succ m
|
theorem succ_le {n m : nat} (H : n ≤ m) : succ n ≤ succ m
|
||||||
:= add_one m ▸ add_one n ▸ add_le_right H 1
|
:= add_one m ▸ add_one n ▸ add_le_right H (1:num)
|
||||||
|
|
||||||
end nat
|
end nat
|
||||||
end experiment
|
end experiment
|
||||||
|
|
|
@ -34,7 +34,7 @@ calc g (succ a) = pr₁ (well_founded.fix g.F (succ a)) : rfl
|
||||||
theorem g_all_zero (a : nat) : g a = zero :=
|
theorem g_all_zero (a : nat) : g a = zero :=
|
||||||
nat.induction_on a
|
nat.induction_on a
|
||||||
g_zero
|
g_zero
|
||||||
(λ a₁ (ih : g a₁ = zero), calc
|
(λ a₁ (ih : g a₁ = 0), calc
|
||||||
g (succ a₁) = g (g a₁) : g_succ
|
g (succ a₁) = g (g a₁) : g_succ
|
||||||
... = g 0 : ih
|
... = g 0 : ih
|
||||||
... = 0 : g_zero)
|
... = 0 : g_zero)
|
||||||
|
|
|
@ -63,14 +63,4 @@ exists.intro
|
||||||
(x+y)
|
(x+y)
|
||||||
(calc a+b = 2*x + 2*y : by rewrite [Hx, Hy]
|
(calc a+b = 2*x + 2*y : by rewrite [Hx, Hy]
|
||||||
... = 2*(x+y) : by rewrite mul.left_distrib)
|
... = 2*(x+y) : by rewrite mul.left_distrib)
|
||||||
|
|
||||||
theorem dvd_of_dvd_add_left {m n₁ n₂ : ℕ} (H₁ : m ∣ n₁ + n₂) (H₂ : m ∣ n₁) : m ∣ n₂ :=
|
|
||||||
obtain (c₁ : nat) (Hc₁ : n₁ + n₂ = m * c₁), from H₁,
|
|
||||||
obtain (c₂ : nat) (Hc₂ : n₁ = m * c₂), from H₂,
|
|
||||||
have aux : m * (c₁ - c₂) = n₂, from calc
|
|
||||||
m * (c₁ - c₂) = m * c₁ - m * c₂ : by rewrite mul_sub_left_distrib
|
|
||||||
... = n₁ + n₂ - m * c₂ : Hc₁
|
|
||||||
... = n₁ + n₂ - n₁ : Hc₂
|
|
||||||
... = n₂ : add_sub_cancel_left,
|
|
||||||
dvd.intro aux
|
|
||||||
end hidden
|
end hidden
|
||||||
|
|
|
@ -1,83 +1,83 @@
|
||||||
open num bool
|
open num bool
|
||||||
|
|
||||||
example : le 0 0 = tt := rfl
|
example : num.le 0 0 = tt := rfl
|
||||||
example : le 0 1 = tt := rfl
|
example : num.le 0 1 = tt := rfl
|
||||||
example : le 0 2 = tt := rfl
|
example : num.le 0 2 = tt := rfl
|
||||||
example : le 0 3 = tt := rfl
|
example : num.le 0 3 = tt := rfl
|
||||||
|
|
||||||
example : le 1 0 = ff := rfl
|
example : num.le 1 0 = ff := rfl
|
||||||
example : le 1 1 = tt := rfl
|
example : num.le 1 1 = tt := rfl
|
||||||
example : le 1 2 = tt := rfl
|
example : num.le 1 2 = tt := rfl
|
||||||
example : le 1 3 = tt := rfl
|
example : num.le 1 3 = tt := rfl
|
||||||
|
|
||||||
example : le 2 0 = ff := rfl
|
example : num.le 2 0 = ff := rfl
|
||||||
example : le 2 1 = ff := rfl
|
example : num.le 2 1 = ff := rfl
|
||||||
example : le 2 2 = tt := rfl
|
example : num.le 2 2 = tt := rfl
|
||||||
example : le 2 3 = tt := rfl
|
example : num.le 2 3 = tt := rfl
|
||||||
example : le 2 4 = tt := rfl
|
example : num.le 2 4 = tt := rfl
|
||||||
example : le 2 5 = tt := rfl
|
example : num.le 2 5 = tt := rfl
|
||||||
|
|
||||||
example : le 3 0 = ff := rfl
|
example : num.le 3 0 = ff := rfl
|
||||||
example : le 3 1 = ff := rfl
|
example : num.le 3 1 = ff := rfl
|
||||||
example : le 3 2 = ff := rfl
|
example : num.le 3 2 = ff := rfl
|
||||||
example : le 3 3 = tt := rfl
|
example : num.le 3 3 = tt := rfl
|
||||||
example : le 3 4 = tt := rfl
|
example : num.le 3 4 = tt := rfl
|
||||||
example : le 3 5 = tt := rfl
|
example : num.le 3 5 = tt := rfl
|
||||||
|
|
||||||
example : le 4 0 = ff := rfl
|
example : num.le 4 0 = ff := rfl
|
||||||
example : le 4 1 = ff := rfl
|
example : num.le 4 1 = ff := rfl
|
||||||
example : le 4 2 = ff := rfl
|
example : num.le 4 2 = ff := rfl
|
||||||
example : le 4 3 = ff := rfl
|
example : num.le 4 3 = ff := rfl
|
||||||
example : le 4 4 = tt := rfl
|
example : num.le 4 4 = tt := rfl
|
||||||
example : le 4 5 = tt := rfl
|
example : num.le 4 5 = tt := rfl
|
||||||
|
|
||||||
example : le 5 0 = ff := rfl
|
example : num.le 5 0 = ff := rfl
|
||||||
example : le 5 1 = ff := rfl
|
example : num.le 5 1 = ff := rfl
|
||||||
example : le 5 2 = ff := rfl
|
example : num.le 5 2 = ff := rfl
|
||||||
example : le 5 3 = ff := rfl
|
example : num.le 5 3 = ff := rfl
|
||||||
example : le 5 4 = ff := rfl
|
example : num.le 5 4 = ff := rfl
|
||||||
example : le 5 5 = tt := rfl
|
example : num.le 5 5 = tt := rfl
|
||||||
example : le 5 6 = tt := rfl
|
example : num.le 5 6 = tt := rfl
|
||||||
|
|
||||||
example : 0 - 0 = 0 := rfl
|
example : num.sub 0 0 = 0 := rfl
|
||||||
example : 0 - 1 = 0 := rfl
|
example : num.sub 0 1 = 0 := rfl
|
||||||
example : 0 - 2 = 0 := rfl
|
example : num.sub 0 2 = 0 := rfl
|
||||||
example : 0 - 3 = 0 := rfl
|
example : num.sub 0 3 = 0 := rfl
|
||||||
|
|
||||||
example : 1 - 0 = 1 := rfl
|
example : num.sub 1 0 = 1 := rfl
|
||||||
example : 1 - 1 = 0 := rfl
|
example : num.sub 1 1 = 0 := rfl
|
||||||
example : 1 - 2 = 0 := rfl
|
example : num.sub 1 2 = 0 := rfl
|
||||||
example : 1 - 3 = 0 := rfl
|
example : num.sub 1 3 = 0 := rfl
|
||||||
|
|
||||||
example : 2 - 0 = 2 := rfl
|
example : num.sub 2 0 = 2 := rfl
|
||||||
example : 2 - 1 = 1 := rfl
|
example : num.sub 2 1 = 1 := rfl
|
||||||
example : 2 - 2 = 0 := rfl
|
example : num.sub 2 2 = 0 := rfl
|
||||||
example : 2 - 3 = 0 := rfl
|
example : num.sub 2 3 = 0 := rfl
|
||||||
example : 2 - 4 = 0 := rfl
|
example : num.sub 2 4 = 0 := rfl
|
||||||
|
|
||||||
example : 3 - 0 = 3 := rfl
|
example : num.sub 3 0 = 3 := rfl
|
||||||
example : 3 - 1 = 2 := rfl
|
example : num.sub 3 1 = 2 := rfl
|
||||||
example : 3 - 2 = 1 := rfl
|
example : num.sub 3 2 = 1 := rfl
|
||||||
example : 3 - 3 = 0 := rfl
|
example : num.sub 3 3 = 0 := rfl
|
||||||
example : 3 - 4 = 0 := rfl
|
example : num.sub 3 4 = 0 := rfl
|
||||||
example : 3 - 5 = 0 := rfl
|
example : num.sub 3 5 = 0 := rfl
|
||||||
|
|
||||||
example : 4 - 0 = 4 := rfl
|
example : num.sub 4 0 = 4 := rfl
|
||||||
example : 4 - 1 = 3 := rfl
|
example : num.sub 4 1 = 3 := rfl
|
||||||
example : 4 - 2 = 2 := rfl
|
example : num.sub 4 2 = 2 := rfl
|
||||||
example : 4 - 3 = 1 := rfl
|
example : num.sub 4 3 = 1 := rfl
|
||||||
example : 4 - 4 = 0 := rfl
|
example : num.sub 4 4 = 0 := rfl
|
||||||
example : 4 - 5 = 0 := rfl
|
example : num.sub 4 5 = 0 := rfl
|
||||||
|
|
||||||
example : 5 - 0 = 5 := rfl
|
example : num.sub 5 0 = 5 := rfl
|
||||||
example : 5 - 1 = 4 := rfl
|
example : num.sub 5 1 = 4 := rfl
|
||||||
example : 5 - 2 = 3 := rfl
|
example : num.sub 5 2 = 3 := rfl
|
||||||
example : 5 - 3 = 2 := rfl
|
example : num.sub 5 3 = 2 := rfl
|
||||||
example : 5 - 4 = 1 := rfl
|
example : num.sub 5 4 = 1 := rfl
|
||||||
example : 5 - 5 = 0 := rfl
|
example : num.sub 5 5 = 0 := rfl
|
||||||
|
|
||||||
example : 11 - 5 = 6 := rfl
|
example : num.sub 11 5 = 6 := rfl
|
||||||
example : 5 - 11 = 0 := rfl
|
example : num.sub 5 11 = 0 := rfl
|
||||||
example : 12 - 7 = 5 := rfl
|
example : num.sub 12 7 = 5 := rfl
|
||||||
example : 120 - 12 = 108 := rfl
|
example : num.sub 120 12 = 108 := rfl
|
||||||
example : 111 - 11 = 100 := rfl
|
example : num.sub 111 11 = 100 := rfl
|
||||||
|
|
|
@ -3,8 +3,8 @@ import logic data.nat data.prod
|
||||||
open nat prod
|
open nat prod
|
||||||
open decidable
|
open decidable
|
||||||
|
|
||||||
constant modulo (x : ℕ) (y : ℕ) : ℕ
|
constant modulo1 (x : ℕ) (y : ℕ) : ℕ
|
||||||
infixl `mod` := modulo
|
infixl `mod` := modulo1
|
||||||
|
|
||||||
constant gcd_aux : ℕ × ℕ → ℕ
|
constant gcd_aux : ℕ × ℕ → ℕ
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
inductive one.{l} : Type.{max 1 l} :=
|
inductive one1.{l} : Type.{max 1 l} :=
|
||||||
unit : one.{l}
|
unit : one1.{l}
|
||||||
|
|
||||||
set_option pp.universes true
|
set_option pp.universes true
|
||||||
check one
|
check one1
|
||||||
|
|
||||||
|
|
||||||
inductive one2.{l} : Type.{max 1 l} :=
|
inductive one2.{l} : Type.{max 1 l} :=
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import data.num
|
import data.num
|
||||||
|
|
||||||
inductive one.{l} : Type.{l} :=
|
inductive one1.{l} : Type.{l} :=
|
||||||
unit : one
|
unit : one1
|
||||||
|
|
||||||
inductive pone : Type.{0} :=
|
inductive pone : Type.{0} :=
|
||||||
unit : pone
|
unit : pone
|
||||||
|
@ -17,7 +17,7 @@ inductive wrap2.{l} (A : Type.{l}) : Type.{max 1 l} :=
|
||||||
mk : A → wrap2 A
|
mk : A → wrap2 A
|
||||||
|
|
||||||
set_option pp.universes true
|
set_option pp.universes true
|
||||||
check @one.rec
|
check @one1.rec
|
||||||
check @pone.rec
|
check @pone.rec
|
||||||
check @two.rec
|
check @two.rec
|
||||||
check @wrap.rec
|
check @wrap.rec
|
||||||
|
|
|
@ -15,12 +15,12 @@ namespace int
|
||||||
constant int : Type.{1}
|
constant int : Type.{1}
|
||||||
constant add : int → int → int
|
constant add : int → int → int
|
||||||
constant le : int → int → Prop
|
constant le : int → int → Prop
|
||||||
constant one : int
|
constant one1 : int
|
||||||
infixl `+` := add
|
infixl `+` := add
|
||||||
infix `≤` := le
|
infix `≤` := le
|
||||||
axiom add_assoc (a b c : int) : (a + b) + c = a + (b + c)
|
axiom add_assoc (a b c : int) : (a + b) + c = a + (b + c)
|
||||||
axiom add_le_left {a b : int} (H : a ≤ b) (c : int) : c + a ≤ c + b
|
axiom add_le_left {a b : int} (H : a ≤ b) (c : int) : c + a ≤ c + b
|
||||||
definition lt (a b : int) := a + one ≤ b
|
definition lt (a b : int) := a + one1 ≤ b
|
||||||
infix `<` := lt
|
infix `<` := lt
|
||||||
end int
|
end int
|
||||||
|
|
||||||
|
@ -28,5 +28,5 @@ open int
|
||||||
open nat
|
open nat
|
||||||
open eq
|
open eq
|
||||||
theorem add_lt_left {a b : int} (H : a < b) (c : int) : c + a < c + b :=
|
theorem add_lt_left {a b : int} (H : a < b) (c : int) : c + a < c + b :=
|
||||||
subst (symm (add_assoc c a one)) (add_le_left H c)
|
subst (symm (add_assoc c a one1)) (add_le_left H c)
|
||||||
end experiment
|
end experiment
|
||||||
|
|
|
@ -3,5 +3,5 @@ open encodable decidable bool prod list nat option
|
||||||
variable l : list (nat × bool)
|
variable l : list (nat × bool)
|
||||||
check encode l
|
check encode l
|
||||||
eval encode [2, 1]
|
eval encode [2, 1]
|
||||||
example : decode (list nat) (encode [1, 1]) = some [1, 1] :=
|
example : decode (list nat) (encode [(1:nat), 1]) = some [1, 1] :=
|
||||||
rfl
|
rfl
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import data.int
|
import data.int
|
||||||
open [coercions] int
|
open [coercions] [classes] int
|
||||||
open [coercions] nat
|
open [coercions] nat
|
||||||
|
|
||||||
definition lt (a b : int) := int.le (int.add a 1) b
|
definition lt1 (a b : int) := int.le (int.add a 1) b
|
||||||
infix `<` := lt
|
infix `<` := lt1
|
||||||
infixl `+` := int.add
|
infixl `+` := int.add
|
||||||
|
|
||||||
theorem lt_add_succ2 (a : int) (n : nat) : a < a + nat.succ n :=
|
theorem lt_add_succ2 (a : int) (n : nat) : a < a + nat.succ n :=
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import logic data.prod
|
import data.nat logic data.prod
|
||||||
open prod
|
open prod nat
|
||||||
|
|
||||||
-- Test tuple notation
|
-- Test tuple notation
|
||||||
check (3, false, 1, true)
|
check ((3:nat), false, (1:num), true)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import data.rat
|
import data.rat
|
||||||
open rat
|
open rat int
|
||||||
|
|
||||||
attribute rat.of_int [coercion]
|
attribute rat.of_int [coercion]
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import data.rat
|
import data.rat
|
||||||
open rat
|
open rat
|
||||||
|
|
||||||
attribute rat.of_int [coercion]
|
example : (1:rat) + 2⁻¹ + 3 = 3 + 2⁻¹ + 1⁻¹ :=
|
||||||
|
|
||||||
example : 1 + 2⁻¹ + 3 = 3 + 2⁻¹ + 1⁻¹ :=
|
|
||||||
rfl
|
rfl
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
definition x [reducible] := 10
|
open nat
|
||||||
definition y := 20
|
definition x [reducible] := (10:nat)
|
||||||
definition z [irreducible] := 30
|
definition y := (20:nat)
|
||||||
definition w := 40
|
definition z [irreducible] := (30:nat)
|
||||||
|
definition w := (40:nat)
|
||||||
|
|
||||||
|
|
||||||
(*
|
(*
|
||||||
local env = get_env()
|
local env = get_env()
|
||||||
|
@ -21,8 +23,6 @@ definition w := 40
|
||||||
assert(tc:whnf(w) == w)
|
assert(tc:whnf(w) == w)
|
||||||
-- Opaque and definitions marked as irreducibled are not unfolded
|
-- Opaque and definitions marked as irreducibled are not unfolded
|
||||||
local tc = non_irreducible_type_checker(env)
|
local tc = non_irreducible_type_checker(env)
|
||||||
assert(tc:whnf(x) == val_x)
|
|
||||||
assert(tc:whnf(y) == val_y)
|
|
||||||
assert(tc:whnf(z) == z)
|
assert(tc:whnf(z) == z)
|
||||||
-- Only definitions marked as reducible are unfolded
|
-- Only definitions marked as reducible are unfolded
|
||||||
local tc = reducible_type_checker(env)
|
local tc = reducible_type_checker(env)
|
||||||
|
@ -30,12 +30,6 @@ definition w := 40
|
||||||
assert(tc:whnf(y) == y)
|
assert(tc:whnf(y) == y)
|
||||||
assert(tc:whnf(z) == z)
|
assert(tc:whnf(z) == z)
|
||||||
assert(tc:whnf(w) == w)
|
assert(tc:whnf(w) == w)
|
||||||
-- Default: only opaque definitions are not unfolded.
|
|
||||||
-- Opaqueness is a feature of the kernel.
|
|
||||||
local tc = type_checker(env)
|
|
||||||
assert(tc:whnf(x) == val_x)
|
|
||||||
assert(tc:whnf(y) == val_y)
|
|
||||||
assert(tc:whnf(z) == val_z)
|
|
||||||
*)
|
*)
|
||||||
|
|
||||||
eval [whnf] x
|
eval [whnf] x
|
||||||
|
|
|
@ -3,4 +3,4 @@ open nat
|
||||||
constant f : nat → nat
|
constant f : nat → nat
|
||||||
|
|
||||||
theorem tst1 (x y : nat) (H1 : (λ z, z + 0) x = y) : f x = f y :=
|
theorem tst1 (x y : nat) (H1 : (λ z, z + 0) x = y) : f x = f y :=
|
||||||
by rewrite [▸* at H1, ^add at H1, H1]
|
by rewrite [▸* at H1, add_zero at H1, H1]
|
||||||
|
|
|
@ -3,7 +3,7 @@ open nat
|
||||||
constant f : nat → nat
|
constant f : nat → nat
|
||||||
|
|
||||||
example (x y : nat) (H1 : (λ z, z + 0) x = y) : f x = f y :=
|
example (x y : nat) (H1 : (λ z, z + 0) x = y) : f x = f y :=
|
||||||
by rewrite [▸* at H1, ^ [add, nat.rec_on, of_num] at H1, H1]
|
by rewrite [▸* at H1, add_zero at H1, H1]
|
||||||
|
|
||||||
example (x y : nat) (H1 : (λ z, z + 0) x = y) : f x = f y :=
|
example (x y : nat) (H1 : (λ z, z + 0) x = y) : f x = f y :=
|
||||||
by rewrite [▸* at H1, ↑[add, nat.rec_on, of_num] at H1, H1]
|
by rewrite [▸* at H1, add_zero at H1, H1]
|
||||||
|
|
|
@ -8,5 +8,5 @@ attribute of_num [unfold 1]
|
||||||
|
|
||||||
example (x y : nat) (H1 : f x 0 0 = 0) : x = 0 :=
|
example (x y : nat) (H1 : f x 0 0 = 0) : x = 0 :=
|
||||||
begin
|
begin
|
||||||
rewrite [▸* at H1, 4>add_zero at H1, H1]
|
rewrite [↑f at H1, 4>add_zero at H1, H1]
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,10 +16,10 @@ namespace list
|
||||||
section
|
section
|
||||||
variable {T : Type}
|
variable {T : Type}
|
||||||
notation `[` l:(foldr `,` (h t, cons h t) nil) `]` := l
|
notation `[` l:(foldr `,` (h t, cons h t) nil) `]` := l
|
||||||
check [10, 20, 30]
|
check [(10:num), 20, 30]
|
||||||
end
|
end
|
||||||
end list
|
end list
|
||||||
|
|
||||||
open list
|
open list
|
||||||
check [10, 20, 40]
|
check [(10:num), 20, 40]
|
||||||
check 10 ◀ 20
|
check (10:num) ◀ 20
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import logic
|
import logic
|
||||||
open bool
|
open bool nat
|
||||||
|
|
||||||
definition set {{T : Type}} := T → bool
|
definition set {{T : Type}} := T → bool
|
||||||
infix `∈` := λx A, A x = tt
|
infix `∈` := λx A, A x = tt
|
||||||
|
|
||||||
check 1 ∈ (λ x, tt)
|
check 1 ∈ (λ x : nat, tt)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import data.nat
|
import data.nat
|
||||||
open nat
|
open nat
|
||||||
|
|
||||||
example : ∀ a b, a + b = b + a :=
|
example : ∀ a b : nat, a + b = b + a :=
|
||||||
show ∀ a b : nat, a + b = b + a
|
show ∀ a b : nat, a + b = b + a
|
||||||
| 0 0 := rfl
|
| 0 0 := rfl
|
||||||
| 0 (succ b) := by rewrite zero_add
|
| 0 (succ b) := by rewrite zero_add
|
||||||
|
|
|
@ -1,24 +1,6 @@
|
||||||
set_option structure.eta_thm true
|
set_option structure.eta_thm true
|
||||||
set_option structure.proj_mk_thm true
|
set_option structure.proj_mk_thm true
|
||||||
|
|
||||||
structure has_mul [class] (A : Type) :=
|
|
||||||
(mul : A → A → A)
|
|
||||||
|
|
||||||
structure has_add [class] (A : Type) :=
|
|
||||||
(add : A → A → A)
|
|
||||||
|
|
||||||
structure has_one [class] (A : Type) :=
|
|
||||||
(one : A)
|
|
||||||
|
|
||||||
structure has_zero [class] (A : Type) :=
|
|
||||||
(zero : A)
|
|
||||||
|
|
||||||
structure has_inv [class] (A : Type) :=
|
|
||||||
(inv : A → A)
|
|
||||||
|
|
||||||
structure has_neg [class] (A : Type) :=
|
|
||||||
(neg : A → A)
|
|
||||||
|
|
||||||
structure semigroup [class] (A : Type) extends has_mul A :=
|
structure semigroup [class] (A : Type) extends has_mul A :=
|
||||||
(mul_assoc : ∀a b c, mul (mul a b) c = mul a (mul b c))
|
(mul_assoc : ∀a b c, mul (mul a b) c = mul a (mul b c))
|
||||||
|
|
||||||
|
|
|
@ -7,11 +7,11 @@ definition s : nat × nat := pair 10 20
|
||||||
structure test :=
|
structure test :=
|
||||||
(A : Type) (a : A) (B : A → Type) (b : B a)
|
(A : Type) (a : A) (B : A → Type) (b : B a)
|
||||||
|
|
||||||
definition s2 := ⦃ test, a := 3, b := 10 ⦄
|
definition s2 := ⦃ test, a := (3:nat), b := (10:nat) ⦄
|
||||||
|
|
||||||
eval s2
|
eval s2
|
||||||
|
|
||||||
definition s3 := {| test, a := 20, s2 |}
|
definition s3 := {| test, a := (20:nat), s2 |}
|
||||||
|
|
||||||
eval s3
|
eval s3
|
||||||
|
|
||||||
|
|
|
@ -19,13 +19,12 @@ definition num_to_nat (n : num) : nat
|
||||||
:= num.rec zero (λ n, pos_num_to_nat n) n
|
:= num.rec zero (λ n, pos_num_to_nat n) n
|
||||||
attribute num_to_nat [coercion]
|
attribute num_to_nat [coercion]
|
||||||
|
|
||||||
-- Now we can write 2 + 3, the coercion will be applied
|
check (2:num) + 3
|
||||||
check 2 + 3
|
|
||||||
|
|
||||||
-- Define an assump as an alias for the eassumption tactic
|
-- Define an assump as an alias for the eassumption tactic
|
||||||
definition assump : tactic := tactic.eassumption
|
definition assump : tactic := tactic.eassumption
|
||||||
|
|
||||||
theorem T1 {p : nat → Prop} {a : nat } (H : p (a+2)) : ∃ x, p (succ x)
|
theorem T1 {p : nat → Prop} {a : nat } (H : p (a+(2:num))) : ∃ x, p (succ x)
|
||||||
:= by apply exists.intro; assump
|
:= by apply exists.intro; assump
|
||||||
|
|
||||||
definition is_zero (n : nat)
|
definition is_zero (n : nat)
|
||||||
|
|
|
@ -5,8 +5,8 @@ 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
|
||||||
|
|
||||||
inductive one.{l} : Type.{max 1 l} :=
|
inductive one1.{l} : Type.{max 1 l} :=
|
||||||
star : one
|
star : one1
|
||||||
|
|
||||||
set_option pp.universes true
|
set_option pp.universes true
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ namespace manual
|
||||||
variable {A : Type.{l₁}}
|
variable {A : Type.{l₁}}
|
||||||
variable (C : tree A → Type.{l₂})
|
variable (C : tree A → Type.{l₂})
|
||||||
definition below (t : tree A) : Type :=
|
definition below (t : tree A) : Type :=
|
||||||
tree.rec_on t (λ a, one.{l₂}) (λ t₁ t₂ r₁ r₂, C t₁ × C t₂ × r₁ × r₂)
|
tree.rec_on t (λ a, one1.{l₂}) (λ t₁ t₂ r₁ r₂, C t₁ × C t₂ × r₁ × r₂)
|
||||||
end
|
end
|
||||||
|
|
||||||
section
|
section
|
||||||
|
@ -27,7 +27,7 @@ namespace manual
|
||||||
definition below_rec_on (t : tree A) (H : Π (n : tree A), below C n → C n) : C t
|
definition below_rec_on (t : tree A) (H : Π (n : tree A), below C n → C n) : C t
|
||||||
:= have general : C t × below C t, from
|
:= have general : C t × below C t, from
|
||||||
tree.rec_on t
|
tree.rec_on t
|
||||||
(λa, (H (leaf a) one.star, one.star))
|
(λa, (H (leaf a) one1.star, one1.star))
|
||||||
(λ (l r : tree A) (Hl : C l × below C l) (Hr : C r × below C r),
|
(λ (l r : tree A) (Hl : C l × below C l) (Hr : C r × below C r),
|
||||||
have b : below C (node l r), from
|
have b : below C (node l r), from
|
||||||
(pr₁ Hl, pr₁ Hr, pr₂ Hl, pr₂ Hr),
|
(pr₁ Hl, pr₁ Hr, pr₂ Hl, pr₂ Hr),
|
||||||
|
|
|
@ -5,8 +5,8 @@ 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
|
||||||
|
|
||||||
inductive one.{l} : Type.{max 1 l} :=
|
inductive one1.{l} : Type.{max 1 l} :=
|
||||||
star : one
|
star : one1
|
||||||
|
|
||||||
set_option pp.universes true
|
set_option pp.universes true
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ namespace tree
|
||||||
variable {A : Type.{l₁}}
|
variable {A : Type.{l₁}}
|
||||||
variable (C : tree A → Type.{l₂})
|
variable (C : tree A → Type.{l₂})
|
||||||
definition below (t : tree A) : Type :=
|
definition below (t : tree A) : Type :=
|
||||||
tree.rec_on t (λ a, one.{l₂}) (λ t₁ t₂ r₁ r₂, C t₁ × C t₂ × r₁ × r₂)
|
tree.rec_on t (λ a, one1.{l₂}) (λ t₁ t₂ r₁ r₂, C t₁ × C t₂ × r₁ × r₂)
|
||||||
end
|
end
|
||||||
|
|
||||||
section
|
section
|
||||||
|
@ -27,7 +27,7 @@ namespace tree
|
||||||
definition below_rec_on (t : tree A) (H : Π (n : tree A), below C n → C n) : C t
|
definition below_rec_on (t : tree A) (H : Π (n : tree A), below C n → C n) : C t
|
||||||
:= have general : C t × below C t, from
|
:= have general : C t × below C t, from
|
||||||
tree.rec_on t
|
tree.rec_on t
|
||||||
(λa, (H (leaf a) one.star, one.star))
|
(λa, (H (leaf a) one1.star, one1.star))
|
||||||
(λ (l r : tree A) (Hl : C l × below C l) (Hr : C r × below C r),
|
(λ (l r : tree A) (Hl : C l × below C l) (Hr : C r × below C r),
|
||||||
have b : below C (node l r), from
|
have b : below C (node l r), from
|
||||||
(pr₁ Hl, pr₁ Hr, pr₂ Hl, pr₂ Hr),
|
(pr₁ Hl, pr₁ Hr, pr₂ Hl, pr₂ Hr),
|
||||||
|
|
|
@ -5,8 +5,8 @@ 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
|
||||||
|
|
||||||
inductive one.{l} : Type.{max 1 l} :=
|
inductive one1.{l} : Type.{max 1 l} :=
|
||||||
star : one
|
star : one1
|
||||||
|
|
||||||
set_option pp.universes true
|
set_option pp.universes true
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ namespace tree
|
||||||
variable {A : Type.{l₁}}
|
variable {A : Type.{l₁}}
|
||||||
variable (C : tree A → Type.{l₂})
|
variable (C : tree A → Type.{l₂})
|
||||||
definition below (t : tree A) : Type :=
|
definition below (t : tree A) : Type :=
|
||||||
tree.rec_on t (λ a, one.{l₂}) (λ t₁ t₂ r₁ r₂, C t₁ × C t₂ × r₁ × r₂)
|
tree.rec_on t (λ a, one1.{l₂}) (λ t₁ t₂ r₁ r₂, C t₁ × C t₂ × r₁ × r₂)
|
||||||
end
|
end
|
||||||
|
|
||||||
section
|
section
|
||||||
|
@ -27,7 +27,7 @@ namespace tree
|
||||||
definition below_rec_on (t : tree A) (H : Π (n : tree A), below C n → C n) : C t
|
definition below_rec_on (t : tree A) (H : Π (n : tree A), below C n → C n) : C t
|
||||||
:= have general : C t × below C t, from
|
:= have general : C t × below C t, from
|
||||||
tree.rec_on t
|
tree.rec_on t
|
||||||
(λa, (H (leaf a) one.star, one.star))
|
(λa, (H (leaf a) one1.star, one1.star))
|
||||||
(λ (l r : tree A) (Hl : C l × below C l) (Hr : C r × below C r),
|
(λ (l r : tree A) (Hl : C l × below C l) (Hr : C r × below C r),
|
||||||
have b : below C (node l r), from
|
have b : below C (node l r), from
|
||||||
(pr₁ Hl, pr₁ Hr, pr₂ Hl, pr₂ Hr),
|
(pr₁ Hl, pr₁ Hr, pr₂ Hl, pr₂ Hr),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import logic data.nat
|
import logic data.nat
|
||||||
open eq.ops nat
|
open eq.ops nat algebra
|
||||||
|
|
||||||
inductive tree (A : Type) :=
|
inductive tree (A : Type) :=
|
||||||
| leaf : A → tree A
|
| leaf : A → tree A
|
||||||
|
@ -27,10 +27,10 @@ lt_succ_of_le (le_max_right (height t₁) (height t₂))
|
||||||
theorem height_lt.trans {A : Type} : transitive (@height_lt A) :=
|
theorem height_lt.trans {A : Type} : transitive (@height_lt A) :=
|
||||||
inv_image.trans lt height @lt.trans
|
inv_image.trans lt height @lt.trans
|
||||||
|
|
||||||
example : height_lt (leaf 2) (node (leaf 1) (leaf 2)) :=
|
example : height_lt (leaf (2:nat)) (node (leaf 1) (leaf 2)) :=
|
||||||
!height_lt.node_right
|
!height_lt.node_right
|
||||||
|
|
||||||
example : height_lt (leaf 2) (node (node (leaf 1) (leaf 2)) (leaf 3)) :=
|
example : height_lt (leaf (2:nat)) (node (node (leaf 1) (leaf 2)) (leaf 3)) :=
|
||||||
height_lt.trans !height_lt.node_right !height_lt.node_left
|
height_lt.trans !height_lt.node_right !height_lt.node_left
|
||||||
|
|
||||||
end tree
|
end tree
|
||||||
|
|
|
@ -36,11 +36,11 @@ definition subterm {A : Type} : tree A → tree A → Prop := tc (@direct_subter
|
||||||
|
|
||||||
definition subterm.wf {A : Type} : well_founded (@subterm A) :=
|
definition subterm.wf {A : Type} : well_founded (@subterm A) :=
|
||||||
tc.wf (@direct_subterm.wf A)
|
tc.wf (@direct_subterm.wf A)
|
||||||
|
open nat
|
||||||
example : subterm (leaf 2) (node (leaf 1) (leaf 2)) :=
|
example : subterm (leaf (2:nat)) (node (leaf 1) (leaf 2)) :=
|
||||||
!tc.base !direct_subterm.node_r
|
!tc.base !direct_subterm.node_r
|
||||||
|
|
||||||
example : subterm (leaf 2) (node (node (leaf 1) (leaf 2)) (leaf 3)) :=
|
example : subterm (leaf (2:nat)) (node (node (leaf 1) (leaf 2)) (leaf 3)) :=
|
||||||
have s₁ : subterm (leaf 2) (node (leaf 1) (leaf 2)), from
|
have s₁ : subterm (leaf 2) (node (leaf 1) (leaf 2)), from
|
||||||
!tc.base !direct_subterm.node_r,
|
!tc.base !direct_subterm.node_r,
|
||||||
have s₂ : subterm (node (leaf 1) (leaf 2)) (node (node (leaf 1) (leaf 2)) (leaf 3)), from
|
have s₂ : subterm (node (leaf 1) (leaf 2)) (node (node (leaf 1) (leaf 2)) (leaf 3)), from
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import logic
|
import logic
|
||||||
|
|
||||||
definition proj1 (x : num) (y : num) := x
|
definition proj1 (x : num) (y : num) := x
|
||||||
definition One := 1
|
definition One : num := 1
|
||||||
|
|
||||||
(*
|
(*
|
||||||
local num = Const("num")
|
local num = Const("num")
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import data.prod data.num logic.quantifiers
|
import data.prod data.num logic.quantifiers
|
||||||
open prod
|
open prod nat
|
||||||
|
|
||||||
check (true, false, 10)
|
check (true, false, (10:nat))
|
||||||
|
|
||||||
-- definition a f := f
|
-- definition a f := f
|
||||||
|
|
||||||
|
|
|
@ -7,8 +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,
|
|
||||||
rewrite [succ_add]
|
rewrite [succ_add]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -10,5 +10,5 @@ definition unzip : Π {n : nat}, vector (A × B) n → vector A n × vector B n
|
||||||
(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) : nat × nat) :: nil) = (1 :: 2 :: nil, 20 :: 30 :: nil) :=
|
||||||
rfl
|
rfl
|
||||||
|
|
|
@ -75,7 +75,7 @@ namespace vector
|
||||||
(λ (n₁ : nat) (a₁ : A) (v₁ : vector A n₁) (B : bw (vcons a₁ v₁)),
|
(λ (n₁ : nat) (a₁ : A) (v₁ : vector A n₁) (B : bw (vcons a₁ v₁)),
|
||||||
vcons a₁ (pr₁ B)))
|
vcons a₁ (pr₁ B)))
|
||||||
|
|
||||||
example : append (1 :: 2 :: vnil) (3 :: vnil) = 1 :: 2 :: 3 :: vnil :=
|
example : append ((1:nat) :: 2 :: vnil) (3 :: vnil) = 1 :: 2 :: 3 :: vnil :=
|
||||||
rfl
|
rfl
|
||||||
|
|
||||||
definition head {A : Type} {n : nat} (v : vector A (succ n)) : A :=
|
definition head {A : Type} {n : nat} (v : vector A (succ n)) : A :=
|
||||||
|
|
Loading…
Reference in a new issue