-
Notifications
You must be signed in to change notification settings - Fork 8
/
TacticsTest.v
183 lines (151 loc) · 4.36 KB
/
TacticsTest.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
Set Warnings "-notation-overridden,-parsing".
From Coq Require Export String.
From LF Require Import Tactics.
Parameter MISSING: Type.
Module Check.
Ltac check_type A B :=
match type of A with
| context[MISSING] => idtac "Missing:" A
| ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"]
end.
Ltac print_manual_grade A :=
match eval compute in A with
| Some (pair ?S ?C) =>
idtac "Score:" S;
match eval compute in C with
| ""%string => idtac "Comment: None"
| _ => idtac "Comment:" C
end
| None =>
idtac "Score: Ungraded";
idtac "Comment: None"
end.
End Check.
From LF Require Import Tactics.
Import Check.
Goal True.
idtac "------------------- apply_exercise1 --------------------".
idtac " ".
idtac "#> rev_exercise1".
idtac "Possible points: 3".
check_type @rev_exercise1 ((forall l l' : list nat, l = @rev nat l' -> l' = @rev nat l)).
idtac "Assumptions:".
Abort.
Print Assumptions rev_exercise1.
Goal True.
idtac " ".
idtac "------------------- inversion_ex3 --------------------".
idtac " ".
idtac "#> inversion_ex3".
idtac "Possible points: 1".
check_type @inversion_ex3 (
(forall (X : Type) (x y z w : X) (l j : list X),
x :: y :: l = w :: z :: j -> x :: l = z :: j -> x = y)).
idtac "Assumptions:".
Abort.
Print Assumptions inversion_ex3.
Goal True.
idtac " ".
idtac "------------------- inversion_ex6 --------------------".
idtac " ".
idtac "#> inversion_ex6".
idtac "Possible points: 1".
check_type @inversion_ex6 (
(forall (X : Type) (x y z : X) (l j : list X),
x :: y :: l = [ ] -> y :: l = z :: j -> x = z)).
idtac "Assumptions:".
Abort.
Print Assumptions inversion_ex6.
Goal True.
idtac " ".
idtac "------------------- plus_n_n_injective --------------------".
idtac " ".
idtac "#> plus_n_n_injective".
idtac "Possible points: 3".
check_type @plus_n_n_injective ((forall n m : nat, n + n = m + m -> n = m)).
idtac "Assumptions:".
Abort.
Print Assumptions plus_n_n_injective.
Goal True.
idtac " ".
idtac "------------------- beq_nat_true --------------------".
idtac " ".
idtac "#> beq_nat_true".
idtac "Possible points: 2".
check_type @beq_nat_true ((forall n m : nat, beq_nat n m = true -> n = m)).
idtac "Assumptions:".
Abort.
Print Assumptions beq_nat_true.
Goal True.
idtac " ".
idtac "------------------- beq_nat_true_informal --------------------".
idtac " ".
idtac "#> Manually graded: informal_proof".
idtac "Advanced".
idtac "Possible points: 2".
print_manual_grade manual_grade_for_informal_proof.
idtac " ".
idtac "------------------- gen_dep_practice --------------------".
idtac " ".
idtac "#> nth_error_after_last".
idtac "Possible points: 3".
check_type @nth_error_after_last (
(forall (n : nat) (X : Type) (l : list X),
@length X l = n -> @nth_error X l n = @None X)).
idtac "Assumptions:".
Abort.
Print Assumptions nth_error_after_last.
Goal True.
idtac " ".
idtac "------------------- destruct_eqn_practice --------------------".
idtac " ".
idtac "#> bool_fn_applied_thrice".
idtac "Possible points: 2".
check_type @bool_fn_applied_thrice (
(forall (f : bool -> bool) (b : bool), f (f (f b)) = f b)).
idtac "Assumptions:".
Abort.
Print Assumptions bool_fn_applied_thrice.
Goal True.
idtac " ".
idtac "------------------- beq_nat_sym --------------------".
idtac " ".
idtac "#> beq_nat_sym".
idtac "Possible points: 3".
check_type @beq_nat_sym ((forall n m : nat, beq_nat n m = beq_nat m n)).
idtac "Assumptions:".
Abort.
Print Assumptions beq_nat_sym.
Goal True.
idtac " ".
idtac "------------------- split_combine --------------------".
idtac " ".
idtac "#> Manually graded: split_combine".
idtac "Advanced".
idtac "Possible points: 3".
print_manual_grade manual_grade_for_split_combine.
idtac " ".
idtac "------------------- filter_exercise --------------------".
idtac " ".
idtac "#> filter_exercise".
idtac "Advanced".
idtac "Possible points: 3".
check_type @filter_exercise (
(forall (X : Type) (test : X -> bool) (x : X) (l lf : list X),
@filter X test l = x :: lf -> test x = true)).
idtac "Assumptions:".
Abort.
Print Assumptions filter_exercise.
Goal True.
idtac " ".
idtac "------------------- forall_exists_challenge --------------------".
idtac " ".
idtac "#> Manually graded: forall_exists_challenge".
idtac "Advanced".
idtac "Possible points: 4".
print_manual_grade manual_grade_for_forall_exists_challenge.
idtac " ".
idtac " ".
idtac "Max points - standard: 18".
idtac "Max points - advanced: 30".
Abort.