<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="es">
	<id>https://www.glc.us.es/~jalonso/SLC2018/index.php?action=history&amp;feed=atom&amp;title=Tema_2</id>
	<title>Tema 2 - Historial de revisiones</title>
	<link rel="self" type="application/atom+xml" href="https://www.glc.us.es/~jalonso/SLC2018/index.php?action=history&amp;feed=atom&amp;title=Tema_2"/>
	<link rel="alternate" type="text/html" href="https://www.glc.us.es/~jalonso/SLC2018/index.php?title=Tema_2&amp;action=history"/>
	<updated>2026-07-18T23:51:22Z</updated>
	<subtitle>Historial de revisiones para esta página en el wiki</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>https://www.glc.us.es/~jalonso/SLC2018/index.php?title=Tema_2&amp;diff=120&amp;oldid=prev</id>
		<title>Jalonso en 10:57 15 jul 2018</title>
		<link rel="alternate" type="text/html" href="https://www.glc.us.es/~jalonso/SLC2018/index.php?title=Tema_2&amp;diff=120&amp;oldid=prev"/>
		<updated>2018-07-15T10:57:03Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;es&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Revisión anterior&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revisión del 10:57 15 jul 2018&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Línea 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Línea 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;ocaml&lt;/del&gt;&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;coq&lt;/ins&gt;&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;(* T2: Demostraciones por inducción en Coq *)&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;(* T2: Demostraciones por inducción en Coq *)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Jalonso</name></author>
		
	</entry>
	<entry>
		<id>https://www.glc.us.es/~jalonso/SLC2018/index.php?title=Tema_2&amp;diff=81&amp;oldid=prev</id>
		<title>Jalonso: Protegió «Tema 2» ([edit=sysop] (indefinido) [move=sysop] (indefinido))</title>
		<link rel="alternate" type="text/html" href="https://www.glc.us.es/~jalonso/SLC2018/index.php?title=Tema_2&amp;diff=81&amp;oldid=prev"/>
		<updated>2018-03-25T08:34:04Z</updated>

		<summary type="html">&lt;p&gt;Protegió «&lt;a href=&quot;/~jalonso/SLC2018/index.php/Tema_2&quot; title=&quot;Tema 2&quot;&gt;Tema 2&lt;/a&gt;» ([edit=sysop] (indefinido) [move=sysop] (indefinido))&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;es&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Revisión anterior&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revisión del 08:34 25 mar 2018&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;es&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(Sin diferencias)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Jalonso</name></author>
		
	</entry>
	<entry>
		<id>https://www.glc.us.es/~jalonso/SLC2018/index.php?title=Tema_2&amp;diff=75&amp;oldid=prev</id>
		<title>Jalonso en 10:50 24 mar 2018</title>
		<link rel="alternate" type="text/html" href="https://www.glc.us.es/~jalonso/SLC2018/index.php?title=Tema_2&amp;diff=75&amp;oldid=prev"/>
		<updated>2018-03-24T10:50:31Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;https://www.glc.us.es/~jalonso/SLC2018/index.php?title=Tema_2&amp;amp;diff=75&amp;amp;oldid=48&quot;&gt;Mostrar los cambios&lt;/a&gt;</summary>
		<author><name>Jalonso</name></author>
		
	</entry>
	<entry>
		<id>https://www.glc.us.es/~jalonso/SLC2018/index.php?title=Tema_2&amp;diff=48&amp;oldid=prev</id>
		<title>Jalonso: Página creada con &#039;&lt;source lang=&quot;ocaml&quot;&gt; (* T2: Demostraciones por inducción en Coq *)  Definition admit {T: Type} : T.  Admitted.  (* Ejemplo de importación de teorías *) Require Export Basics...&#039;</title>
		<link rel="alternate" type="text/html" href="https://www.glc.us.es/~jalonso/SLC2018/index.php?title=Tema_2&amp;diff=48&amp;oldid=prev"/>
		<updated>2018-03-05T18:18:51Z</updated>

		<summary type="html">&lt;p&gt;Página creada con &amp;#039;&amp;lt;source lang=&amp;quot;ocaml&amp;quot;&amp;gt; (* T2: Demostraciones por inducción en Coq *)  Definition admit {T: Type} : T.  Admitted.  (* Ejemplo de importación de teorías *) Require Export Basics...&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Página nueva&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;ocaml&amp;quot;&amp;gt;&lt;br /&gt;
(* T2: Demostraciones por inducción en Coq *)&lt;br /&gt;
&lt;br /&gt;
Definition admit {T: Type} : T.  Admitted.&lt;br /&gt;
&lt;br /&gt;
(* Ejemplo de importación de teorías *)&lt;br /&gt;
Require Export Basics.&lt;br /&gt;
&lt;br /&gt;
(* =====================================================================&lt;br /&gt;
   § Pruebas por inducción &lt;br /&gt;
   ================================================================== *)&lt;br /&gt;
&lt;br /&gt;
(* Ejemplo de demostración que no puede ser realizada por el método &lt;br /&gt;
   simple  *) &lt;br /&gt;
Theorem plus_n_O_firsttry : forall n:nat,&lt;br /&gt;
  n = n + 0.&lt;br /&gt;
Proof.&lt;br /&gt;
  intros n.&lt;br /&gt;
  simpl. (* ¡¡¡No hace nada!!! *)&lt;br /&gt;
Abort.&lt;br /&gt;
&lt;br /&gt;
Theorem plus_n_O_secondtry : forall n:nat,&lt;br /&gt;
  n = n + 0.&lt;br /&gt;
Proof.&lt;br /&gt;
  intros n. destruct n as [| n&amp;#039;].&lt;br /&gt;
  - (* n = 0 *)&lt;br /&gt;
    reflexivity. (* Hasta aquí todo bien ... *)&lt;br /&gt;
  - (* n = S n&amp;#039; *)&lt;br /&gt;
    simpl.       (* ... pero otra vez no hacemos nada *)&lt;br /&gt;
Abort.&lt;br /&gt;
&lt;br /&gt;
(* Ejemplo prueba por inducción de n = n + 0. *)&lt;br /&gt;
Theorem plus_n_O : forall n:nat, n = n + 0.&lt;br /&gt;
Proof.&lt;br /&gt;
  intros n. induction n as [| n&amp;#039; IHn&amp;#039;].&lt;br /&gt;
  - (* n = 0 *)    reflexivity.&lt;br /&gt;
  - (* n = S n&amp;#039; *) simpl. rewrite &amp;lt;- IHn&amp;#039;. reflexivity.  Qed.&lt;br /&gt;
&lt;br /&gt;
(* Ejemplo prueba por inducción de (minus n n = 0). *)&lt;br /&gt;
Theorem minus_diag : forall n,&lt;br /&gt;
  minus n n = 0.&lt;br /&gt;
Proof.&lt;br /&gt;
  intros n. induction n as [| n&amp;#039; IHn&amp;#039;].&lt;br /&gt;
  - (* n = 0 *)&lt;br /&gt;
    simpl. reflexivity.&lt;br /&gt;
  - (* n = S n&amp;#039; *)&lt;br /&gt;
    simpl. rewrite -&amp;gt; IHn&amp;#039;. reflexivity.  Qed.&lt;br /&gt;
&lt;br /&gt;
(* ---------------------------------------------------------------------&lt;br /&gt;
   Ejercicio 1.1. Demostrar que &lt;br /&gt;
      forall n:nat, n * 0 = 0.&lt;br /&gt;
   ------------------------------------------------------------------ *)&lt;br /&gt;
&lt;br /&gt;
Theorem mult_0_r : forall n:nat,&lt;br /&gt;
  n * 0 = 0.&lt;br /&gt;
Admitted.&lt;br /&gt;
&lt;br /&gt;
(* ---------------------------------------------------------------------&lt;br /&gt;
   Ejercicio 1.2. Demostrar que &lt;br /&gt;
      forall n m : nat, S (n + m) = n + (S m).&lt;br /&gt;
   ------------------------------------------------------------------ *)&lt;br /&gt;
&lt;br /&gt;
Theorem plus_n_Sm : forall n m : nat,&lt;br /&gt;
  S (n + m) = n + (S m).&lt;br /&gt;
Admitted.&lt;br /&gt;
&lt;br /&gt;
(* ---------------------------------------------------------------------&lt;br /&gt;
   Ejercicio 1.3. Demostrar que &lt;br /&gt;
      forall n m : nat, n + m = m + n.&lt;br /&gt;
   ------------------------------------------------------------------ *)&lt;br /&gt;
&lt;br /&gt;
Theorem plus_comm : forall n m : nat,&lt;br /&gt;
  n + m = m + n.&lt;br /&gt;
Admitted.&lt;br /&gt;
&lt;br /&gt;
(* ---------------------------------------------------------------------&lt;br /&gt;
   Ejercicio 1.4. Demostrar que &lt;br /&gt;
      forall n m p : nat, n + (m + p) = (n + m) + p.&lt;br /&gt;
   ------------------------------------------------------------------ *)&lt;br /&gt;
&lt;br /&gt;
Theorem plus_assoc : forall n m p : nat,&lt;br /&gt;
  n + (m + p) = (n + m) + p.&lt;br /&gt;
Admitted.&lt;br /&gt;
&lt;br /&gt;
(* ---------------------------------------------------------------------&lt;br /&gt;
   Ejercicio 2. Se considera la siguiente función que dobla su argumento. &lt;br /&gt;
      Fixpoint double (n:nat) :=&lt;br /&gt;
        match n with&lt;br /&gt;
        | O =&amp;gt; O&lt;br /&gt;
        | S n&amp;#039; =&amp;gt; S (S (double n&amp;#039;))&lt;br /&gt;
        end.&lt;br /&gt;
&lt;br /&gt;
   Demostrar que &lt;br /&gt;
      forall n, double n = n + n. &lt;br /&gt;
   ------------------------------------------------------------------ *)&lt;br /&gt;
&lt;br /&gt;
Fixpoint double (n:nat) :=&lt;br /&gt;
  match n with&lt;br /&gt;
  | O =&amp;gt; O&lt;br /&gt;
  | S n&amp;#039; =&amp;gt; S (S (double n&amp;#039;))&lt;br /&gt;
  end.&lt;br /&gt;
&lt;br /&gt;
Lemma double_plus : forall n, double n = n + n .&lt;br /&gt;
Admitted.&lt;br /&gt;
&lt;br /&gt;
(* ---------------------------------------------------------------------&lt;br /&gt;
   Ejercicio 3. Demostrar que&lt;br /&gt;
       forall n : nat, evenb (S n) = negb (evenb n).&lt;br /&gt;
   ------------------------------------------------------------------ *)&lt;br /&gt;
&lt;br /&gt;
Theorem evenb_S : forall n : nat,&lt;br /&gt;
  evenb (S n) = negb (evenb n).&lt;br /&gt;
Admitted.&lt;br /&gt;
&lt;br /&gt;
(* ---------------------------------------------------------------------&lt;br /&gt;
   Ejercicio 4. Explicar la diferencia entre las tácticas destruct e&lt;br /&gt;
   induction. &lt;br /&gt;
   ------------------------------------------------------------------ *)&lt;br /&gt;
&lt;br /&gt;
(* La diferencia es que en la induct siempre tienes una hipótesis, a la&lt;br /&gt;
   que llamas hipótesis de inducción, así como dos únicos casos (el caso&lt;br /&gt;
   del elemento más simple y suponiendo que se cumple para n el de&lt;br /&gt;
   n+1). &lt;br /&gt;
&lt;br /&gt;
   En cambio, en destruct puedes tener mayor número de casos y no &lt;br /&gt;
   suponer una hipótesis.  *)&lt;br /&gt;
&lt;br /&gt;
(* =====================================================================&lt;br /&gt;
   § Lemas locales &lt;br /&gt;
   ================================================================== *)&lt;br /&gt;
&lt;br /&gt;
(* Ejemplo de teorema con lema local usando assert. *)&lt;br /&gt;
Theorem mult_0_plus&amp;#039; : forall n m : nat,&lt;br /&gt;
  (0 + n) * m = n * m.&lt;br /&gt;
Proof.&lt;br /&gt;
  intros n m.&lt;br /&gt;
  assert (H: 0 + n = n). { reflexivity. }&lt;br /&gt;
  rewrite -&amp;gt; H.&lt;br /&gt;
  reflexivity.&lt;br /&gt;
Qed.&lt;br /&gt;
&lt;br /&gt;
(* Otro ejemplo de teorema con lema local usando assert. &lt;br /&gt;
   Primero, la prueba si assert es *) &lt;br /&gt;
Theorem plus_rearrange_firsttry : forall n m p q : nat,&lt;br /&gt;
  (n + m) + (p + q) = (m + n) + (p + q).&lt;br /&gt;
Proof.&lt;br /&gt;
  intros n m p q.&lt;br /&gt;
  rewrite -&amp;gt; plus_comm.&lt;br /&gt;
Abort.&lt;br /&gt;
&lt;br /&gt;
(* En cambio usando assert *)&lt;br /&gt;
Theorem plus_rearrange : forall n m p q : nat,&lt;br /&gt;
  (n + m) + (p + q) = (m + n) + (p + q).&lt;br /&gt;
Proof.&lt;br /&gt;
  intros n m p q.&lt;br /&gt;
  assert (H: n + m = m + n).&lt;br /&gt;
  { rewrite -&amp;gt; plus_comm. reflexivity. }&lt;br /&gt;
  rewrite -&amp;gt; H. reflexivity.  Qed.&lt;br /&gt;
&lt;br /&gt;
(* =====================================================================&lt;br /&gt;
   § Pruebas formales vs pruebas informales&lt;br /&gt;
   ================================================================== *)&lt;br /&gt;
&lt;br /&gt;
(* &amp;quot;_Informal proofs are algorithms; formal proofs are code_.&amp;quot; *)&lt;br /&gt;
&lt;br /&gt;
(* Ejemplos de pruebas formales en Coq *)&lt;br /&gt;
Theorem plus_assoc&amp;#039; : forall n m p : nat,&lt;br /&gt;
  n + (m + p) = (n + m) + p.&lt;br /&gt;
Proof.&lt;br /&gt;
  intros n m p. induction n as [| n&amp;#039; IHn&amp;#039;]. reflexivity.&lt;br /&gt;
  simpl. rewrite -&amp;gt; IHn&amp;#039;. reflexivity.&lt;br /&gt;
Qed.&lt;br /&gt;
&lt;br /&gt;
Theorem plus_assoc&amp;#039;&amp;#039; : forall n m p : nat,&lt;br /&gt;
  n + (m + p) = (n + m) + p.&lt;br /&gt;
Proof.&lt;br /&gt;
  intros n m p. induction n as [| n&amp;#039; IHn&amp;#039;].&lt;br /&gt;
  - (* n = 0 *)&lt;br /&gt;
    reflexivity.&lt;br /&gt;
  - (* n = S n&amp;#039; *)&lt;br /&gt;
    simpl. rewrite -&amp;gt; IHn&amp;#039;. reflexivity.&lt;br /&gt;
Qed.&lt;br /&gt;
&lt;br /&gt;
(* Ejemplo prueba informal &lt;br /&gt;
&lt;br /&gt;
   Theorem_: For any [n], [m] and [p],&lt;br /&gt;
      n + (m + p) = (n + m) + p.&lt;br /&gt;
&lt;br /&gt;
   Proof: By induction on [n].&lt;br /&gt;
    - First, suppose [n = 0].  We must show&lt;br /&gt;
         0 + (m + p) = (0 + m) + p.&lt;br /&gt;
      This follows directly from the definition of [+].&lt;br /&gt;
&lt;br /&gt;
    - Next, suppose [n = S n&amp;#039;], where&lt;br /&gt;
         n&amp;#039; + (m + p) = (n&amp;#039; + m) + p.&lt;br /&gt;
      We must show&lt;br /&gt;
         (S n&amp;#039;) + (m + p) = ((S n&amp;#039;) + m) + p.&lt;br /&gt;
&lt;br /&gt;
      By the definition of [+], this follows from&lt;br /&gt;
         S (n&amp;#039; + (m + p)) = S ((n&amp;#039; + m) + p),&lt;br /&gt;
      which is immediate from the induction hypothesis.  &lt;br /&gt;
&lt;br /&gt;
    Qed. *)&lt;br /&gt;
&lt;br /&gt;
(* ---------------------------------------------------------------------&lt;br /&gt;
   Ejercicio 5. Escribir una prueba informal de que la suma es&lt;br /&gt;
   conmutativa. &lt;br /&gt;
   ------------------------------------------------------------------ *)&lt;br /&gt;
&lt;br /&gt;
(* ---------------------------------------------------------------------&lt;br /&gt;
   Ejercicio 6. Escribir prueba informal de&lt;br /&gt;
      forall n:nat, true = beq_nat n n.&lt;br /&gt;
   ------------------------------------------------------------------ *)&lt;br /&gt;
&lt;br /&gt;
(* =====================================================================&lt;br /&gt;
   § Ejercicios complementarios &lt;br /&gt;
   ================================================================== *)&lt;br /&gt;
&lt;br /&gt;
(* ---------------------------------------------------------------------&lt;br /&gt;
   Ejercicio 7. Demostrar, usando assert pero no induct,&lt;br /&gt;
      forall n m p : nat, n + (m + p) = m + (n + p).&lt;br /&gt;
   ------------------------------------------------------------------ *)&lt;br /&gt;
&lt;br /&gt;
Theorem plus_swap : forall n m p : nat,&lt;br /&gt;
  n + (m + p) = m + (n + p).&lt;br /&gt;
Admitted.&lt;br /&gt;
&lt;br /&gt;
(* ---------------------------------------------------------------------&lt;br /&gt;
   Ejercicio 8. Demostrar que la multiplicación es conmutativa.&lt;br /&gt;
   ------------------------------------------------------------------ *)&lt;br /&gt;
&lt;br /&gt;
Theorem mult_comm : forall m n : nat,&lt;br /&gt;
  m * n = n * m.&lt;br /&gt;
Admitted.&lt;br /&gt;
&lt;br /&gt;
(* ---------------------------------------------------------------------&lt;br /&gt;
   Ejercicio 9.1. Demostrar que &lt;br /&gt;
      forall n:nat, true = leb n n.  &lt;br /&gt;
   ------------------------------------------------------------------ *)&lt;br /&gt;
&lt;br /&gt;
Theorem leb_refl : forall n:nat,&lt;br /&gt;
  true = leb n n.&lt;br /&gt;
Admitted.&lt;br /&gt;
&lt;br /&gt;
(* ---------------------------------------------------------------------&lt;br /&gt;
   Ejercicio 9.2. Demostrar que &lt;br /&gt;
      forall n:nat, beq_nat 0 (S n) = false. &lt;br /&gt;
   ------------------------------------------------------------------ *)&lt;br /&gt;
&lt;br /&gt;
Theorem zero_nbeq_S : forall n:nat,&lt;br /&gt;
  beq_nat 0 (S n) = false.&lt;br /&gt;
Admitted.&lt;br /&gt;
&lt;br /&gt;
(* ---------------------------------------------------------------------&lt;br /&gt;
   Ejercicio 9.3. Demostrar que &lt;br /&gt;
      forall b : bool, andb b false = false.&lt;br /&gt;
   ------------------------------------------------------------------ *)&lt;br /&gt;
&lt;br /&gt;
Theorem andb_false_r : forall b : bool,&lt;br /&gt;
  andb b false = false.&lt;br /&gt;
Admitted.&lt;br /&gt;
&lt;br /&gt;
(* ---------------------------------------------------------------------&lt;br /&gt;
   Ejercicio 9.4. Demostrar que &lt;br /&gt;
      forall n m p : nat, leb n m = true -&amp;gt; leb (p + n) (p + m) = true.&lt;br /&gt;
   ------------------------------------------------------------------ *)&lt;br /&gt;
&lt;br /&gt;
Theorem plus_ble_compat_l : forall n m p : nat,&lt;br /&gt;
  leb n m = true -&amp;gt; leb (p + n) (p + m) = true.&lt;br /&gt;
Admitted.&lt;br /&gt;
&lt;br /&gt;
(* ---------------------------------------------------------------------&lt;br /&gt;
   Ejercicio 9.5. Demostrar que &lt;br /&gt;
      forall n:nat, beq_nat (S n) 0 = false.&lt;br /&gt;
   ------------------------------------------------------------------ *)&lt;br /&gt;
&lt;br /&gt;
Theorem S_nbeq_0 : forall n:nat,&lt;br /&gt;
  beq_nat (S n) 0 = false.&lt;br /&gt;
Admitted.&lt;br /&gt;
&lt;br /&gt;
(* ---------------------------------------------------------------------&lt;br /&gt;
   Ejercicio 9.6. Demostrar que &lt;br /&gt;
       forall n:nat, 1 * n = n.&lt;br /&gt;
   ------------------------------------------------------------------ *)&lt;br /&gt;
&lt;br /&gt;
Theorem mult_1_l : forall n:nat, 1 * n = n.&lt;br /&gt;
Admitted.&lt;br /&gt;
&lt;br /&gt;
(* ---------------------------------------------------------------------&lt;br /&gt;
   Ejercicio 9.7. Demostrar que &lt;br /&gt;
       forall b c : bool, orb (andb b c)&lt;br /&gt;
                              (orb (negb b)&lt;br /&gt;
                                   (negb c))&lt;br /&gt;
                          = true.&lt;br /&gt;
   ------------------------------------------------------------------ *)&lt;br /&gt;
&lt;br /&gt;
Theorem all3_spec : forall b c : bool,&lt;br /&gt;
    orb&lt;br /&gt;
      (andb b c)&lt;br /&gt;
      (orb (negb b)&lt;br /&gt;
           (negb c))&lt;br /&gt;
    = true.&lt;br /&gt;
Admitted.&lt;br /&gt;
&lt;br /&gt;
(* ---------------------------------------------------------------------&lt;br /&gt;
   Ejercicio 9.8. Demostrar que &lt;br /&gt;
      forall n m p : nat, (n + m) * p = (n * p) + (m * p).&lt;br /&gt;
   ------------------------------------------------------------------ *)&lt;br /&gt;
&lt;br /&gt;
Theorem mult_plus_distr_r : forall n m p : nat,&lt;br /&gt;
  (n + m) * p = (n * p) + (m * p).&lt;br /&gt;
Admitted.&lt;br /&gt;
&lt;br /&gt;
(* ---------------------------------------------------------------------&lt;br /&gt;
   Ejercicio 9.9. Demostrar que &lt;br /&gt;
      forall n m p : nat, n * (m * p) = (n * m) * p.&lt;br /&gt;
   ------------------------------------------------------------------ *)&lt;br /&gt;
&lt;br /&gt;
Theorem mult_assoc : forall n m p : nat,&lt;br /&gt;
  n * (m * p) = (n * m) * p.&lt;br /&gt;
Admitted.&lt;br /&gt;
&lt;br /&gt;
(* ---------------------------------------------------------------------&lt;br /&gt;
   Ejercicio 10. Demostrar que&lt;br /&gt;
       forall n : nat, true = beq_nat n n.&lt;br /&gt;
   ------------------------------------------------------------------ *)&lt;br /&gt;
&lt;br /&gt;
Theorem beq_nat_refl : forall n : nat,&lt;br /&gt;
  true = beq_nat n n.&lt;br /&gt;
Admitted.&lt;br /&gt;
&lt;br /&gt;
(* ---------------------------------------------------------------------&lt;br /&gt;
   Ejercicio 11. La táctica replace permite especificar el subtérmino&lt;br /&gt;
   que se desea reescribir y su sustituto: [replace (t) with (u)]&lt;br /&gt;
   sustituye todas las copias de la expresión t en el objetivo por la&lt;br /&gt;
   expresión u y añade la ecuación (t = u) como un nuevo subojetivo. &lt;br /&gt;
 &lt;br /&gt;
   El uso de la táctica replace es especialmente útil cuando la táctica &lt;br /&gt;
   rewrite actúa sobre una parte del objetivo que no es la que se desea. &lt;br /&gt;
&lt;br /&gt;
   Demostrar, usando la táctica replace y sin usar &lt;br /&gt;
   [assert (n + m = m + n)], que&lt;br /&gt;
      forall n m p : nat, n + (m + p) = m + (n + p).&lt;br /&gt;
   ------------------------------------------------------------------ *)&lt;br /&gt;
&lt;br /&gt;
Theorem plus_swap&amp;#039; : forall n m p : nat,&lt;br /&gt;
  n + (m + p) = m + (n + p).&lt;br /&gt;
Admitted.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jalonso</name></author>
		
	</entry>
</feed>