Debian Codegraph @

test-suite/bugs/bug_7916.v

raw
1 From Corelib Require Import Setoid.
2
3 Lemma test {A}
4 (lookup : list A -> nat -> option A)
5 (opA : option A -> option A -> option A)
6 (opL : list A -> list A -> list A)
7 (val : option A -> Prop) :
8 (forall l1 l2 (i : nat), lookup (opL l1 l2) i = opA (lookup l1 i) (lookup l2 i)) ->
9 forall l1 l2, (forall i : nat, val (lookup (opL l1 l2) i)) -> forall i : nat, val (lookup l1 i).
10 Proof.
11 intros list_lookup_op l1 l2.
12 (* setoid_rewrite list_lookup_op. Undo. *)
13 #[export] Hint Mode Reflexive ! ! : typeclass_instances.
14
15 setoid_rewrite list_lookup_op.
16 Abort.
17
18 (* Minimized bug from math-comp*)
19 Module MathComp.
20
21 (* File reduced by coq-bug-finder from original input, then from 4170 lines to 77 lines, then from 96 lines to 1135 lines, then from 1139 lines to 101 lines, then from 119 lines to 516 lines, then from 520 lines to 108 lines, then from 123 lines to 158 lines, then from 162 lines to 108 lines, then from 121 lines to 253 lines, then from 257 lines to 109 lines, then from 113 lines to 109 lines *)
22 (* coqc version 8.14+alpha compiled with OCaml 4.12.0
23 coqtop version 8.14+alpha *)
24 Axiom proof_admitted : False.
25 Tactic Notation "admit" := abstract case proof_admitted.
26 Require Corelib.ssr.ssreflect.
27
28 Export Corelib.ssr.ssreflect.
29 Global Set Asymmetric Patterns.
30 Require Corelib.ssr.ssrbool.
31 Require BinNums NatDef.
32 Export Corelib.ssr.ssrfun.
33 Export Corelib.ssr.ssrbool.
34
35 Definition PredType : forall T pT, (pT -> pred T) -> predType T.
36 exact PredType || exact mkPredType.
37 Defined.
38 Arguments PredType [T pT] toP.
39
40 Set Implicit Arguments.
41 Unset Strict Implicit.
42
43 Module Export Equality.
44
45 Definition axiom T (e : rel T) := forall x y, reflect (x = y) (e x y).
46
47 Structure mixin_of T := Mixin {op : rel T; _ : axiom op}.
48 Notation class_of := mixin_of (only parsing).
49
50 Section ClassDef.
51
52 Structure type := Pack {sort; _ : class_of sort}.
53 Local Coercion sort : type >-> Sortclass.
54 Variables (T : Type) (cT : type).
55
56 Definition class := let: Pack _ c := cT return class_of cT in c.
57
58 End ClassDef.
59 Coercion sort : type >-> Sortclass.
60 Notation eqType := type.
61
62 Definition eq_op T := Equality.op (Equality.class T).
63
64 Notation "x == y" := (eq_op x y)
65 (at level 70, no associativity) : bool_scope.
66 Notation xpredU1 := (fun a1 (p : pred _) x => (x == a1) || p x).
67
68 Declare Scope seq_scope.
69 Open Scope seq_scope.
70
71 Notation seq := list.
72
73 Infix "::" := cons : seq_scope.
74
75 Notation "[ :: ]" := nil (at level 0, format "[ :: ]") : seq_scope.
76
77 Section Sequences.
78
79 Variable T : Type.
80 Implicit Type s : seq T.
81
82 Definition behead s := if s is _ :: s' then s' else [::].
83
84 End Sequences.
85
86 Section EqSeq.
87
88 Variables (n0 : nat) (T : eqType) (x0 : T).
89
90 Fixpoint mem_seq (s : seq T) :=
91 if s is y :: s' then xpredU1 y (mem_seq s') else xpred0.
92
93 Definition seq_eqclass := seq T.
94 Coercion pred_of_seq (s : seq_eqclass) : {pred T} := mem_seq s.
95
96 Canonical seq_predType := PredType (pred_of_seq : seq T -> pred T).
97
98 Lemma mem_head x s : x \in x :: s.
99 admit.
100 Defined.
101
102 Lemma mem_behead s : {subset behead s <= s}.
103 admit.
104 Defined.
105
106 Fixpoint uniq s := if s is x :: s' then (x \notin s') && uniq s' else true.
107
108 End EqSeq.
109
110 Section Map.
111
112 Variables (n0 : nat) (T1 : Type) (x1 : T1).
113 Variables (T2 : Type) (x2 : T2) (f : T1 -> T2).
114
115 Fixpoint map s := if s is x :: s' then f x :: map s' else [::].
116
117 End Map.
118
119 Parameters (n0 : nat) (T1 : eqType) (x1 : T1).
120 Parameters (T2 : eqType) (x2 : T2) (f : T1 -> T2).
121
122 Lemma mapP s y : reflect (exists2 x, x \in s & y = f x) (y \in map f s).
123 admit.
124 Defined.
125
126 Lemma map_inj_in_uniq s : {in s &, injective f} -> uniq (map f s) = uniq s.
127 Proof.
128 elim: s => //= x s IHs //= injf; congr (~~ _ && _).
129 apply/mapP/idP=> [[y sy /injf] | ]; last by exists x.
130 rewrite mem_head.
131 rewrite mem_behead // => -> //.
132 Abort.
133 End Equality.
134 End MathComp.
135
136 Module Iris.
137
138 (* File reduced by coq-bug-finder from original input, then from 1726 lines to 63 lines, then from 117 lines to 133 lines, then from 137 lines to 64 lines, then from 115 lines to 134 lines, then from 138 lines to 69 lines, then from 96 lines to 750 lines, then from 752 lines to 101 lines, then from 126 lines to 357 lines, then from 361 lines to 116 lines, then from 140 lines to 190 lines, then from 194 lines to 125 lines, then from 148 lines to 1547 lines, then from 1547 lines to 152 lines, then from 156 lines to 152 lines *)
139 (* coqc version 8.14+alpha compiled with OCaml 4.12.0
140 coqtop version 8.14+alpha *)
141 Axiom proof_admitted : False.
142 Tactic Notation "admit" := abstract case proof_admitted.
143 Require Corelib.ssr.ssreflect.
144 Require Corelib.Lists.ListDef.
145 Module Export stdpp_DOT_base.
146 Module Export stdpp.
147 Module Export base.
148 Export Corelib.Classes.Morphisms.
149 Export Corelib.Setoids.Setoid.
150
151 Global Generalizable All Variables.
152
153 Declare Scope stdpp_scope.
154 Global Open Scope stdpp_scope.
155
156 Notation "(=)" := eq (only parsing) : stdpp_scope.
157 Notation "(=@{ A } )" := (@eq A) (only parsing) : stdpp_scope.
158
159 Class Equiv A := equiv: relation A.
160
161 Infix "≡" := equiv (at level 70, no associativity) : stdpp_scope.
162
163 Class Decision (P : Prop) := decide : {P} + {~ P}.
164 Global Arguments decide _ {_} : simpl never, assert.
165
166 Class RelDecision {A B} (R : A -> B -> Prop) :=
167 decide_rel x y :: Decision (R x y).
168 Notation EqDecision A := (RelDecision (=@{A})).
169
170 Class Inj {A B} (R : relation A) (S : relation B) (f : A -> B) : Prop :=
171 inj x y : S (f x) (f y) -> R x y.
172
173 Lemma not_symmetry `{R : relation A, !Symmetric R} x y : ~R x y -> ~R y x.
174 admit.
175 Defined.
176 End base.
177
178 End stdpp.
179
180 End stdpp_DOT_base.
181 Module Export stdpp_DOT_decidable.
182 Module Export stdpp.
183 Module Export decidable.
184 Notation cast_if S := (if S then left _ else right _).
185
186 Program Definition inj_eq_dec `{EqDecision A} {B} (f : B -> A)
187 `{!Inj (=) (=) f} : EqDecision B := fun x y => cast_if (decide (f x = f y)).
188 Solve Obligations with firstorder congruence.
189
190 End decidable.
191
192 End stdpp.
193
194 End stdpp_DOT_decidable.
195 Module Export stdpp_DOT_tactics.
196 Module Export stdpp.
197 Module Export tactics.
198
199 Ltac fast_done :=
200 solve
201 [ eassumption
202 | symmetry; eassumption
203 | apply not_symmetry; eassumption
204 | reflexivity ].
205
206 Ltac done :=
207 solve
208 [ repeat first
209 [ fast_done
210 | solve [trivial]
211
212 | progress intros
213 | solve [symmetry; trivial]
214 | solve [apply not_symmetry; trivial]
215 | discriminate
216 | contradiction
217 | split
218 | match goal with H : ~_ |- _ => case H; clear H; fast_done end ]
219 ].
220
221 End tactics.
222
223 End stdpp.
224
225 End stdpp_DOT_tactics.
226 Module Export stdpp.
227 Module Export prelude.
228 Export stdpp.tactics.
229
230 End prelude.
231 Export Corelib.ssr.ssreflect.
232 Export stdpp.prelude.
233 Set Primitive Projections.
234
235 Class Dist A := dist : nat -> relation A.
236 Notation "x ≡{ n }≡ y" := (dist n x y)
237 (at level 70, n at next level, format "x ≡{ n }≡ y").
238 Notation NonExpansive f := (forall n, Proper (dist n ==> dist n) f).
239
240 Record OfeMixin A `{Equiv A, Dist A} := {
241 mixin_equiv_dist (x y : A) : x ≡ y <-> forall n, x ≡{n}≡ y;
242 mixin_dist_equivalence n : Equivalence (@dist A _ n);
243 mixin_dist_S n (x y : A) : x ≡{S n}≡ y -> x ≡{n}≡ y
244 }.
245
246 Structure ofe := Ofe {
247 ofe_car :> Type;
248 ofe_equiv : Equiv ofe_car;
249 ofe_dist : Dist ofe_car;
250 ofe_mixin : OfeMixin ofe_car
251 }.
252 Global Hint Extern 0 (Equiv _) => eapply (@ofe_equiv _) : typeclass_instances.
253 Global Hint Extern 0 (Dist _) => eapply (@ofe_dist _) : typeclass_instances.
254
255 Section ofe_mixin.
256 Context {A : ofe}.
257 Implicit Types x y : A.
258 Lemma equiv_dist x y : x ≡ y <-> forall n, x ≡{n}≡ y.
259 admit.
260 Defined.
261 Global Instance dist_equivalence n : Equivalence (@dist A _ n).
262 admit.
263 Defined.
264 End ofe_mixin.
265
266 Record chain (A : ofe) := {
267 chain_car :> nat -> A;
268 chain_cauchy n i : n <= i -> chain_car i ≡{n}≡ chain_car n
269 }.
270
271 Program Definition chain_map {A B : ofe} (f : A -> B)
272 `{!NonExpansive f} (c : chain A) : chain B :=
273 {| chain_car n := f (c n) |}.
274 Next Obligation.
275 admit.
276 Defined.
277
278 Notation Compl A := (chain A%type -> A).
279 Class Cofe (A : ofe) := {
280 compl : Compl A;
281 conv_compl n c : compl c ≡{n}≡ c n;
282 }.
283
284 Lemma compl_chain_map `{Cofe A, Cofe B} (f : A -> B) c `(NonExpansive f) :
285 compl (chain_map f c) ≡ f (compl c).
286 Proof.
287 apply equiv_dist=>n.
288 rewrite !conv_compl.
289 Abort.
290 End stdpp.
291 End Iris.
292
293 Module SSr.
294
295
296 (* File reduced by coq-bug-finder from original input, then from 451 lines to 35 lines, then from 99 lines to 1013 lines, then from 1016 lines to 85 lines, then from 99 lines to 206 lines, then from 209 lines to 101 lines, then from 114 lines to 360 lines, then from 363 lines to 185 lines, then from 198 lines to 330 lines, then from 334 lines to 185 lines, then from 189 lines to 185 lines *)
297 (* coqc version 8.14+alpha compiled with OCaml 4.12.0
298 coqtop version 8.14+alpha *)
299 Axiom proof_admitted : False.
300 Tactic Notation "admit" := abstract case proof_admitted.
301 Require Corelib.ssr.ssreflect.
302
303 Export Corelib.ssr.ssreflect.
304 Require BinNums NatDef.
305
306 Set Implicit Arguments.
307 Unset Strict Implicit.
308
309 Module Export Real.
310
311 Record structure : Type := Structure {
312 val : Type;
313 set := val -> Prop;
314 rel := val -> set;
315 le : rel;
316 sup : set -> val;
317 add : val -> val -> val;
318 zero : val;
319 opp : val -> val;
320 mul : val -> val -> val;
321 one : val;
322 inv : val -> val
323 }.
324
325 Definition eq R : rel R := fun x y => le x y /\ le y x.
326
327 Definition ub R (E : set R) : set R := fun z => forall y, E y -> le y z.
328
329 Definition down R (E : set R) : set R := fun x => exists2 y, E y & le x y.
330
331 Definition nonempty R (E : set R) : Prop := exists x, E x.
332 Definition has_ub R (E : set R) : Prop := nonempty (ub E).
333 Definition has_sup R (E : set R) : Prop := nonempty E /\ has_ub E.
334
335 Record axioms R : Prop := Axioms {
336 le_reflexive (x : val R) :
337 le x x;
338 le_transitive (x y z : val R) :
339 le x y -> le y z -> le x z;
340 sup_upper_bound (E : set R) :
341 has_sup E -> ub E (sup E);
342 sup_total (E : set R) (x : val R) :
343 has_sup E -> down E x \/ le (sup E) x;
344 add_monotone (x y z : val R) :
345 le y z -> le (add x y) (add x z);
346 add_commutative (x y : val R) :
347 eq (add x y) (add y x);
348 add_associative (x y z : val R) :
349 eq (add x (add y z)) (add (add x y) z);
350 add_zero_left (x : val R) :
351 eq (add (zero R) x) x;
352 add_opposite_right (x : val R) :
353 eq (add x (opp x)) (zero R);
354 mul_monotone x y z :
355 le (zero R) x -> le y z -> le (mul x y) (mul x z);
356 mul_commutative (x y : val R) :
357 eq (mul x y) (mul y x);
358 mul_associative (x y z : val R) :
359 eq (mul x (mul y z)) (mul (mul x y) z);
360 mul_distributive_right (x y z : val R) :
361 eq (mul x (add y z)) (add (mul x y) (mul x z));
362 mul_one_left (x : val R) :
363 eq (mul (one R) x) x;
364 mul_inverse_right (x : val R) :
365 ~ eq x (zero R) -> eq (mul x (inv x)) (one R);
366 one_nonzero : ~ eq (one R) (zero R)
367 }.
368
369 Record model : Type := Model {
370 model_structure : structure;
371 model_axioms : axioms model_structure
372 }.
373
374 Definition image R S (phi : val R -> val S) (E : set R) (y : val S) :=
375 exists2 x, E x & eq y (phi x).
376
377 Record morphism R S (phi : val R -> val S) : Prop := Morphism {
378 morph_le x y :
379 le (phi x) (phi y) <-> le x y;
380 morph_sup (E : set R) :
381 has_sup E -> eq (phi (sup E)) (sup (image phi E));
382 morph_add x y :
383 eq (phi (add x y)) (add (phi x) (phi y));
384 morph_zero :
385 eq (phi (zero R)) (zero S);
386 morph_opp x :
387 eq (phi (opp x)) (opp (phi x));
388 morph_mul x y :
389 eq (phi (mul x y)) (mul (phi x) (phi y));
390 morph_one :
391 eq (phi (one R)) (one S);
392 morph_inv x :
393 ~ eq x (zero R) -> eq (phi (inv x)) (inv (phi x))
394 }.
395 Coercion val : structure >-> Sortclass.
396 Coercion model_structure : model >-> structure.
397 Delimit Scope real_scope with Rval.
398 Local Open Scope real_scope.
399 Arguments add {R} x%_Rval y%_Rval : rename, simpl never.
400
401 Reserved Notation "x == y" (at level 70, no associativity).
402
403 Notation "x <= y" := (le x y) : real_scope.
404 Notation "x + y" := (add x y) : real_scope.
405 Notation "0" := (zero _) : real_scope.
406
407 Notation "x == y" := (eq x y) : real_scope.
408 Notation "x >= y" := (y <= x) (only parsing) : real_scope.
409 Notation "x < y" := (~ (x >= y)) : real_scope.
410 Notation "x <= y <= z" := (x <= y /\ y <= z) : real_scope.
411 Import Corelib.Classes.Morphisms.
412
413 Section RealLemmas.
414
415 Variable R : Real.model.
416 Implicit Types x y z : R.
417 Local Notation eqR :=(@Real.eq (Real.model_structure R)) (only parsing).
418
419 Lemma leRR x : x <= x.
420 admit.
421 Defined.
422
423 Lemma ltRW x y : x < y -> x <= y.
424 admit.
425 Defined.
426
427 Lemma eqR_refl x : x == x.
428 admit.
429 Defined.
430
431 Lemma eqR_sym x y : x == y -> y == x.
432 admit.
433 Defined.
434
435 Lemma eqR_trans x y z : x == y -> y == z -> x == z.
436 admit.
437 Defined.
438
439 Add Parametric Relation : R eqR
440 reflexivity proved by eqR_refl
441 symmetry proved by eqR_sym
442 transitivity proved by eqR_trans
443 as real_equality.
444
445 Instance addR_Proper : Proper (eqR ==> eqR ==> eqR) Real.add.
446 admit.
447 Defined.
448
449 Lemma add0R x : 0 + x == x.
450 admit.
451 Defined.
452
453 End RealLemmas.
454
455 #[export] Hint Resolve eqR_refl leRR ltRW.
456
457 #[export] Existing Instance real_equality.
458 #[export] Existing Instance addR_Proper.
459
460 Section RealMorph.
461
462 Variables (R S : Real.structure) (phi : R -> S).
463 Hypothesis phiP : Real.morphism phi.
464
465 Lemma Rmorph_eq x y : phi x == phi y <-> x == y.
466 Proof.
467 by rewrite /Real.eq !Real.morph_le.
468 Qed.
469
470 End RealMorph.
471
472 Parameters (R : Real.structure) (S : Real.model) (phi : R -> S).
473 Axiom phiP : Real.morphism phi.
474 Implicit Types (x y z : R) (E : Real.set R).
475 Definition phi_eq := Rmorph_eq phiP.
476 Definition phiD := Real.morph_add phiP.
477 Definition phi0 := Real.morph_zero phiP.
478
479 Lemma Radd0 x : 0 + x == x.
480 Proof.
481 by rewrite -phi_eq phiD phi0 add0R.
482 Abort.
483 End Real.
484 End SSr.