-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexists.v
52 lines (47 loc) · 1.19 KB
/
exists.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
Require Import List.
Import ListNotations.
Set Implicit Arguments.
Fixpoint before {A: Type} (x : A) y l : Prop :=
match l with
| [] => False
| a :: l' =>
a = x \/
(a <> y /\ before x y l')
end.
Section before.
Variable A : Type.
Lemma before_In :
forall x y l,
before (A:=A) x y l ->
In x l.
Proof using.
induction l; intros; simpl in *; intuition.
Qed.
Lemma before_split :
forall l (x y : A),
before x y l ->
x <> y ->
In x l ->
In y l ->
exists xs ys zs,
l = xs ++ x :: ys ++ y :: zs.
Proof using.
induction l; intros; simpl in *; intuition; subst; try congruence.
- exists []. simpl.
apply in_split in H1.
destruct H1; destruct H1.
subst. eauto.
- exists []. simpl.
apply in_split in H1.
destruct H1; destruct H1. subst. eauto.
- exists []. simpl.
apply in_split in H1.
destruct H1; destruct H1. subst. eauto.
- match goal with
| [ H : context [ In ], H' : context [ In ] |- _ ] =>
eapply H in H'
end; eauto.
destruct H1; destruct H1; destruct H1. subst.
exists (a :: x0), x1, x2. auto.
Qed.
End before.