refactor(library/data): move vector as indexed family to examples folder

This commit is contained in:
Leonardo de Moura 2015-08-12 15:05:14 -07:00
parent 840c1a3693
commit b4024982a2
27 changed files with 32 additions and 28 deletions

View file

@ -16,9 +16,9 @@ the expression =v = w= since it would not be able to establish that
_definitionally equal_.
#+BEGIN_SRC lean
import data.vector data.nat
import data.fixed_list data.nat
open nat
check λ (v : vector nat (2+3)) (w : vector nat 5), v = w
check λ (v : fixed_list nat (2+3)) (w : fixed_list nat 5), v = w
#+END_SRC
Similarly, the following definition only type checks because =id= is transparent, and the type checker can establish that

View file

@ -4,4 +4,5 @@ Released under Apache 2.0 license as described in the file LICENSE.
Author: Jeremy Avigad
-/
import .empty .unit .bool .num .string .nat .int .rat .fintype
import .prod .sum .sigma .option .subtype .quotient .list .vector .finset .set .stream
import .prod .sum .sigma .option .subtype .quotient .list .finset .set .stream
import .fin

View file

@ -2,8 +2,11 @@
Copyright (c) 2014 Floris van Doorn. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: Floris van Doorn, Leonardo de Moura
This file demonstrates how to encode vectors using indexed inductive families.
In standard library we do not use this approach.
-/
import data.nat data.list data.fin
import data.nat data.list data.fin data.fixed_list
open nat prod fin
inductive vector (A : Type) : nat → Type :=

View file

@ -1,4 +1,4 @@
import data.vector
import data.examples.vector
open nat vector
definition fib : nat → nat,

View file

@ -1,4 +1,4 @@
import data.vector
import data.examples.vector
open nat vector
set_option pp.implicit true

View file

@ -1,4 +1,4 @@
import data.vector
import data.examples.vector
open nat
theorem tst (n : nat) (v : vector nat n) : v = v :=

View file

@ -1,4 +1,4 @@
import data.vector
import data.examples.vector
open nat vector
variable {A : Type}

View file

@ -1,4 +1,4 @@
import data.vector
import data.examples.vector
example (A : Type) (n : nat) (v : vector A n) : v = v :=
begin

View file

@ -1,4 +1,4 @@
import data.vector
import data.examples.vector
open nat prod.ops
example (n : nat) (v₁ : vector nat n) (v₂ : vector nat 0) (h₁ : (v₂, n).2 = 0) (h₂ : n = 0) (h₃ : eq.rec_on h₁ v₁ = v₂) : v₂ = eq.rec_on h₂ v₁ :=

View file

@ -1,4 +1,4 @@
import data.vector
import data.examples.vector
open vector nat decidable
variable A : Type

View file

@ -1,4 +1,4 @@
import logic data.prod data.vector
import logic data.prod data.examples.vector
open prod nat inhabited vector
theorem tst1 : inhabited (vector nat 2)

View file

@ -1,4 +1,4 @@
import data.vector
import data.examples.vector
open nat
namespace vector

View file

@ -1,4 +1,4 @@
import data.vector
import data.examples.vector
open nat vector
definition last {A : Type} : Π {n}, vector A (succ n) → A

View file

@ -1,4 +1,4 @@
import data.vector data.prod
import data.examples.vector data.prod
open nat vector prod
variables {A B : Type}

View file

@ -1,4 +1,4 @@
import data.vector
import data.examples.vector
open nat vector
definition swap {A : Type} : Π {n}, vector A (succ (succ n)) → vector A (succ (succ n))

View file

@ -1,4 +1,4 @@
import data.vector
import data.examples.vector
open nat vector
definition diag {A : Type} : Π {n}, vector (vector A n) n → vector A n

View file

@ -1,4 +1,4 @@
import data.vector
import data.examples.vector
open vector
definition map {A B C : Type} (f : A → B → C) : Π {n}, vector A n → vector B n → vector C n

View file

@ -1,4 +1,4 @@
import data.vector
import data.examples.vector
open vector
set_option pp.implicit true

View file

@ -1,4 +1,4 @@
import data.vector
import data.examples.vector
open nat vector
example (a b : nat) : succ a = succ b → a + 2 = b + 2 :=

View file

@ -1,4 +1,4 @@
import data.vector
import data.examples.vector
open nat
namespace vector

View file

@ -1,4 +1,4 @@
import data.vector
import data.examples.vector
open nat vector
variables {A B : Type}

View file

@ -1,4 +1,4 @@
import data.vector
import data.examples.vector
open nat vector
variable {A : Type}

View file

@ -1,4 +1,4 @@
import data.list data.vector
import data.list data.examples.vector
variables {A B : Type}

View file

@ -1,4 +1,4 @@
import data.vector
import data.examples.vector
open nat vector prod
variables {A B : Type}

View file

@ -1,4 +1,4 @@
import data.vector
import data.examples.vector
open nat vector
variables {A B : Type}

View file

@ -1,4 +1,4 @@
import data.vector
import data.examples.vector
open nat vector prod
variables {A B : Type}

View file

@ -1,4 +1,4 @@
import data.nat data.vector data.list.basic
import data.nat data.examples.vector data.list.basic
attribute nat [recursor]