\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[english,spanish]{babel}
\decimalpoint
\unaccentedoperators
\usepackage[intlimits]{amsmath}
\usepackage{amsfonts,amssymb,amsthm,mathtools,extarrows}
\usepackage[width=16cm,height=22cm]{geometry}
\usepackage{tikz}
\usepackage[colorlinks]{hyperref}
\usepackage{parskip}
\usepackage{xcolor,colortbl}

\swapnumbers
\theoremstyle{plain}
\newtheorem{thm}{Teorema}
\newtheorem{prop}[thm]{Proposición}
\newtheorem{lem}[thm]{Lema}
\newtheorem{cor}[thm]{Corollary}
\theoremstyle{definition}
\newtheorem{defn}[thm]{Definición}
\newtheorem{ex}{Ejemplo}
\theoremstyle{remark}
\newtheorem{remark}{Observación}

%% Blackboard bold letters
\newcommand{\IntegerNumbers}{{\mathbb{Z}}}
\newcommand{\RationalNumbers}{{\mathbb{Q}}}
\newcommand{\RealNumbers}{{\mathbb{R}}}
\newcommand{\ExtendedRealNumbers}{{\overline{\mathbb{R}}}}
\newcommand{\ComplexNumbers}{{\mathbb{C}}}
\newcommand{\ExtendedPositiveRealNumbers}{{\overline{\RealNumbers}_+}}

\newcommand{\fA}{{\mathfrak{A}}} % Gothic letters, if you want to use them
\newcommand{\cA}{{\mathcal{A}}} % Cal letters, if you want to use them

\renewcommand{\Re}{\operatorname{Re}}
\renewcommand{\Im}{\operatorname{Im}}
\renewcommand{\phi}{\varphi}
\newcommand{\eps}{\varepsilon}
\newcommand{\eqdef}{\coloneqq}

\DeclareMathOperator{\imagunit}{i}
\DeclareMathOperator{\enumber}{e}
\DeclareMathOperator{\Image}{im}
\DeclareMathOperator{\Range}{\mathcal{R}}
\DeclareMathOperator{\sign}{sgn}
\DeclareMathOperator{\closure}{clos}
\DeclareMathOperator{\supp}{supp}
\DeclareMathOperator{\interior}{int}
\DeclareMathOperator{\conv}{conv}
\DeclareMathOperator{\dist}{dist}
\DeclareMathOperator{\SimpleMeasurables}{\mathcal{SM}}
\DeclareMathOperator{\Measurables}{\mathcal{M}}

\newcommand{\matr}[2]{\left(\begin{array}{#1}#2\end{array}\right)}
\newcommand{\detmatr}[2]{\left|\begin{array}{#1}#2\end{array}\right|}

\newcommand{\uniformlyto}[1]{\xLongrightarrow{#1}}
\newcommand{\pointwiseto}[1]{\xlongrightarrow{#1}}
\newcommand{\aeto}[1]{\xlongrightarrow{#1\text{-c.t.p.}}}
\newcommand{\muto}[1]{\xrightharpoondown{#1}}
\newcommand{\aeeq}[1]{\xlongequal{#1\text{-c.t.p.}}}
\newcommand{\auniformlyto}[1]{\xLongrightarrow{#1\text{-c.u.}}}

\definecolor{lightgray}{rgb}{0.8,0.8,0.8}
\definecolor{lightgreen}{rgb}{0.8,1,0.8}
\definecolor{lightblue}{rgb}{0.8,0.8,1}
\newcommand{\h}{1.732}
\newcommand{\hhalf}{0.866}
\newcommand{\Bx}{2}
\newcommand{\By}{0.8}
\newcommand{\Cy}{-3}
\newcommand{\titley}{3}

\renewcommand{\author}[1]{\newcommand{\authorname}{#1}\hypersetup{pdfauthor={#1}}}
\newcommand{\keywords}[1]{\hypersetup{pdfkeywords={#1}}}
\newcommand{\pdftitle}[1]{\hypersetup{pdftitle={#1}}}
\renewcommand{\title}[1]{\newcommand{\titlename}{#1}\newcommand{\shorttitlename}{#1}%
\renewcommand{\maketitle}{\begin{center}\bfseries{\Large{\titlename}}\\[1ex]{\authorname}\end{center}\par\medskip%
}%maketitle
}%mytitle
\newcommand{\shorttitle}[1]{\renewcommand{\shorttitlename}{#1}}
\makeatletter
\pagestyle{empty}
\renewcommand{\@oddfoot}{\hfill{}\shorttitlename{},\quad{}página~{\thepage}~de~\pageref*{endlabel}\hfill}
\makeatother

\author{Ada Sofía Estudiántez Avanzádez}
\title{Fórmula para $\boldsymbol{A\setminus(B\setminus C)}$}
\shorttitle{Fórmula para $A\setminus(B\setminus C)$}
\pdftitle{Formula para A setminus (B setminus C)}
\keywords{diferencia de conjuntos; demostración}

\begin{document}
\maketitle


Recordemos las definiciones de la unión, intersección y diferencia de conjuntos:
\begin{align*}
x&\in A\cup B & &\iff & &\bigl(x\in A\bigr)\ \vee\ \bigl(x\in B\bigr);\\[1ex]
x&\in A\cap B & &\iff & &\bigl(x\in A\bigr)\ \wedge\ \bigl(x\in B\bigr);\\[1ex]
x&\in A\setminus B & &\iff & &\bigl(x\in A\bigr)\ \wedge\ \overline{\bigl(x\in B\bigr)}.
\end{align*}

\begin{prop}
Sean $A,B,C$ algunos conjuntos. Entonces
\[
A\setminus(B\setminus C)=(A\setminus B)\cup(A\cap C).
\]
\end{prop}

\noindent
La demostración más natural, basada en ciertas propiedades de operaciones lógicas,
se puede encontrar en otro texto.
A continuación están escritas otras dos demostraciones.

\medskip

\begin{proof}[Demostración basada en tablas de verdad]
Usemos las siguientes notaciones breves:
\[
a_x\eqdef (x\in A),\qquad b_x\eqdef (x\in B),\qquad c_x\eqdef (x\in C).
\]
Entonces
\begin{align*}
x&\in A\setminus(B\setminus C)
\iff
a_x\wedge\overline{b_x\wedge\overline{c_x}};
\\
x&\in (A\setminus B)\cup(A\cap C)
\iff
\bigl(a_x\wedge\overline{b_x}\bigr)\vee\bigl(a_x\wedge c_x\bigr).
\end{align*}
Falta demostrar que
\begin{equation} \label{eq:logic_identity}
a_x\wedge\overline{b_x\wedge\overline{c_x}}
\iff
\bigl(a_x\wedge\overline{b_x}\bigr)\vee\bigl(a_x\wedge c_x\bigr).
\end{equation}
Lo haremos con tablas de verdad.
Hay que considerar todas las 8 opciones posibles para $a_x,b_x,c_x$:
\[
\newcolumntype{g}{>{\columncolor{lightgreen}}c}
\newcolumntype{b}{>{\columncolor{lightblue}}c}
\begin{array}{|c|c|c||c|c|g|c|c|b|} \hline
\vphantom{\displaystyle 0_{0_{0_0}}^{0^{0^0}}}a_x & b_x & c_x &
b_x\wedge\overline{c_x} & \overline{b_x\wedge\overline{c_x}} & a_x\wedge\overline{b_x\wedge\overline{c_x}} &
a_x\wedge\overline{b_x} & a_x\wedge c_x & \bigl(a_x\wedge\overline{b_x}\bigr)\vee\bigl(a_x\wedge c_x\bigr) \\\hline
0 & 0 & 0 &  0 & 1 & 0 &  0 & 0 & 0 \\\hline
0 & 0 & 1 &  0 & 1 & 0 &  0 & 0 & 0 \\\hline
0 & 1 & 0 &  1 & 0 & 0 &  0 & 0 & 0 \\\hline
0 & 1 & 1 &  0 & 1 & 0 &  0 & 0 & 0 \\\hline
1 & 0 & 0 &  0 & 1 & 1 &  1 & 1 & 1 \\\hline
1 & 0 & 1 &  0 & 1 & 1 &  1 & 1 & 1 \\\hline
1 & 1 & 0 &  1 & 0 & 0 &  0 & 0 & 0 \\\hline
1 & 1 & 1 &  0 & 1 & 1 &  0 & 1 & 1 \\\hline
\end{array}
\]
Observamos que la columna verde coincide con la azul,
con lo que acabamos de demostrar la equivalencia \eqref{eq:logic_identity}.
\end{proof}

\begin{proof}[Demostración por medio de diagramas de Euler--Venn]
En la demostración anterior tuvimos que considerar 8 opciones posibles;
lo mismo se puede hacer de manera más evidente con diagramas de Euler--Venn.
A cada una de las 8 opciones le corresponde un pedazo del plano.

Primero dibujemos $B\setminus C$ y $A\setminus(B\setminus C)$:
\begin{center}
\begin{tikzpicture}[scale=0.7]
\fill[lightgray] (-1,0) arc (120:0:2cm) arc (-60:180:2cm);
\node at (0,\titley) {$B\setminus C$};
\draw (-1,0) circle(2cm);
\draw (1,0) circle(2cm);
\draw (0,-\h) circle (2cm);
\node at (-\Bx,\By) {$A$};
\node at (\Bx,\By) {$B$};
\node at (0,\Cy) {$C$};
\end{tikzpicture}
\qquad\qquad
\begin{tikzpicture}[scale=0.7]
\fill[lightgreen] (0,\h) arc (60:360:2cm) arc (60:120:2cm) arc (180:120:2cm);
\node at (0,\titley) {$A\setminus(B\setminus C)$};
\draw (-1,0) circle(2cm);
\draw (1,0) circle(2cm);
\draw (0,-\h) circle (2cm);
\node at (-\Bx,\By) {$A$};
\node at (\Bx,\By) {$B$};
\node at (0,\Cy) {$C$};
\end{tikzpicture}
\end{center}
Por otro lado, dibujemos $A\setminus B$, $A\cap C$ y $(A\setminus B)\cup(A\cap C)$:
\begin{center}
\begin{tikzpicture}[scale=0.7]
\fill[lightgray] (0,\h) arc (60:300:2cm) arc (-120:-240:2cm);
\node at (0,\titley) {$A\setminus B$};
\draw (-1,0) circle(2cm);
\draw (1,0) circle(2cm);
\draw (0,-\h) circle (2cm);
\node at (-\Bx,\By) {$A$};
\node at (\Bx,\By) {$B$};
\node at (0,\Cy) {$C$};
\end{tikzpicture}
\qquad\qquad
\begin{tikzpicture}[scale=0.7]
\fill[lightgray] (1,0) arc (60:180:2cm) arc (-120:0:2cm);
\node at (0,\titley) {$A\cap C$};
\draw (-1,0) circle(2cm);
\draw (1,0) circle(2cm);
\draw (0,-\h) circle (2cm);
\node at (-\Bx,\By) {$A$};
\node at (\Bx,\By) {$B$};
\node at (0,\Cy) {$C$};
\end{tikzpicture}
\end{center}
\begin{center}
\begin{tikzpicture}[scale=0.7]
\fill[lightblue] (0,\h) arc (60:360:2cm) arc (60:120:2cm) arc (180:120:2cm);
\node at (0,\titley) {$(A\setminus B)\cup(A\cap C)$};
\draw (-1,0) circle(2cm);
\draw (1,0) circle(2cm);
\draw (0,-\h) circle (2cm);
\node at (-\Bx,\By) {$A$};
\node at (\Bx,\By) {$B$};
\node at (0,\Cy) {$C$};
\end{tikzpicture}
\end{center}
El dibujo verde coincide con el dibujo azul.
\end{proof}

\label{endlabel}
\end{document}
