Skip to content

Commit ed1aed0

Browse files
committed
[ pages code ] Draft Predicate Logic introduction
1 parent 03b9c3e commit ed1aed0

File tree

8 files changed

+395
-27
lines changed

8 files changed

+395
-27
lines changed

assets/local.css

+31-21
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@
55
}
66
}
77

8+
/* Monospace is easier to read when entering lots of symbols */
9+
10+
input {
11+
font-family: monospace;
12+
}
13+
14+
/* Displayed formulas are centred. */
15+
16+
.displayedformula {
17+
text-align: center;
18+
}
819

920
/* Code entry stuff */
1021

@@ -24,6 +35,9 @@
2435
overflow:hidden;
2536
resize:none;
2637
}
38+
.defnsat-entry input {
39+
width: 100%
40+
}
2741

2842
.defnsat-parseresult {
2943
grid-column: 1;
@@ -74,10 +88,6 @@
7488

7589
/* Natural deduction stuff */
7690

77-
/* input { */
78-
/* font-family: "DejaVu Sans Mono", "Linux Libertine O", "serif"; */
79-
/* } */
80-
8191
.vertical {
8292
display:flex;
8393
flex-direction: column;
@@ -146,10 +156,9 @@
146156
}
147157

148158
.comment {
149-
color: #164; /* FIXME: dark mode? */
159+
color: #164;
150160
font-style: italic;
151161
white-space: nowrap;
152-
/* padding-left: 0.8em; */
153162
}
154163

155164
@media (prefers-color-scheme: dark) {
@@ -191,10 +200,11 @@
191200

192201
.resetbutton {
193202
padding: 0;
194-
border: solid #ddd 1px;
195-
font-size: 50%;
196-
border-radius: 3px;
203+
/*border: solid #ddd 1px;*/
204+
font-size: 60%;
205+
border-radius: 2px;
197206
margin-right: 0.3em;
207+
opacity: 0.7;
198208
}
199209

200210
/* ------------------------ */
@@ -235,19 +245,19 @@
235245
}
236246

237247
.assumptionbox {
238-
border-radius: 0.4em 0.4em 0 0;
239-
border-top: 1px solid #ddd;
240-
border-left: 1px solid #ddd;
241-
border-right: 1px solid #ddd;
242-
display: flex;
243-
flex-direction: column;
244-
margin-left: 0.5em; margin-right: 0.5em
248+
border-radius: 0.4em 0.4em 0 0;
249+
border-top: 1px solid #ddd;
250+
border-left: 1px solid #ddd;
251+
border-right: 1px solid #ddd;
252+
display: flex;
253+
flex-direction: column;
254+
margin-left: 0.5em; margin-right: 0.5em
245255
}
246256

247257
.assumption {
248-
border-bottom: 1px solid #ddd;
249-
margin-bottom: 1.2em;
250-
color: #555;
251-
font-style: italic;
252-
padding-left: 0.5em
258+
border-bottom: 1px solid #ddd;
259+
margin-bottom: 1.2em;
260+
color: #555;
261+
font-style: italic;
262+
padding-left: 0.5em
253263
}

frontend/frontend.ml

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,28 @@
11
open Widgets
22

3+
module Formula_validator = struct
4+
open Fol_formula
5+
6+
type config = unit
7+
8+
let read_config _ = Some ()
9+
let placeholder _ = "<formula>"
10+
let validate _ str =
11+
match Formula.of_string str with
12+
| Ok f ->
13+
Ok ("Formula is: " ^ Formula.to_string f)
14+
| Error (`Parse err) ->
15+
Error (Parser_util.Driver.string_of_error err)
16+
end
17+
318
let () =
419
Ulmus.attach_all "lmt" Slakemoth_widget.component;
520
Ulmus.attach_all "tickbox" Tickbox.component;
621
Ulmus.attach_all "textbox" Textbox.component;
7-
Ulmus.attach_all "entrybox" (Validating_entry.component (module Validating_entry.Null_Validator));
22+
Ulmus.attach_all "entrybox"
23+
(Validating_entry.component (module Validating_entry.Null_Validator));
24+
Ulmus.attach_all "formulaentry"
25+
(Validating_entry.component (module Formula_validator));
826

927
Ulmus.attach_all "rules" Natural_deduction.Rules.from_rules;
1028
Ulmus.attach_all "rules-display" Natural_deduction.Rules.display_rules;

html_static/html_static.ml

+3
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,9 @@ let figcaption ?attrs = normal_element "figcaption" ?attrs
229229
let div ?attrs = normal_element "div" ?attrs
230230
let main ?attrs = normal_element "main" ?attrs
231231

232+
let details ?attrs = normal_element "details" ?attrs
233+
let summary ?attrs = normal_element "summary" ?attrs
234+
232235
(* 4.5 Text level semantics *)
233236
let a ?attrs = normal_element "a" ?attrs
234237
let em ?attrs = normal_element "em" ?attrs

html_static/html_static.mli

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
include Html_sig.S
44
(** Supports the generic HTML generation interface. *)
55

6+
val details : _ normal_element
7+
val summary : _ normal_element
8+
69
val raw_text : string -> _ t
710
(** [raw_text str] produces a document consisting of [str] without
811
escaping any of the HTML-sensitive characters. FIXME: better

0 commit comments

Comments
 (0)