[tex} add 2 tikz examples

This commit is contained in:
Julin S 2024-02-23 11:33:32 +05:30
parent f3071ba4c5
commit aeb2f06a2a
5 changed files with 109 additions and 2 deletions

2
.gitignore vendored
View File

@ -70,4 +70,4 @@ lex.yy.c
bsv/**/bsim
bsv/**/*.h
latex/**.pdf
latex/**/*.pdf

View File

@ -33,6 +33,7 @@ Fixpoint blist_parse (b: list Byte.byte): blist :=
match b with
| x30 => BCons false (blist_parse bs)
| x31 => BCons true (blist_parse bs)
| x20 => blist_parse bs
| _ => blist_parse bs
end
end.
@ -67,6 +68,7 @@ Compute "000"%bl.
Compute "0000"%bl.
Compute "00000"%bl.
Compute "11101101001001001"%bl.
Compute "11 101 1010 01001001"%bl.
(* "0001 1101 1010 0100 1001 "%bl : blist *)
(* Before adding 4-tuple padding and space *)

View File

@ -2,4 +2,5 @@
- long-brackets.tex: Label a table with long braces spanning multiple rows
- nfa-rules.tex: Typing rules for an NFA
- misc.tex: Miscellaneous
+ Antimirov derivatives
1) Antimirov derivatives
2) Semantics of regular expressions

61
latex/tikz/example1.tex Normal file
View File

@ -0,0 +1,61 @@
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{figure}
\tikzstyle{proc} = [rectangle, minimum width=5mm, minimum height=5mm, text centered, draw=black]
\begin{tikzpicture}
\node (spec) {Spec};
\node (compiler) [proc,right of=spec,xshift=20mm,align=center] {Spec\\ compiler};
\node (nfa) [below of=spec,yshift=-20mm] {NFA};
\node (proof) [right of=compiler,xshift=20mm,yshift=2mm] {Proof};
\node (proofchecker) [proc,right of=proof,xshift=20mm,align=center,minimum height=30mm] {Proof\\ checker};
\node (correctness) [right of=proofchecker,xshift=20mm] {Correctness};
%
\node (tf) [right of=nfa,xshift=30mm] {Transitions};
\node (haskell) [right of=tf,xshift=30mm] {Haskell};
\node (vhdl) [right of=haskell,xshift=25mm] {VHDL};
%
\draw[->] (spec) -- (compiler);
\draw[->] (nfa) -- (tf) node[above,midway] (thompson) {Thompson};
\draw[->] (tf) -- (haskell) node[above,midway] {Extraction};
\draw[->] (haskell) -- (vhdl) node[above,midway] {Clash};
\draw[->] (compiler.220) -- ++(0,-5mm) -| (nfa.120);
\draw[->] (compiler.15) -- (proof.west);
\draw[->] (proof.east) -- (proofchecker.west);
\draw[->] (nfa.60) -- ++(0,10mm) -- (haskell.north)++(0,10mm);
%
%\draw[->] (compiler.south)++(0,-5mm) -- ++(15mm,0) |- (proofchecker.220);
\draw[->] (proofchecker.east) -- (correctness.west);
%
% \node at (compiler.south)++(0,-5mm) [circle,fill,inner sep=1.5pt]{};
% \node at (compiler.south)++(0,-5mm) [circle,fill,inner sep=1.5pt]{};
%
%\draw[->] (compiler.220) -- ++(0,-5mm) -| (nfa.north);
% \draw[->] (compiler.320) -- ++(0,-5mm) -| (nfa.north);
%
% \node (tf) [proc,right of=nfa,xshift=9mm] {Label $\mapsto$ nat};
% \node (tbl) [below of=tf,yshift=-5mm,align=center] {Transition\\table};
% \node (vm) [proc,left of=tbl,xshift=-5mm] {VM};
% \node (inp) [left of=vm,xshift=-5mm,align=left] {Input\\string};
% \node (verd) [below of=vm,yshift=-5mm] {Verdict};
% \draw[->] (vm) -- (verd);
% \draw[->] (inp) -- (vm);
% \draw[->] (tbl) -- (vm);
% \draw[->] (tf) -- (tbl);
% \draw[->] (nfa) -- (tf) node[above,midway] {Thompson};
% \draw[->] (spec) -- (compiler);
%\draw[->] (compiler.south) |- (nfa);
% \draw[->] (compiler.south) -| (nfa.north);
%\draw[->] (compiler.south) |- (thompson.north)+(0mm,8mm) -| (nfa.north);
%\draw[->] (compiler.south) |- ($ (thompson.north) + (0mm,5mm) $) -| (nfa.north);
% \draw[->] (compiler.south) |- (nfa.north)+(10,10mm) -| (nfa.north);
%\draw[->] (compiler.south) |- (compiler.south)+(0,-10mm) -| (nfa);
% \draw[->] (compiler.east)+(0,-5mm) -- (nfa);
\end{tikzpicture}
\caption{Method overview}
\label{fig:flow}
\end{figure}
\end{document}

View File

@ -0,0 +1,43 @@
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{figure}
%\tikzstyle{proc} = [rectangle, minimum width=5mm, minimum height=5mm, text centered, draw=black]
\begin{tikzpicture}
\node (s1) {s1};
\node (s2)[right of=s1,xshift=5mm] {s2};
\node (s3)[right of=s2,xshift=5mm] {s3};
\draw[->] (s1) -- (s2) node[above,midway] {a};
\draw[->] (s2) -- (s3) node[above,midway] {b};
\end{tikzpicture}
\caption{Idea scenario}
\label{fig:ideal-states}
\end{figure}
\begin{figure}
%\tikzstyle{proc} = [rectangle, minimum width=5mm, minimum height=5mm, text centered, draw=black]
\begin{tikzpicture}
\node (f1) {false};
\node (t1)[right of=f1,xshift=5mm] {true};
\node (f2)[right of=t1,xshift=10mm] {false};
\node (t2)[right of=f2,xshift=5mm] {true};
\draw[dotted] (f1.north west)++(-1mm,3mm) rectangle (t1.south east)++(5mm,3mm);
\draw[dotted] (f2.north west)++(-1mm,3mm) rectangle (t2.south east)++(5mm,3mm);
\draw[->] (f1) -- (t1) node[above,midway] {a};
\draw[->] (f2) -- (t2) node[above,midway] {b};
\draw[->] (t1) -- (f2) node[above,midway] {$\varepsilon$};
%\draw[dotted] (f1.135)++(-5mm,3mm) rectangle (t1.305)++(5mm,0mm);
%\draw[dotted] (f1.135)++(-5mm,3mm) rectangle (t2.305)++(-5mm,0mm);
\end{tikzpicture}
\caption{Actual scenario}
\label{fig:actual-states}
\end{figure}
\end{document}