Skip to content

Commit 9588b93

Browse files
author
Gregory Malecha
committed
porting of most things so that it builds with 8.5~beta3
1 parent e7233b6 commit 9588b93

File tree

15 files changed

+133
-91
lines changed

15 files changed

+133
-91
lines changed

examples/MonadReasoning.v

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ Require Import ExtLib.Data.Fun.
77
Set Implicit Arguments.
88
Set Strict Implicit.
99

10+
(** Currently not ported due to universes *)
11+
12+
(*
1013
Section with_m.
1114
Variable m : Type -> Type.
1215
Variable Monad_m : Monad m.
@@ -53,4 +56,5 @@ Section with_m.
5356
eapply equiv_prefl; eauto. }
5457
Qed.
5558
56-
End with_m.
59+
End with_m.
60+
*)

theories/Data/HList.v

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ Set Asymmetric Patterns.
1515

1616
(** Core Type and Functions **)
1717
Section hlist.
18-
Context {iT : Type@{i}}.
19-
Variable F : iT -> Type@{d}.
18+
Context {iT : Type}.
19+
Variable F : iT -> Type.
2020

21-
Inductive hlist : list iT -> Type@{d} :=
21+
Inductive hlist : list iT -> Type :=
2222
| Hnil : hlist nil
2323
| Hcons : forall l ls, F l -> hlist ls -> hlist (l :: ls).
2424

@@ -332,7 +332,7 @@ Section hlist.
332332
end.
333333

334334
Polymorphic Fixpoint hlist_nth ls (h : hlist ls) (n : nat) :
335-
match nth_error ls n return Type@{i} with
335+
match nth_error ls n return Type with
336336
| None => unit
337337
| Some t => F t
338338
end :=
@@ -398,10 +398,10 @@ Section hlist.
398398

399399
Theorem hlist_nth_hlist_app
400400
: forall l l' (h : hlist l) (h' : hlist l') n,
401-
hlist_nth@{i} (hlist_app h h') n =
401+
hlist_nth (hlist_app h h') n =
402402
match nth_error l n as k
403403
return nth_error l n = k ->
404-
match nth_error (l ++ l') n return Type@{i} with
404+
match nth_error (l ++ l') n return Type with
405405
| None => unit
406406
| Some t => F t
407407
end
@@ -410,17 +410,17 @@ Section hlist.
410410
match
411411
cast1 _ _ _ pf in _ = z ,
412412
eq_sym pf in _ = w
413-
return match w return Type@{i} with
413+
return match w return Type with
414414
| None => unit
415415
| Some t => F t
416416
end ->
417-
match z return Type@{i} with
417+
match z return Type with
418418
| None => unit
419419
| Some t => F t
420420
end
421421
with
422422
| eq_refl , eq_refl => fun x => x
423-
end (hlist_nth@{i} h n)
423+
end (hlist_nth h n)
424424
| None => fun pf =>
425425
match cast2 _ _ _ pf in _ = z
426426
return match z with
@@ -471,7 +471,8 @@ Section hlist.
471471
{ intro. induction ls; simpl.
472472
{ rewrite (hlist_eta x); intros; constructor. }
473473
{ rewrite (hlist_eta x); intros; intuition; constructor.
474-
eapply preflexive; eauto with typeclass_instances.
474+
eapply preflexive; [ | eauto with typeclass_instances ].
475+
eauto with typeclass_instances.
475476
eapply IHls; eauto. } }
476477
{ red. induction 1.
477478
{ constructor. }
@@ -628,10 +629,10 @@ Section hlist.
628629

629630
Theorem nth_error_get_hlist_nth_Some
630631
: forall ls n s,
631-
nth_error_get_hlist_nth@{i} ls n = Some s ->
632+
nth_error_get_hlist_nth ls n = Some s ->
632633
exists pf : nth_error ls n = Some (projT1 s),
633634
forall h, projT2 s h = match pf in _ = t
634-
return match t return Type@{i} with
635+
return match t return Type with
635636
| Some t => F t
636637
| None => unit
637638
end

theories/Data/Monads/FuelMonadLaws.v

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Require Import ExtLib.Tactics.TypeTac.
1313
Set Implicit Arguments.
1414
Set Strict Implicit.
1515

16+
(*
1617
Section Laws.
1718
Section fixResult_T.
1819
Context {T : Type} (e : type T).
@@ -145,3 +146,4 @@ Section Laws.
145146
*)
146147
147148
End Laws.
149+
*)

theories/Data/Monads/IdentityMonadLaws.v

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Require Import ExtLib.Data.Monads.IdentityMonad.
1010
Set Implicit Arguments.
1111
Set Strict Implicit.
1212

13+
(*
1314
Section with_T.
1415
Context {T : Type} (e : type T).
1516
@@ -62,3 +63,4 @@ Proof.
6263
{ simpl; intros. red. solve_equal. }
6364
{ unfold bind, Monad_ident. do 6 red; intros. solve_equal. }
6465
Qed.
66+
*)

theories/Data/Monads/OptionMonadLaws.v

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Require Import ExtLib.Tactics.TypeTac.
1212
Set Implicit Arguments.
1313
Set Strict Implicit.
1414

15+
(*
1516
Section Laws.
1617
Variable m : Type -> Type.
1718
Variable Monad_m : Monad m.
@@ -294,3 +295,4 @@ setoid_rewrite bind_of_return.
294295
Qed.
295296
296297
End Laws.
298+
*)

theories/Data/Monads/ReaderMonadLaws.v

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Require Import ExtLib.Tactics.TypeTac.
1111
Set Implicit Arguments.
1212
Set Strict Implicit.
1313

14+
(*
1415
Section Laws.
1516
Variable m : Type -> Type.
1617
Variable Monad_m : Monad m.
@@ -93,3 +94,4 @@ Section Laws.
9394
*)
9495
9596
End Laws.
97+
*)

theories/Data/SigT.v

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Require Import ExtLib.Tactics.TypeTac.
77

88
Set Implicit Arguments.
99
Set Strict Implicit.
10+
Set Printing Universes.
1011

1112
Section type.
1213
Variable T : Type.
@@ -32,12 +33,14 @@ Section type.
3233
Proof.
3334
constructor.
3435
{ destruct x; destruct y; intros. simpl in *. destruct H. destruct H0. subst.
35-
apply only_proper in H; eauto with typeclass_instances.
36-
apply only_proper in H0; eauto with typeclass_instances. intuition. }
36+
apply only_proper in H; [ | eauto with typeclass_instances ].
37+
apply only_proper in H0; [ | eauto with typeclass_instances ]. intuition. }
3738
{ red. destruct x; intros. do 2 red in H.
3839
do 2 red; simpl in *. intuition.
3940
try solve [ apply equiv_prefl; eauto ].
40-
exists eq_refl. solve_equal. }
41+
exists eq_refl.
42+
eapply Proper.preflexive; [ | eapply H1 ].
43+
eauto with typeclass_instances. }
4144
{ red; destruct x; destruct y; intros; simpl in *.
4245
intuition. destruct H1; subst. exists eq_refl. symmetry; assumption. }
4346
{ red; destruct x; destruct y; destruct z; intros; simpl in *; intuition.

theories/Generic/DerivingData.v

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ Fixpoint dataD (T : Type) (X : T -> Type) (d : data X) : Type :=
1515
match d with
1616
| Inj _X x => x
1717
| Get X i => X i
18-
| Prod X l r => prod (dataD l) (dataD r)
19-
| Sigma X i s => @sigT i (fun v => dataD (s v))
20-
| Pi X i s => forall v : i, dataD (s v)
18+
| Prod l r => prod (dataD l) (dataD r)
19+
| @Sigma _ _ i s => @sigT i (fun v => dataD (s v))
20+
| @Pi _ _ i s => forall v : i, dataD (s v)
2121
end.
2222

2323
(** Example of lists as data **)
@@ -46,29 +46,30 @@ Fixpoint dataP (T : Type) (X : T -> Type) (d : data X) (R : Type) : Type :=
4646
match d with
4747
| Inj _X x => x -> R
4848
| Get X x => X x -> R
49-
| Prod X l r => dataP l (dataP r R)
50-
| Sigma X i s => forall i, dataP (s i) R
51-
| Pi X i s => (forall i, dataD (s i)) -> R
49+
| @Prod _ _ l r => dataP l (dataP r R)
50+
| @Sigma _ _ i s => forall i, dataP (s i) R
51+
| @Pi _ _ i s => (forall i, dataD (s i)) -> R
5252
end.
5353

5454
Fixpoint dataMatch (T : Type) (X : T -> Type) (d : data X) {struct d}
5555
: forall (R : Type), dataP d R -> dataD d -> R :=
5656
match d as d return forall (R : Type), dataP d R -> dataD d -> R with
5757
| Inj _ _ => fun _ p => p
5858
| Get X x => fun _ p => p
59-
| Prod X l r => fun _ p v =>
59+
| @Prod _ _ l r => fun _ p v =>
6060
dataMatch r _ (dataMatch l _ p (fst v)) (snd v)
61-
| Sigma X i d => fun _ p v =>
61+
| @Sigma _ _ i d => fun _ p v =>
6262
match v with
63-
| existT x y => dataMatch (d x) _ (p _) y
63+
| existT _ x y => dataMatch (d x) _ (p _) y
6464
end
65-
| Pi X i d => fun _ p v => p v
65+
| @Pi _ _ i d => fun _ p v => p v
6666
end.
6767

68-
68+
(* This used to work
6969
(** You really need a fold! **)
70-
Fixpoint dataLength {x} (l : list x) : nat :=
70+
Fixpoint dataLength {x} (l : list x) Z {struct l} : nat :=
7171
dataMatch (dataList x) _ (fun tag => match tag with
72-
| true => fun _ => 0
73-
| false => fun h t => S (dataLength t)
72+
| true => fun _ => 0
73+
| false => fun h t => S (Z t) (* (dataLength t) *)
7474
end) (list_to_dataList l).
75+
*)

theories/Programming/Show.v

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ Set Strict Implicit.
1515

1616
Set Printing Universes.
1717

18-
Polymorphic Definition showM : Type :=
19-
forall m : Type, Injection ascii m -> Monoid m -> m.
18+
Universe Ushow.
2019

21-
Polymorphic Class ShowScheme (T : Type) : Type :=
22-
{ show_mon : Monoid T
20+
Polymorphic Definition showM@{T} : Type@{Ushow} :=
21+
forall m : Type@{T}, Injection ascii m -> Monoid m -> m.
22+
23+
Polymorphic Class ShowScheme@{t} (T : Type@{t}) : Type :=
24+
{ show_mon : Monoid@{t} T
2325
; show_inj : Injection ascii T
2426
}.
2527

@@ -36,7 +38,8 @@ Global Instance ShowScheme_string_compose : ShowScheme (string -> string) :=
3638
Polymorphic Definition runShow {T} {M : ShowScheme T} (m : showM) : T :=
3739
m _ show_inj show_mon.
3840

39-
Polymorphic Class Show T := show : T -> showM.
41+
Polymorphic Class Show@{t m} (T : Type@{t}) : Type :=
42+
show : T -> showM@{m}.
4043

4144
Polymorphic Definition to_string {T} {M : Show T} (v : T) : string :=
4245
runShow (show v) ""%string.
@@ -73,10 +76,9 @@ Polymorphic Definition indent (indent : showM) (v : showM) : showM :=
7376
Section sepBy.
7477
Import ShowNotation.
7578
Local Open Scope show_scope.
76-
Polymorphic Variable T : Type.
77-
Context {F : Foldable T showM}.
7879

79-
Polymorphic Definition sepBy (sep : showM) (ls : T) : showM :=
80+
Polymorphic Definition sepBy {T : Type}
81+
{F : Foldable T showM} (sep : showM) (ls : T) : showM :=
8082
match
8183
fold (fun s acc =>
8284
match acc with
@@ -115,9 +117,11 @@ Polymorphic Definition wrap (before after : showM) (x : showM) : showM :=
115117
Section sum_Show.
116118
Import ShowNotation.
117119
Local Open Scope show_scope.
118-
Polymorphic Context {A : Type@{a}} {B : Type@{b}} {AS:Show A} {BS:Show B}.
119-
Global Polymorphic Instance sum_Show : Show (A+B) :=
120-
{ show s :=
120+
121+
Polymorphic Definition sum_Show@{a m}
122+
{A : Type@{a}} {B : Type@{a}} {AS:Show@{a m} A} {BS:Show@{a m} B}
123+
: Show@{a m} (A+B) :=
124+
fun s =>
121125
let (tag, payload) :=
122126
match s with
123127
| inl a => (show_exact "inl"%string, show a)
@@ -128,8 +132,8 @@ Section sum_Show.
128132
tag <<
129133
" "%char <<
130134
payload <<
131-
")"%char
132-
}.
135+
")"%char.
136+
133137
End sum_Show.
134138

135139
Section foldable_Show.
@@ -188,12 +192,12 @@ Global Instance Show_Z : Show Z :=
188192
end.
189193

190194
Section pair_Show.
191-
Polymorphic Context {A : Type@{a}} {B : Type@{b}} {AS:Show A} {BS:Show B}.
192-
Global Polymorphic Instance pair_Show : Show (A*B) :=
193-
{ show p :=
194-
let (a,b) := p in
195-
"("%char << show a << ","%char << show b << ")"%char
196-
}.
195+
Polymorphic Definition pair_Show@{a m}
196+
{A : Type@{a}} {B : Type@{a}} {AS:Show A} {BS:Show B}
197+
: Show (A*B) :=
198+
fun p =>
199+
let (a,b) := p in
200+
"("%char << show a << ","%char << show b << ")"%char.
197201
End pair_Show.
198202
End hiding_notation.
199203

theories/Structures/FunctorLaws.v

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,23 @@ Set Strict Implicit.
1010

1111
Section laws.
1212

13-
Polymorphic Class FunctorLaws
13+
Polymorphic Class FunctorLaws@{t u X}
1414
(F : Type@{t} -> Type@{u})
1515
(Functor_F : Functor F)
16-
(Feq : type1 F)
16+
(Feq : type1@{t u X} F)
1717
: Type :=
18-
{ fmap_id : forall T (tT : type T),
19-
typeOk tT -> forall (f : T -> T),
18+
{ fmap_id : forall (T : Type@{t}) (tT : type@{t} T)
19+
(tTo : typeOk@{t} tT) (f : T -> T),
2020
IsIdent f ->
2121
equal (fmap f) (@id (F T))
22-
; fmap_compose : forall T U V (tT : type T) (tU : type U) (tV : type V),
22+
; fmap_compose : forall (T U V : Type@{t})
23+
(tT : type@{t} T) (tU : type@{t} U) (tV : type@{t} V),
2324
typeOk tT -> typeOk tU -> typeOk tV ->
2425
forall (f : T -> U) (g : U -> V),
2526
proper f -> proper g ->
2627
equal (fmap (compose g f)) (compose (fmap g) (fmap f))
27-
; fmap_proper :> forall T U (tT : type T) (tU : type U),
28-
typeOk tT -> typeOk tU ->
28+
; fmap_proper :> forall (T : Type@{t}) (U : Type@{u}) (tT : type T) (tU : type U),
29+
typeOk@{t} tT -> typeOk@{u} tU ->
2930
proper (@fmap _ _ T U)
3031
}.
3132
End laws.

0 commit comments

Comments
 (0)