Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variables (scopes, quantification,...) #5

Open
Jazzpirate opened this issue Feb 27, 2021 · 0 comments
Open

Variables (scopes, quantification,...) #5

Jazzpirate opened this issue Feb 27, 2021 · 0 comments

Comments

@Jazzpirate
Copy link
Collaborator

Jazzpirate commented Feb 27, 2021

Possible approach 1: Variable declarations

  • \vardecl[name=N,type={\NaturalNumbers}]{varN}{N} (syntax analogous to \symdef, see Symbolic notations #3) introduces a macro \varN for the variable N, and behaves exactly like a semantic macro,
    i.e. in mathmode, $\varN$ simply yields "N" (its notation), in textmode it takes 0 {}-arguments and one optional []-argument:

=> \implication*[2]{\even{\varN[A \NaturalNumbers[natural number] $\varN$]}[ is even]}[, if]{\even{\natpow{\varN[its]}*{2}[ square]}[ is even]}

Possible approach 2: Scope environments
Can optionally declare variables, e.g. \varscope([name=name, type=t, notation=not, (universal|existential)])*{...} - with everything optional. If an occuring variable is not "declared in a \varscope, its scope is the most inner \varscope in which it occurs. A variable occurence is whatever LaTeXML's math parser considers a variable, or a \var{name} (for not explicitly declared variables in text, e.g. "its" in the example), or \name if a variable with name name is declared in the current \varscope, e.g.:

\varscope{\implication*[2]{\even{\var{N][A \NaturalNumbers[natural number] $N$]}[ is even]}[, if]{\even{\natpow{\var{N}[its]}*{2}[ square]}[ is even]}}

or

\varscope[name=varN, type=\NaturalNumbers, not=N]{\implication*[2]{\even{\varN[A \NaturalNumbers[natural number] $N$]}[ is even]}[, if]{\even{\natpow{\varN[its]}*{2}[ square]}[ is even]}}

Advantage: compatible with fewer explicit annotations, scope still has to be provided, though

Disadvantage: might require an additional \apply-operator for applications of (function) variables, but we probably can't avoid that anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant