Debian Codegraph @

test-suite/bugs/bug_3286.v

raw
1 Require Import TestSuite.funext.
2
3 Ltac make_apply_under_binders_in lem H :=
4 let tac := make_apply_under_binders_in in
5 match type of H with
6 | forall x : ?T, @?P x
7 => let ret := constr:(fun x' : T =>
8 let Hx := H x' in
9 ltac:(let ret' := tac lem Hx in
10 exact ret')) in
11 match eval cbv zeta in ret with
12 | fun x => Some (@?P x) => let P' := (eval cbv zeta in P) in
13 constr:(Some P')
14 end
15 | _ => let ret := constr:(ltac:(match goal with
16 | _ => (let H' := fresh in
17 pose H as H';
18 apply lem in H';
19 exact (Some H'))
20 | _ => exact (@None nat)
21 end
22 )) in
23 let ret' := (eval cbv beta zeta in ret) in
24 constr:(ret')
25 | _ => constr:(@None nat)
26 end.
27
28 Ltac apply_under_binders_in lem H :=
29 let H' := make_apply_under_binders_in lem H in
30 let H'0 := match H' with Some ?H'0 => constr:(H'0) end in
31 let H'' := fresh in
32 pose proof H'0 as H'';
33 clear H;
34 rename H'' into H.
35
36 Goal forall A B C (f g : forall (x : A) (y : B x), C x y), (forall x y, f x y = g x y) -> True.
37 Proof.
38 intros A B C f g H.
39 let lem := constr:(@functional_extensionality_dep) in
40 apply_under_binders_in lem H.
41 (* Anomaly: Uncaught exception Not_found(_). Please report. *)
42 Abort.