|
| 1 | +# Frequently Asked Questions |
| 2 | + |
| 3 | +This page answers common questions about the P language and its toolchain. |
| 4 | + |
| 5 | +## General Questions |
| 6 | + |
| 7 | +### What is P? |
| 8 | + |
| 9 | +P is a state machine-based programming language for formally modeling and specifying complex distributed systems. It allows programmers to model their system design as a collection of communicating state machines and provides tools to check that the system satisfies desired correctness specifications. |
| 10 | + |
| 11 | +### How is P different from other formal methods tools? |
| 12 | + |
| 13 | +P distinguishes itself by: |
| 14 | +- Being a programming language rather than just a specification language |
| 15 | +- Focusing on practical distributed systems verification |
| 16 | +- Providing a balance between expressiveness and analyzability |
| 17 | +- Supporting both safety and liveness properties |
| 18 | +- Generating executable code from models |
| 19 | + |
| 20 | +### Is P open source? |
| 21 | + |
| 22 | +Yes, P is open source and available on [GitHub](https://github.com/p-org/P) under the MIT license. |
| 23 | + |
| 24 | +### Who uses P? |
| 25 | + |
| 26 | +P is used extensively inside Amazon (AWS) for analysis of complex distributed systems. It was also used to implement and validate the USB device driver stack that ships with Microsoft Windows 8 and Windows Phone. Additionally, it's being used for programming safe robotics systems in academia. |
| 27 | + |
| 28 | +## Technical Questions |
| 29 | + |
| 30 | +### What kind of systems can I model with P? |
| 31 | + |
| 32 | +P is particularly well-suited for modeling: |
| 33 | +- Distributed protocols and systems |
| 34 | +- Concurrent software |
| 35 | +- Event-driven systems |
| 36 | +- Reactive systems |
| 37 | +- State-based controllers |
| 38 | + |
| 39 | +### What properties can P verify? |
| 40 | + |
| 41 | +P can verify: |
| 42 | +- Safety properties (bad things never happen) |
| 43 | +- Liveness properties (good things eventually happen) |
| 44 | +- Invariants (properties that must always hold) |
| 45 | +- Temporal properties (ordering of events) |
| 46 | + |
| 47 | +### How does P handle state space explosion? |
| 48 | + |
| 49 | +P employs several techniques to manage state space explosion: |
| 50 | +- Search prioritization heuristics |
| 51 | +- Compositional verification |
| 52 | +- Abstraction techniques |
| 53 | +- Bounded model checking |
| 54 | + |
| 55 | +### Can P generate executable code? |
| 56 | + |
| 57 | +Yes, P can generate C# and C code from your models. The generated code can be deployed on various platforms when combined with the P runtime. |
| 58 | + |
| 59 | +### How does P compare to TLA+? |
| 60 | + |
| 61 | +While both P and TLA+ are used for formal specification and verification: |
| 62 | +- P is more programming-language-like, while TLA+ is more mathematical |
| 63 | +- P generates executable code, TLA+ is primarily for specification |
| 64 | +- P focuses on state machine models, TLA+ on temporal logic |
| 65 | +- P has built-in support for distributed systems concepts |
| 66 | + |
| 67 | +## Usage Questions |
| 68 | + |
| 69 | +### How do I get started with P? |
| 70 | + |
| 71 | +Follow these steps: |
| 72 | +1. Install P following the [installation instructions](getstarted/install.md) |
| 73 | +2. Go through the [Quick Start Guide](getstarted/quickstart.md) |
| 74 | +3. Follow the [Learning Path](learning-path.md) |
| 75 | + |
| 76 | +### How do I debug a P program? |
| 77 | + |
| 78 | +You can debug P programs by: |
| 79 | +- Adding print statements to trace execution |
| 80 | +- Using assertions to check conditions |
| 81 | +- Examining error traces from the model checker |
| 82 | +- Using the [debugging techniques](advanced/debuggingerror.md) for counterexamples |
| 83 | + |
| 84 | +### How do I model check a P program? |
| 85 | + |
| 86 | +Use the `p check` command followed by the test case name: |
| 87 | +```bash |
| 88 | +p check TestCaseName |
| 89 | +``` |
| 90 | + |
| 91 | +For more options, see [Using P Compiler and Checker](getstarted/usingP.md). |
| 92 | + |
| 93 | +### How do I integrate P with my existing codebase? |
| 94 | + |
| 95 | +P provides a foreign interface that allows you to: |
| 96 | +- Call external functions from P code |
| 97 | +- Use external types in P code |
| 98 | +- Generate code that integrates with your existing system |
| 99 | + |
| 100 | +See [P Foreign Interface](manual/foriegntypesfunctions.md) for details. |
| 101 | + |
| 102 | +## Performance Questions |
| 103 | + |
| 104 | +### How large a system can P verify? |
| 105 | + |
| 106 | +The size of systems P can verify depends on: |
| 107 | +- The complexity of the state machines |
| 108 | +- The number of concurrent components |
| 109 | +- The properties being verified |
| 110 | +- Available computing resources |
| 111 | + |
| 112 | +P has been used to verify industrial-scale distributed systems at AWS. |
| 113 | + |
| 114 | +### How long does model checking typically take? |
| 115 | + |
| 116 | +Model checking time varies widely based on: |
| 117 | +- System complexity |
| 118 | +- State space size |
| 119 | +- Property complexity |
| 120 | +- Search strategy |
| 121 | + |
| 122 | +Simple examples may check in seconds, while complex systems might take hours. |
| 123 | + |
| 124 | +### Can P use multiple cores for verification? |
| 125 | + |
| 126 | +The current version of P primarily uses a single core for verification. However, work is ongoing to support parallel verification strategies. |
| 127 | + |
| 128 | +## Community Questions |
| 129 | + |
| 130 | +### How do I contribute to P? |
| 131 | + |
| 132 | +You can contribute to P by: |
| 133 | +- Reporting bugs on [GitHub Issues](https://github.com/p-org/P/issues) |
| 134 | +- Submitting pull requests with improvements |
| 135 | +- Adding examples or case studies |
| 136 | +- Improving documentation |
| 137 | +- Participating in [discussions](https://github.com/p-org/P/discussions) |
| 138 | + |
| 139 | +See [Building from Source](getstarted/build.md) for information on building P from source code. |
| 140 | + |
| 141 | +### Where can I get help with P? |
| 142 | + |
| 143 | +You can get help with P through: |
| 144 | +- [GitHub Discussions](https://github.com/p-org/P/discussions) |
| 145 | +- [GitHub Issues](https://github.com/p-org/P/issues) |
| 146 | +- Contacting the P team at [[email protected]](mailto:[email protected]) |
| 147 | + |
| 148 | +### Are there any books or courses on P? |
| 149 | + |
| 150 | +While there are no dedicated books on P yet, you can learn from: |
| 151 | +- The [documentation](https://p-org.github.io/P/) |
| 152 | +- [Academic papers](publications.md) about P |
| 153 | +- [Video presentations](videos.md) about P |
| 154 | +- [Case studies](casestudies.md) showing P in action |
0 commit comments