Documentation about all the different operators

So there’s lots of operators you can use like “and” and “or” and “elementof”, but there’s no particular place these are documented.

I reckon you could come up with a list of such things if you stared long enough at text-to-ast but I uhhh don’t know enough javascript to do this well.

Something that tells me this may be more subtle than I’d think: based on staring at text-to-ast, I would have guessed that “containselement” is a valid operator, but it does not appear to work (or at least not in the way I would have guessed).

Demo

You are better off staring at the spec file as it directly gives some mappings from the text to the AST. Lines 208 - 243 have some set operators like

  "x elementof A": ["in", "x", "A"],
  "x ∈ A": ["in", "x", "A"],
  "x notelementof A": ["notin", "x", "A"],
  "x ∉ A": ["notin", "x", "A"],
  "A containselement x": ["ni", "A", "x"],
  "A ∋ x": ["ni", "A", "x"],
  "A notcontainselement x": ["notni", "A", "x"],
  "A ∌ x": ["notni", "A", "x"],

There you can see the actual operators in the AST are in and ni, despite needing to be called elementof and containselement in the text format. The unicode options like A ∋ x should clarify their meanings.

In latex, the names match better (ignore the fact that we have double backslashes, that’s Javascript string escaping):

  "x \\in A": ["in", "x", "A"],
  "x \\notin A": ["notin", "x", "A"],
  "x \\not\\in A": ["notin", "x", "A"],
  "A \\ni x": ["ni", "A", "x"],
  "A \\not\\ni x": ["notni", "A", "x"],

I don’t know why neither ∋ nor containselement work inside a <boolean>. They work in a <math> so it isn’t a problem with parsing. I created a bug report.

1 Like