@@ -28,36 +28,32 @@ module DRIVER-COQ
28
28
imports PROVER-CORE-SYNTAX
29
29
imports STRATEGIES-EXPORTED-SYNTAX
30
30
31
+ // Add sort "Term" to declarations
31
32
rule <k> CS:CoqSentence CSs:CoqSentences => CS ~> CSs ... </k>
32
33
<declarations> ( .Bag
33
34
=> <declaration> sort StringToSort("Term") </declaration>
34
35
) ...
35
36
</declarations>
36
37
37
- rule <k> Definition ID BINDERs : TYPE := TERM .
38
- => .K
39
- ...
40
- </k>
41
- <declarations> ( .Bag
42
- => <declaration> symbol CoqIdentToSymbol(ID)(CoqBindersToSorts(BINDERs)) : CoqTermToSort(ID) </declaration>
43
- ) ...
44
- </declarations>
45
-
38
+ // Add symbol (of sort Term) and equality axiom corresponding to each definition
39
+ rule Definition ID BINDERs : TYPE := TERM . => Definition ID := TERM .
46
40
rule <k> Definition ID := TERM .
47
41
=> .K
48
42
...
49
43
</k>
50
44
<declarations> ( .Bag
51
- => <declaration> axiom \equals(CoqIdentToSymbol(ID), CoqTermToPattern(TERM)) </declaration>
45
+ => <declaration> symbol CoqIdentToSymbol(ID)(.Sorts) : StringToSort("Term") </declaration>
46
+ <declaration> axiom \equals(CoqIdentToSymbol(ID), CoqTermToPattern(TERM)) </declaration>
52
47
) ...
53
48
</declarations>
54
49
50
+ // Translate inductive cases
55
51
rule <k> Inductive ID BINDERs : TERM := .CoqIndCases .
56
52
=> .K
57
53
...
58
54
</k>
59
55
<declarations> ( .Bag
60
- => <declaration> symbol CoqIdentToSymbol(ID)(CoqBindersToSorts(BINDERs)) : CoqTermToSort(ID ) </declaration>
56
+ => <declaration> symbol CoqIdentToSymbol(ID)(.Sorts) : StringToSort("Term" ) </declaration>
61
57
) ...
62
58
</declarations>
63
59
@@ -66,20 +62,12 @@ module DRIVER-COQ
66
62
...
67
63
</k>
68
64
<declarations> ( .Bag
69
- => <declaration> symbol CoqIdentToSymbol(IDC)(CoqBindersToSorts(BINDERCs)) : CoqTermToSort(ID ) </declaration>
65
+ => <declaration> symbol CoqIdentToSymbol(IDC)(.Sorts) : StringToSort("Term" ) </declaration>
70
66
<declaration> axiom \type(CoqIdentToSymbol(IDC)(.Patterns), CoqTermToPattern(TERMC)) </declaration>
71
67
) ...
72
68
</declarations>
73
69
74
- syntax Sorts ::= CoqBindersToSorts(CoqBinders) [function]
75
- rule CoqBindersToSorts(.CoqBinders) => .Sorts
76
- rule CoqBindersToSorts(NAME:CoqName BINDERs) => StringToSort("Term"), CoqBindersToSorts(BINDERs)
77
- rule CoqBindersToSorts((NAMES : TYPE) BINDERs) => CoqNamesToSorts(NAMES) ++Sorts CoqBindersToSorts(BINDERs)
78
-
79
- syntax Sorts ::= CoqNamesToSorts(CoqNames) [function]
80
- rule CoqNamesToSorts(.CoqNames) => .Sorts
81
- rule CoqNamesToSorts(NAME:CoqName NAMEs) => StringToSort("Term"), CoqNamesToSorts(NAMEs)
82
-
70
+ // Converting Term to Pattern
83
71
syntax Pattern ::= CoqTermToPattern(CoqTerm) [function]
84
72
rule CoqTermToPattern(UN:UpperName) => CoqIdentToSymbol(UN)
85
73
rule CoqTermToPattern(LN:LowerName) => CoqIdentToSymbol(LN)
@@ -127,7 +115,7 @@ module DRIVER-COQ
127
115
rule CoqPatternToPatterns(ID:CoqQualID) => CoqIdentToSymbol(ID), .Patterns
128
116
rule CoqPatternToPatterns(ID:CoqQualID P:CoqPattern) => CoqIdentToSymbol(ID) ++Patterns CoqPatternToPatterns(P)
129
117
130
- // Get binders from MultPattern
118
+ // Get binders from MultPattern
131
119
syntax Patterns ::= CoqMultPatternToBinders(CoqMultPattern) [function]
132
120
syntax Patterns ::= CoqPatternToBinders(CoqMultPattern) [function]
133
121
rule CoqMultPatternToBinders(ID:CoqQualID) => .Patterns
0 commit comments