Debian Codegraph @

test-suite/bugs/bug_3732.v

raw
1 Require Import TestSuite.admit.
2 (* File reduced by coq-bug-finder from original input, then from 2073 lines to 358 lines, then from 359 lines to 218 lines, then from 107 lines to 92 lines *)
3 (* coqc version trunk (October 2014) compiled on Oct 11 2014 1:13:41 with OCaml 4.01.0
4 coqtop version cagnode16:/afs/csail.mit.edu/u/j/jgross/coq-trunk,trunk (d65496f09c4b68fa318783e53f9cd6d5c18e1eb7) *)
5 Require Import TestSuite.list.
6
7 Set Implicit Arguments.
8 Global Set Asymmetric Patterns.
9
10 Section machine.
11 Variables pc state : Type.
12
13 Inductive propX (i := pc) (j := state) : list Type -> Type :=
14 | Inj : forall G, Prop -> propX G
15 | ExistsX : forall G A, propX (A :: G) -> propX G.
16
17 Arguments Inj [G].
18
19 Definition PropX := propX nil.
20 Fixpoint last (G : list Type) : Type.
21 exact (match G with
22 | nil => unit
23 | cons T nil => T
24 | cons _ G' => last G'
25 end).
26 Defined.
27 Fixpoint eatLast (G : list Type) : list Type.
28 exact (match G with
29 | nil => nil
30 | cons _ nil => nil
31 | cons x G' => cons x (eatLast G')
32 end).
33 Defined.
34
35 Fixpoint subst G (p : propX G) : (last G -> PropX) -> propX (eatLast G) :=
36 match p with
37 | Inj _ P => fun _ => Inj P
38 | ExistsX G A p1 => fun p' =>
39 match G return propX (A :: G) -> propX (eatLast (A :: G)) -> propX (eatLast G) with
40 | nil => fun p1 _ => ExistsX p1
41 | cons _ _ => fun _ rc => ExistsX rc
42 end p1 (subst p1 (match G return (last G -> PropX) -> last (A :: G) -> PropX with
43 | nil => fun _ _ => Inj True
44 | _ => fun p' => p'
45 end p'))
46 end.
47
48 Definition spec := state -> PropX.
49 Definition codeSpec := pc -> option spec.
50
51 Inductive valid (specs : codeSpec) (G : list PropX) : PropX -> Prop := Env : forall P, In P G -> valid specs G P.
52 Definition interp specs := valid specs nil.
53 End machine.
54 Notation "'ExX' : A , P" := (ExistsX (A := A) P) (at level 89) : PropX_scope.
55 Bind Scope PropX_scope with PropX propX.
56 Parameters pc state : Type.
57
58 Inductive subs : list Type -> Type :=
59 | SNil : subs nil
60 | SCons : forall T Ts, (last (T :: Ts) -> PropX pc state) -> subs (eatLast (T :: Ts)) -> subs (T :: Ts).
61
62 Fixpoint SPush G T (s : subs G) (f : T -> PropX pc state) : subs (T :: G) :=
63 match s in subs G return subs (T :: G) with
64 | SNil => SCons _ nil f SNil
65 | SCons T' Ts f' s' => SCons T (T' :: Ts) f' (SPush s' f)
66 end.
67
68 Fixpoint Substs G (s : subs G) : propX pc state G -> PropX pc state :=
69 match s in subs G return propX pc state G -> PropX pc state with
70 | SNil => fun p => p
71 | SCons _ _ f s' => fun p => Substs s' (subst p f)
72 end.
73 Parameter specs : codeSpec pc state.
74
75 Lemma simplify_fwd_ExistsX : forall G A s (p : propX pc state (A :: G)),
76 interp specs (Substs s (ExX : A, p))
77 -> exists a, interp specs (Substs (SPush s a) p).
78 admit.
79 Defined.
80
81 Goal forall (G : list Type) (A : Type) (p : propX pc state (@cons Type A G))
82 (s : subs G)
83 (_ : @interp pc state specs (@Substs G s (@ExistsX pc state G A p)))
84 (P : forall _ : subs (@cons Type A G), Prop)
85 (_ : forall (s0 : subs (@cons Type A G))
86 (_ : @interp pc state specs (@Substs (@cons Type A G) s0 p)),
87 P s0),
88 @ex (forall _ : A, PropX pc state)
89 (fun a : forall _ : A, PropX pc state => P (@SPush G A s a)).
90 intros ? ? ? ? H ? H'.
91 apply simplify_fwd_ExistsX in H.
92 firstorder.
93 Qed.
94 (* Toplevel input, characters 15-19:
95 Error: Illegal application:
96 The term "cons" of type "forall A : Type, A -> list A -> list A"
97 cannot be applied to the terms
98 "Type" : "Type"
99 "T" : "Type"
100 "G0" : "list Type"
101 The 2nd term has type "Type@{Top.53}" which should be coercible to
102 "Type@{Top.12}".
103 *)