Example where distinct variable constraints are violated based on automatic expansion of a definition

Here's an example of an expanding definition causing a distinct variable constraint to be violated.

The easiest way to get some kinds, terms, and statements with distinct variable constraints to work with is going to be to import one of our existing interfaces; here we pick Interface:First-order logic.  import (PROPOSITIONAL Interface:Classical_propositional_calculus ) import (PREDICATE Interface:First-order_logic (PROPOSITIONAL) ) 

Here's a definition with a dummy variable (because  is found on the right hand side, but not the left hand side, of the definition).  var (formula p) def ((truth) (p ∨ (¬ p))) 

Here is an example of a valid theorem with a distinct variable constraint.  var (variable x) thm (Valid ((p x)) ((p ∨ (¬ p)) → (∀ x (p ∨ (¬ p)))) ( (p ∨ (¬ p)) x Generalization )) 

Now suppose we want to prove, which looks similar but which has a definition. What happens is that the definition gets expanded, and then JHilbert complains about the lack of a distinct variable constraint between  and the unnamed variable.  thm (Invalid ((p x)) ((truth) → (∀ x (truth))) ( (truth) x Generalization )) 

This combination of the automatic expansion of definitions and the way that distinct variables work is a significant inconvenience in using definitions as they currently exist in JHilbert. One workaround is to expand the definitions manually (which allows the distinct variable constraints to be expressed explicitly), and another is to export to an interface in which the definition is not a  but a.

An example of expanding the definitions manually is  in Basic arithmetic. An example of moving the proof into a separate module in which the term is declared with  rather than   is the way that Basic operations of Zermelo–Fraenkel set theory is separate from First steps in set theory.

Once JHilbert definitions are redesigned (see Wikiproofs:JHilbert definition soundness), it is likely that whatever kind of definitions allow dummy variables won't be automatically expanded.