diff options
| author | Cyril Cohen | 2019-06-26 00:27:04 +0200 |
|---|---|---|
| committer | Assia Mahboubi | 2019-07-05 13:06:04 +0200 |
| commit | 2a0a00630785c616899abaa6fccb95ee76f751bf (patch) | |
| tree | 3765c35c3277e79b35bce93c863ffa9de7a0b72a /mathcomp | |
| parent | 1bda1dd5621684737c9d993855ae104e8b9d2909 (diff) | |
feat(finfun.v): Add tuple_of_finfun, finfun_of_tuple & cancel lemmas
Diffstat (limited to 'mathcomp')
| -rw-r--r-- | mathcomp/ssreflect/finfun.v | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/mathcomp/ssreflect/finfun.v b/mathcomp/ssreflect/finfun.v index 075ebfa..749f5e2 100644 --- a/mathcomp/ssreflect/finfun.v +++ b/mathcomp/ssreflect/finfun.v @@ -270,6 +270,26 @@ Canonical dfinfun_finType rT := End InheritedStructures. +Section FinFunTuple. + +Context {T : Type} {n : nat}. + +Definition tuple_of_finfun (f : T ^ n) : n.-tuple T := [tuple f i | i < n]. + +Definition finfun_of_tuple (t : n.-tuple T) : (T ^ n) := [ffun i => tnth t i]. + +Lemma finfun_of_tupleK : cancel finfun_of_tuple tuple_of_finfun. +Proof. +by move=> t; apply: eq_from_tnth => i; rewrite tnth_map ffunE tnth_ord_tuple. +Qed. + +Lemma tuple_of_finfunK : cancel tuple_of_finfun finfun_of_tuple. +Proof. +by move=> f; apply/ffunP => i; rewrite ffunE tnth_map tnth_ord_tuple. +Qed. + +End FinFunTuple. + Section FunPlainTheory. Variables (aT : finType) (rT : Type). |
