Skip to main content

calcprop

Binder

Librería de cálculo proposicional en Python. Construye fórmulas con v('etiqueta') y los operadores &, |, -, >> y **, y decide con test(P, premisas) si P es consecuencia lógica de las premisas.

from calcprop import *

A, B = v('llueve'), v('suelo mojado')
test(B, [A, A >> B])        # True   (modus ponens)
test(A, [B, A >> B])        # False  (afirmar el consecuente)
test(unoDe(A, B), [A, -B])  # True

Cuando se mezclan conectivos distintos conviene poner paréntesis: la precedencia es la de Python, no la de la lógica (A & B >> C se lee A & (B >> C)).

Para ver el razonamiento hay dos herramientas didácticas:

print(explica(B, [A, A >> B]))       # árbol de refutación paso a paso
print(tabla_verdad(B, [A, A >> B]))  # tabla de verdad con las filas que cumplen las premisas
  • Introducción al cálculo proposicional, interactiva: Introduccion.ipynb; se puede ejecutar sin instalar nada pulsando el botón launch binder de arriba.

  • Manual de uso: Manual.org / Manual.pdf.

  • Código fuente documentado (programación literaria): CalcProp.org; src/calcprop/__init__.py se genera de él mediante org-babel-tangle.

  • Pruebas: python -m pytest.

Es el motor lógico del paquete qbank (generación de bancos de preguntas de opción múltiple).

Instalación

pip install calcprop

Autoría y licencia

Copyright (C) 2020-2026 Andrés Bujosa, Marcos Bujosa

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

See the LICENSE file for details.

Metadata

Release files for calcprop 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for calcprop 0.2.0
File Size Uploaded Provenance
calcprop-0.2.0.tar.gz 59.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for calcprop 0.2.0
File Interpreter ABI Platform
calcprop-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 81.2 kB

Release files / calcprop-0.2.0.tar.gz

Download URL calcprop-0.2.0.tar.gz
Size 59.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1cf184d9bb0bcb81a436a1807228c281c375fa846aff8fce12b7f43dccd18afc
BLAKE2b-256 checksum
How to use checksums
411d290668d2ec177370c036cd6a38a086bebcc91cdafe4c81b5656bde3451d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.2

Release files / calcprop-0.2.0-py3-none-any.whl

Download URL calcprop-0.2.0-py3-none-any.whl
Size 21.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
61d670ef770b0919ca288f0988a52c4814b98c21396a643e91f17b6cf7d24f9d
BLAKE2b-256 checksum
How to use checksums
ae2980142059de4237ee064037302d088e2d4989e70f113ac93874394dc67d2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.2

Security for calcprop 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page