-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcoqtypes.py
70 lines (49 loc) · 1.33 KB
/
coqtypes.py
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
class GroupElement:
def __init__(self, name, group):
self.name = name
self.group = group
self.type = group.U
def to_coq(self):
pass
class Group:
def __init__(self, name):
self.name = name
self.U = Variable("U")
self.operation = "op {}".format(name)
self.inverse = "inv {}".format(name)
self.identity = "id {}".format(name)
def load_properties(self):
pass
def multiply(self, elt1, elt2):
# assume self and other are part of same group
new = GroupElement("{} {} {}".format(self.operation, elt1.name, elt2.name), self)
return new
def inverse(self, element):
inv = GroupElement("{} {}".format(self.inverse, elt.name), self)
return inv
def identity(self, elt):
return elt
def to_coq_declare(self):
return "Variable {}:group U. ".format(self.name)
def to_coq(self):
return self.name
def __repr__(self):
return "Group {}".format(self.name)
class Variable:
def __init__(self, name, coqtype="U"):
self.name = name
self.type = coqtype
# self.supersets = [Group]
def to_coq_declare(self):
return "Variable {}:{}. ".format(self.name, self.type)
def to_coq(self):
return self.name
def __repr__(self):
return self.name
class Subgoal:
def __init__(self, statement):
self.statement = statement
def __str__(self):
return self.statement
def __repr__(self):
return self.__str__()