Skip to main content

Framework for meta-programming in ASP

Project description

metasp

Installation

To install the project you must have Python 3.12 or higher, and run

pip install .

Usage

Run the following for basic usage information:

metasp -h

This gives you three different modes of operation: Here are the available modes:

  • solve: Solve the processed and reified input files using the meta encoding for the semantics.
  • transform: Output the transformed first-order program and perform syntactic checks.
  • reify: Output the reification with extensions.
  • ui: Launch the user interface mode.

Solving

metasp solve <system> <input_files>

The first argument specifies the system to use for solving, which can be either clingo, clingcon or fclingo. In what follows we will use clingo as an example, but the same applies to the other systems.

Once this is provided you will get a normal clingo command line interface, where you can provide additional arguments to the solver. For example, you can specify the number of models to compute with -n 0. And directly add your input files.

You can see how to run different examples in the examples folder, each example contains a README.md file with instructions on how to run it

  • examples/tel example of how to use the tel (Temporal Equilibrium Logic) extension.
  • examples/del example of how to use the del (Dynamic Equilibrium Logic) extension.
  • examples/mel example of how to use the mel (Modal Equilibrium Logic) extension.

Notice all of them are under finite traces.

Metasp basic arguments

You can see the additional arguments for the metasp that indicate the extension.

metasp solve clingo -h

Additional Arguments

  • Logging Use --log to set the logging level. For detailed parsing information, set it to debug.

  • Extension Files

    • --syntax-encoding: Specify the path to syntax encoding files containing the grammar.
    • --semantics-encoding: Provide the path to semantics encoding files that define the semantic extension.

Output Configuration

  • Printer Function Choose the printing function for models with --printer.

    • Default: Normal clingo print.
    • Alternative: temporal_printer (prints each state on a separate line).
    • Custom: Add your own printing functions using the --python-scripts argument.
  • Python Scripts Use --python-scripts to load custom Python scripts before running the system. These scripts can contain custom printing functions. See the examples/mel folder for usage examples.

Command line tools

To avoid long command lines, you can use a YAML configuration file to set arguments for your extension. Here is an example structure:

syntax-encoding:
    - "./syntax.lp"
semantics-encoding:
    - "./semantics.lp"
printer: temporal_printer
required-constants:
    - "n"
  • syntax-encoding: List of syntax encoding files.
  • semantics-encoding: List of semantics encoding files.
  • printer: Printer function to use (e.g., temporal_printer).
  • required-constants: Constants required for the encoding.

The required-constants field helps ensure all necessary constants are provided, preventing unexpected results when running the system.

UI

To launch the user interface, provide your system configuration using the --meta-config config.yml argument. The configuration file can optionally include a ui-encoding field to add extra encodings for UI generation. The ui-encoding field is optional and can be used to enhance the UI generation with additional logic or features.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

metasp-0.1.2.tar.gz (96.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

metasp-0.1.2-py3-none-any.whl (44.7 kB view details)

Uploaded Python 3

File details

Details for the file metasp-0.1.2.tar.gz.

File metadata

  • Download URL: metasp-0.1.2.tar.gz
  • Upload date:
  • Size: 96.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for metasp-0.1.2.tar.gz
Algorithm Hash digest
SHA256 8d4a725ab9ff34541da508491a45a01c58e238bccf09c6bbe2cfec7db1635ea7
MD5 cfb897e50b097de7b7150af94456f9b7
BLAKE2b-256 02f46844e5db14b52273b3fa78524b49a5311d4e1fa2936df8e1efcbeb28f12d

See more details on using hashes here.

Provenance

The following attestation bundles were made for metasp-0.1.2.tar.gz:

Publisher: deploy.yml on potassco/metasp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file metasp-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: metasp-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 44.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for metasp-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f697f1cf584e09a527181b49bdefdf4b777474f8f86021a4158e6ce957b538a8
MD5 0c5c39221ee0b8c4adf26b247858e85a
BLAKE2b-256 f3af4c380a9ee8c45e08fc4bc4841e5f3cba5554baaf7cb9902189a19b4e11f8

See more details on using hashes here.

Provenance

The following attestation bundles were made for metasp-0.1.2-py3-none-any.whl:

Publisher: deploy.yml on potassco/metasp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page