diff --git a/anno3/apprendimento_automatico/slides/todo.org b/anno3/apprendimento_automatico/slides/todo.org deleted file mode 100644 index 3d4640f..0000000 --- a/anno3/apprendimento_automatico/slides/todo.org +++ /dev/null @@ -1,5 +0,0 @@ -* TODO [0/1] -- [ ] 002: - - [ ] Laplace adjustment - - [ ] Output code decoding - - [ ] Itemeset bUh frequent: significato frequent diff --git a/tesi/ltximg/org-ltximg_0a7696e5b188d7fc86c624d1a47ddc5d0ae7f087.png b/tesi/ltximg/org-ltximg_0a7696e5b188d7fc86c624d1a47ddc5d0ae7f087.png new file mode 100644 index 0000000..e0bfca6 Binary files /dev/null and b/tesi/ltximg/org-ltximg_0a7696e5b188d7fc86c624d1a47ddc5d0ae7f087.png differ diff --git a/tesi/ltximg/org-ltximg_11c2ec30cdafd758a1fbfbf67653f503cb53e9c5.png b/tesi/ltximg/org-ltximg_11c2ec30cdafd758a1fbfbf67653f503cb53e9c5.png new file mode 100644 index 0000000..82209d8 Binary files /dev/null and b/tesi/ltximg/org-ltximg_11c2ec30cdafd758a1fbfbf67653f503cb53e9c5.png differ diff --git a/tesi/ltximg/org-ltximg_166308ff0efacc3da39a11175c0fca86ad5be987.png b/tesi/ltximg/org-ltximg_166308ff0efacc3da39a11175c0fca86ad5be987.png new file mode 100644 index 0000000..842a863 Binary files /dev/null and b/tesi/ltximg/org-ltximg_166308ff0efacc3da39a11175c0fca86ad5be987.png differ diff --git a/tesi/ltximg/org-ltximg_16868976fbbb05d2559e11697f35e884258be583.png b/tesi/ltximg/org-ltximg_16868976fbbb05d2559e11697f35e884258be583.png new file mode 100644 index 0000000..c49a5b2 Binary files /dev/null and b/tesi/ltximg/org-ltximg_16868976fbbb05d2559e11697f35e884258be583.png differ diff --git a/tesi/ltximg/org-ltximg_1c1725e4483e6ee165fb966d08d17859517d009a.png b/tesi/ltximg/org-ltximg_1c1725e4483e6ee165fb966d08d17859517d009a.png new file mode 100644 index 0000000..826efb1 Binary files /dev/null and b/tesi/ltximg/org-ltximg_1c1725e4483e6ee165fb966d08d17859517d009a.png differ diff --git a/tesi/ltximg/org-ltximg_3314c11becd25c60681c6fe16930d3cf4f469839.png b/tesi/ltximg/org-ltximg_3314c11becd25c60681c6fe16930d3cf4f469839.png new file mode 100644 index 0000000..c7500ff Binary files /dev/null and b/tesi/ltximg/org-ltximg_3314c11becd25c60681c6fe16930d3cf4f469839.png differ diff --git a/tesi/ltximg/org-ltximg_37282bbd0144eebe67dddf28ad789543d7d3488c.png b/tesi/ltximg/org-ltximg_37282bbd0144eebe67dddf28ad789543d7d3488c.png new file mode 100644 index 0000000..2d7fcf2 Binary files /dev/null and b/tesi/ltximg/org-ltximg_37282bbd0144eebe67dddf28ad789543d7d3488c.png differ diff --git a/tesi/ltximg/org-ltximg_4122f5adf7beea453fe97a408a0f1008909319d9.png b/tesi/ltximg/org-ltximg_4122f5adf7beea453fe97a408a0f1008909319d9.png new file mode 100644 index 0000000..1bfc69b Binary files /dev/null and b/tesi/ltximg/org-ltximg_4122f5adf7beea453fe97a408a0f1008909319d9.png differ diff --git a/tesi/ltximg/org-ltximg_4df34694486e6e2cac7fc619b968acf8ba0c160f.png b/tesi/ltximg/org-ltximg_4df34694486e6e2cac7fc619b968acf8ba0c160f.png new file mode 100644 index 0000000..f68743c Binary files /dev/null and b/tesi/ltximg/org-ltximg_4df34694486e6e2cac7fc619b968acf8ba0c160f.png differ diff --git a/tesi/ltximg/org-ltximg_511c81a97e12e47228266f1db9a6d1fbe7ce0674.png b/tesi/ltximg/org-ltximg_511c81a97e12e47228266f1db9a6d1fbe7ce0674.png new file mode 100644 index 0000000..2b51f28 Binary files /dev/null and b/tesi/ltximg/org-ltximg_511c81a97e12e47228266f1db9a6d1fbe7ce0674.png differ diff --git a/tesi/ltximg/org-ltximg_5327cee19ac35beeb496d75c8291ae17aacc40b1.png b/tesi/ltximg/org-ltximg_5327cee19ac35beeb496d75c8291ae17aacc40b1.png new file mode 100644 index 0000000..c8fb14c Binary files /dev/null and b/tesi/ltximg/org-ltximg_5327cee19ac35beeb496d75c8291ae17aacc40b1.png differ diff --git a/tesi/ltximg/org-ltximg_55108c8cf78177739e33f28a2aa8eade50bbdb96.png b/tesi/ltximg/org-ltximg_55108c8cf78177739e33f28a2aa8eade50bbdb96.png new file mode 100644 index 0000000..49c01a6 Binary files /dev/null and b/tesi/ltximg/org-ltximg_55108c8cf78177739e33f28a2aa8eade50bbdb96.png differ diff --git a/tesi/ltximg/org-ltximg_5d63da95448f59d6b4025c32f91abace274d6c72.png b/tesi/ltximg/org-ltximg_5d63da95448f59d6b4025c32f91abace274d6c72.png new file mode 100644 index 0000000..4344440 Binary files /dev/null and b/tesi/ltximg/org-ltximg_5d63da95448f59d6b4025c32f91abace274d6c72.png differ diff --git a/tesi/ltximg/org-ltximg_686f668fa722d81c1324ab7991813e5963f1d3c6.png b/tesi/ltximg/org-ltximg_686f668fa722d81c1324ab7991813e5963f1d3c6.png new file mode 100644 index 0000000..fdd7b7c Binary files /dev/null and b/tesi/ltximg/org-ltximg_686f668fa722d81c1324ab7991813e5963f1d3c6.png differ diff --git a/tesi/ltximg/org-ltximg_74daf5a4b9666da77570d519dd0f67bf729230f1.png b/tesi/ltximg/org-ltximg_74daf5a4b9666da77570d519dd0f67bf729230f1.png new file mode 100644 index 0000000..6398fb9 Binary files /dev/null and b/tesi/ltximg/org-ltximg_74daf5a4b9666da77570d519dd0f67bf729230f1.png differ diff --git a/tesi/ltximg/org-ltximg_9046a52bd7c2838acc3da9d3a38618d3efb345d0.png b/tesi/ltximg/org-ltximg_9046a52bd7c2838acc3da9d3a38618d3efb345d0.png new file mode 100644 index 0000000..e79103a Binary files /dev/null and b/tesi/ltximg/org-ltximg_9046a52bd7c2838acc3da9d3a38618d3efb345d0.png differ diff --git a/tesi/ltximg/org-ltximg_9503c1f813b6049d9bc1a197e5187e383ff3d8cc.png b/tesi/ltximg/org-ltximg_9503c1f813b6049d9bc1a197e5187e383ff3d8cc.png new file mode 100644 index 0000000..62ded6f Binary files /dev/null and b/tesi/ltximg/org-ltximg_9503c1f813b6049d9bc1a197e5187e383ff3d8cc.png differ diff --git a/tesi/ltximg/org-ltximg_97cfe75d0dab20dd7c6b7ccccf20bed30f74a5bf.png b/tesi/ltximg/org-ltximg_97cfe75d0dab20dd7c6b7ccccf20bed30f74a5bf.png new file mode 100644 index 0000000..e3a68ae Binary files /dev/null and b/tesi/ltximg/org-ltximg_97cfe75d0dab20dd7c6b7ccccf20bed30f74a5bf.png differ diff --git a/tesi/ltximg/org-ltximg_9a3c1b1088fc185cda7899001819826e490df893.png b/tesi/ltximg/org-ltximg_9a3c1b1088fc185cda7899001819826e490df893.png new file mode 100644 index 0000000..f3e6e4f Binary files /dev/null and b/tesi/ltximg/org-ltximg_9a3c1b1088fc185cda7899001819826e490df893.png differ diff --git a/tesi/ltximg/org-ltximg_9db8ac04199fed1b9906d34db28bd4c38d1a9cec.png b/tesi/ltximg/org-ltximg_9db8ac04199fed1b9906d34db28bd4c38d1a9cec.png new file mode 100644 index 0000000..57cffdb Binary files /dev/null and b/tesi/ltximg/org-ltximg_9db8ac04199fed1b9906d34db28bd4c38d1a9cec.png differ diff --git a/tesi/ltximg/org-ltximg_9e25ef70b7c62c6c7c31babfe9631d33172bdd13.png b/tesi/ltximg/org-ltximg_9e25ef70b7c62c6c7c31babfe9631d33172bdd13.png new file mode 100644 index 0000000..fdd7b7c Binary files /dev/null and b/tesi/ltximg/org-ltximg_9e25ef70b7c62c6c7c31babfe9631d33172bdd13.png differ diff --git a/tesi/ltximg/org-ltximg_a1fba3097218c2e6d52357f81d387fe0c6132163.png b/tesi/ltximg/org-ltximg_a1fba3097218c2e6d52357f81d387fe0c6132163.png new file mode 100644 index 0000000..8bbe1d1 Binary files /dev/null and b/tesi/ltximg/org-ltximg_a1fba3097218c2e6d52357f81d387fe0c6132163.png differ diff --git a/tesi/ltximg/org-ltximg_adaec38702be97dcd649ebea0c7305bcc25c0d9e.png b/tesi/ltximg/org-ltximg_adaec38702be97dcd649ebea0c7305bcc25c0d9e.png new file mode 100644 index 0000000..937fc59 Binary files /dev/null and b/tesi/ltximg/org-ltximg_adaec38702be97dcd649ebea0c7305bcc25c0d9e.png differ diff --git a/tesi/ltximg/org-ltximg_b58ff841c9a81784a9a999eb18d9484e9edb0bc3.png b/tesi/ltximg/org-ltximg_b58ff841c9a81784a9a999eb18d9484e9edb0bc3.png new file mode 100644 index 0000000..92e2b60 Binary files /dev/null and b/tesi/ltximg/org-ltximg_b58ff841c9a81784a9a999eb18d9484e9edb0bc3.png differ diff --git a/tesi/ltximg/org-ltximg_b5eb5883a9bf3a113e53d4c9cb08d1e367f5123e.png b/tesi/ltximg/org-ltximg_b5eb5883a9bf3a113e53d4c9cb08d1e367f5123e.png new file mode 100644 index 0000000..7c2e7bd Binary files /dev/null and b/tesi/ltximg/org-ltximg_b5eb5883a9bf3a113e53d4c9cb08d1e367f5123e.png differ diff --git a/tesi/ltximg/org-ltximg_d5829fee882afb797287d3d61361e6b781649230.png b/tesi/ltximg/org-ltximg_d5829fee882afb797287d3d61361e6b781649230.png new file mode 100644 index 0000000..cf380ae Binary files /dev/null and b/tesi/ltximg/org-ltximg_d5829fee882afb797287d3d61361e6b781649230.png differ diff --git a/tesi/ltximg/org-ltximg_d85f039003b0e7b0640a91ccfd29b9e8b41819c2.png b/tesi/ltximg/org-ltximg_d85f039003b0e7b0640a91ccfd29b9e8b41819c2.png new file mode 100644 index 0000000..8066940 Binary files /dev/null and b/tesi/ltximg/org-ltximg_d85f039003b0e7b0640a91ccfd29b9e8b41819c2.png differ diff --git a/tesi/ltximg/org-ltximg_e66ec261fc91c5e95ba5ff1fd19d5776ad25f000.png b/tesi/ltximg/org-ltximg_e66ec261fc91c5e95ba5ff1fd19d5776ad25f000.png new file mode 100644 index 0000000..9cfa572 Binary files /dev/null and b/tesi/ltximg/org-ltximg_e66ec261fc91c5e95ba5ff1fd19d5776ad25f000.png differ diff --git a/tesi/ltximg/org-ltximg_ed411e8724596359e6c7ec08434132c02afe1d6d.png b/tesi/ltximg/org-ltximg_ed411e8724596359e6c7ec08434132c02afe1d6d.png new file mode 100644 index 0000000..b8781b9 Binary files /dev/null and b/tesi/ltximg/org-ltximg_ed411e8724596359e6c7ec08434132c02afe1d6d.png differ diff --git a/tesi/ltximg/org-ltximg_ed88d5d2bb4d6646bcb72fb2261d168a93798278.png b/tesi/ltximg/org-ltximg_ed88d5d2bb4d6646bcb72fb2261d168a93798278.png new file mode 100644 index 0000000..4fb7c54 Binary files /dev/null and b/tesi/ltximg/org-ltximg_ed88d5d2bb4d6646bcb72fb2261d168a93798278.png differ diff --git a/tesi/ltximg/org-ltximg_f9d6bd1e9e2cf7eb29b158d6dd13a53794d97130.png b/tesi/ltximg/org-ltximg_f9d6bd1e9e2cf7eb29b158d6dd13a53794d97130.png new file mode 100644 index 0000000..8e10abe Binary files /dev/null and b/tesi/ltximg/org-ltximg_f9d6bd1e9e2cf7eb29b158d6dd13a53794d97130.png differ diff --git a/tesi/ltximg/org-ltximg_fa082177ad3b8221d131735a416e5fad35ba4c02.png b/tesi/ltximg/org-ltximg_fa082177ad3b8221d131735a416e5fad35ba4c02.png new file mode 100644 index 0000000..db8e9e0 Binary files /dev/null and b/tesi/ltximg/org-ltximg_fa082177ad3b8221d131735a416e5fad35ba4c02.png differ diff --git a/tesi/tesi.pdf b/tesi/tesi.pdf index 3d12000..5ecb687 100644 Binary files a/tesi/tesi.pdf and b/tesi/tesi.pdf differ diff --git a/tesi/tesi_unicode.org b/tesi/tesi_unicode.org index d507caa..30f232a 100644 --- a/tesi/tesi_unicode.org +++ b/tesi/tesi_unicode.org @@ -849,7 +849,7 @@ Reasoning about all possible executions of a program is not always feasible[CIT] and in case of explosion usually symbolic execution engines implement heuristics to reduce the size of the search space.[CIT] -** Translation validation +** Translation Validation Translators, such as translators and code generators, are huge pieces of software usually consisting of multiple subsystem and constructing an actual specification of a translator implementation for @@ -865,7 +865,7 @@ existing translators that consists of taking the source and the target - [ ] What happens when there is no semantic equivalence - [ ] Translation validation through symbolic execution -* Translation validation of the Pattern Matching Compiler +* Translation Validation of the Pattern Matching Compiler ** Accessors OCaml encourages widespread usage of composite types to encapsulate data. Composite types include /discriminated unions/, of which we have @@ -954,6 +954,14 @@ At the target level /accessors/ are constructed by compressing the steps taken b the symbolic engine during the evaluation of a value. /Accessors/ don't store any kind of information about the concrete value of the scrutinee. +Accessors respect the following invariants: +| v(Here) = v +| K(vᵢ)ⁱ(k.a) = vₖ(a) if k ∈ [0;n[ +We will see in the following chapters how at the source level and the +target level a value v_{S} and a value v_{T} can be deconstructed into +a value vector $(v_i)^{i\in{I}}$ of which we can access the root using +the $Here$ accessor and we can inspect the k-th element using an +accessor of the form $k.a$. ** Source program The OCaml source code of a pattern matching function has the @@ -1041,7 +1049,7 @@ During compilation by the translator, expressions at the right-hand-side are compiled into Lambda code and are referred as lambda code actions lᵢ. \\ -We define the /pattern matrix/ P as the matrix |m x n| where m is bigger +We define the /pattern matrix/ P as the matrix |m × n| where m is bigger or equal than the number of clauses in the source program and n is equal to the arity of the constructor with the gratest arity. \begin{equation*} @@ -1324,10 +1332,10 @@ In our prototype the source matrix mₛ is defined as follows ** Target translation The target program of the following general form is parsed using a parser -generated by Menhir, a LR(1) parser generator for the OCaml programming language. +generated by Menhir[CIT], a LR(1) parser generator for the OCaml programming language. Menhir compiles LR(1) a grammar specification, in this case a subset of the Lambda intermediate language, down to OCaml code. -This is the grammar of the target language (TODO: check menhir grammar) +This is the grammar of the target language[CIT] (TODO: check menhir grammar) | start ::= sexpr | sexpr ::= variable \vert{} string \vert{} "(" special_form ")" | string ::= "\"" identifier "\"" ;; string between doublequotes @@ -1450,7 +1458,7 @@ Guard nodes of the tree are emitted whenever a guard is found. Guards node contains a blackbox of code that is never evaluated and two branches, one that is taken in case the guard evaluates to true and the other one that contains the path taken when the guard evaluates to -true. +false. \begin{comment} Are K and Here clear here? \end{comment} @@ -1467,36 +1475,35 @@ in terms of the decision tree of pattern matrices by the following: | 〚((pᵢ → bbᵢ)^{i∈I}〛 := 〚(Here), (pᵢ → bbᵢ)^{i∈I} 〛 Decision tree computed from pattern matrices respect the following invariant: -| ∀v (vᵢ)^{i∈I} = v(aᵢ)^{i∈I} → 〚m〛(v) = m(vᵢ)^{i∈I} for m = ((aᵢ)^{i∈I}, (rᵢ)^{i∈I}) -| v(Here) = v -| K(vᵢ)ⁱ(k.a) = vₖ(a) if k ∈ [0;n[ -\begin{comment} -TODO: EXPLAIN -\end{comment} +| ∀v (vᵢ)^{i∈I} = v(aᵢ)^{i∈I} → m(vᵢ)^{i∈I} = 〚m〛(v) for m = ((aᵢ)^{i∈I}, (rᵢ)^{i∈I}) +The invariant conveys the fact that OCaml pattern matching values can +be deconstructed into a value vector and if we can correctly inspect +the value vector elements using the accessor notation we can build a +decision tree 〚m〛 from a pattern matrix that are equivalent when run +against the value at hand. We proceed to show the correctness of the invariant by a case analysys. Base cases: 1. [| ∅, (∅ → bbᵢ)ⁱ |] ≡ Leaf bbᵢ where i := min(I), that is a - decision tree [|ms|] defined by an empty accessor and empty + decision tree [|m|] defined by an empty accessor and empty patterns pointing to blackboxes /bbᵢ/. This respects the invariant because a source matrix in the case of empty rows returns - the first expression and (Leaf bb)(v) := Match bb -2. [| (aⱼ)ʲ, ∅ |] ≡ Failure + the first expression and $(Leaf bb)(v) := Match\enspace bb$ +2. [| (aⱼ)ʲ, ∅ |] ≡ Failure, as it is the case with the matrix + decomposition algorithm Regarding non base cases: Let's first define some auxiliary functions -- The index family of a constructor - | Idx(K) := [0; arity(K)[ -- head of an ordered family (we write x for any object here, value, pattern etc.) - | head((xᵢ)^{i ∈ I}) = x_min(I) -- tail of an ordered family - | tail((xᵢ)^{i ∈ I}) := (xᵢ)^{i ≠ min(I)} -- head constructor of a value or pattern +- The index family of a constructor: $Idx(K) := [0; arity(K)[$ +- head of an ordered family (we write x for any object here, value, + pattern etc.): $head((x_i)^{i \in I}) = x_{min(I)}$ +- tail of an ordered family: $tail((x_i)^{i \in I}) := (x_i)^{i \ne min(I)}$ +- head constructor of a value or pattern: | constr(K(xᵢ)ⁱ) = K | constr(_) = ⊥ | constr(x) = ⊥ -- first non-⊥ element of an ordered family +- first non-⊥ element of an ordered family: | First((xᵢ)ⁱ) := ⊥ \quad \quad \quad if ∀i, xᵢ = ⊥ | First((xᵢ)ⁱ) := x_min{i \vert{} xᵢ ≠ ⊥} \quad if ∃i, xᵢ ≠ ⊥ - definition of group decomposition: @@ -1520,12 +1527,12 @@ submatrices, according to the head constructor of their first pattern. Groups(m) returns one submatrix m_r for each head constructor K that occurs on the first row of m, plus one "wildcard submatrix" m_{wild} that matches on all values that do not start with one of those head -constructors. +constructors. \\ Intuitively, m is equivalent to its decomposition in the following sense: if the first pattern of an input vector (v_i)^i starts with one of the head constructors Kₖ, then running (v_i)^i against m is the same -as running it against the submatrix m_{Kₖ}; otherwise (its head -constructor ∉ (Kₖ)ᵏ) it is equivalent to running it against +as running it against the submatrix m_{Kₖ}; otherwise (when its head +constructor is not one of (Kₖ)ᵏ) it is equivalent to running it against the wildcard submatrix. \\ We formalize this intuition as follows @@ -1631,8 +1638,8 @@ we have to prove that # TODO: replace C with D Symbolic Values during symbolic evaluation have the following form | vₜ ::= Block(tag ∈ ℕ, (vᵢ)^{i∈I}) \vert n ∈ ℕ -The result of the symbolic evaluation is a target decision tree Cₜ -| Cₜ ::= Leaf bb \vert Switch(a, (πᵢ → Cᵢ)^{i∈S} , C?) \vert Failure +The result of the symbolic evaluation is a target decision tree Dₜ +| Dₜ ::= Leaf bb \vert Switch(a, (πᵢ → Dᵢ)^{i∈S} , D?) \vert Failure Every branch of the decision tree is "constrained" by a domain πₜ that intuitively tells us the set of possible values that can "flow" through that path. @@ -1641,9 +1648,9 @@ possible values that can "flow" through that path. πₜ conditions are refined by the engine during the evaluation; at the root of the decision tree the domain corresponds to the set of possible values that the type of the function can hold. -C? is the fallback node of the tree that is taken whenever the value +D? is the fallback node of the tree that is taken whenever the value at that point of the execution can't flow to any other subbranch. -Intuitively, the π_{fallback} condition of the C? fallback node is +Intuitively, the π_{fallback} condition of the D? fallback node is | π_{fallback} = ¬\bigcup\limits_{i∈I}πᵢ The fallback node can be omitted in the case where the domain of the children nodes correspond to set of possible values pointed by the @@ -1672,7 +1679,7 @@ tₛ: and simmetrically, to run a value vₜ against a target program tₜ: # TODO t_t todo.1 We denote as $\vrel {v_S} {v_T}$ the equivalence relation between a -source value vₛ and a target value vₜ. The relationship is proven by +source value vₛ and a target value vₜ. The equivalence relation is proven by structural induction. \begin{mathpar} \infer[integers] @@ -1754,35 +1761,59 @@ executed guards and a \emph{matching result} $r$. \infer {\forall {\vrel {v_S} {v_T}},\quad \runrel {t_S(v_S)} {t_T(v_T)}} - {\progrel t_S t_T} + {\progrel {t_S} {t_T}} \end{mathpar} Once formulated in this way, our equivalence algorithm must check the natural notion of input-output equivalence for matching programs, captured by the relation $\progrel {t_S} {t_T}$. + \subsubsection{The equivalence checking algorithm} + +\begin{comment} The equivalence checking algorithm takes as input a domain of possible values \emph{S} and a pair of source and target decision trees and in case the two trees are not equivalent it returns a counter example. The algorithm respects the following correctness statement: -\begin{comment} % TODO: we have to define what \covers mean for readers to understand the specifications % (or we use a simplifying lie by hiding \covers in the statements). -\end{comment} \begin{align*} - \SimpleEquiv S {C_S} {C_T} = \Yes \;\land\; \covers {C_T} S + \SimpleEquiv S {D_S} {D_T} = \Yes \;\land\; \covers {D_T} S & \implies - \forall {\vrel {v_S} {v_T}} \in S,\; \runrel {C_S(v_S)} {C_T(v_T)} + \forall {\vrel {v_S} {v_T}} \in S,\; \runrel {D_S(v_S)} {D_T(v_T)} \\ - \SimpleEquiv S {C_S} {C_T} = \No {v_S} {v_T} \;\land\; \covers {C_T} S + \SimpleEquiv S {D_S} {D_T} = \No {v_S} {v_T} \;\land\; \covers {D_T} S & \implies - \vrel {v_S} {v_T} \in S \;\land\; {\nparamrel{run} {C_S(v_S)} {C_T(v_T)}} + \vrel {v_S} {v_T} \in S \;\land\; {\nparamrel{run} {D_S(v_S)} {D_T(v_T)}} \end{align*} -This algorithm $\SimpleEquiv S {C_S} {C_T}$ is in fact exactly +This algorithm $\SimpleEquiv S {D_S} {D_T}$ is in fact exactly a decision procedure for the provability of the judgment -$(\Equivrel S {C_S} {C_T} \emptyqueue)$, defined below in the general -form $(\Equivrel S {C_S} {C_T} G)$ where $G$ is a \emph{guard queue}, +$(\Equivrel S {D_S} {D_T} \emptyqueue)$, defined below in the general +form $(\Equivrel S {D_S} {D_T} G)$ where $G$ is a \emph{guard queue}, indicating an imbalance between the guards observed in the source tree and in the target tree. +\end{comment} + +During the equivalence checking phase we traverse the two trees, +recursively checking equivalence of pairs of subtrees. When we +traverse a branch condition, we learn a condition on an accessor that +restricts the set of possible input values that can flow in the +corresponding subtree. We represent this in our algorithm as an +\emph{input domain} $S$ of possible values (a mapping from accessors +to target domains). + +The equivalence checking algorithm $\SimpleEquiv S {D_S} {D_T}$ takes +an input domain \emph{S} and a pair of source and target decision +trees. In case the two trees are not equivalent, it returns a counter +example. + +It is defined exactly as a decision procedure for the provability of +the judgment $(\Equivrel S {D_S} {D_T} \emptyqueue)$, defined below in +the general form $(\Equivrel S {D_S} {D_T} G)$ where $G$ is a +\emph{guard queue}, indicating an imbalance between the guards +observed in the source tree and in the target tree. (For clarity of +exposition, the inference rules do not explain how we build the +counter-example.) + \begin{mathpar} \begin{array}{l@{~}r@{~}l} & & \text{\emph{input space}} \\ @@ -1822,8 +1853,8 @@ for content equality. \end{mathpar} \end{comment} \begin{mathpar} - \infer{ } - {\Equivrel \emptyset {C_S} {C_T} G} + \infer[empty]{ } + {\Equivrel \emptyset {D_S} {D_T} G} \infer{ } {\Equivrel S \Failure \Failure \emptyqueue} @@ -1840,14 +1871,14 @@ child of the right hand side is tested for equality against the left hand side. \begin{mathpar} - \infer + \infer[explode-right] {D_S \in {\Leaf t, \Failure} \\ - \forall i,\; \EquivTEX {(S \land a \in D_i)} {D_S} {D_i} G + \forall i,\; \Equivrel {(S \cap a \in \pi_i)} {D_S} {D_i} G \\ - \EquivTEX {(S \land a \notin \Fam i {D_i})} {D_S} \Dfb G} - {\EquivTEX S - {D_S} {\Switch a {\Fam i {D_i} {D_i}} \Dfb} G} + \Equivrel {(S \cap a \notin \Fam i {\pi_i})} {D_S} \Dfb G} + {\Equivrel S + {D_S} {\Switch a {\Fam i {\pi_i} {D_i}} \Dfb} G} \end{mathpar} \begin{comment} @@ -1867,18 +1898,14 @@ result in an empty intersection. If the accessors are different, \emph{$dom_T$} is left unchanged. \begin{mathpar} - \infer - {\forall i,\; - \EquivTEX - {(S \land a = K_i)} - {D_i} {\trim {D_T} {a = K_i}} G + \infer[explode-right] + {D_S \in {\Leaf t, \Failure} \\ - \EquivTEX - {(S \land a \notin \Fam i {K_i})} - \Dfb {\trim {D_T} {a \notin \Fam i {K_i}}} G - } - {\EquivTEX S - {\Switch a {\Fam i {K_i, D_i}} \Dfb} {D_T} G} + \forall i,\; \Equivrel {(S \cap a \in \pi_i)} {D_S} {D_i} G + \\ + \Equivrel {(S \cap a \notin \Fam i {\pi_i})} {D_S} \Dfb G} + {\Equivrel S + {D_S} {\Switch a {\Fam i {\pi_i} {D_i}} \Dfb} G} \end{mathpar} The equivalence checking algorithm deals with guards by storing a @@ -1893,18 +1920,19 @@ Termination of the algorithm is successful only when the guards queue is empty. \begin{mathpar} \infer - {\EquivTEX S {C_0} {C_T} {G, (t_S = 0)} + {\Equivrel S {D_0} {D_T} {G, (e_S = 0)} \\ - \EquivTEX S {C_1} {C_T} {G, (t_S = 1)}} - {\EquivTEX S - {\Guard {t_S} {C_0} {C_1}} {C_T} G} + \Equivrel S {D_1} {D_T} {G, (e_S = 1)}} + {\Equivrel S + {\Guard {e_S} {D_0} {D_1}} {D_T} G} \infer - {\trel {t_S} {t_T} + {\erel {e_S} {e_T} \\ - \EquivTEX S {C_S} {C_b} G} - {\EquivTEX S - {C_S} {\Guard {t_T} {C_0} {C_1}} {(t_S = b), G}} + \Equivrel S {D_S} {D_b} G} + {\Equivrel S + {D_S} {\Guard {e_T} {D_0} {D_1}} {(e_S = b), G}} + \end{mathpar} Our equivalence-checking algorithm $\EquivTEX S {C_S} {C_T} G$ is a exactly decision procedure for the provability of the judgment diff --git a/todo.org b/todo.org index 1527e2c..dd055c1 100644 --- a/todo.org +++ b/todo.org @@ -1,15 +1,25 @@ -* Apprendimento Automatico [2/2] +* Apprendimento Automatico [2/3] - [X] Scrivile per date di esame - [X] Richiedi date esame +- [ ] Slides [0/2] + - [ ] 002: + + [ ] Laplace adjustment + + [ ] Output code decoding + + [ ] Itemeset bUh frequent: significato frequent + - [ ] 02: + + [ ] Inductive Leap + + [ ] Biased hyp -* Tesi [8/31] +* Tesi [8/33] - [ ] Rivedere inference rules di Gabriel e aggiustarle con le mie - [ ] Definisci domain sempre allo stesso modo, con bigcup o | +- [ ] Scegli se usare [[t_s]\] o D(ts) - [X] Definizione di First(x_i): serve? - [ ] ~1444: run t_t against value (todo.1) - [X] ~1435: equivalence v_s v_t: formulala, correggi omitted - [ ] Definisci Run e =_run +- [ ] Correggi Dfb e D? - [X] 3.4: DECISION TREE CHAPTER + [X] sposta inferenze sotto decision tree in equivalenze? + [X] Rivedi sezioni: magari le altre mettile come sottosezioni