# Formal logic proof of absolute value formula

I've been trying to prove this for a long time now, anyone willing to offer some help or get me pointed in the right direction?

$(x>0 \implies z = x) \wedge (x < 0 \implies z = -x) \implies z \ge 0$

-

Re-tagged as "logic" instead of "higher-order-logic", as this is  first-order logic. – Alex Becker Mar 21 '11 at 0:13

## 2 Answers

Hint: What happens if x = 0? Does that say anything about z?

-

As Robert's answer indicates, the statement is false. However, changing the first $>$ to $\geq$ gives a true statement which I would use a proof by contradiction, that is assume $z < 0$ and $(x \geq 0 \implies z = x) \wedge (x < 0 \implies z = -x)$ and derive a contradiction. This can be done as follows:

$(z < 0) \wedge ((x>0 \implies z = x) \wedge (x < 0 \implies z = -x))$ $\implies (((x \geq 0 \implies z = x) \wedge z < 0) \wedge ((x < 0 \implies z = -x) \wedge z < 0))$ $\implies ((x \geq 0 \implies x < 0) \wedge (x < 0 \implies -x < 0))$ $\implies ((F \wedge (x < 0 \implies -x < 0)) \vee ((x \geq 0 \implies x < 0) \wedge F))$ $\implies (F \vee F)$ $\implies F$ $\therefore \neg((z < 0) \wedge ((x \geq 0 \implies z = x) \wedge (x < 0 \implies z = -x)))$ $\therefore (x \geq 0 \implies z = x) \wedge (x < 0 \implies z = -x) \implies z \ge 0$

-

As @Robert's answer indicates, the statement is actually false, since $x$ need not be either $<0$ or $>0$; it could be $0$ (if it's implicitly assumed to be a real number; else it could also be $2+3\mathrm{i}$ or something else entirely). It follows that this proof must be flawed. The error is in replacing $(x>0\implies x<0)$ by $F$, since this implication is actually true if $x>0$ is false. – joriki Mar 24 '11 at 6:13
@Joriki: Thanks, I missed that. Fixed. – Alex Becker Mar 24 '11 at 6:36
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 21, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9447028040885925, "perplexity_flag": "head"}