Program transformation using partial functions which preserve partial correctness

Much work has been done demonstrating that certain program transformations preserve particular properties. That is, for any program $P$ which has property $\alpha$, show that $P$ transformed under transformation $T$ still has property $\alpha$.

I'm interested in a transformation which replaces every usage of function $f$ in $P$ with partial function $g$, where $g$ is a restriction of $f$ (meaning that $g(x) = y \implies f(x) = y$). It seems intuitively obvious that this transformation, while not necessarily preserving totatlity, preserves partial correctness. Yet I cannot find a standard proof or reference on this or even mention of this seemingly elemental fact.

Can anyone help me out? A reference, a proof, a different formalism?

1 Answer

I imagine that you can prove this straight from the operational semantics using the standard operational precongruence (assuming that you have a sequential language). Some of the relevant techniques have been collected in Operationally-based theories of program equivalence by Andy Pitts.

If you have a Hoare logic of partial correctness for the language you are interested in, you can probably establish a meta-theorem to the effect that for all programs $M$, all models $\xi, \xi'$ such that $\xi$ is less defined than $\xi'$, and all formulae $A, B$, we have $\xi \models \{A\} M \{B\}$ implies $\xi' \models\{A\} M \{B\}$. Proving such a meta-theorem typically boils down to the operational reasoning mentioned above.

Such questions come up all the time in proving observational and descriptive completeness of Hoare logics. As Neel points out in an answer to your other question, domain theory is based upon related ideas.
{"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": 1, "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, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.923439621925354, "perplexity": 412.4092229857294}, "config": {"markdown_headings": false, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": false}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2019-47/segments/1573496671411.14/warc/CC-MAIN-20191122171140-20191122200140-00052.warc.gz"}