Skip to main content

A quantum-classical hybrid reasoning engine for uncertainty-aware AI inference

Project description

Probabilistic Quantum Reasoner

PyPI PyPI Downloads Docs License: Commercial Python 3.10+

A quantum-classical hybrid reasoning engine for uncertainty-aware AI inference, fusing quantum probabilistic graphical models (QPGMs) with classical probabilistic logic.

🎯 Overview

The Probabilistic Quantum Reasoner implements a novel approach to AI reasoning by encoding knowledge using quantum amplitude distributions over Hilbert space, modeling uncertainty through entanglement and non-commutative conditional graphs, and enabling hybrid Quantum Bayesian Networks with causal, counterfactual, and abductive reasoning capabilities.

🧩 Key Features

  • Quantum Bayesian Networks: Hybrid classical-quantum probabilistic graphical models
  • Quantum Belief Propagation: Unitary message passing with amplitude-weighted inference
  • Causal Quantum Reasoning: Do-calculus analog for quantum intervention logic
  • Multiple Backends: Support for Qiskit, PennyLane, and classical simulation
  • Uncertainty Modeling: Entanglement-based uncertainty representation
  • Counterfactual Reasoning: Quantum counterfactuals using unitary interventions

🚀 Quick Start

Installation

pip install probabilistic-quantum-reasoner

For development with extra features:

pip install probabilistic-quantum-reasoner[dev,docs,extras]

Basic Usage

from probabilistic_quantum_reasoner import QuantumBayesianNetwork
from probabilistic_quantum_reasoner.backends import QiskitBackend

# Create a quantum Bayesian network
qbn = QuantumBayesianNetwork(backend=QiskitBackend())

# Add quantum and classical nodes
weather = qbn.add_quantum_node("weather", ["sunny", "rainy"])
mood = qbn.add_stochastic_node("mood", ["happy", "sad"])

# Create entangled relationship
qbn.add_edge(weather, mood)
qbn.entangle([weather, mood])

# Perform quantum inference
result = qbn.infer(evidence={"weather": "sunny"})
print(f"Mood probabilities: {result}")

# Quantum intervention (do-calculus)
intervention_result = qbn.intervene("weather", "rainy")
print(f"Mood under intervention: {intervention_result}")

🧬 Mathematical Foundation

The library implements quantum probabilistic reasoning using:

  • Tensor Product Spaces: Joint state representation as |ψ⟩ = Σᵢⱼ αᵢⱼ|iⱼ⟩
  • Amplitude Manipulation: Via Kraus operators and parameterized unitaries
  • Density Matrix Operations: Mixed state inference through partial tracing
  • Non-commutative Conditional Probability: P_Q(A|B) ≠ P_Q(B|A) in general

📖 Documentation

🧪 Examples

Quantum XOR Reasoning

# Create entangled XOR gate reasoning
qbn = QuantumBayesianNetwork()
a = qbn.add_quantum_node("A", [0, 1])
b = qbn.add_quantum_node("B", [0, 1])
xor = qbn.add_quantum_node("XOR", [0, 1])

qbn.add_quantum_xor_relationship(a, b, xor)
result = qbn.infer(evidence={"A": 1, "B": 0})

Weather-Mood Causal Graph

# Hybrid classical-quantum causal modeling
from probabilistic_quantum_reasoner.examples import WeatherMoodExample

example = WeatherMoodExample()
causal_effect = example.estimate_causal_effect("weather", "mood")
counterfactual = example.counterfactual_query("What if it was sunny?")

🛠️ Architecture

probabilistic_quantum_reasoner/
├── core/                    # Core network structures
│   ├── network.py          # QuantumBayesianNetwork
│   ├── nodes.py            # Quantum/Stochastic/Hybrid nodes
│   └── operators.py        # Quantum operators and gates
├── inference/              # Reasoning engines
│   ├── engine.py           # Main inference engine
│   ├── causal.py           # Causal reasoning
│   ├── belief_propagation.py
│   └── variational.py      # Variational quantum inference
├── backends/               # Backend implementations
│   ├── qiskit_backend.py
│   ├── pennylane_backend.py
│   └── simulator.py
└── examples/               # Example implementations

🔬 Research Applications

  • AGI Inference Scaffolds: Uncertainty-aware reasoning for autonomous systems
  • Quantum Explainable AI (Q-XAI): Interpretable quantum decision making
  • Counterfactual Analysis: "What-if" scenarios in quantum superposition
  • Epistemic Uncertainty Modeling: Non-classical uncertainty representation

🤝 Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

📚 Citation

If you use this library in your research, please cite:

@software{bajpai2025quantum,
  title={Probabilistic Quantum Reasoner: A Hybrid Quantum-Classical Reasoning Engine},
  author={Bajpai, Krishna},
  year={2025},
  url={https://github.com/krish567366/probabilistic-quantum-reasoner}
}

👨‍💻 Author

Krishna Bajpai

🙏 Acknowledgments

  • Quantum computing community for foundational algorithms
  • Classical probabilistic reasoning research
  • Open source quantum computing frameworks (Qiskit, PennyLane)

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

probabilistic_quantum_reasoner-1.0.0.tar.gz (66.0 kB view details)

Uploaded Source

Built Distribution

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

probabilistic_quantum_reasoner-1.0.0-py3-none-any.whl (71.4 kB view details)

Uploaded Python 3

File details

Details for the file probabilistic_quantum_reasoner-1.0.0.tar.gz.

File metadata

File hashes

Hashes for probabilistic_quantum_reasoner-1.0.0.tar.gz
Algorithm Hash digest
SHA256 95b73ad8f2030440a2c69e1bf00234b0b8f0ae657ca314d4e02021c13d24733f
MD5 06e9084d9b69615aac7ae946525d4c06
BLAKE2b-256 551bb118f040577897fb63951f1c32fc77089e361fad166d821e458384fb1389

See more details on using hashes here.

File details

Details for the file probabilistic_quantum_reasoner-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for probabilistic_quantum_reasoner-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 765dff7c5ce38fd6481080cbba8363af41eba099b34b019fc79bc7c1fcd66f8d
MD5 045a43f66cb0cd7c88fdbeb970c6b534
BLAKE2b-256 4b636977122a9a050739f65b444c8b6614016ec4b5e70a4787ab6f2cded28981

See more details on using hashes here.

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