Introduction
The ideas shared, below, pertain to connections between literate computer programming, computer-aided reasoning, computer-aided mathematical proofs, computer-aided argumentation, computer-aided fact-checking and computational journalism.
Web documents can include code regions for content in computer programming languages, knowledge representation languages, other machine-readable syntaxes, or natural languages. These code regions can connect to URL-addressable services to provide features including presenting users with visual hints and feedback. Such visual hints and feedback could pertain to the correctness of programming language portions, to epistemological factors pertaining to fact-checking, or to the verification and correctness of reasoning or argumentation.
Code Regions
Code regions are document elements which contain content in computer programming languages, knowledge representation languages, other machine-readable languages, or natural languages.
Groups of code regions connect to URL-addressable services. A service processes the contents of a group of code regions and provides state information and informational messages for each code region in the group. Web documents can contain multiple groups of code regions, each connected to a service.
Services can provide users with visual hints and feedback on code regions. Code regions connected to services pertaining to programming languages could provide users with help, information, warnings and errors. Code regions connected to services pertaining to fact-checking could provide users with a number of epistemological visual hints and feedback items. Code regions connected to services pertaining to automated reasoning or automated theorem proving could provide users with visual hints and feedback related to verification or correctness.
The technical means of providing users with visual hints and feedback are cascading stylesheets utilizing an attribute-based style selector to vary styling based upon the value of a state
attribute which is updated by a service. The possible values of the state
attribute are service-specific.
As styleable document elements, code regions can be either inline or block elements in documents, flowing within regions of text or positioned between regions of text.
Services
A service is any compiler, interpreter, runtime environment, automated theorem prover, automated reasoner, fact-checking system, or other software system which can, via a protocol, provide custom state data and messages for code regions.
Services can be hosted locally on client machines, hosted on organizations’ servers, remote servers, or hosted on the cloud.
A service receives a request which includes a grouping of code regions, the contents of those code regions, and it responds with state information for each code region, e.g. “ok” or “error”, and an array of pertinent messages for each code region.
Example code-region
Element and Attributes
The following element and attributes are a preliminary rough-draft sketch provided for purposes of discussion and to expand upon and to clarify upon the ideas discussed above.
In the following example, all of the code-region
elements with a group
attribute value of “1234” are gathered together for purposes of an XML-RPC request to a service at a relative URL “service.php”. The HTML/XHTML contents of the group’s code-region
elements are included in the XML-RPC request to the service. The service is invoked whenever: (1) one of the code regions in the group changes, (2) the document sequence of code regions in the group changes, or (3) the group’s service is invoked via JavaScript. Whenever the service is successfully invoked, it responds with data which is utilized to automatically populate the state
and message
attributes of each code-region
element in the group.
<code-region
service="service.php"
service-type="xml-rpc"
group="1234"
index="1"
state="error"
message="…">
…
</code-region>
The service
attribute is for the URL of a services with which to process the contents of a sequence of code regions participating in a group.
The service-type
attribute is for extensibility and indicates the type of or protocol for the service, e.g. XML-RPC. The default value could be “xml-rpc”.
The group
attribute is a text string identifying which group that a code region is in. The text value should be unique to the document. A Web document can contain multiple groups and each can contain multiple code regions.
The index
attribute of a code region is the code region’s index within the sequence of code regions within a group. Its default value is obtained from auto-incrementing a counter for each code region of a group as it occurs in document order.
The state
attribute is for data returned by a service for a particular code region. It is a service-specific text value which is automatically placed into the attribute value for purposes of scripting or styling.
For example,
code-region[state='ok']:after { content:url('ok.png'); }
code-region[state='error']:after { content:url('error.png'); }
or
code-region[state='error'] { text-decoration:underline wavy red; }
The message
attribute is for data returned by a service for a particular code region. Its value is an array of service-specific text strings. Where the state attribute could indicate an error, the value(s) of the message attribute might describe the error.
The content-editable
attribute is for indicating whether a user can edit the content of the code region.
The Advancement of Artificial Intelligence
With code regions, Web documents can make use of artificial intelligence services including, but not limited to: automated theorem provers, automated reasoners and fact-checking systems.
Users could, for instance, author argumentative essays and utilize code regions, resembling literate computer programming, to show that their facts were checked and that their arguments were valid and machine-verifiable.
The ease of authoring, viewing and sharing Web documents which utilize artificial intelligence services could invigorate artificial intelligence research and development.
Conclusion
The ideas shared, above, pertain to connections between literate computer programming, computer-aided reasoning, computer-aided mathematical proofs, computer-aided argumentation, computer-aided fact-checking and computational journalism.
Web documents can include code regions for content in computer programming languages, knowledge representation languages, other machine-readable syntaxes, or natural languages. These code regions can connect to URL-addressable services to provide features including presenting users with visual hints and feedback. Such visual hints and feedback could pertain to the correctness of programming language portions, to epistemological factors pertaining to fact-checking, or to the verification and correctness of reasoning or argumentation.