Add bad 8pus files

This commit is contained in:
augustin64 2024-05-20 10:57:55 +02:00
parent 2c01cab197
commit d40f4081c4
10 changed files with 68 additions and 9 deletions

View File

@ -5,6 +5,7 @@ open Types
open Hlam
open Lam
exception InputError of string
type entry =
Simple of (unit -> instr)
@ -18,12 +19,11 @@ module StringMap = Map.Make(String)
let parse_lam t =
match Parser.main Lexer.token t with
| Lam l -> l
| Instr _ -> failwith "entry must be a lam"
| Instr _ -> raise (InputError "entry must be a lam")
let parse_cmd t =
match Parser.main Lexer.token t with
| Instr is -> is
| Lam _ -> failwith "entry must be a cmd"
| Lam _ -> raise (InputError "entry must be an instruction")
let show_beta_reduction e =
let rec aux = function
@ -171,6 +171,9 @@ let rec interactive (get_instr : unit -> instr) (sl : (interactive_state) list)
| TacticFailed arg ->
print_error "Tactic failed" arg;
(cg, (g, gs))::sq |> interactive get_instr
| InputError arg ->
print_error "Invalid input" arg;
(cg, (g, gs))::sq |> interactive get_instr
| End_of_file | Lexer.Eof ->
print_string "Bye!\n";
(g, gs)

View File

@ -2,20 +2,41 @@
make
echo "=== Alpha-équivalence ==="
for file in tests/alpha_equiv/*; do
echo_title () {
echo -e "\033[0;34m$@\033[0m"
}
echo_title "=== Alpha-équivalence ==="
for file in tests/alpha_equiv/*.lam; do
echo "-- $file"
./pieuvre -alpha $file >/dev/null
done
echo "=== Bêta-réduction ==="
for file in tests/lam/*; do
echo_title "=== Bêta-réduction ==="
for file in tests/lam/*.lam; do
echo "-- $file"
./pieuvre -reduce $file >/dev/null
done
echo "=== Preuves ==="
for file in tests/8pus/*; do
echo_title "=== Preuves ==="
for file in tests/8pus/*.8pus; do
echo "-- $file"
./pieuvre $file >/dev/null
done
echo_title "-== Preuves avec erreurs ==-"
for file in tests/8pus/bad/*.8pus; do
# On vérifie deux choses:
# - Un message d'erreur s'affiche bien
# - Le code de sortie est bien 0
echo "-- $file"
error=$(./pieuvre $file 2>&1 1>/dev/null)
retVal=$?
if [ $retVal -ne 0 ]; then
echo -e "\033[0;31mNon-0 exit code, see stderr:\033[0m"
echo $error
elif [[ $error == "" ]]; then
echo -e "\033[0;31mNo message in stderr\033[0m"
fi
done

View File

@ -0,0 +1,5 @@
Goal A -> B -> A.
intro.
exact H1.
exact H0.
Qed.

View File

@ -0,0 +1,2 @@
Goal A -> (B -> A).
apply H0.

View File

@ -0,0 +1,3 @@
intro.
left.
right.

View File

@ -0,0 +1,2 @@
Goal A /\ B.
intro.

View File

@ -0,0 +1,8 @@
Goal A -> B -> (A /\ B).
intros.
left.
right.
split.
exact H0.
exact H1.
Qed.

View File

@ -0,0 +1,6 @@
Goal A -> (A \/ B).
intro.
split.
left.
exact H0.
Qed.

View File

@ -0,0 +1,6 @@
Goal A -> B -> A.
intros.
exact H3.
apply H5.
exact H0.
Qed.

View File

@ -0,0 +1,3 @@
Goal (A -> B) -> A -> C.
intros.
apply H0.