Friday, July 31, 2020

conferences on formalization and cataloging math and physics

https://imkt.org/activities/events/ - International Mathematical Knowledge Trust


https://cicm-conference.org/cicm.php - Conference on Intelligent Computer Mathematics

  • CICM 2021 will be held in Timisoara, Romania during the week of July 26-30, 2021
  • CICM 2022 will be held in Tbilisi, Georgia sometime in the second half of September 2022 as a component of the Computational Logic Autumn Summit (CLAS 2022) taking place in Tbilisi.

online digital math libraries and Physics libraries

Mathematics

There are multiple formal math databases:
In addition to formal math databases, there are digital math libraries
These digital math libraries are relevant for searching and parsing content.


"How to Build a Global Digital Mathematics Library" by S Watt
https://cs.uwaterloo.ca/~smwatt/pub/reprints/2016-synasc-gdml.pdf

Physics


Teaching resource: https://www.compadre.org/

Increasing levels of formality in a trivial physics statement

In this post I start with a trivial observation about Physics concepts and attempt to add layers of formalization through semantic enrichment. Inspired by sTeX, I use pseudo-Latex which has no supported implementation. RDF tags might be more appropriate.

The initial observation is
The relation between period, T, and linear frequency, f, is T = 1/f. Thus frequency as a function of period is f = 1/T.
The purpose of using this as a starting point is that it is simple and easily understood by a human.
The rest of this post explores what semantic additions would be needed for a computer to parse the text.

Each of these transitions can be identified manually. I don't have reliable ways of automating this process.

*********************
The first change is conversion from ASCII to Latex, a common presentation method in Math and Physics. This change only alters presentation. I've highlighted the changes in red.

The relation between period, $T$, and linear frequency, $f$, is
\begin{equation}
T = 1/f.
\end{equation}
Thus frequency as a function of period is
\begin{equation}
f = 1/T.
\end{equation}

*********************

The next change is to bound claims being made.

\claim{1}{The relation between period, $T$, and linear frequency, $f$, is
  \begin{equation}
    T = 1/f.
  \end{equation}
}
Thus \claim{2}{frequency as a function of period is
  \begin{equation}
    f = 1/T.
  \end{equation}
}

*********************

Replace "thus" with the relation between claims.

\claim{1}{The relation between period, $T$, and linear frequency, $f$, is
  \begin{equation}
    T = 1/f.
  \end{equation}
}
\relation_between_claims{claim 2 is derivable from claim 1}
\claim{2}{frequency as a function of period is
  \begin{equation}
    f = 1/T.
  \end{equation}
}

*********************

Within each claim there are variables and symbols. Identify those.
I've inserted parenthesis to make the order of operations clear.

\claim{1}{The relation between \named_variable{period}, \symbol{T}, and \named_variable{linear frequency}, \symbol{f}, is
  \begin{equation}
    \symbol{T} \operator{=} (\integer{1}\operator{/}\symbol{f}).
  \end{equation}
}
\relation_between_claims{claim 2 is derivable from claim 1}
\claim{2}{The \named_variable{frequency} as a function of \named_variable{period} is
  \begin{equation}
    \symbol{f} \operator{=} (\integer{1}\operator{/}\symbol{T}).
  \end{equation}
}

Visually, this could be represented by color-coded boxing
Here claims are red, connections are light green, expressions are dark green, named variables are pink, variables are blue, operators are light blue, and operators are purple.

This visualization seems to relate to discourse representation theory (DRT) though I don't know how to leverage it. See box notation here and here.


*********************
The "T" and "f" symbols are conventions that are used in other papers. We can indicate that by assigning universal identifiers.
Similarly, the operators "/" and "=" are defined in other papers. Those also get a universal ID.
The relation between named variables and symbols needs to be made explicit.
With those associations made, replace the symbols and operators in the expressions.

\def{symbol{T} = pdg2948}                   % the symbol "T" has a (universal) Godel number
\def{symbol{f} = pdg9215}                   % the symbol "f" has a (universal) Godel number
\def{operator{/} = pdg1340}                 % the operator "/" has a (universal) Godel number
\def{operator{=} = pdg8821}                 % the operator "=" has a (universal) Godel number
\def{named_variable{period} = symbol{T}}    % the named variable "period" is equivalent to the symbol "T"
\def{named_variable{frequency} = symbol{f}} % the named variable "frequency" is equivalent to the symbol "f"

\claim{1}{The relation between \named_variable{period}, pdg2948, and \named_variable{linear frequency}, pdg9215, is
  \begin{equation}
    pdg2948 pdg8821 (\integer{1} pdg1340 pdg9215).
  \end{equation}
}
\relation_between_claims{claim 2 is derivable from claim 1}
\claim{2}{The \named_variable{frequency} as a function of \named_variable{period} is
  \begin{equation}
    pdg9215 pdg8821 (\integer{1} pdg1340 pdg2948).
  \end{equation}
}

One of the purposes of associating a symbol "T" with a universal identifier is that the type can be specified. Here "f" and "T" are both Real valued.

At this point the relation between claims 1 and 2 could be converted to SymPy and verified; see
https://derivationmap.net/review_derivation/884319/

converting the Physics Derivation Graph backend from JSON to a property graph

I shared the JSON database with a few researchers and realized I am embarrassed by the pointer chasing needed to construct the graph. The complexity of numerical IDs used for every feature in the PDG is confusing.

I had come up with a property graph schema which greatly simplifies the concepts and reduces the pointer chasing present in the JSON. Implementing the backend of the PDG as a property graph instead of JSON is a reasonable and beneficial task, but I'm not comfortable with any of the available property graph databases. There are many options available:

My criteria are open source, widely adopted, stable. 
I want the graph content to be plain text. For Neo4j, this means exporting graph content to a Cypher representation:
I want to be able to enforce constraints on the property graph to prevent undesired edges or properties. In Neo4j this is possible but not supported in the community edition.
Staring at the current PDG JSON file, the structure is reasonably intuitive and relatively close to the property graph schema I had come up with. The JSON structure is not a "nodes and edges" design. The JSON is hierarchical (nested dictionaries) to both be more concise and to reduce the computational pointer chasing. 

searching Math and Physics content

The workflow for naive web search is
  1. input query
  2. click on search
  3. get results
This is the dominant mindset and is based on use of Google for finding web content. 
Revising the search string is taken as a failure.
Looking at the second page of results is taken as a failure.

That doesn't need to be the process for search. Interactive refinement of queries is a significant improvement since the user might not realize what's available.


What would searching Math and Physics be like?

  • Leveraging Latex would be important since that is the style the bulk of content uses.
  • Tagging sections would be useful to differentiate claim/lemma/theorem. Documents with sTeX markup or OMdoc could provide better results.
  • Identifying symbol meanings (operators, constants, variables) in expressions. Using "x" for position and "d" for position should be treated as equivalent.

Thursday, July 30, 2020

degrees of formalization in math

Update 2021-07-30: this concept is the de Bruijn factor.

There are many different views of formalization for mathematics. They are not all competing in the same scope. There are different degrees of formalization. Three analogies for this are
  • spectrum of formalization, from informal (e.g., Latex) to increasing formality, like CAS and then to Proof assistants.
  • "levels of zoom" as in visualization, like Google Maps but for Math
  • compiling "high level concepts" (e.g., Latex) to controlled natural language to proofs
The idea of "zooming visualization" is relevant to the user experience -- a reader should be able to select the level of granularity.

The idea of "compiling" is about making implicit concepts explicit. Also, compiling to different architectures is similar to formalizing in different logics and axioms. Unlike the visualization concept, there is not one underlying basis to specify formalization in.


What are the degrees of formalization in math?
  1. verbal (hallway chats, post-conference dinners, coffee breaks)
  2. white board or chalk board
  3. physical paper + pen or pencil
  4. typesetting: Latex or equivalents like Markdown or pretextbook.org (XML based) or pandoc; Powerpoint; Rmd, reStructuredText, MyST, jupyterbook
  5. semantic enrichment/decoration: sTeX, OMDoc; PDG inference rules; pf2 package (sty)
  6. controlled natural languages (e.g., Naproche)
  7. CAS verification of inference rules (e.g. Sage, SymPy)
  8. formal verification in a selected target logic and axioms (e.g., Lean, Isabella, COQ)

References

Wednesday, July 29, 2020

manual translation process from Latex to Sympy for Physics Derivation Graph

Suppose I have a Latex string like

1 = \\int_0^W a \\sin\\left(\\frac{n \\pi}{W} x\\right) \\psi(x)^* dx

The first step is to eliminate notation that is presentation oriented

1 = \\int_0^W a \\sin(\\frac{n \\pi}{W} x) \\psi(x)^* dx

Second, rewrite multi-character variables to single variable

>>> import sympy 
>>> sympy.__version__ 
'1.5.1' 
>>> from sympy.parsing.latex import parse_latex
>>> sympy.srepr(parse_latex('1 = \int_0^W a \sin(\\frac{n \pi}{W} x) f(x)^* dx'))
"Equality(Integer(1), Integral(Mul(Symbol('a'), Mul(Function('f')(Symbol('x')), sin(Mul(Symbol('x'), Mul(Pow(Symbol('W'), Integer(-1)), Mul(Symbol('n'), Symbol('pi'))))))), Tuple(Symbol('x'), Integer(0), Symbol('W'))))"

Note that the complex conjugate operation was dropped without warning. We'll need to manually insert that later.

The SymPy representation is challenging to review, so it can be transformed back to Latex:
>>> sympy.latex((parse_latex('1 = \int_0^W a \sin(\\frac{n \pi}{W} x) f(x)^* dx')))
'1 = \\int\\limits_{0}^{W} a f{\\left(x \\right)} \\sin{\\left(x \\frac{n \\pi}{W} \\right)}\\, dx'
which shows that the input Latex does not get transformed exactly, but close enough for human verification.

From the single-variable representation, replace variables with PDG symbol IDs.
W --> 2523
a --> ?
n --> 1592
pi --> 3141
x --> ?
f --> psi --> 9489
In the context of an isolated function, I don't know which "a" and which "x" are relevant.
To determine those IDs I would need to review the derivation.

which, replacing all instances, yields
Equality(Integer(1), Integral(Mul(Symbol('a'), Mul(Function('pdg9489')(Symbol('x')), sin(Mul(Symbol('x'), Mul(Pow(Symbol('pdg2523'), Integer(-1)), Mul(Symbol('pdg1592'), Symbol('pdg3141'))))))), Tuple(Symbol('x'), Integer(0), Symbol('pdg2523'))))

Finally, insert the "conjugate" for \psi(x)
Equality(Integer(1), Integral(Mul(Symbol('a'), Mul(conjugate(Function('pdg9489')(Symbol('x'))), sin(Mul(Symbol('x'), Mul(Pow(Symbol('pdg2523'), Integer(-1)), Mul(Symbol('pdg1592'), Symbol('pdg3141'))))))), Tuple(Symbol('x'), Integer(0), Symbol('pdg2523'))))