Skip to content

Commit 8339b9c

Browse files
1 parent cdc9fe8 commit 8339b9c

File tree

76 files changed

+6406
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+6406
-0
lines changed

refman/.buildinfo

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Sphinx build info version 1
2+
# This file records the configuration used when building these files. When it is not found, a full rebuild will be done.
3+
config: 8e2a85eab20f98fda0352a8ff14ae838
4+
tags: 645f666f9bcd5a90fca523b33c5a78b7

refman/_sources/index.rst.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
EasyCrypt reference manual
2+
========================================================================
3+
4+
.. toctree::
5+
:maxdepth: 2
6+
7+
tactics

refman/_sources/tactics.rst.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Proof tactics reference
2+
========================================================================
3+
4+
.. toctree::
5+
:maxdepth: 1
6+
:glob:
7+
8+
tactics/*
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
========================================================================
2+
Tactic: `skip`
3+
========================================================================
4+
5+
The `skip` tactic applies to program-logic goals where the program(s) under
6+
consideration are empty. In this situation, program execution performs
7+
no computation and produces no state changes.
8+
9+
Applying `skip` eliminates the program component of the goal and reduces
10+
the proof obligation to a pure logical goal. Concretely, the remaining
11+
task is to prove that the precondition implies the postcondition.
12+
13+
The `skip` tactic does not attempt to solve this logical obligation itself.
14+
15+
.. contents::
16+
:local:
17+
18+
------------------------------------------------------------------------
19+
In Hoare logic
20+
------------------------------------------------------------------------
21+
22+
.. ecproof::
23+
:title: Hoare logic example
24+
25+
require import AllCore.
26+
27+
module M = {
28+
proc f(x : int) = {
29+
return x;
30+
}
31+
}.
32+
33+
pred p : int.
34+
pred q : int.
35+
36+
lemma L : hoare[M.f : p x ==> q res].
37+
proof.
38+
proc. (*$*) skip.
39+
abort.
40+
41+
------------------------------------------------------------------------
42+
In Relational Hoare logic
43+
------------------------------------------------------------------------
44+
45+
In the relational Hoare logic setting, the `skip`` tactic applies only
46+
when both programs are empty, in which case it reduces the relational
47+
judgment to obligations on the preconditions and postconditions alone.
48+
49+
.. ecproof::
50+
:title: Relational Hoare logic example
51+
52+
require import AllCore.
53+
54+
module M = {
55+
proc f(x : int) = {
56+
return x;
57+
}
58+
}.
59+
60+
pred p : int & int.
61+
pred q : int & int.
62+
63+
lemma L : equiv[M.f ~ M.f : p x{1} x{2} ==> q res{1} res{2}].
64+
proof.
65+
proc. (*$*) skip.
66+
abort.
67+
68+
------------------------------------------------------------------------
69+
In Probabilistic Hoare logic
70+
------------------------------------------------------------------------
71+
72+
In the probabilistic Hoare logic setting, applying `skip` generates an
73+
additional proof obligation compared to the pure Hoare case. Besides the
74+
logical implication between the precondition and the postcondition, one
75+
must also prove that the probability weight of the empty program, namely
76+
`1%r`, satisfies the bound specified in the judgment.
77+
78+
.. ecproof::
79+
:title: Probabilistic Hoare logic example
80+
81+
require import AllCore.
82+
83+
module M = {
84+
proc f(x : int) = {
85+
return x;
86+
}
87+
}.
88+
89+
pred p : int.
90+
pred q : int.
91+
92+
lemma L : phoare[M.f : p x ==> q res] >= (1%r / 2%r).
93+
proof.
94+
proc. (*$*) skip.
95+
abort.
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
// @ts-check
2+
3+
// Extra JS capability for selected tabs to be synced
4+
// The selection is stored in local storage so that it persists across page loads.
5+
6+
/**
7+
* @type {Record<string, HTMLElement[]>}
8+
*/
9+
let sd_id_to_elements = {};
10+
const storageKeyPrefix = "sphinx-design-tab-id-";
11+
12+
/**
13+
* Create a key for a tab element.
14+
* @param {HTMLElement} el - The tab element.
15+
* @returns {[string, string, string] | null} - The key.
16+
*
17+
*/
18+
function create_key(el) {
19+
let syncId = el.getAttribute("data-sync-id");
20+
let syncGroup = el.getAttribute("data-sync-group");
21+
if (!syncId || !syncGroup) return null;
22+
return [syncGroup, syncId, syncGroup + "--" + syncId];
23+
}
24+
25+
/**
26+
* Initialize the tab selection.
27+
*
28+
*/
29+
function ready() {
30+
// Find all tabs with sync data
31+
32+
/** @type {string[]} */
33+
let groups = [];
34+
35+
document.querySelectorAll(".sd-tab-label").forEach((label) => {
36+
if (label instanceof HTMLElement) {
37+
let data = create_key(label);
38+
if (data) {
39+
let [group, id, key] = data;
40+
41+
// add click event listener
42+
// @ts-ignore
43+
label.onclick = onSDLabelClick;
44+
45+
// store map of key to elements
46+
if (!sd_id_to_elements[key]) {
47+
sd_id_to_elements[key] = [];
48+
}
49+
sd_id_to_elements[key].push(label);
50+
51+
if (groups.indexOf(group) === -1) {
52+
groups.push(group);
53+
// Check if a specific tab has been selected via URL parameter
54+
const tabParam = new URLSearchParams(window.location.search).get(
55+
group
56+
);
57+
if (tabParam) {
58+
console.log(
59+
"sphinx-design: Selecting tab id for group '" +
60+
group +
61+
"' from URL parameter: " +
62+
tabParam
63+
);
64+
window.sessionStorage.setItem(storageKeyPrefix + group, tabParam);
65+
}
66+
}
67+
68+
// Check is a specific tab has been selected previously
69+
let previousId = window.sessionStorage.getItem(
70+
storageKeyPrefix + group
71+
);
72+
if (previousId === id) {
73+
// console.log(
74+
// "sphinx-design: Selecting tab from session storage: " + id
75+
// );
76+
// @ts-ignore
77+
label.previousElementSibling.checked = true;
78+
}
79+
}
80+
}
81+
});
82+
}
83+
84+
/**
85+
* Activate other tabs with the same sync id.
86+
*
87+
* @this {HTMLElement} - The element that was clicked.
88+
*/
89+
function onSDLabelClick() {
90+
let data = create_key(this);
91+
if (!data) return;
92+
let [group, id, key] = data;
93+
for (const label of sd_id_to_elements[key]) {
94+
if (label === this) continue;
95+
// @ts-ignore
96+
label.previousElementSibling.checked = true;
97+
}
98+
window.sessionStorage.setItem(storageKeyPrefix + group, id);
99+
}
100+
101+
document.addEventListener("DOMContentLoaded", ready, false);

refman/_sphinx_design_static/sphinx-design.min.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
/* Compatability shim for jQuery and underscores.js.
2+
*
3+
* Copyright Sphinx contributors
4+
* Released under the two clause BSD licence
5+
*/
6+
7+
/**
8+
* small helper function to urldecode strings
9+
*
10+
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent#Decoding_query_parameters_from_a_URL
11+
*/
12+
jQuery.urldecode = function(x) {
13+
if (!x) {
14+
return x
15+
}
16+
return decodeURIComponent(x.replace(/\+/g, ' '));
17+
};
18+
19+
/**
20+
* small helper function to urlencode strings
21+
*/
22+
jQuery.urlencode = encodeURIComponent;
23+
24+
/**
25+
* This function returns the parsed url parameters of the
26+
* current request. Multiple values per key are supported,
27+
* it will always return arrays of strings for the value parts.
28+
*/
29+
jQuery.getQueryParameters = function(s) {
30+
if (typeof s === 'undefined')
31+
s = document.location.search;
32+
var parts = s.substr(s.indexOf('?') + 1).split('&');
33+
var result = {};
34+
for (var i = 0; i < parts.length; i++) {
35+
var tmp = parts[i].split('=', 2);
36+
var key = jQuery.urldecode(tmp[0]);
37+
var value = jQuery.urldecode(tmp[1]);
38+
if (key in result)
39+
result[key].push(value);
40+
else
41+
result[key] = [value];
42+
}
43+
return result;
44+
};
45+
46+
/**
47+
* highlight a given string on a jquery object by wrapping it in
48+
* span elements with the given class name.
49+
*/
50+
jQuery.fn.highlightText = function(text, className) {
51+
function highlight(node, addItems) {
52+
if (node.nodeType === 3) {
53+
var val = node.nodeValue;
54+
var pos = val.toLowerCase().indexOf(text);
55+
if (pos >= 0 &&
56+
!jQuery(node.parentNode).hasClass(className) &&
57+
!jQuery(node.parentNode).hasClass("nohighlight")) {
58+
var span;
59+
var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg");
60+
if (isInSVG) {
61+
span = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
62+
} else {
63+
span = document.createElement("span");
64+
span.className = className;
65+
}
66+
span.appendChild(document.createTextNode(val.substr(pos, text.length)));
67+
node.parentNode.insertBefore(span, node.parentNode.insertBefore(
68+
document.createTextNode(val.substr(pos + text.length)),
69+
node.nextSibling));
70+
node.nodeValue = val.substr(0, pos);
71+
if (isInSVG) {
72+
var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
73+
var bbox = node.parentElement.getBBox();
74+
rect.x.baseVal.value = bbox.x;
75+
rect.y.baseVal.value = bbox.y;
76+
rect.width.baseVal.value = bbox.width;
77+
rect.height.baseVal.value = bbox.height;
78+
rect.setAttribute('class', className);
79+
addItems.push({
80+
"parent": node.parentNode,
81+
"target": rect});
82+
}
83+
}
84+
}
85+
else if (!jQuery(node).is("button, select, textarea")) {
86+
jQuery.each(node.childNodes, function() {
87+
highlight(this, addItems);
88+
});
89+
}
90+
}
91+
var addItems = [];
92+
var result = this.each(function() {
93+
highlight(this, addItems);
94+
});
95+
for (var i = 0; i < addItems.length; ++i) {
96+
jQuery(addItems[i].parent).before(addItems[i].target);
97+
}
98+
return result;
99+
};
100+
101+
/*
102+
* backward compatibility for jQuery.browser
103+
* This will be supported until firefox bug is fixed.
104+
*/
105+
if (!jQuery.browser) {
106+
jQuery.uaMatch = function(ua) {
107+
ua = ua.toLowerCase();
108+
109+
var match = /(chrome)[ \/]([\w.]+)/.exec(ua) ||
110+
/(webkit)[ \/]([\w.]+)/.exec(ua) ||
111+
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
112+
/(msie) ([\w.]+)/.exec(ua) ||
113+
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
114+
[];
115+
116+
return {
117+
browser: match[ 1 ] || "",
118+
version: match[ 2 ] || "0"
119+
};
120+
};
121+
jQuery.browser = {};
122+
jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true;
123+
}

0 commit comments

Comments
 (0)