Skip to content

Commit

Permalink
Bug fix: natural constants marked as metavars
Browse files Browse the repository at this point in the history
  • Loading branch information
kenmonks committed Dec 14, 2024
1 parent f8d9c5e commit 40a632b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lde/src/formula.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { Expression } from './expression.js'
import { Environment } from './environment.js'
import { Symbol as LurchSymbol } from './symbol.js'
import Matching from './matching.js'
import Parsing from './experimental/parsing.js'

/**
* A {@link LogicConcept LogicConcept} can be converted into a formula by
Expand Down Expand Up @@ -69,8 +70,10 @@ const from = (LC, inPlace=false) => {
).map( be => be.boundSymbolNames() ).flat() )
// make a copy and change all of its undeclared symbols into metavariables
const result = (inPlace) ? LC : LC.copy()
// in addition to these, we also have to avoid natural number constants
result.descendantsSatisfying( d => d instanceof LurchSymbol )
.filter( s => !declared.has( s.text() ) && !bound.has( s.text() )
&& !Parsing.isNaturalNumber( s )
&& s.isFree() )
.forEach( s => s.makeIntoA( Matching.metavariable ) )
// return it
Expand Down

0 comments on commit 40a632b

Please sign in to comment.