Skip to content

Commit b5e3433

Browse files
author
Gregory Malecha
committed
injective instances for List.
1 parent 5faa035 commit b5e3433

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

theories/Data/List.v

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Require Import ExtLib.Core.RelDec.
44
Require Import ExtLib.Structures.Monoid.
55
Require Import ExtLib.Structures.Reducible.
66
Require Import ExtLib.Tactics.Consider.
7+
Require Import ExtLib.Tactics.Injection.
78

89
Set Implicit Arguments.
910
Set Strict Implicit.
@@ -180,6 +181,26 @@ Section ListEq.
180181

181182
End ListEq.
182183

184+
Global Instance Injective_cons T (a : T) b c d : Injective (a :: b = c :: d) :=
185+
{ result := a = c /\ b = d }.
186+
inversion 1; auto.
187+
Defined.
188+
189+
Global Instance Injective_cons_nil T (a : T) b : Injective (a :: b = nil) :=
190+
{ result := False }.
191+
inversion 1; auto.
192+
Defined.
193+
194+
Global Instance Injective_nil_cons T (a : T) b : Injective (nil = a :: b) :=
195+
{ result := False }.
196+
inversion 1; auto.
197+
Defined.
198+
199+
Global Instance Injective_nil_nil T : Injective (nil = @nil T) :=
200+
{ result := True }.
201+
auto.
202+
Defined.
203+
183204
Lemma eq_list_eq
184205
: forall T (a b : T) (pf : a = b) (F : _ -> Type) val,
185206
match pf in _ = x return list (F x) with

0 commit comments

Comments
 (0)