plouf/doc/README.md
2025-12-20 19:11:28 +01:00

45 lines
2.0 KiB
Markdown

This is a reference for the language. It is for now in construction, messy and can change at any time.
- Comments are C style comments
## Predicates
- You can create a predicate with `let predicate_name = predicate`
- You can create an implication with `let predicate_name = conditions => result` where conditions and result are predicates
- Predicates have to be proven with `predicate : {proof}` in order to be used in other proofs
- You can combine predicates with `(predicate1; predicate2; predicate3)`
## Truths
- A truth is a predicate that has been proven to be true
- A predicate alone is interpreted as a truth : `predicate;`
## Axioms
- You can use `ax` instead of `let` to define an axiom, or any externaly proven predicate
- Axioms are considered true without needing a proof
## Proofs
- You can prove a new predicate by "running" a true predicate `p1` on an other true predicate `p2` that fulfill its conditions : `let p = predicate : {p1(p2)}`
- The verifier will do its best to prove your predicates automatically, and tell you were it has not been able to
## Variables
- You have to define a set/type before doing anything with a variable : `let x in set.R`
- You can define multiple variable with the same type together : `let a,b,c in set.N`
- If you give a value to a variable, the type is implicit : `let x = 3`
- Variable definition is a predicate, but you don't have to prove it
- In a predicate combination, you can define a variable in a predicate and use it in another predicate : `(n in set.N, n/2=0)`
- If you define a variable with the same name as an other one, it will shadow it during the time of its existence
## Expressions
- Expressions are OCamL style
- They are evaluated from left to right (generally)
## Functions
- Predicates are functions that take truths as input and return a truth
- You can use `_` instead of an argument and the verifier will try to deduce what didn't put. For example, if a truth is needed as an argument, the verifier will try to prove it itself