author | wenzelm |
Tue, 22 Jul 2025 12:02:53 +0200 | |
changeset 82894 | a8e47bd31965 |
parent 81182 | fc5066122e68 |
permissions | -rw-r--r-- |
42151 | 1 |
(* Title: HOL/HOLCF/ex/Letrec.thy |
35932 | 2 |
Author: Brian Huffman |
3 |
*) |
|
4 |
||
62175 | 5 |
section \<open>Recursive let bindings\<close> |
35932 | 6 |
|
7 |
theory Letrec |
|
8 |
imports HOLCF |
|
9 |
begin |
|
10 |
||
11 |
definition |
|
45788
9049b24959de
HOLCF/ex/Letrec.thy: keep class 'domain' as default sort
huffman
parents:
42151
diff
changeset
|
12 |
CLetrec :: "('a::pcpo \<rightarrow> 'a \<times> 'b::pcpo) \<rightarrow> 'b" where |
35932 | 13 |
"CLetrec = (\<Lambda> F. snd (F\<cdot>(\<mu> x. fst (F\<cdot>x))))" |
14 |
||
41229
d797baa3d57c
replaced command 'nonterminals' by slightly modernized version 'nonterminal';
wenzelm
parents:
40774
diff
changeset
|
15 |
nonterminal recbinds and recbindt and recbind |
35932 | 16 |
|
17 |
syntax |
|
81095 | 18 |
"_recbind" :: "[logic, logic] \<Rightarrow> recbind" (\<open>(\<open>indent=2 notation=\<open>mixfix Letrec binding\<close>\<close>_ =/ _)\<close> 10) |
80914
d97fdabd9e2b
standardize mixfix annotations via "isabelle update -a -u mixfix_cartouches" --- to simplify systematic editing;
wenzelm
parents:
80768
diff
changeset
|
19 |
"" :: "recbind \<Rightarrow> recbindt" (\<open>_\<close>) |
d97fdabd9e2b
standardize mixfix annotations via "isabelle update -a -u mixfix_cartouches" --- to simplify systematic editing;
wenzelm
parents:
80768
diff
changeset
|
20 |
"_recbindt" :: "[recbind, recbindt] \<Rightarrow> recbindt" (\<open>_,/ _\<close>) |
d97fdabd9e2b
standardize mixfix annotations via "isabelle update -a -u mixfix_cartouches" --- to simplify systematic editing;
wenzelm
parents:
80768
diff
changeset
|
21 |
"" :: "recbindt \<Rightarrow> recbinds" (\<open>_\<close>) |
d97fdabd9e2b
standardize mixfix annotations via "isabelle update -a -u mixfix_cartouches" --- to simplify systematic editing;
wenzelm
parents:
80768
diff
changeset
|
22 |
"_recbinds" :: "[recbindt, recbinds] \<Rightarrow> recbinds" (\<open>_;/ _\<close>) |
81095 | 23 |
"_Letrec" :: "[recbinds, logic] \<Rightarrow> logic" (\<open>(\<open>notation=\<open>mixfix Letrec expression\<close>\<close>Letrec (_)/ in (_))\<close> 10) |
80768 | 24 |
|
81182 | 25 |
syntax_consts |
26 |
"_Letrec" \<rightleftharpoons> CLetrec |
|
27 |
||
35932 | 28 |
translations |
29 |
(recbindt) "x = a, (y,ys) = (b,bs)" == (recbindt) "(x,y,ys) = (a,b,bs)" |
|
30 |
(recbindt) "x = a, y = b" == (recbindt) "(x,y) = (a,b)" |
|
31 |
||
32 |
translations |
|
33 |
"_Letrec (_recbinds b bs) e" == "_Letrec b (_Letrec bs e)" |
|
34 |
"Letrec xs = a in (e,es)" == "CONST CLetrec\<cdot>(\<Lambda> xs. (a,e,es))" |
|
35 |
"Letrec xs = a in e" == "CONST CLetrec\<cdot>(\<Lambda> xs. (a,e))" |
|
36 |
||
37 |
end |