Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
e7c676b5b0
17
README.md
17
README.md
@ -12,6 +12,7 @@ Allez, tous à vos pieuvres !
|
|||||||
*L'équipe de Pieuvre™ n'est pas responsable des dommages occasionnés par les réalisations philosophiques causées aux utilisateur·ices de par l'utilisation du programme*
|
*L'équipe de Pieuvre™ n'est pas responsable des dommages occasionnés par les réalisations philosophiques causées aux utilisateur·ices de par l'utilisation du programme*
|
||||||
|
|
||||||
# Utilisation
|
# Utilisation
|
||||||
|
`Pieuvre` génère automatiquement un fichier `log.8pus` contenant la preuve venant d'être faite.
|
||||||
|
|
||||||
## Option `typecheck`
|
## Option `typecheck`
|
||||||
L'option `typecheck` peut être testée avec les fichiers tests dans `tests/typecheck`. Pour cela, utiliser les commandes :
|
L'option `typecheck` peut être testée avec les fichiers tests dans `tests/typecheck`. Pour cela, utiliser les commandes :
|
||||||
@ -20,11 +21,25 @@ L'option `typecheck` peut être testée avec les fichiers tests dans `tests/type
|
|||||||
./pieuvre -typecheck tests/typecheck/wrong-type
|
./pieuvre -typecheck tests/typecheck/wrong-type
|
||||||
```
|
```
|
||||||
|
|
||||||
## Note d'implémentation
|
## Option `alpha`
|
||||||
|
L'option `alpha` vérifie si deux lambda-termes sont alpha-équivalents. Elle s'utilise de la manière suivante :
|
||||||
|
```
|
||||||
|
./pieuvre -alpha tests/lambda-terms/alpha-eq.lams
|
||||||
|
./pieuvre -alpha tests/lambda-terms/alpha-not-eq.lams
|
||||||
|
```
|
||||||
|
|
||||||
|
## Option `reduce`
|
||||||
|
L'option `alpha` vérifie si deux lambda-termes sont alpha-équivalents. Elle s'utilise de la manière suivante :
|
||||||
|
```
|
||||||
|
./pieuvre -reduce tests/lambda-terms/lambda.lam
|
||||||
|
```
|
||||||
|
|
||||||
|
## Notes d'implémentation
|
||||||
|
|
||||||
## Répartition du travail
|
## Répartition du travail
|
||||||
|
|
||||||
### Adrien
|
### Adrien
|
||||||
|
- Option `typecheck`
|
||||||
|
|
||||||
### Samy
|
### Samy
|
||||||
Fonctions de manipulation des λ-termes (pieuvre.ml)
|
Fonctions de manipulation des λ-termes (pieuvre.ml)
|
||||||
|
|||||||
39
main.ml
39
main.ml
@ -34,15 +34,6 @@ let is_interactive = match file with
|
|||||||
| _ -> false
|
| _ -> false
|
||||||
in
|
in
|
||||||
|
|
||||||
let readline () = match file with
|
|
||||||
| None -> (
|
|
||||||
Printf.printf ">>> ";
|
|
||||||
flush stdout;
|
|
||||||
read_line ()
|
|
||||||
)
|
|
||||||
| Some f -> input_line f
|
|
||||||
in
|
|
||||||
|
|
||||||
if !reduce_option then (
|
if !reduce_option then (
|
||||||
let lexbuf = Lexing.from_channel (match file with
|
let lexbuf = Lexing.from_channel (match file with
|
||||||
| None -> stdin
|
| None -> stdin
|
||||||
@ -105,12 +96,29 @@ if !typecheck_option then (
|
|||||||
exit 0
|
exit 0
|
||||||
);
|
);
|
||||||
|
|
||||||
(* Show a message only if the input is read from stdin *)
|
(* Affiche un message si l'entrée est lue sur stdin *)
|
||||||
let show s = match file with
|
let show s = match file with
|
||||||
| None -> Printf.printf "%s" s
|
| None -> Printf.printf "%s" s
|
||||||
| _ -> ()
|
| _ -> ()
|
||||||
in
|
in
|
||||||
|
|
||||||
|
(* Ouvre un fichier contenant la preuve écrite *)
|
||||||
|
let log_file = open_out "log.8pus" in
|
||||||
|
|
||||||
|
let readline () =
|
||||||
|
let line = match file with
|
||||||
|
| None -> (
|
||||||
|
Printf.printf ">>> ";
|
||||||
|
flush stdout;
|
||||||
|
read_line ()
|
||||||
|
)
|
||||||
|
| Some f -> input_line f
|
||||||
|
in
|
||||||
|
Printf.fprintf log_file "%s\n" line;
|
||||||
|
flush log_file;
|
||||||
|
line
|
||||||
|
in
|
||||||
|
|
||||||
show "Please type the formula to prove\n";
|
show "Please type the formula to prove\n";
|
||||||
|
|
||||||
let ty =
|
let ty =
|
||||||
@ -262,8 +270,7 @@ while !subgoals <> [] do
|
|||||||
in
|
in
|
||||||
|
|
||||||
let rec applyUntilWorking () =
|
let rec applyUntilWorking () =
|
||||||
try
|
try (
|
||||||
(
|
|
||||||
let readTactic = read_tactic () in
|
let readTactic = read_tactic () in
|
||||||
applyTactic readTactic
|
applyTactic readTactic
|
||||||
)
|
)
|
||||||
@ -285,10 +292,10 @@ let finalLam = !fill_holes [] in
|
|||||||
if (typecheck [] finalLam ty) then (
|
if (typecheck [] finalLam ty) then (
|
||||||
Printf.printf "Final proof :\n";
|
Printf.printf "Final proof :\n";
|
||||||
reduce finalLam;
|
reduce finalLam;
|
||||||
)
|
) else (
|
||||||
else (
|
|
||||||
Printf.printf "Invalid proof constructed!\n";
|
Printf.printf "Invalid proof constructed!\n";
|
||||||
Printf.printf "%s can't be typed with %s.\n" (string_of_lam finalLam) (string_of_ty ty);
|
Printf.printf "%s can't be typed with %s.\n" (string_of_lam finalLam) (string_of_ty ty);
|
||||||
Printf.printf "The whole development team of pieuvre is sorry for the damage eventually done by this error.\n"
|
Printf.printf "The whole development team of pieuvre is sorry for the damage eventually done by this error.\n"
|
||||||
)
|
);
|
||||||
;;
|
|
||||||
|
close_out log_file;;
|
||||||
|
|||||||
2
tests/lambda-terms/lambda.lam
Normal file
2
tests/lambda-terms/lambda.lam
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
fun a: A => fun f: A -> A =>
|
||||||
|
(fun x: A => f (f (f a))) a
|
||||||
Loading…
x
Reference in New Issue
Block a user