Documentation ¶
Overview ¶
Package sets implement basic math sets theory, usefull to evaluate an answer. For instance, the two expression A and A ∩ (B U neg(B)) are equal
Note that this package treats sets as opaque, so that simplification using relation such as A = B U C are not supported.
Index ¶
Constants ¶
const MaxNumberOfLeaves = 16
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BinNode ¶
type BinNode interface { String() string // contains filtered or unexported methods }
BinNode is one node of a binary tree representation of a set expression.
The nil value is invalid and does not appear in a well formed tree.
type BinarySet ¶
type BinarySet struct { // Sets stores the LaTeX code of each set, // like "A", "B_i" or "B_{i+1}", and is indexed by // a Leaf id. // A well formed set has no more than [MaxNumberOfLeaves] leaves. Sets []string Root BinNode }
func (BinarySet) IsEquivalent ¶
IsEquivalent assumes [other] is built with the same leaves, and returns true if the two expressions define the same set. For instance, A n A == A and (A n B) u (A n neg(B)) == A
type Complement ¶
type Complement struct {
Right BinNode
}
func (Complement) String ¶
func (c Complement) String() string
type ListNode ¶
type ListNode struct { // with length 0 if Op == SLeaf, one if Op == SComplement, > 1 otherwise Args []ListNode Op SetOp Leaf Set // valid only if Op == SLeaf }
ListNode is a tree where operator are grouped when possible, used by the student app.
type ListSet ¶
ListSet is a tree where operator are grouped when possible, and leaf contents are extracted