-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqed
More file actions
executable file
·62 lines (53 loc) · 1.79 KB
/
qed
File metadata and controls
executable file
·62 lines (53 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
#set -x
# Check all the arguments specified in the 'arguments' file. Well, actually,
# check only the lines in that file that begin with '+'. That way you can put
# arguments in there that you're not ready to check.
function echo_color() {
echo -ne "\033[01;$1m$2\033[00m"
}
powerset() { [ $# -eq 0 ] && echo || (shift; powerset "$@") |
while read r ; do echo -e "$1 $r\n$r"; done }
test_shorter_paths() {
conclusion=`echo $@ | sed "s/ from .*$//"`
premises=`echo $@ | sed "s/^.* from //"`
powerset $premises | while read subset; do
# Only use proper subsets.
if [[ $subset = $premises ]]; then continue; fi
# Attempt to establish the same conclusion using fewer premises.
demonstrate $conclusion from $subset
# It's not supposed to work. If it does, yell.
if [[ $? = 0 ]]; then
echo_color 99 " "
echo_color 46 " "
echo_color 99 " alt "
echo "$conclusion <- $subset"
fi
done
}
cat run_these | while read arg; do
first_letter=${arg:0:1}
d=${arg:1}
if [[ $first_letter = "+" ]]; then
demonstrate $d
if [[ $? = 0 ]]; then
echo_color 42 " "
echo_color 99 " valid "
echo -n " "
args=`echo $d | sed "s/from/<-/"`
echo_color 99 "$args"
echo
# disable for now
#test_shorter_paths $d
else
echo_color 99 " "
echo_color 45 " "
echo_color 99 " invalid "
args=`echo $d | sed "s/from/<-/"`
echo_color 99 "$args"
echo
fi
fi
done
# test that no combination of premises raises a syntax error
#test_shorter_paths "true" from 1def3 misc 1p21 1p22 1p24c 1p25c 1p26 misc