Skip to content

Commit 86ca0cf

Browse files
committed
Reinstate GS1.m with \_ in comments.
Add a emacs mode line to indicate mathematica mode
1 parent bbc7d37 commit 86ca0cf

File tree

1 file changed

+24
-23
lines changed
  • examples/symbolic_logic/gries_schneider

1 file changed

+24
-23
lines changed

examples/symbolic_logic/gries_schneider/GS1.m

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
(* -*- wolfram -*- *)
12
(* ****************************************************************************
23
34
by Brian Beckman. License the same as for Mathics3: GPL3.
@@ -32,8 +33,8 @@
3233
(* Section 1.2 Textual substitution, page 8
3334
_____ _ _ ___ _ _ _ _ _ _
3435
|_ _|____ _| |_ _ _ __ _| | / __|_ _| |__ __| |_(_) |_ _ _| |_(_)___ _ _
35-
| |/ -_) \ / _| || / _` | | |__ \ || | '_ (_-< _| | _| || | _| / _ \ ' \
36-
|_||___/_|_||__||_,_|__,_|_| |___/|_,_|_.__/__/|__|_||__||_,_||__|_|___/_||_|
36+
| |/ -_) \ / _| || / _` | | \__ \ || | '_ (_-< _| | _| || | _| / _ \ ' \
37+
|_|\___/_\_\\__|\_,_\__,_|_| |___/\_,_|_.__/__/\__|_|\__|\_,_|\__|_\___/_||_|
3738
3839
Mathics gives us direct syntax for Gries & Schneider's (G&S)'s "textual
3940
substitution:"
@@ -245,13 +246,13 @@
245246

246247
(* Inference Rule Substitution (1.1), page 10
247248
___ __ ___ _ _
248-
|_ _|_ _ / _|___ _ _ ___ _ _ __ ___ | _ |_ _| |___(_)
249-
| || ' || _/ -_) '_/ -_) ' |/ _/ -_) | / || | / -_)_
250-
|___|_||_|_| |___|_| |___|_||_|__|___| |_|_||_,_|_|___(_)
249+
|_ _|_ _ / _|___ _ _ ___ _ _ __ ___ | _ \_ _| |___(_)
250+
| || ' \| _/ -_) '_/ -_) ' \/ _/ -_) | / || | / -_)_
251+
|___|_||_|_| \___|_| \___|_||_\__\___| |_|_\\_,_|_\___(_)
251252
___ _ _ _ _ _ _
252253
/ __|_ _| |__ __| |_(_) |_ _ _| |_(_)___ _ _
253-
|__ | || | '_ (_-< _| | _| || | _| / _ | ' |
254-
|___/|_,_|_.__/__/|__|_||__||_,_||__|_|___/_||_|
254+
\__ \ || | '_ (_-< _| | _| || | _| / _ \ ' \
255+
|___/\_,_|_.__/__/\__|_|\__|\_,_|\__|_\___/_||_|
255256
256257
The inference rule 'Substitution' takes in a top-line expression e, a list
257258
of variables v, and a corresponding list of replacement expressions f, and
@@ -335,12 +336,12 @@
335336
(* Section 1.3 Textual substitution and equality, page 11
336337
_____ _ _ ___ _ _ _ _ _ _
337338
|_ _|____ _| |_ _ _ __ _| | / __|_ _| |__ __| |_(_) |_ _ _| |_(_)___ _ _
338-
| |/ -_) | / _| || / _` | | |__ | || | '_ (_-< _| | _| || | _| / _ | ' |
339-
|_||___/_|_||__||_,_|__,_|_| |___/|_,_|_.__/__/|__|_||__||_,_||__|_|___/_||_|
339+
| |/ -_) \ / _| || / _` | | \__ \ || | '_ (_-< _| | _| || | _| / _ \ ' \
340+
|_|\___/_\_\\__|\_,_\__,_|_| |___/\_,_|_.__/__/\__|_|\__|\_,_|\__|_\___/_||_|
340341
_ ___ _ _ _
341342
__ _ _ _ __| | | __|__ _ _ _ __ _| (_) |_ _ _
342-
/ _` | ' |/ _` | | _|/ _` | || / _` | | | _| || |
343-
|__,_|_||_|__,_| |___|__, ||_,_|__,_|_|_||__||_, |
343+
/ _` | ' \/ _` | | _|/ _` | || / _` | | | _| || |
344+
\__,_|_||_\__,_| |___\__, |\_,_\__,_|_|_|\__|\_, |
344345
|_| |__/
345346
346347
Going forward, we want more inference and less evaluation. This is tricky in
@@ -1054,8 +1055,8 @@ over and over (google "don't repeat yourself"), introduce "Postfix notation
10541055
(* Here is a cheat sheet of all the rules we've defined so far.
10551056
___ _ _ ___ _ _ __
10561057
/ __| |_ ___ __ _| |_ / __| |_ ___ ___| |_ ___ ___ / _|__ _ _ _
1057-
| (__| ' |/ -_) _` | _| |__ | ' |/ -_) -_) _| (_-</ _ | | _/ _` | '_|
1058-
|___|_||_|___|__,_||__| |___/_||_|___|___||__| /__/|___/ |_| |__,_|_|
1058+
| (__| ' \/ -_) _` | _| \__ \ ' \/ -_) -_) _| (_-</ _ \ | _/ _` | '_|
1059+
\___|_||_\___\__,_|\__| |___/_||_\___\___|\__| /__/\___/ |_| \__,_|_|
10591060
10601061
(* 1.1 *) substitutionInferenceRule[e_, v_:List, f_:List] :=
10611062
Module[{ rules = MapThread[ Rule, {v, f} ] }, e /. rules ]
@@ -1091,13 +1092,13 @@ over and over (google "don't repeat yourself"), introduce "Postfix notation
10911092

10921093
(* Section 1.4 Leibniz's rule and function evaluation, page 13
10931094
_ _ _ _ _ ___ _ _
1094-
| | ___(_) |__ _ _ (_)__( )___ | _ |_ _| |___ __ _ _ _ __| |
1095-
| |__/ -_) | '_ | ' || |_ //|_ / | / || | / -_) / _` | ' |/ _` |
1096-
|____|___|_|_.__/_||_|_/__| /__| |_|_||_,_|_|___| |__,_|_||_|__,_|
1095+
| | ___(_) |__ _ _ (_)__( )___ | _ \_ _| |___ __ _ _ _ __| |
1096+
| |__/ -_) | '_ \ ' \| |_ //|_ / | / || | / -_) / _` | ' \/ _` |
1097+
|____\___|_|_.__/_||_|_/__| /__| |_|_\\_,_|_\___| \__,_|_||_\__,_|
10971098
___ _ _ ___ _ _ _
10981099
| __| _ _ _ __| |_(_)___ _ _ | __|_ ____ _| |_ _ __ _| |_(_)___ _ _
1099-
| _| || | ' |/ _| _| / _ | ' | | _|| V / _` | | || / _` | _| / _ | ' |
1100-
|_| |_,_|_||_|__||__|_|___/_||_| |___||_/|__,_|_||_,_|__,_||__|_|___/_||_|
1100+
| _| || | ' \/ _| _| / _ \ ' \ | _|\ V / _` | | || / _` | _| / _ \ ' \
1101+
|_| \_,_|_||_\__|\__|_\___/_||_| |___|\_/\__,_|_|\_,_\__,_|\__|_\___/_||_|
11011102
11021103
Start at the bottom of page 13. A lot of this we can do without prose, now,
11031104
because we're getting accustomed to the style.
@@ -1524,9 +1525,9 @@ calculus is (from page 42)
15241525

15251526
(* Section 1.6, The assignment statement, page 16
15261527
_ _ _
1527-
/_| _____(_)__ _ _ _ _ __ ___ _ _| |_
1528-
/ _ | (_-<_-< / _` | ' || ' |/ -_) ' | _|
1529-
/_/ |_|/__/__/_|__, |_||_|_|_|_|___|_||_|__|
1528+
/_\ _____(_)__ _ _ _ _ __ ___ _ _| |_
1529+
/ _ \ (_-<_-< / _` | ' \| ' \/ -_) ' \ _|
1530+
/_/ \_\/__/__/_\__, |_||_|_|_|_\___|_||_\__|
15301531
|___/
15311532
15321533
Here we exhibit the first instance of a "type." It's just a head and some
@@ -1675,8 +1676,8 @@ enclosing our variables in curly braces (List brackets).
16751676
(* Exercises for Chapter 1, pages 21-23
16761677
___ _ ___ _ _
16771678
| __|_ _____ _ _ __(_)___ ___ ___ / __| |_ / |
1678-
| _|| | / -_) '_/ _| (_-</ -_|_-< | (__| ' | _ | |
1679-
|___/_|_|___|_| |__|_/__/|___/__/ |___|_||_(_) |_|
1679+
| _|\ \ / -_) '_/ _| (_-</ -_|_-< | (__| ' \ _ | |
1680+
|___/_\_\___|_| \__|_/__/\___/__/ \___|_||_(_) |_|
16801681
16811682
*************************************************************************** *)
16821683

0 commit comments

Comments
 (0)