Commit f0b904bf authored by Raphael Rieu-Helft's avatar Raphael Rieu-Helft

Add meta rewrite_def declarations programmatically during reflection

parent 97f52506
...@@ -257,7 +257,7 @@ ...@@ -257,7 +257,7 @@
<goal name="VC add_limbs.14.0.0" expl="assertion" proved="true"> <goal name="VC add_limbs.14.0.0" expl="assertion" proved="true">
<transf name="reflection_f" proved="true" arg1="mp_decision"> <transf name="reflection_f" proved="true" arg1="mp_decision">
<goal name="VC add_limbs.14.0.0.0" expl="assertion" proved="true"> <goal name="VC add_limbs.14.0.0.0" expl="assertion" proved="true">
<proof prover="0"><result status="valid" time="0.39"/></proof> <proof prover="0"><result status="valid" time="0.22"/></proof>
</goal> </goal>
<goal name="VC add_limbs.14.0.0.1" proved="true"> <goal name="VC add_limbs.14.0.0.1" proved="true">
<proof prover="3"><result status="valid" time="0.23"/></proof> <proof prover="3"><result status="valid" time="0.23"/></proof>
...@@ -539,7 +539,7 @@ ...@@ -539,7 +539,7 @@
<goal name="VC add.55.0.0" expl="assertion" proved="true"> <goal name="VC add.55.0.0" expl="assertion" proved="true">
<transf name="reflection_f" proved="true" arg1="mp_decision"> <transf name="reflection_f" proved="true" arg1="mp_decision">
<goal name="VC add.55.0.0.0" expl="assertion" proved="true"> <goal name="VC add.55.0.0.0" expl="assertion" proved="true">
<proof prover="0"><result status="valid" time="0.24"/></proof> <proof prover="0"><result status="valid" time="0.43"/></proof>
</goal> </goal>
<goal name="VC add.55.0.0.1" proved="true"> <goal name="VC add.55.0.0.1" proved="true">
<proof prover="3"><result status="valid" time="0.19"/></proof> <proof prover="3"><result status="valid" time="0.19"/></proof>
...@@ -621,7 +621,7 @@ ...@@ -621,7 +621,7 @@
<goal name="VC add.74.0.0" expl="assertion" proved="true"> <goal name="VC add.74.0.0" expl="assertion" proved="true">
<transf name="reflection_f" proved="true" arg1="mp_decision"> <transf name="reflection_f" proved="true" arg1="mp_decision">
<goal name="VC add.74.0.0.0" expl="assertion" proved="true"> <goal name="VC add.74.0.0.0" expl="assertion" proved="true">
<proof prover="0"><result status="valid" time="0.22"/></proof> <proof prover="0"><result status="valid" time="0.42"/></proof>
</goal> </goal>
<goal name="VC add.74.0.0.1" proved="true"> <goal name="VC add.74.0.0.1" proved="true">
<proof prover="3"><result status="valid" time="0.30"/></proof> <proof prover="3"><result status="valid" time="0.30"/></proof>
...@@ -738,7 +738,7 @@ ...@@ -738,7 +738,7 @@
<goal name="VC add_in_place.17.0.0" expl="assertion" proved="true"> <goal name="VC add_in_place.17.0.0" expl="assertion" proved="true">
<transf name="reflection_f" proved="true" arg1="mp_decision"> <transf name="reflection_f" proved="true" arg1="mp_decision">
<goal name="VC add_in_place.17.0.0.0" expl="assertion" proved="true"> <goal name="VC add_in_place.17.0.0.0" expl="assertion" proved="true">
<proof prover="0"><result status="valid" time="0.18"/></proof> <proof prover="0"><result status="valid" time="0.36"/></proof>
</goal> </goal>
<goal name="VC add_in_place.17.0.0.1" proved="true"> <goal name="VC add_in_place.17.0.0.1" proved="true">
<proof prover="3"><result status="valid" time="0.28"/></proof> <proof prover="3"><result status="valid" time="0.28"/></proof>
......
...@@ -5204,7 +5204,7 @@ ...@@ -5204,7 +5204,7 @@
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.157.0.0.0.29" proved="true"> <goal name="VC div_sb_qr.157.0.0.0.29" proved="true">
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.03"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.157.0.0.0.30" proved="true"> <goal name="VC div_sb_qr.157.0.0.0.30" proved="true">
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
...@@ -5306,10 +5306,10 @@ ...@@ -5306,10 +5306,10 @@
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.157.0.0.0.63" proved="true"> <goal name="VC div_sb_qr.157.0.0.0.63" proved="true">
<proof prover="3"><result status="valid" time="0.03"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.157.0.0.0.64" proved="true"> <goal name="VC div_sb_qr.157.0.0.0.64" proved="true">
<proof prover="3"><result status="valid" time="0.03"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.157.0.0.0.65" proved="true"> <goal name="VC div_sb_qr.157.0.0.0.65" proved="true">
<proof prover="3"><result status="valid" time="0.03"/></proof> <proof prover="3"><result status="valid" time="0.03"/></proof>
...@@ -5474,7 +5474,7 @@ ...@@ -5474,7 +5474,7 @@
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.157.0.0.0.119" proved="true"> <goal name="VC div_sb_qr.157.0.0.0.119" proved="true">
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.03"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.157.0.0.0.120" proved="true"> <goal name="VC div_sb_qr.157.0.0.0.120" proved="true">
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
...@@ -5867,7 +5867,7 @@ ...@@ -5867,7 +5867,7 @@
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.163.0.0.0.32" proved="true"> <goal name="VC div_sb_qr.163.0.0.0.32" proved="true">
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.04"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.163.0.0.0.33" proved="true"> <goal name="VC div_sb_qr.163.0.0.0.33" proved="true">
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
...@@ -5939,7 +5939,7 @@ ...@@ -5939,7 +5939,7 @@
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.163.0.0.0.56" proved="true"> <goal name="VC div_sb_qr.163.0.0.0.56" proved="true">
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.04"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.163.0.0.0.57" proved="true"> <goal name="VC div_sb_qr.163.0.0.0.57" proved="true">
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
...@@ -5954,7 +5954,7 @@ ...@@ -5954,7 +5954,7 @@
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.163.0.0.0.61" proved="true"> <goal name="VC div_sb_qr.163.0.0.0.61" proved="true">
<proof prover="3"><result status="valid" time="0.27"/></proof> <proof prover="3"><result status="valid" time="0.22"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.163.0.0.0.62" proved="true"> <goal name="VC div_sb_qr.163.0.0.0.62" proved="true">
<proof prover="3"><result status="valid" time="0.04"/></proof> <proof prover="3"><result status="valid" time="0.04"/></proof>
...@@ -5966,16 +5966,16 @@ ...@@ -5966,16 +5966,16 @@
<proof prover="3"><result status="valid" time="0.04"/></proof> <proof prover="3"><result status="valid" time="0.04"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.163.0.0.0.65" proved="true"> <goal name="VC div_sb_qr.163.0.0.0.65" proved="true">
<proof prover="3"><result status="valid" time="0.04"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.163.0.0.0.66" proved="true"> <goal name="VC div_sb_qr.163.0.0.0.66" proved="true">
<proof prover="3"><result status="valid" time="0.04"/></proof> <proof prover="3"><result status="valid" time="0.04"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.163.0.0.0.67" proved="true"> <goal name="VC div_sb_qr.163.0.0.0.67" proved="true">
<proof prover="3"><result status="valid" time="0.04"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.163.0.0.0.68" proved="true"> <goal name="VC div_sb_qr.163.0.0.0.68" proved="true">
<proof prover="3"><result status="valid" time="0.04"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.163.0.0.0.69" proved="true"> <goal name="VC div_sb_qr.163.0.0.0.69" proved="true">
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
...@@ -6017,7 +6017,7 @@ ...@@ -6017,7 +6017,7 @@
<proof prover="3"><result status="valid" time="0.03"/></proof> <proof prover="3"><result status="valid" time="0.03"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.163.0.0.0.82" proved="true"> <goal name="VC div_sb_qr.163.0.0.0.82" proved="true">
<proof prover="3"><result status="valid" time="0.04"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.163.0.0.0.83" proved="true"> <goal name="VC div_sb_qr.163.0.0.0.83" proved="true">
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
...@@ -6038,7 +6038,7 @@ ...@@ -6038,7 +6038,7 @@
<proof prover="3"><result status="valid" time="0.30"/></proof> <proof prover="3"><result status="valid" time="0.30"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.163.0.0.0.89" proved="true"> <goal name="VC div_sb_qr.163.0.0.0.89" proved="true">
<proof prover="3"><result status="valid" time="0.22"/></proof> <proof prover="3"><result status="valid" time="0.27"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.163.0.0.0.90" proved="true"> <goal name="VC div_sb_qr.163.0.0.0.90" proved="true">
<proof prover="3"><result status="valid" time="0.26"/></proof> <proof prover="3"><result status="valid" time="0.26"/></proof>
...@@ -6137,10 +6137,10 @@ ...@@ -6137,10 +6137,10 @@
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.163.0.0.0.122" proved="true"> <goal name="VC div_sb_qr.163.0.0.0.122" proved="true">
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.04"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.163.0.0.0.123" proved="true"> <goal name="VC div_sb_qr.163.0.0.0.123" proved="true">
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.04"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.163.0.0.0.124" proved="true"> <goal name="VC div_sb_qr.163.0.0.0.124" proved="true">
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
...@@ -7510,10 +7510,10 @@ ...@@ -7510,10 +7510,10 @@
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.239.0.0.0.14" proved="true"> <goal name="VC div_sb_qr.239.0.0.0.14" proved="true">
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.01"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.239.0.0.0.15" proved="true"> <goal name="VC div_sb_qr.239.0.0.0.15" proved="true">
<proof prover="3"><result status="valid" time="0.01"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.239.0.0.0.16" proved="true"> <goal name="VC div_sb_qr.239.0.0.0.16" proved="true">
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
...@@ -7528,7 +7528,7 @@ ...@@ -7528,7 +7528,7 @@
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.239.0.0.0.20" proved="true"> <goal name="VC div_sb_qr.239.0.0.0.20" proved="true">
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.03"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.239.0.0.0.21" proved="true"> <goal name="VC div_sb_qr.239.0.0.0.21" proved="true">
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
...@@ -7675,7 +7675,7 @@ ...@@ -7675,7 +7675,7 @@
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.239.0.0.0.69" proved="true"> <goal name="VC div_sb_qr.239.0.0.0.69" proved="true">
<proof prover="3"><result status="valid" time="0.03"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.239.0.0.0.70" proved="true"> <goal name="VC div_sb_qr.239.0.0.0.70" proved="true">
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
...@@ -7684,7 +7684,7 @@ ...@@ -7684,7 +7684,7 @@
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.239.0.0.0.72" proved="true"> <goal name="VC div_sb_qr.239.0.0.0.72" proved="true">
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.03"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.239.0.0.0.73" proved="true"> <goal name="VC div_sb_qr.239.0.0.0.73" proved="true">
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
...@@ -7696,13 +7696,13 @@ ...@@ -7696,13 +7696,13 @@
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.239.0.0.0.76" proved="true"> <goal name="VC div_sb_qr.239.0.0.0.76" proved="true">
<proof prover="3"><result status="valid" time="0.03"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.239.0.0.0.77" proved="true"> <goal name="VC div_sb_qr.239.0.0.0.77" proved="true">
<proof prover="3"><result status="valid" time="0.04"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.239.0.0.0.78" proved="true"> <goal name="VC div_sb_qr.239.0.0.0.78" proved="true">
<proof prover="3"><result status="valid" time="0.03"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.239.0.0.0.79" proved="true"> <goal name="VC div_sb_qr.239.0.0.0.79" proved="true">
<proof prover="3"><result status="valid" time="0.04"/></proof> <proof prover="3"><result status="valid" time="0.04"/></proof>
...@@ -7711,7 +7711,7 @@ ...@@ -7711,7 +7711,7 @@
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.239.0.0.0.81" proved="true"> <goal name="VC div_sb_qr.239.0.0.0.81" proved="true">
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.04"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.239.0.0.0.82" proved="true"> <goal name="VC div_sb_qr.239.0.0.0.82" proved="true">
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
...@@ -7753,7 +7753,7 @@ ...@@ -7753,7 +7753,7 @@
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.239.0.0.0.95" proved="true"> <goal name="VC div_sb_qr.239.0.0.0.95" proved="true">
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.03"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.239.0.0.0.96" proved="true"> <goal name="VC div_sb_qr.239.0.0.0.96" proved="true">
<proof prover="3"><result status="valid" time="0.02"/></proof> <proof prover="3"><result status="valid" time="0.02"/></proof>
...@@ -8100,10 +8100,10 @@ ...@@ -8100,10 +8100,10 @@
<proof prover="3"><result status="valid" time="0.22"/></proof> <proof prover="3"><result status="valid" time="0.22"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.239.0.0.2" proved="true"> <goal name="VC div_sb_qr.239.0.0.2" proved="true">
<proof prover="2" timelimit="1"><result status="valid" time="0.50"/></proof> <proof prover="2" timelimit="1"><result status="valid" time="0.32"/></proof>
</goal> </goal>
<goal name="VC div_sb_qr.239.0.0.3" proved="true"> <goal name="VC div_sb_qr.239.0.0.3" proved="true">
<proof prover="2" timelimit="1"><result status="valid" time="0.50"/></proof> <proof prover="2" timelimit="1"><result status="valid" time="0.32"/></proof>
</goal> </goal>
</transf> </transf>
</goal> </goal>
......
...@@ -85,8 +85,6 @@ function interp (e:expr) (y:vars) (z:C.cvars) : C.a ...@@ -85,8 +85,6 @@ function interp (e:expr) (y:vars) (z:C.cvars) : C.a
| Cst c -> C.interp c z | Cst c -> C.interp c z
end end
meta rewrite_def function interp
use import bool.Bool use import bool.Bool
use import list.List use import list.List
...@@ -128,16 +126,12 @@ let rec lemma ctx_bound_w (l:context) (b1 b2:int) ...@@ -128,16 +126,12 @@ let rec lemma ctx_bound_w (l:context) (b1 b2:int)
function interp_eq (g:equality) (y:vars) (z:C.cvars) : bool function interp_eq (g:equality) (y:vars) (z:C.cvars) : bool
= match g with (g1, g2) -> interp g1 y z = interp g2 y z end = match g with (g1, g2) -> interp g1 y z = interp g2 y z end
meta rewrite_def function interp_eq
function interp_ctx (l: context) (g: equality) (y: vars) (z:C.cvars) : bool function interp_ctx (l: context) (g: equality) (y: vars) (z:C.cvars) : bool
= match l with = match l with
| Nil -> interp_eq g y z | Nil -> interp_eq g y z
| Cons h t -> (interp_eq h y z) -> (interp_ctx t g y z) | Cons h t -> (interp_eq h y z) -> (interp_ctx t g y z)
end end
meta rewrite_def function interp_ctx
use import mach.int.Int63 use import mach.int.Int63
use import seq.Seq use import seq.Seq
use import mach.array.Array63 use import mach.array.Array63
...@@ -734,8 +728,6 @@ function interp_c (e:cprod) (y:vars) (z:C.cvars) : C.a ...@@ -734,8 +728,6 @@ function interp_c (e:cprod) (y:vars) (z:C.cvars) : C.a
| Times e1 e2 -> C.(*) (interp_c e1 y z) (interp_c e2 y z) | Times e1 e2 -> C.(*) (interp_c e1 y z) (interp_c e2 y z)
end end
meta rewrite_def function interp_c
function interp' (e:expr') (y:vars) (z:C.cvars) : C.a function interp' (e:expr') (y:vars) (z:C.cvars) : C.a
= match e with = match e with
| Sum e1 e2 -> C.(+) (interp' e1 y z) (interp' e2 y z) | Sum e1 e2 -> C.(+) (interp' e1 y z) (interp' e2 y z)
...@@ -746,8 +738,6 @@ function interp' (e:expr') (y:vars) (z:C.cvars) : C.a ...@@ -746,8 +738,6 @@ function interp' (e:expr') (y:vars) (z:C.cvars) : C.a
| Coeff c -> C.interp c z | Coeff c -> C.interp c z
end end
meta rewrite_def function interp'
(*exception NonLinear*) (*exception NonLinear*)
type equality' = (expr', expr') type equality' = (expr', expr')
...@@ -756,16 +746,12 @@ type context' = list equality' ...@@ -756,16 +746,12 @@ type context' = list equality'
function interp_eq' (g:equality') (y:vars) (z:C.cvars) : bool function interp_eq' (g:equality') (y:vars) (z:C.cvars) : bool
= match g with (g1, g2) -> interp' g1 y z = interp' g2 y z end = match g with (g1, g2) -> interp' g1 y z = interp' g2 y z end
meta rewrite_def function interp_eq'
function interp_ctx' (l: context') (g: equality') (y: vars) (z:C.cvars) : bool function interp_ctx' (l: context') (g: equality') (y: vars) (z:C.cvars) : bool
= match l with = match l with
| Nil -> interp_eq' g y z | Nil -> interp_eq' g y z
| Cons h t -> (interp_eq' h y z) -> (interp_ctx' t g y z) | Cons h t -> (interp_eq' h y z) -> (interp_ctx' t g y z)
end end
meta rewrite_def function interp_ctx'
let rec predicate valid_expr' (e:expr') let rec predicate valid_expr' (e:expr')
variant { e } variant { e }
= match e with = match e with
...@@ -843,8 +829,6 @@ use import real.RealInfix ...@@ -843,8 +829,6 @@ use import real.RealInfix
use import real.FromInt use import real.FromInt
use import int.Abs use import int.Abs
(*meta coercion function from_int*)
type t = (int, int) type t = (int, int)
type rvars = int -> real type rvars = int -> real
...@@ -858,8 +842,6 @@ function rinterp (t:t) (v:rvars) : real ...@@ -858,8 +842,6 @@ function rinterp (t:t) (v:rvars) : real
| (n,d) -> from_int n /. from_int d | (n,d) -> from_int n /. from_int d
end end
meta rewrite_def function rinterp
let lemma prod_compat_eq (a b c:real) let lemma prod_compat_eq (a b c:real)
requires { c <> 0.0 } requires { c <> 0.0 }
requires { a *. c = b *. c } requires { a *. c = b *. c }
...@@ -1016,8 +998,6 @@ function interp_id (t:t') (v:int -> int) : int ...@@ -1016,8 +998,6 @@ function interp_id (t:t') (v:int -> int) : int
| Error -> 0 (* never created *) | Error -> 0 (* never created *)
end end
meta rewrite_def function interp_id
let constant izero = IC 0 let constant izero = IC 0
let constant ione = IC 1 let constant ione = IC 1
...@@ -1059,8 +1039,6 @@ let ghost function m_y (y:int -> int): (int -> real) ...@@ -1059,8 +1039,6 @@ let ghost function m_y (y:int -> int): (int -> real)
ensures { forall i. result i = from_int (y i) } ensures { forall i. result i = from_int (y i) }
= fun i -> from_int (y i) = fun i -> from_int (y i)
meta rewrite_def function m_y
let m (t:t') : (int, int) let m (t:t') : (int, int)
ensures { forall z. rinterp result (m_y z) = from_int (interp_id t z) } ensures { forall z. rinterp result (m_y z) = from_int (interp_id t z) }
raises { NError -> true } raises { NError -> true }
...@@ -1187,8 +1165,6 @@ constant rradix: real = from_int (M.radix) ...@@ -1187,8 +1165,6 @@ constant rradix: real = from_int (M.radix)
function qinterp (q:Q.t) : real function qinterp (q:Q.t) : real
= match q with (n,d) -> from_int n /. from_int d end = match q with (n,d) -> from_int n /. from_int d end
meta rewrite_def function qinterp
lemma qinterp_def: forall q v. qinterp q = Q.rinterp q v lemma qinterp_def: forall q v. qinterp q = Q.rinterp q v
function interp_exp (e:exp) (y:evars) : int function interp_exp (e:exp) (y:evars) : int
...@@ -1200,16 +1176,12 @@ function interp_exp (e:exp) (y:evars) : int ...@@ -1200,16 +1176,12 @@ function interp_exp (e:exp) (y:evars) : int
| Minus e' -> - (interp_exp e' y) | Minus e' -> - (interp_exp e' y)
end end
meta rewrite_def function interp_exp
function minterp (t:t) (y:evars) : real function minterp (t:t) (y:evars) : real
= match t with = match t with
(q,e) -> (q,e) ->
qinterp q *. pow rradix (from_int (interp_exp e y)) qinterp q *. pow rradix (from_int (interp_exp e y))
end end
meta rewrite_def function minterp
exception MPError exception MPError
let rec opp_exp (e:exp) let rec opp_exp (e:exp)
...@@ -1447,8 +1419,6 @@ function mpinterp (t:t) (y:evars) : int ...@@ -1447,8 +1419,6 @@ function mpinterp (t:t) (y:evars) : int
| R -> M.radix | R -> M.radix
end end
meta rewrite_def function mpinterp
(* TODO restructure stuff so that expr, eq, ctx, valid_ can be imported without having to implement these *) (* TODO restructure stuff so that expr, eq, ctx, valid_ can be imported without having to implement these *)
let mpadd (a b:t) : t let mpadd (a b:t) : t
...@@ -1524,8 +1494,6 @@ let rec function m (t:t) : R.coeff ...@@ -1524,8 +1494,6 @@ let rec function m (t:t) : R.coeff
| R -> ((1,1), Lit 1) (* or ((radix, 1), Lit 0) ? *) | R -> ((1,1), Lit 1) (* or ((radix, 1), Lit 0) ? *)
end end
meta rewrite_def function m
let ghost function m_y (y:int->int): (int -> real) let ghost function m_y (y:int->int): (int -> real)
ensures { forall i. result i = from_int (y i) } ensures { forall i. result i = from_int (y i) }
= fun i -> from_int (y i) = fun i -> from_int (y i)
...@@ -1538,8 +1506,6 @@ let rec function m_cprod (e:cprod) : R.cprod ...@@ -1538,8 +1506,6 @@ let rec function m_cprod (e:cprod) : R.cprod
| Times c1 c2 -> R.Times (m_cprod c1) (m_cprod c2) | Times c1 c2 -> R.Times (m_cprod c1) (m_cprod c2)
end end
meta rewrite_def function m_cprod
let rec function m_expr (e:expr') : R.expr' let rec function m_expr (e:expr') : R.expr'
ensures { forall y z. pos_expr' e z -> R.interp' result (m_y y) z ensures { forall y z. pos_expr' e z -> R.interp' result (m_y y) z
= from_int (interp' e y z) } = from_int (interp' e y z) }
...@@ -1553,16 +1519,12 @@ let rec function m_expr (e:expr') : R.expr' ...@@ -1553,16 +1519,12 @@ let rec function m_expr (e:expr') : R.expr'
| ProdR c e -> R.ProdR (m_cprod c) (m_expr e) | ProdR c e -> R.ProdR (m_cprod c) (m_expr e)
end end
meta rewrite_def function m_expr
let function m_eq (eq:equality') : R.equality' let function m_eq (eq:equality') : R.equality'
ensures { forall y z. pos_eq' eq z -> (R.interp_eq' result (m_y y) z ensures { forall y z. pos_eq' eq z -> (R.interp_eq' result (m_y y) z
<-> interp_eq' eq y z) } <-> interp_eq' eq y z) }
ensures { valid_eq' eq -> R.valid_eq' result } ensures { valid_eq' eq -> R.valid_eq' result }
= match eq with (e1,e2) -> (m_expr e1, m_expr e2) end = match eq with (e1,e2) -> (m_expr e1, m_expr e2) end
meta rewrite_def function m_eq
use import list.Length use import list.Length
let rec function m_ctx (ctx:context') : R.context' let rec function m_ctx (ctx:context') : R.context'
...@@ -1579,8 +1541,6 @@ let rec function m_ctx (ctx:context') : R.context' ...@@ -1579,8 +1541,6 @@ let rec function m_ctx (ctx:context') : R.context'
r r
end end
meta rewrite_def function m_ctx