Ssr.Context
Require Import mathcomp.ssreflect.ssreflect.
From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq.
Require Import AutosubstSsr.
Definition get {T} `{Ids T} (Gamma : seq T) (n : var) : T :=
nth (ids 0) Gamma n.
Arguments get {T _} Gamma n.
Fixpoint dget {T} `{Ids T} `{Subst T} (Gamma : list T) (n : var) {struct n} : T :=
match Gamma, n with
| [::], _ => ids 0
| A :: _, 0 => A.[ren (+1)]
| _ :: Gamma, n.+1 => (dget Gamma n).[ren (+1)]
end.
Arguments dget {T _ _} Gamma n.
Lemma get_map {T} `{Ids T} (f : T -> T) Gamma n :
n < size Gamma -> get (map f Gamma) n = f (get Gamma n).
Proof. exact: nth_map. Qed.
(* Local Variables: *)
(* coq-load-path: (("." "Ssr")) *)
(* End: *)
From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq.
Require Import AutosubstSsr.
Definition get {T} `{Ids T} (Gamma : seq T) (n : var) : T :=
nth (ids 0) Gamma n.
Arguments get {T _} Gamma n.
Fixpoint dget {T} `{Ids T} `{Subst T} (Gamma : list T) (n : var) {struct n} : T :=
match Gamma, n with
| [::], _ => ids 0
| A :: _, 0 => A.[ren (+1)]
| _ :: Gamma, n.+1 => (dget Gamma n).[ren (+1)]
end.
Arguments dget {T _ _} Gamma n.
Lemma get_map {T} `{Ids T} (f : T -> T) Gamma n :
n < size Gamma -> get (map f Gamma) n = f (get Gamma n).
Proof. exact: nth_map. Qed.
(* Local Variables: *)
(* coq-load-path: (("." "Ssr")) *)
(* End: *)