Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
aa:lab:sol:8 [2025/12/01 19:14]
mihnea.gheorghe rezolvare exercițiu Python
aa:lab:sol:8 [2025/12/04 12:08] (current)
mihnea.gheorghe fix notation consistency
Line 138: Line 138:
 \begin{aligned} \begin{aligned}
 \mathrm{isBST}(\mathrm{Nil}) \mathrm{isBST}(\mathrm{Nil})
-&​\overset{(\text{BST})}{=} \mathrm{isBSTBetween}(\mathrm{Nil},​ -\infty, \infty) \\+&​\overset{(\text{BST})}{=} \mathrm{isBSTBetween}(\mathrm{Nil},​ -\infty, ​+\infty) \\
 &​\overset{(\text{BST1})}{=} \text{true},​ \forall x \in \mathbb{E} &​\overset{(\text{BST1})}{=} \text{true},​ \forall x \in \mathbb{E}
 \end{aligned} \end{aligned}
Line 146: Line 146:
 \begin{aligned} \begin{aligned}
 \mathrm{isBST}(\mathrm{Node}(x,​ \mathrm{Nil},​ \mathrm{Nil})) \mathrm{isBST}(\mathrm{Node}(x,​ \mathrm{Nil},​ \mathrm{Nil}))
-&​\overset{(\text{BST})}{=} \mathrm{isBSTBetween}(\mathrm{Node}(x,​ \mathrm{Nil},​ \mathrm{Nil}),​ -\infty, \infty) \\ +&​\overset{(\text{BST})}{=} \mathrm{isBSTBetween}(\mathrm{Node}(x,​ \mathrm{Nil},​ \mathrm{Nil}),​ -\infty, ​+\infty) \\ 
-&​\overset{(\text{BST2})}{=} (-\infty \le x \le \infty) ​+&​\overset{(\text{BST2})}{=} (-\infty \le x \le +\infty) ​
 \;\land\; \;\land\;
 \mathrm{isBSTBetween}(\mathrm{Nil},​ -\infty, x) \mathrm{isBSTBetween}(\mathrm{Nil},​ -\infty, x)
 \;\land\; \;\land\;
-\mathrm{isBSTBetween}(\mathrm{Nil},​ x, \infty) \\+\mathrm{isBSTBetween}(\mathrm{Nil},​ x, +\infty) \\
 &​\overset{(\overline{\mathbb{E}})}{=} \text{true} \;\land\; &​\overset{(\overline{\mathbb{E}})}{=} \text{true} \;\land\;
 \mathrm{isBSTBetween}(\mathrm{Nil},​ -\infty, x) \mathrm{isBSTBetween}(\mathrm{Nil},​ -\infty, x)
 \;\land\; \;\land\;
-\mathrm{isBSTBetween}(\mathrm{Nil},​ x, \infty) \\+\mathrm{isBSTBetween}(\mathrm{Nil},​ x, +\infty) \\
 &​\overset{(\text{BST1})}{=} \text{true},​ \forall x \in \mathbb{E} &​\overset{(\text{BST1})}{=} \text{true},​ \forall x \in \mathbb{E}
 \end{aligned} \end{aligned}
Line 169: Line 169:
 \( \(
 \overset{(\text{BST})}{\Leftrightarrow} \overset{(\text{BST})}{\Leftrightarrow}
-\mathrm{isBSTBetween}(t,​ -\infty, \infty)+\mathrm{isBSTBetween}(t,​ -\infty, ​+\infty)
 \overset{(\text{BST2})}{\Leftrightarrow} \overset{(\text{BST2})}{\Leftrightarrow}
-(lo \le y \le hi) \;\land\; +(-\infty ​\le y \le +\infty) \;\land\; 
-\mathrm{isBSTBetween}(l, ​lo, y) \;\land\; +\mathrm{isBSTBetween}(l, ​-\infty, y) \;\land\; 
-\mathrm{isBSTBetween}(r,​ y, hi) \+\mathrm{isBSTBetween}(r,​ y, +\infty) \
 (\text{II}) (\text{II})
 \) \)