Skip to content
Snippets Groups Projects
Commit aa590968 authored by Patrick Baudin's avatar Patrick Baudin
Browse files

[WP] adds comments in the tactics dedicated to sequences

parent 6de1f210
No related branches found
No related tags found
No related merge requests found
...@@ -63,12 +63,16 @@ class sequence = ...@@ -63,12 +63,16 @@ class sequence =
begin begin
match self#get_field vmode with match self#get_field vmode with
| `Sum -> | `Sum ->
(* n1>=0 && n2>=0 && ... |- (a *^ (n1 + n2 + ...)) -+-> ((a *^ n1) ^ (a *^ n2) ^ ...) *)
let ns = sum n in let ns = sum n in
(* NB. the term is rewriten in itself when the initial term is not a sum *)
let pos = F.p_all positive ns in let pos = F.p_all positive ns in
let cat = concat ~result (List.map (repeat ~result a) ns) in let cat = concat ~result (List.map (repeat ~result a) ns) in
Tactical.condition "Positive" pos @@ Tactical.condition "Positive" pos @@
Tactical.rewrite ?at [ "Unroll" , pos , value , cat ] Tactical.rewrite ?at [ "Unroll" , pos , value , cat ]
| `Left -> | `Left ->
(* n<=0 |- (a *^ n) -+-> [] *)
(* n-1>=0 |- (a *^ n) -+-> (a ^ (a *^ (n-1))) *)
let p = F.e_add n F.e_minus_one in let p = F.e_add n F.e_minus_one in
let unroll = concat ~result [a ; repeat ~result a p] in let unroll = concat ~result [a ; repeat ~result a p] in
Tactical.rewrite ?at [ Tactical.rewrite ?at [
...@@ -76,6 +80,8 @@ class sequence = ...@@ -76,6 +80,8 @@ class sequence =
"Unroll", positive p , value , unroll ; "Unroll", positive p , value , unroll ;
] ]
| `Right -> | `Right ->
(* n<=0 |- (a *^ n) -+-> [] *)
(* n-1>=0 |- (a *^ n) -+-> ((a *^ (n-1)) ^ a) *)
let p = F.e_add n F.e_minus_one in let p = F.e_add n F.e_minus_one in
let unroll = concat ~result [repeat ~result a p ; a] in let unroll = concat ~result [repeat ~result a p ; a] in
Tactical.rewrite ?at [ Tactical.rewrite ?at [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment