Debian Codegraph @

test-suite/ssr/elim2.v

raw
1 (************************************************************************)
2 (* * The Rocq Prover / The Rocq Development Team *)
3 (* v * Copyright INRIA, CNRS and contributors *)
4 (* <O___,, * (see version control and CREDITS file for authors & dates) *)
5 (* \VV/ **************************************************************)
6 (* // * This file is distributed under the terms of the *)
7 (* * GNU Lesser General Public License Version 2.1 *)
8 (* * (see LICENSE file for the text of the license) *)
9 (************************************************************************)
10
11 (* (c) Copyright 2006-2016 Microsoft Corporation and Inria. *)
12
13 Require Import ssreflect.
14 Require Import ssrbool TestSuite.ssr_mini_mathcomp.
15 (* div fintype finfun path bigop. *)
16
17 Axiom daemon : False. Ltac myadmit := case: daemon.
18
19 Lemma big_load R (K K' : R -> Type) idx op I r (P : pred I) F :
20 let s := \big[op/idx]_(i <- r | P i) F i in
21 K s * K' s -> K' s.
22 Proof. by move=> /= [_]. Qed.
23 Arguments big_load [R] K [K' idx op I r P F].
24
25 Section Elim1.
26
27 Variables (R : Type) (K : R -> Type) (f : R -> R).
28 Variables (idx : R) (op op' : R -> R -> R).
29
30 Hypothesis Kid : K idx.
31
32 Ltac ASSERT1 := match goal with |- (K idx) => myadmit end.
33 Ltac ASSERT2 K := match goal with |- (forall x1 : R, R ->
34 forall y1 : R, R -> K x1 -> K y1 -> K (op x1 y1)) => myadmit end.
35
36
37 Lemma big_rec I r (P : pred I) F
38 (Kop : forall i x, P i -> K x -> K (op (F i) x)) :
39 K (\big[op/idx]_(i <- r | P i) F i).
40 Proof.
41 elim/big_ind2: {-}_.
42 ASSERT1. ASSERT2 K. match goal with |- (forall i : I, is_true (P i) -> K (F i)) => myadmit end. Undo 4.
43 elim/big_ind2: _ / {-}_.
44 ASSERT1. ASSERT2 K. match goal with |- (forall i : I, is_true (P i) -> K (F i)) => myadmit end. Undo 4.
45
46 elim/big_rec2: (\big[op/idx]_(i <- r | P i) op idx (F i))
47 / (\big[op/idx]_(i <- r | P i) F i).
48 ASSERT1. match goal with |- (forall i : I, R -> forall y2 : R, is_true (P i) -> K y2 -> K (op (F i) y2)) => myadmit end. Undo 3.
49
50 elim/(big_load (phantom R)): _.
51 Undo.
52
53 Fail elim/big_rec2: {2}_.
54
55 elim/big_rec2: (\big[op/idx]_(i <- r | P i) F i)
56 / {1}(\big[op/idx]_(i <- r | P i) F i).
57 Undo.
58
59 elim/(big_load (phantom R)): _.
60 Undo.
61
62 Fail elim/big_rec2: _ / {2}(\big[op/idx]_(i <- r | P i) F i).
63 Admitted.
64
65 Definition morecomplexthannecessary A (P : A -> A -> Prop) x y := P x y.
66
67 Lemma grab A (P : A -> A -> Prop) n m : (n = m) -> (P n n) -> morecomplexthannecessary A P n m.
68 by move->.
69 Qed.
70
71 Goal forall n m, m + (n + m) = m + (n * 1 + m).
72 Proof. move=> n m; elim/grab : (_ * _) / {1}n => //; exact: muln1. Qed.
73
74 End Elim1.