(* Module Test. Definition T1 := Tstruct 1%positive (Fcons 101%positive tint (Fcons 102%positive tint Fnil)) noattr. Definition T2 := Tstruct 2%positive (Fcons 201%positive T1 (Fcons 202%positive T1 Fnil)) noattr. Definition T3 := Tstruct 3%positive (Fcons 301%positive T2 (Fcons 302%positive T2 Fnil)) noattr.  Definition v : reptype T3 := (((Vint (Int.repr 1), Vint (Int.repr 2)), (Vint (Int.repr 3), Vint (Int.repr 4))), ((Vint (Int.repr 5), Vint (Int.repr 6)), (Vint (Int.repr 7), Vint (Int.repr 8)))).  Arguments eq_rect_r / {A} {x} P H {y} H0. Arguments proj_except_reptype / t gf gfs v.  Lemma Test1: JMeq (proj_reptype T3 (StructField 201%positive :: StructField 302%positive :: nil) v) (Vint (Int.repr 5), Vint (Int.repr 6)).  Lemma Test2: JMeq (upd_reptype T3 (StructField 201%positive :: StructField 302%positive :: nil) v (Vint (Int.repr 15), Vint (Int.repr 16))) (((Vint (Int.repr 1), Vint (Int.repr 2)), (Vint (Int.repr 3), Vint (Int.repr 4))), ((Vint (Int.repr 15), Vint (Int.repr 16)), (Vint (Int.repr 7), Vint (Int.repr 8)))).  Lemma Test3: JMeq (proj_except_reptype T3 (StructField 201%positive) (StructField 302%positive :: nil) v) (((Vint (Int.repr 1), Vint (Int.repr 2)), (Vint (Int.repr 3), Vint (Int.repr 4))), ((Vint (Int.repr 7), Vint (Int.repr 8)))). End Test. *)

(* Specifications: *)
Lemma upd_reptype_nil: forall t v v0, upd_reptype t nil v v0 = v0.
Lemma upd_reptype_cons: forall t gf gfs v v0 v0',
legal_nested_field t (gf :: gfs) ->
JMeq v0 v0' ->
upd_reptype t (gf :: gfs) v v0 =
upd_reptype t gfs v (upd_reptype _ (gf :: nil) (proj_reptype t gfs v) v0').