octalgo.octalgo.rinstance
Require Import syntax.
Require Import subs.
Require Import pmatch.
Require Import bSemantics.
Require Import monotonicity.
Require Import soundness.
Require Import fixpoint.
Require Import completeness.
Require Import bigop_aux.
Require Import utils.
Require Import finseqs.
Set Implicit Arguments.
Variable p : program.
Hypothesis psafe : prog_safe p.
Variable i : interp.
Variable def : syntax.constant.
Hypothesis psafe : prog_safe p.
Variable i : interp.
Variable def : syntax.constant.
Rv is the set of variables to replace
assuming a set of substitutions
facts fixedpoint
Any substitution that matches a clause cl (which intersects with Rv) in the model of p has its restriction to Rv in subs. This completeness condition of subs ensures that the transformation does not lose any deductible fact. The intersection condition could be dropped by manually adding emptysub to subs
Hypothesis subs_comp :
[∀ cl in p,
(#|tail_vars (body_cl cl) :&: Rv| > 0) ==>
[∀ s : sub,
(bmatch def ffp cl s)
==> (sub_filter s Rv \in subs)]].
[∀ cl in p,
(#|tail_vars (body_cl cl) :&: Rv| > 0) ==>
[∀ s : sub,
(bmatch def ffp cl s)
==> (sub_filter s Rv \in subs)]].
stv returns the to-be-replaced variables of a clause
Instantiation of a clause by subs
returns a sequence of rules by applying on the clause only the substitution whose domain is exactly the domain of the clause
Definition inst_rule (cl : clause): seq clause :=
if (#|tail_vars (body_cl cl) :&: Rv| > 0) then
[seq scl s cl | s <- enum subs & dom s == stv cl]
else [:: cl].
if (#|tail_vars (body_cl cl) :&: Rv| > 0) then
[seq scl s cl | s <- enum subs & dom s == stv cl]
else [:: cl].
For any clause, the set of substitutions that match cl with the
mth iteration of the semantic is a subset of those that match cl with
the model of p