Skip to Content.
Sympa Menu

coq-club - RE: [Coq-Club] Why is the signature of sqrt R->R ?

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

RE: [Coq-Club] Why is the signature of sqrt R->R ?


Chronological Thread 
  • From: "Soegtrop, Michael" <michael.soegtrop AT intel.com>
  • To: "coq-club AT inria.fr" <coq-club AT inria.fr>
  • Subject: RE: [Coq-Club] Why is the signature of sqrt R->R ?
  • Date: Fri, 1 Feb 2019 09:37:47 +0000
  • Accept-language: de-DE, en-US
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=michael.soegtrop AT intel.com; spf=Pass smtp.mailfrom=michael.soegtrop AT intel.com; spf=None smtp.helo=postmaster AT mga11.intel.com
  • Dlp-product: dlpe-windows
  • Dlp-reaction: no-action
  • Dlp-version: 11.0.400.15
  • Ironport-phdr: 9a23:JoCklRAoqBL2xLSjEshtUyQJP3N1i/DPJgcQr6AfoPdwSPT/p8bcNUDSrc9gkEXOFd2Cra4c26yO6+jJYi8p2d65qncMcZhBBVcuqP49uEgeOvODElDxN/XwbiY3T4xoXV5h+GynYwAOQJ6tL1LdrWev4jEMBx7xKRR6JvjvGo7Vks+7y/2+94fcbglUhzexe69+IAmrpgjNq8cahpdvJLwswRXTuHtIfOpWxWJsJV2Nmhv3+9m98p1+/SlOovwt78FPX7n0cKQ+VrxYES8pM3sp683xtBnMVhWA630BWWgLiBVIAgzF7BbnXpfttybxq+Rw1DWGMcDwULs5Xymp4aV2Rx/ykCoJNyA3/nzLisJ+j6xbrhCupx1jzIHbe4yaLuZyc6fHcN8GWWZMXMBcXDFBDIOmaIsPCvIMMehFoYn6uVQOoge+BROrBOP30jNDm3j43awm3OQhCw7JwgggE9wTu3nTqdX1NbsdUeCvw6bWyTXPdehW2TDj54jHbhAhu/aMXaprfMrQz0kvCx3KjlGKpYP5ODOV0/0Avm6G5ORuUuKvjnQoqwB3ojW3x8csjJXJiZwRylze6Cp23oA4LsC7Rk5jedOoDZ9duz+AO4Z2Qs4uWWFltDggxrACt5O3ZDUGxZUpyhLFZfGKfZKE7gztWeuVOzt0mXFodKynixqv8EWtzvfwWte03VtFtCZJjMPAu3EN2hHV98OJUOFy/l271jaKzw3T6v9LIUQzlafDLp4hzaQ/mocOvUjZHy/2nln2g7GSdkk+5ueo7OHnbq3npp+aKYB0lhnzPrkql8ChG+g1MggDU3Kb9OiizrHu+UP0TK1PjvIsk6nZtJ7aJd4cpq68GwJV14cj5Aq/Dzi8ztsYmWMLLElCeB2ZgIjpJ0vOIPfgDfqkglSslitryO7CPrH7HprNKX3DnK/7fblh805c1BYzzddH6p1IDbEBOev/VVP1tNzFFRA0KBe0wubiCNVlzIwSQ2OPAqmDMKPTq1CE/OwvI/PfLLMS7Xz2LOFg7Przh1c4n0UcdO+nx9FfPHu/B7FtJ1iTSXvqmNYIV2kQ6FkQVuvv3Re5VjNce2y1R+Z0wzAwCIurCc2LEoWsi7yI0SP9BZpbaXxcDUikEHH0eoHCUPAJPnHBavR9myAJAODyA7Qq0guj4VejmuhXa9HM8yhdjqrNkd185undjxY3rGUmDsKB3mXLRGZxzDpRG20GmZtnqEk48W+tlLBiiqUBR91V+/5NFAw9MMyElrEoO5XJQgvEO+yxZhOmT9GhWG5jS904moZIYkBhFtHkhRfGjXKn

Dear Joseph,

 

thanks for the detailed explanation of the design considerations!

 

So in short the story is that all real functions with domain restrictions are extended to total functions over the complete R by returning some value which is convenient in most situations. E.g. for asin I could return –PI/2 or PI/2 for out of domain arguments, so that I can prove that the function is everywhere continuous and that the result of asin is limited to –PI/2 to PI/2 without requiring domain restrictions. And when it comes to proving that my definition of asin has a certain taylor expansion or derivative, I limit the argument range of asin to –1 … 1. Or alternatively I could return 1/0 for out of range asin, which possibly would allow me to prove that the derivative of asin x equals 1/sqrt(1-x^2) everywhere, but then I would need a domain restriction for the lemma which shows that asin x is bounded.

This design leads to that one can prove:

 

Require Import Reals.

Require Import Psatz.

Open Scope R_scope.

 

Lemma sqrt_minus_one_is_zero: sqrt (-1) = 0.

Proof.

  unfold sqrt.

  destruct (Rcase_abs (-1)) as [H|H].

  - reflexivity.

  - contradict H; lra.

Qed.

 

I am not sure if I like that one can prove sqrt(-1) = 0, even if this does not lead to a prove of that x=0 solves x²=-1. It is an interesting system – a bit weird, but I guess one gets used to it over time. As I said, in practice the reals as defined in Coq are very convenient to use and I understand that one has to pay some price for that (like sqrt(-1)=0).

 

Best regards,

 

Michael

 

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928




Archive powered by MHonArc 2.6.18.

Top of Page