Discussion of Homotopy Type Theory and Univalent Foundations
 help / color / mirror / Atom feed
From: "José Manuel Rodriguez Caballero" <josephcmac@gmail.com>
To: HomotopyTypeTheory@googlegroups.com
Subject: Re: [HoTT] The best proof assistant for HoTT from the point of view of automation
Date: Mon, 7 Jan 2019 20:54:48 -0500	[thread overview]
Message-ID: <CAA8xVUjH=QYejBAFF-F1Ly0QdVUPaon6fdcUypSmURDXFFZfpg@mail.gmail.com> (raw)
In-Reply-To: <9343db17-0282-4a4f-8701-8363317f2f8d@googlegroups.com>

[-- Attachment #1: Type: text/plain, Size: 4488 bytes --]

>
> Juan wrote:
> A trivial example of Hott with Lean...


In my case, I learned UniMath just from Voevodsky's video lectures at
Oxford (I was not there): Point 9 in this link:
https://www.math.ias.edu/vladimir/Lectures

I am interested to get back to HoTT, after some time focused in
Isabelle/HOL, just for pleasure (my serious job is with Isabelle/HOL). What
I love of HoTT is the idea of thinking in a topological way about
non-topological problems: this is like a video-game for me, not a project,
it is something just for fun. Here is an example of one of my theorems in
UniMath (a greedy generalization of Euclidean division). As you can see,
automation is almost zero in my program. I guess that it will be shorted in
Lean or in Coq (using the HoTT library).

[Another motivation is that I have the intuition that HoTT is related to
the combinatorics of finite fields via the Weil Conjectures, but I need
more experience before to formalize this intuition, e.g., given a type, we
can express its topological invariants as the number of points on a variety
over a finite field and the correspondence is "natural". This may be
non-sense.]

Unset Automatic Introduction.

(** *** Imports *)

Require Import UniMath.Foundations.NaturalNumbers.

Require Import UniMath.Foundations.PartA.

Definition Increasing := fun (f : nat -> nat) => forall n : nat, f n ≤ f (S
n).

Lemma powerMonotonic : forall f : nat -> nat, Increasing f -> ( forall n k
: nat, f n ≤ f (n + k) ).
Proof.
  intros.
  intros.
  induction k.
  rewrite natplusr0.
  apply (natlehmplusnm 0 (f n) ).
  change (S k) with (1 + k).
  rewrite (natpluscomm 1 k).
  rewrite <- (natplusassoc n k 1).
  unfold Increasing in X.
  specialize (X (n + k)).
  change (S (n + k)) with (1 + (n + k)) in X.
  rewrite ( natpluscomm 1 (n + k) ) in X.
  apply (istransnatleh IHk X).
Defined.

Definition SIncreasing := fun (f : nat -> nat) => forall n : nat, f n < f
(S n).

Lemma SpowerMonotonic : forall f : nat -> nat, SIncreasing f -> ( forall n
k : nat, f n < f (n + k + 1) ).
Proof.
  intros.
  intros.
  induction k.
  rewrite natplusr0.
  rewrite -> (natpluscomm n 1).
  change (1 + n) with (S n).
  unfold SIncreasing in X.
  specialize (X n).
  apply X.
  change (S k) with (1 + k).
  rewrite (natpluscomm 1 k).
  rewrite <- (natplusassoc n k 1).
  unfold SIncreasing in X.
  specialize (X (n + k + 1)).
  rewrite -> (natpluscomm (n + k) 1) in X.
  change (S (1 + (n + k))) with (1 + (1 + (n + k)))  in X.
  rewrite <-( natplusassoc 1 1 (n + k) ) in X.
  rewrite -> ( natpluscomm (1 + 1) (n + k) ) in X.
  rewrite -> ( natplusassoc n k (1 + 1) ) in X.
  rewrite -> ( natplusassoc (n + k) 1 1 ).
  rewrite -> ( natpluscomm (n + k) 1 ) in IHk.
  assert (T :=  istransnatlth (f n) (f (1 + (n + k))) (f (n + (k + (1 +
1)))) ).
  rewrite -> ( natplusassoc n k (1 + 1) ).
  apply T.
  apply IHk.
  apply X.
Defined.

Lemma SpowerLargerThanN : forall f : nat -> nat, SIncreasing f -> ( forall
n : nat, (f 0) + n ≤ f n ).
Proof.
  induction n.
  rewrite (natplusr0 (f 0)).
  apply (natlehmplusnm 0).
  rewrite <- ( plus_n_Sm (f 0) n).
  apply (natlehandplusl (f 0 + n) (f n) 1 ) in IHn.
  change (1 + (f 0 + n)) with (S (f 0 + n)) in IHn.
  change (1 + f n) with (S (f n)) in IHn.
unfold SIncreasing in X.
specialize (X n).
apply (natlthtolehsn) in X.
apply ( istransnatleh IHn X ).
Defined.

Definition EuclidF := fun (f : nat -> nat) (x : dirprod nat nat) => (f (pr1
x)) + (pr2 x).

Definition GreedyEuclid (f : nat -> nat) (isSIncreasing : SIncreasing f) (n
: nat) : dirprod nat nat.
Proof.
intros.
induction n as [ | n x].
- intros.
  apply (dirprodpair (f 0) 0).
- induction (natlthorgeh ((f (pr1 x)) + S (pr2 x)) (f (S (pr1 x)))).
+ apply ( dirprodpair (pr1 x) (S (pr2 x)) ).
+ apply ( dirprodpair (S (pr1 x)) (0) ).
Defined.

Lemma GreedyEuclidLem : forall (f : nat -> nat), SIncreasing f -> forall n
: nat,  hfiber (fun (x : dirprod nat nat) => EuclidF f x) ((f 0) + n).
Proof.
  intros.
  unfold hfiber.
  exists (dirprodpair 0 n).
  unfold EuclidF.
  simpl.
  apply idpath.
Defined.

-- 
You received this message because you are subscribed to the Google Groups "Homotopy Type Theory" group.
To unsubscribe from this group and stop receiving emails from it, send an email to HomotopyTypeTheory+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: Type: text/html, Size: 6178 bytes --]

      reply	other threads:[~2019-01-08  1:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-06 16:57 José Manuel Rodriguez Caballero
2019-01-07 17:58 ` Langston Barrett
2019-01-07 20:57   ` Michael Shulman
2019-01-08  1:06 ` Juan Ospina
2019-01-08  1:54   ` José Manuel Rodriguez Caballero [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAA8xVUjH=QYejBAFF-F1Ly0QdVUPaon6fdcUypSmURDXFFZfpg@mail.gmail.com' \
    --to=josephcmac@gmail.com \
    --cc=HomotopyTypeTheory@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).