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
|
2013-09-08 18:04:07 +00:00
|
|
|
|
Definition vector (A : Type) (n : N) : Type := Π (i : N), (i < n) → A
|
2013-09-01 17:34:57 +00:00
|
|
|
|
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 :=
|
2013-10-29 22:53:50 +00:00
|
|
|
|
λ (j : N) (H : j < n), if (j = i) d (v j H)
|
2013-09-01 17:34:57 +00:00
|
|
|
|
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
|
2013-09-09 05:54:22 +00:00
|
|
|
|
select (update (const three ⊥) two ⊤) two two_lt_three : Bool
|
2013-10-29 23:20:02 +00:00
|
|
|
|
if (two == two) ⊤ ⊥
|
2013-09-09 05:54:22 +00:00
|
|
|
|
update (const three ⊥) two ⊤ : vector Bool three
|
2013-09-01 02:15:48 +00:00
|
|
|
|
|
|
|
|
|
--------
|
2013-09-09 05:54:22 +00:00
|
|
|
|
select::explicit : Π (A : Type) (n : N) (v : vector A n) (i : N), (i < n) → A
|
2013-09-01 02:15:48 +00:00
|
|
|
|
|
|
|
|
|
map type --->
|
2013-09-09 05:54:22 +00:00
|
|
|
|
map::explicit : Π (A B C : Type) (n : N), (A → B → C) → (vector A n) → (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)
|
2013-09-08 18:04:07 +00:00
|
|
|
|
(v1 : Π (i : N), (i < n) → A)
|
|
|
|
|
(v2 : Π (i : N), (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-10-29 23:20:02 +00:00
|
|
|
|
λ (A : Type) (n : N) (v : Π (i : N), (i < n) → A) (i : N) (d : A) (j : N) (H : j < n), if (j == i) d (v j H)
|