2013-09-02 19:29:21 +00:00
|
|
|
|
Set: pp::colors
|
2013-09-03 17:44:51 +00:00
|
|
|
|
Set: pp::unicode
|
2013-09-01 02:15:48 +00:00
|
|
|
|
Assumed: N
|
|
|
|
|
Assumed: lt
|
|
|
|
|
Assumed: zero
|
|
|
|
|
Assumed: one
|
|
|
|
|
Assumed: two
|
|
|
|
|
Assumed: three
|
|
|
|
|
Assumed: two_lt_three
|
|
|
|
|
Defined: vector
|
|
|
|
|
Defined: const
|
|
|
|
|
Defined: update
|
|
|
|
|
Defined: select
|
|
|
|
|
Defined: map
|
2013-09-01 17:34:57 +00:00
|
|
|
|
Axiom two_lt_three : two < three
|
|
|
|
|
Definition vector (A : Type) (n : N) : Type := Π (i : N) (H : i < n), A
|
|
|
|
|
Definition const {A : Type} (n : N) (d : A) : vector A n := λ (i : N) (H : i < n), d
|
|
|
|
|
Definition const::explicit (A : Type) (n : N) (d : A) : vector A n := const n d
|
|
|
|
|
Definition update {A : Type} {n : N} (v : vector A n) (i : N) (d : A) : vector A n :=
|
|
|
|
|
λ (j : N) (H : j < n), if A (j = i) d (v j H)
|
|
|
|
|
Definition update::explicit (A : Type) (n : N) (v : vector A n) (i : N) (d : A) : vector A n := update v i d
|
|
|
|
|
Definition select {A : Type} {n : N} (v : vector A n) (i : N) (H : i < n) : A := v i H
|
|
|
|
|
Definition select::explicit (A : Type) (n : N) (v : vector A n) (i : N) (H : i < n) : A := select v i H
|
|
|
|
|
Definition map {A B C : Type} {n : N} (f : A → B → C) (v1 : vector A n) (v2 : vector B n) : vector C n :=
|
|
|
|
|
λ (i : N) (H : i < n), f (v1 i H) (v2 i H)
|
|
|
|
|
Definition map::explicit (A B C : Type) (n : N) (f : A → B → C) (v1 : vector A n) (v2 : vector B n) : vector C n :=
|
2013-09-01 02:15:48 +00:00
|
|
|
|
map f v1 v2
|
|
|
|
|
Bool
|
|
|
|
|
⊤
|
|
|
|
|
vector Bool three
|
|
|
|
|
|
|
|
|
|
--------
|
2013-09-01 17:34:57 +00:00
|
|
|
|
Π (A : Type) (n : N) (v : vector A n) (i : N) (H : i < n), A
|
2013-09-01 02:15:48 +00:00
|
|
|
|
|
|
|
|
|
map type --->
|
2013-09-01 17:34:57 +00:00
|
|
|
|
Π (A B C : Type) (n : N) (f : A → B → C) (v1 : vector A n) (v2 : vector B n), vector C n
|
2013-09-01 02:15:48 +00:00
|
|
|
|
|
|
|
|
|
map normal form -->
|
2013-09-01 17:34:57 +00:00
|
|
|
|
λ (A B C : Type)
|
2013-09-01 02:15:48 +00:00
|
|
|
|
(n : N)
|
2013-09-01 17:34:57 +00:00
|
|
|
|
(f : A → B → C)
|
|
|
|
|
(v1 : Π (i : N) (H : i < n), A)
|
|
|
|
|
(v2 : Π (i : N) (H : i < n), B)
|
2013-09-01 02:15:48 +00:00
|
|
|
|
(i : N)
|
|
|
|
|
(H : i < n),
|
|
|
|
|
f (v1 i H) (v2 i H)
|
|
|
|
|
|
|
|
|
|
update normal form -->
|
2013-09-04 15:30:04 +00:00
|
|
|
|
λ (A : Type) (n : N) (v : Π (i : N) (H : i < n), A) (i : N) (d : A) (j : N) (H : j < n), if A (j = i) d (v j H)
|