Code Monkey home page Code Monkey logo

embed_modal's Introduction

Contents

A set of tools to semantically embed (multi-modal) higher-order modal logic problems formulated in the TPTP [1] dialect THF into higher-order logic formulated in THF. It contains

  • a standalone tool embed for the semantical embedding.
  • a conversion tool convert_qmltp_to_thf for translating first-order modal logic problems formulated in the dialect of the QMLTP [2] to higher-order logic problems formulated in THF. A translated version of the QMLTP can be found on Github [3].
  • a library embedding_lib you can include in your project to semantically embed problems. Contains wrapper functions for easier handling.

This software is based on the theoretical work of Benzmüller and Paulson [4].

Details of the embedding's procedure, a theoretical overview and some performance tests are available in Gleißner, Steen and Benzmüller [5].

Requirements

  • Maven 3.5 or higher
  • Java 8 or higher
  • Make

Build

In the root directory invoke

mvn clean package

Usage

Converting a problem

To convert a modal problem run

java -jar embed/target/embed-1.0-SNAPSHOT-shaded.jar 
-i <INPUT_FILE>
-o <OUTPUT_FILE>

Converting a directory

To recursively convert a directory containing modal problems run

java -jar embed/target/embed-1.0-SNAPSHOT-shaded.jar 
-i <INPUT_DIRECTORY>
-o <OUTPUT_DIRECTORY>
-diroutput <OUTPUT_OPTIONS>

This will preserve the directory structure in the output. If more than semantic is specified the choices for <OUTPUT_OPTIONS> become relevant:

  • joint: exactly one duplicate directory structure and filenames contain a string representing the semantics used during the embedding
  • splitted: one duplicate directory structure for every semantic

Adding Semantics

Specify semantics (which overrides any semantics specified in the problem) for mono-modal problems using

-consequences <CONSEQUENCES>
-constants <CONSTANTS>
-domains <DOMAINS>
-systems <SYSTEMS>

Valid choices for the semantics parameters are

  • <CONSEQUENCES>: global,local
  • <CONSTANTS>: rigid
  • <DOMAINS>: constant, cumulative, decreasing, varying
  • <SYSTEMS>: K, KB, K4, K5, K45, KB5, KB5_KB5, KB5_KB4, D, DB, D4, D5, D45, T, B, S4, S5, S5_KT5, S5_KTB5, S5_KT45, S5_KT4B, S5_KD4B, S5_KD4B5, S5_KDB5, S5U

Note that systems with the same prefix are different axiomatizations of the same semantics.

Specify multiple semantics that creates multiple embedded problems by separating the parameters with a comma e.g.

-domains constant,cumulative

This will create embeddings for all semantics contained by the cross-product of <CONSEQUENCES> x <CONSTANTS> x <DOMAINS> x <SYSTEMS>

Transformation Parameters

Specify special parameters using

-t <OPTIONS>

Valid choices for <OPTIONS> are

  • semantical_modality_axiomatization: embed modality semantics as frame conditions
  • syntactical_modality_axiomatization: embed modality semantics as axioms about modal operators

References

[1] Geoff Sutcliffe - The TPTP Problem Library and Associated Infrastructure. From CNF to TH0, TPTP v6.4.0 - 2017 - Journal of Automated Reasoning - http://www.tptp.org

[2] Thomas Raths and Jens Otten - The QMLTP Problem Library for First-Order Modal Logics - 2012 - Automated Reasoning, IJCAR 2012 - http://www.jens-otten.de/papers/qmltp_ijcar12.pdf - http://www.iltp.de/qmltp

[3] Tobias Gleißner - QMLTP Mirror and QMLTP in THF - https://github.com/TobiasGleissner/QMLTP

[4] Christoph Benzmüller and Lawrence C. Paulson - Quantified Multimodal Logics in Simple Type Theory - 2013 - Logica Universalis (Special Issue on Multimodal Logics) - http://christoph-benzmueller.de/papers/J23.pdf

[5] Tobias Gleißner, Alexander Steen and Christoph Benzmüller - Theorem Provers For Every Normal Modal Logic - 2017 - LPAR-21. 21st International Conference on Logic for Programming, Artificial Intelligence and Reasoning - https://easychair.org/publications/paper/340346

embed_modal's People

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

embed_modal's Issues

java.lang.ArrayIndexOutOfBoundsException on invocation without arguments

When invoking the tool without arguments, an exception is thrown:

[15:05] target$ java -jar embed-1.0-SNAPSHOT-shaded.jar 
usage: embedlogic
 -diroutput <DIROUTPUT>      directory output structure
 -dotbin <DOT_BIN>           Dot binary from graphviz
 -dotin <INPUT_DOT_FILE>     Output file
 -dotout <OUTPUT_DOT_FILE>   Output file
 -f,--format <FORMAT>        Input format. Valid values: modal,free
 -h,--help                   Print help
 -i,--input <INPUT_FILE>     Input file
 -log <LOG>                  log file
 -loglevel <LOGLEVEL>        warning, info, finest
 -o,--output <OUTPUT_FILE>   Output file
 -semantics <SEMANTICS>      standard_s5 or all
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
	at main.EmbedModal.argsParse(EmbedModal.java:158)
	at main.EmbedModal.main(EmbedModal.java:199)

Singlequoted names for annotated formulas

.... cannot be parsed. Can this be added? It's sometimes very nice to write

thf('1', axiom, ...).
...
thf('24', axiom, ...).

instead of spelling out the numbers or using alternative names.

Include statements not supported

When I try to embed a problem

include('logic.spec').

thf(one_prime, axiom, ....).
....(further formulas).....

embedlogic will give me an error main.EmbedModal main - SEVERE: Could not convert: No explicit or default consequence semantics found for identifier one_prime.
However, when I copy&paste the contents of logic.spec into the file, it works fine.

Parsing error on (large? deeply nested?) problem

The parser of the tool gives up on problem GAL016+1.p and others, too.

Is there something that can be done?
Java:

openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)

Error message:

Dec 8, 2017 1:25:55 PM transformation.Wrappers lambda$convertModalMultipleSemanticsOnMultipleDirectoriesTraverseDirectory$4 - INFO: Processing 524: /home/lex/TPTP/modal/GAL/GAL016+1.p
Dec 8, 2017 1:25:55 PM transformation.Wrappers convertModalToString - INFO: Processing /home/lex/TPTP/modal/GAL/GAL016+1.p using additional semantics k_constant_rigid_global
java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at parser.ThfAstGen.parse(ThfAstGen.java:47)
at transformation.Wrappers.convertModalToString(Wrappers.java:286)
at transformation.Wrappers.convertModal(Wrappers.java:335)
at transformation.Wrappers.lambda$convertModalMultipleSemanticsOnMultipleDirectoriesTraverseDirectory$4(Wrappers.java:90)
at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.Iterator.forEachRemaining(Iterator.java:116)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
at transformation.Wrappers.convertModalMultipleSemanticsOnMultipleDirectoriesTraverseDirectory(Wrappers.java:76)
at main.EmbedModal.main(EmbedModal.java:247)
Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded
at org.antlr.v4.runtime.misc.DoubleKeyMap.put(DoubleKeyMap.java:25)
at org.antlr.v4.runtime.atn.PredictionContext.mergeSingletons(PredictionContext.java:234)
at org.antlr.v4.runtime.atn.PredictionContext.merge(PredictionContext.java:155)
at org.antlr.v4.runtime.atn.PredictionContext.mergeSingletons(PredictionContext.java:225)
at org.antlr.v4.runtime.atn.PredictionContext.merge(PredictionContext.java:155)
at org.antlr.v4.runtime.atn.ATNConfigSet.add(ATNConfigSet.java:154)
at org.antlr.v4.runtime.atn.ParserATNSimulator.closure_(ParserATNSimulator.java:1529)
at org.antlr.v4.runtime.atn.ParserATNSimulator.closureCheckingStopState(ParserATNSimulator.java:1513)
at org.antlr.v4.runtime.atn.ParserATNSimulator.closure_(ParserATNSimulator.java:1583)
at org.antlr.v4.runtime.atn.ParserATNSimulator.closureCheckingStopState(ParserATNSimulator.java:1513)
at org.antlr.v4.runtime.atn.ParserATNSimulator.closure_(ParserATNSimulator.java:1583)
at org.antlr.v4.runtime.atn.ParserATNSimulator.closureCheckingStopState(ParserATNSimulator.java:1513)
at org.antlr.v4.runtime.atn.ParserATNSimulator.closure_(ParserATNSimulator.java:1583)
at org.antlr.v4.runtime.atn.ParserATNSimulator.closureCheckingStopState(ParserATNSimulator.java:1513)
at org.antlr.v4.runtime.atn.ParserATNSimulator.closure_(ParserATNSimulator.java:1583)
at org.antlr.v4.runtime.atn.ParserATNSimulator.closureCheckingStopState(ParserATNSimulator.java:1513)
at org.antlr.v4.runtime.atn.ParserATNSimulator.closure_(ParserATNSimulator.java:1583)
at org.antlr.v4.runtime.atn.ParserATNSimulator.closureCheckingStopState(ParserATNSimulator.java:1513)
at org.antlr.v4.runtime.atn.ParserATNSimulator.closure_(ParserATNSimulator.java:1583)
at org.antlr.v4.runtime.atn.ParserATNSimulator.closureCheckingStopState(ParserATNSimulator.java:1513)
at org.antlr.v4.runtime.atn.ParserATNSimulator.closure_(ParserATNSimulator.java:1583)
at org.antlr.v4.runtime.atn.ParserATNSimulator.closureCheckingStopState(ParserATNSimulator.java:1513)
at org.antlr.v4.runtime.atn.ParserATNSimulator.closure_(ParserATNSimulator.java:1583)
at org.antlr.v4.runtime.atn.ParserATNSimulator.closureCheckingStopState(ParserATNSimulator.java:1513)
at org.antlr.v4.runtime.atn.ParserATNSimulator.closure_(ParserATNSimulator.java:1583)
at org.antlr.v4.runtime.atn.ParserATNSimulator.closureCheckingStopState(ParserATNSimulator.java:1513)
at org.antlr.v4.runtime.atn.ParserATNSimulator.closure_(ParserATNSimulator.java:1583)
at org.antlr.v4.runtime.atn.ParserATNSimulator.closureCheckingStopState(ParserATNSimulator.java:1513)
at org.antlr.v4.runtime.atn.ParserATNSimulator.closure_(ParserATNSimulator.java:1583)
at org.antlr.v4.runtime.atn.ParserATNSimulator.closureCheckingStopState(ParserATNSimulator.java:1513)
at org.antlr.v4.runtime.atn.ParserATNSimulator.closure_(ParserATNSimulator.java:1583)
at org.antlr.v4.runtime.atn.ParserATNSimulator.closureCheckingStopState(ParserATNSimulator.java:1513)
Dec 8, 2017 1:32:40 PM transformation.Wrappers convertModal - SEVERE: exceptions.ParseException
Dec 8, 2017 1:32:40 PM transformation.Wrappers lambda$convertModalMultipleSemanticsOnMultipleDirectoriesTraverseDirectory$4 - WARNING: ParseError: Could not convert /home/lex/TPTP/modal/GAL/GAL016+1.p

Multiple definitions of exists-in-world constants for same type

If a modal problem contains a user constant of type $i and quantifies over type $i, the embedding will introduce two distinct exists-in-world constants for the same type. Since only the one introduced in conjunction with quantification is used, this may lead for incompleteness as user constants may not exist with respect to quantification.

Example from SYM065+1 (transformed QMLTP problem), local semantics, cumulative domains, modal system D:

thf(c_type,type,(c : ($i))).
thf(p_type,type,(p : ($i>$o))).
thf ( con , conjecture , ( ( $box @ ( ( p @ c ) ) ) => ( ? [ X :$i ] : ( $box @ ( ( p @ X ) ) ) ) ) ) .

After embedding, this becomes:

% -------------------------------------------------------------------------
% modal definitions 
% -------------------------------------------------------------------------

% declare type for possible worlds
thf( mworld_type , type , ( mworld:$tType ) ).

% declare accessibility relations
thf( mrel_type , type , ( mrel:mworld>mworld>$o) ).

% define accessibility relation properties
thf( mserial_type , type , ( mserial : (mworld>mworld>$o)>$o ) ).
thf( mserial_def , definition , ( mserial = (^ [R:mworld>mworld>$o] : ! [A:mworld] : ? [B:mworld] : (R@A@B)))).

% assign properties to accessibility relations
thf( mrel_mserial , axiom , ( mserial @ mrel ) ).

% define current-world constant and actuality operator
thf( mcurrentworld_type , type , ( mcurrentworld: mworld ) ).
thf( mactual_type , type , ( mactual: ( ( mworld>$o ) >$o ) ) ).
thf( mactual_def , definition , ( mactual = ( ^ [Phi:(mworld>$o)] : ( Phi @ mcurrentworld ) ) ) ).

% define nullary, unary and binary connectives which are no quantifiers
thf( mimplies_type , type , ( mimplies: (mworld>$o)>(mworld>$o)>mworld>$o) ).
thf( mimplies , definition , ( mimplies = (^ [A:mworld>$o,B:mworld>$o,W:mworld] : ( (A@W) => (B@W) )))).
thf( mbox_type , type , ( mbox: (mworld>$o)>mworld>$o) ).
thf( mbox_def , definition , ( mbox = (^ [A:mworld>$o,W:mworld] : ! [V:mworld] : ( (mrel@W@V) => (A@V) )))).

% define exists-in-world predicates for quantified types and non-emptiness axioms
thf( exists_in_world_type__d_i , type , ( eiw__d_i : ( ( ( $i ) > ( mworld > $o ) ) ) ) ).
thf( eiw_nonempty__d_i , axiom , (! [W:mworld]: ( ? [X:($i)] : (eiw__d_i @ X @ W)))).

% define domain restrictions
thf( eiw_cumul__d_i_r , axiom , (! [W:mworld,V:mworld,C:$i]: ( (mrel @ W @ V) => ((eiw__d_i @ C @ W) => (eiw__d_i @ C @ V)) ))).

% define exists quantifiers
thf(mexists_vary_type__d_i , type , ( mexists_vary__d_i : ( ( ( $i ) > ( mworld > $o ) ) > mworld > $o ) ) ).
thf(mexists_vary__d_i , definition , ( mexists_vary__d_i = ( ^ [A:($i)>mworld>$o,W:mworld] : ? [X:($i)] : ((eiw__d_i @ X @ W) & (A @ X @ W))))).

thf(c_type,type,(c:($i))).
thf(p_type,type,(p:($i>(mworld>$o)))).
%--------------------------------------------------------------------------
thf(con,conjecture,( mactual @ ((mimplies@((mbox@((p@c))))@((mexists_vary__d_i@(^ [ X : $i ] : ((mbox@((p@X))))))))) )).

% -------------------------------------------------------------------------
% auxiliary definitions 
% -------------------------------------------------------------------------

% define exists-in-world assertion for user-defined constants
thf( exists_in_world_type__o__d_i_t__o_mworld_t__d_o_c__c_ , type , ( eiw__o__d_i_t__o_mworld_t__d_o_c__c_ : ( ( ( ($i>(mworld>$o)) ) > ( mworld > $o ) ) ) ) ).
thf( eiw_nonempty__o__d_i_t__o_mworld_t__d_o_c__c_ , axiom , (! [W:mworld]: ( ? [X:(($i>(mworld>$o)))] : (eiw__o__d_i_t__o_mworld_t__d_o_c__c_ @ X @ W)))).
thf( eiw_p , axiom , (! [W:mworld]: ( (eiw__o__d_i_t__o_mworld_t__d_o_c__c_ @ p @ W)))).
thf( exists_in_world_type__o__d_i_c_ , type , ( eiw__o__d_i_c_ : ( ( ( ($i) ) > ( mworld > $o ) ) ) ) ).
thf( eiw_nonempty__o__d_i_c_ , axiom , (! [W:mworld]: ( ? [X:(($i))] : (eiw__o__d_i_c_ @ X @ W)))).
thf( eiw_c , axiom , (! [W:mworld]: ( (eiw__o__d_i_c_ @ c @ W)))).

Here, eiw__d_i is used for the axioms and definition of cumulativity. However, eiw__o__d_i_c_ is introduced for postulating the existence of c in every world (last three lines) where eiw__d_i should be used. The problem is CSA whereas the original problem is THM. With the change, it is also THM in THF.

NullPointerException in Wrappers if -o is relative directory path without parent

Command: embedModal -f modal -i modal/ -diroutput splitted -semantics all -o qmltp

Error: Exception in thread "main" java.lang.NullPointerException at transformation.Wrappers.lambda$convertModalMultipleSemanticsOnMultipleDirectoriesTraverseDirectory$4(Wrappers.java:79) at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) [...] at transformation.Wrappers.convertModalMultipleSemanticsOnMultipleDirectoriesTraverseDirectory(Wrappers.java:76) at main.EmbedModal.main(EmbedModal.java:247)

It seems that inPath.getParent().toString().length() throws an NullPointerException since the input directory is relative without any parent. A workaround is to use absolute paths instead:

Workaround: embedModal -f modal -i /home/lex/TPTP/modal/ -diroutput splitted -semantics all -o qmltp

Maybe this should be fixed?

mrel is not specified if neither $box nor $dia is used in the problem

See SET008+3.p (QMLTP). The problem does not contain $box or $dia so mrel is not introduced to the embedded problem. But if translating with varying domain semantics the definition of the quantifier/the exists in world predicates require mrel. Hence, the ATP systems report an error.
Always specifiy mrel or simplify the definition of quantifiers if no box/dia is used in problem?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.