$ this obsolete in the logic of the models. What is the alternative?

In this https://github.com/magento/magento2/blob/2.3/app/code/Magento/Contact/view/frontend/templates/form.phtml, you see something like this

$ this-> helper (& # 39; Magento Contact Helper Data & # 39;) -> getUserEmail ())

In the code quality checks, I see that $ this in the templates is now obsolete

What is the recommended approach?

The compositionality of classical logic

Could someone explain in a few words why classical logic is called compositional? In the case of classical logic, does this mean that truth is functional?

is the following predicate logic correct?

I am interested in rewriting a mathematical statement in the logic of predicates.

Is the following text correct?

Normal Expression

the following $ x $ exists, as $ x in R, x ^ 2-1 = $ 0

Predicate logic expression

$ exists x (x in R space land x ^ 2-1 = 0) $

c # – The logic is stored in the components that receive the input data and update the output data via Observables

I have the C # ASP.Net Core Webapi application that performs calculations for physical models. I have this project class:

Public class Project {
public IEnumerable components;
private ValueService valueService = new ValueService ();

public project (string norm) {
components = FactoryGenerator.GetFactory (norm) .GetComponents (valueService);
}

public IEnumerable Get results () {
Returns valueService.GetResults ();
}

public void SetValues ​​(IEnumerable values) {
values.ToList (). ForEach (t => valueService.SetValue (t.Key, t.Value));
}

public bool Valid (string ComponentName) {
return components.Where (s => s.Title == componentName) .Single (). Valid ();
}
}

This creates smaller components that do calculations. Depends on standard parameter, another set of components is created (via the factory). Each component contains a list of variables that can exist (the client knows which ones) and it can perform calculations on these variables and on variables being initialized in other components (with 3 examples). implementation of GenericComponent).

public abstract class GenericComponent: IObserver <Tuple> {
read-only public IValueService valueService;
identifiable secure cancellation;
public list the variables;
public list observerVariables;

public GenericComponent (IValueService _valueService) {
valueService = _valueService;
}
public string Title {get; together; }
public void OnCompleted () {launches new NotImplementedException (); }
public void OnError (exception error) {// no implementation
}
empty public summary OnNext (Tuple value);
public abstract bool Valid ();
}

Public class LoadComponent: GenericComponent {
public LoadComponent (IValueService valueService): base (valueService) {
variables = new list() { "charge" };
variables.ForEach (s => valueService.RegisterValue (s));
cancel = valueService.Subscribe (this, variables);
}
public override bool Valid () => valueService.GetValue ("load")?. Valid ?? false;
empty public replacement OnNext (Tuple value) {
double load = (double) value.Item2;
if (Math.Abs ​​(load) <1) {
valueService.SetWarning (value.Item1, "The small load must be larger");
}
}
}


Public class ValidationComponent: GenericComponent {

public ValidationComponent (IValueService valueService): base (valueService) {
variables = new list() {"validation.load"};
variables.ForEach (s => valueService.RegisterValue (s));
observingVariables = new list() {"load", "area"};
cancel = valueService.Subscribe (this, observingVariables);
}
private double CalcMargin () {
return 0.5 * (double) valueService.GetValue ("area"). Value
- (double) valueService.GetValue ("load"). Value;
}
public override bool Valid () => CalcMargin ()> 0;
empty public replacement OnNext (Tuple value) {
if (valueService.GetValue ("load"). Value! = null &&
valueService.GetValue ("area"). Value! = null) {
double margin = CalcMargin ();
valid boolean = margin> 0;
valueService.SetValue ("validation.load", "the margin is:" + margin.ToString (),
valid);
if (margin <1) {
valueService.SetWarning ("validation.load", "very narrow margin");
}
}
}
}

Public class CrossSectionComponent: GenericComponent {
public CrossSectionComponent (IValueService valueService): base (valueService) {
variables = new list() {"area", "radius"};
variables.ForEach (s => valueService.RegisterValue (s));
cancel = valueService.Subscribe (this, variables);
}
public override bool Valid () => valueService.GetValue ("radius")?. Valid ?? false;
empty public replacement OnNext (Tuple value) {
if (value.Item1 == "radius") {
double radius = (double) value.Item2;
if (radius <0) {
valueService.SetError ("radius", "Radius must be greater than 0");
} else if (radius <1) {
valueService.SetWarning ("radius", "The radius is very small");
}
valueService.SetValid ("radius", true);
valueService.SetValue ("area", radius * radius * Math.PI, true);
}
}
}

Each component has a list of values ​​with unique keys on the entire model (here, I probably need more controls, as all keys are really unique).
At the moment I'm using a ValueService, where each component stores its values ​​with the respective keys. the ValueService can be used to obtain values ​​from other components in order to perform validation calculations or intermediate steps.

Public class ValueService: IValueService {

Private IDictionary values ​​= new dictionary();
private IDictionary <string, List <IObserver <Tuple>>> observers =
new Dictionary <string, List <IObserver <Tuple>>> ();

public void RegisterValue (string key) {
if (! values.ContainsKey (key)) {
values.Add (key, new value ValueViewModel () {
Key = key,
Value = null
});
observers.Add (key, new list <IObserver <Tuple>> ());
}
}

public IEnumerable Get results () {
return values.Where (s => s.Value.Value! = null) .Select (s => s.Value);
}

public void SetValue (string key, object value) {
if (values.ContainsKey (key)) {
values[key].Value = value;
observers[key].For each (t => {
t.OnNext (new Tuple(key value));
});
}
}

public void SetValue (string key, object value, status bool) {
SetValue (key, value);
SetValid (key, status);
}

public void SetValid (string key, status bool) {
if (values.ContainsKey (key)) {
values[key].Valid = status;
}
}

public ValueViewModel GetValue (string key) {
if (values.ContainsKey (key))
return values[key];
return null;
}

public IDisposable Subscribe (IObserver <Tuple> observer) {
returns new unsubscriber (observers.Values.ToList (). SelectMany (s => s) .ToList (), observer);
}

public IDisposable Subscribe (IObserver <Tuple> observer, IEnumerable keys)
keys.ToList (). ForEach (key => {
if (! observers.ContainsKey (key))
observers.Add (key, new list <IObserver <Tuple>> ());
if (! observers[key]Contains (observer)
observers[key].Add (observer);
});
returns new unsubscriber (observers.Values.ToList (). SelectMany (s => s) .ToList (), observer);
}

public void SetWarning (string key, string warning) {
if (values.ContainsKey (key)) {
values[key].Warning = warning;
values[key].Valid = true;
}
}

public void SetError (string key, string error) {
if (values.ContainsKey (key)) {
values[key].Error = error;
values[key].Valid = false;
}
}

}

The ValueViewModel is used to communicate with the front-end

Public class ValueViewModel
{
public channel Key {get; together; }
public object Value {get; together; }
public bool Valid {get; together; }
public channel Warning {get; together; }
public string Error {get; together; }
}

This is part of a stateless API, that is for each HTTP request (for the moment), a new Project object is generated and used to perform validations (via an array of ValueViewModels).

My API controller looks like this:

                public IActionResult postData ([FromRoute] string standard, [FromRoute] chain component, [FromBody] ValueViewModel[] The data)
{
Project project = new project (standard);
project.SetValues ​​(data);
returns Ok (project.Valid (component));
}

In order to do local testing, I created the following console application

class program {
static void Main (string[] args) {
Console.WriteLine ("Hello world");
Project project = new project ("Eurocode_CH");
listing values ​​= new list {
new ValueViewModel () {
Key = "radius",
Value = 12.0
}
};
project.SetValues ​​(values);
Console.WriteLine (Newtonsoft.Json.JsonConvert.SerializeObject (project.GetResults ()));
values[0]Value = -0.4;
project.SetValues ​​(values);
Console.WriteLine (Newtonsoft.Json.JsonConvert.SerializeObject (project.GetResults ()));
values[0]Value = 0.4;
project.SetValues ​​(values);
Console.WriteLine (Newtonsoft.Json.JsonConvert.SerializeObject (project.GetResults ()));
values.Add (new ValueViewModel () {
Key = "load",
Value = 1.2
});
project.SetValues ​​(values);
Console.WriteLine (Newtonsoft.Json.JsonConvert.SerializeObject (project.GetResults ()));
}
}

This is the exit

[{“Key”:”area”,”Value”:452.38934211693021,”Valid”:true,”Warning”:null,”Error”:null},{“Key”:”radius”,”Value”:12.0,”Valid”:true,”Warning”:null,”Error”:null}]

[{“Key”:”area”,”Value”:0.50265482457436694,”Valid”:true,”Warning”:null,”Error”:null},{“Key”:”radius”,”Value”:-0.4,”Valid”:true,”Warning”:null,”Error”:”Radius
is must be larger than 0″}]

[{“Key”:”area”,”Value”:0.50265482457436694,”Valid”:true,”Warning”:null,”Error”:null},{“Key”:”radius”,”Value”:0.4,”Valid”:true,”Warning”:”Radius
is very small”,”Error”:”Radius is must be larger than 0″}]

[{“Key”:”area”,”Value”:0.50265482457436694,”Valid”:true,”Warning”:null,”Error”:null},{“Key”:”radius”,”Value”:0.4,”Valid”:true,”Warning”:”Radius
is very small”,”Error”:”Radius is must be larger than
0″},{“Key”:”load”,”Value”:1.2,”Valid”:false,”Warning”:null,”Error”:null}]

My concerns are

  • As the project continues, the number of components will become quite large. I am afraid that the performance problem will arise if, for each request, all the components must be generated -> should I use LazyLoading?
  • Is the ValueService good approach to share data between components? Is there a better solution?
  • I still need to implement a specific value generator, for example. a user requests the ValueViewModel for a specific key; the components must generate an error or a warning if all the values ​​have not been defined.
  • I think "AbstractComponent" is a better name than "GenericComponent", on a side note.

logic – Prove the propositional formula is a tautology

I must show that this formula is a theorem of propositional calculus. I tried to assume antecedent and prove that it had resulted, but it did not work. Do I have to show that this equals true? How should I start? It is not possible to use truth tables.

$ (p rightarrow q) rightarrow (p wedge r rightarrow q wedge r) $

Context:

In my class, there is no mention, but I think this form of logic is called equational logic.
Probably, it is based on this book: A logical approach to discrete mathematics
by David Gries

Germany – What is the logic behind the organization of bus transport in Hamburg in "rings"?

"Rings" and "Zones" are used for ticket pricing.

If you live in Hamburg and you do not need to travel regularly outside Hamburg, the main areas and rings are highlighted in blue on the Hamburg transport maps. The rings are the letters, that is to say the rings A and B. The numbers in black and bold are the zones. If you take a subscription, it becomes relevant because you can choose either the entire blue region or the separate areas you need regularly. The blue zone is called "Hamburg Greater Area" or "Großbereich Hamburg".

C – E rings are only useful if you live outside Hamburg and use public transport, including regional trains, to get to work. A monthly subscription makes sense. Otherwise, you only have to choose the final destination station to buy a single ticket.

PUBLIC TRANSPORT IN HAMBURG

You can download the tariff plan or the tariff zone map from

https://www.hvv.de/en/timetables/line-route-networks-plans/overview

Logic – Is the opposite direction to the normal form of the prenex decidable?

Say $ phi $ is written in a Prenexed normal form, if it is in the normal form of prenex and that there is a formula $ phi ^ * $ which is not in the normal form of prenex such that $ phi ^ * $ is equivalent to $ phi $ and $ phi ^ * $ results from the simple drawing of certain quantifiers in the prefix of $ phi $ in the interior of $ phi $, with or without a change of quantizer symbols (that is,. $ forall $ at $ exists $ or $ exists $ at $ forall $) during this pull.

For example: $ forall x ( neg phi) $ ..Pull in $ forall x $ but convert it to $ exists x $ during the pulling to have $ ( neg exists x phi) $. Also $ exists x ( phi to psi) $ ..Pull in $ exists x $ and transform it into $ forall x $ during the pulling to have $ ( forall x phi to psi) $.

Now, I want to invent a syntactic notion of pure form not pre-annexed to mean that the formula is not in the pre-annexed normal form, nor any of its sub-formulas.

Is this notion decidable?

lo.logic – What do you gain with higher order logic?

Gödel 's theorems of acceleration seem to indicate that higher – order logics offer the shortest and shortest proofs of the various propositions of number theory. Explicitly, he gave the following

Theorem.
Let $ n> $ 0 to be a natural number. Yes $ f $ is a computable function, then there is an infinity of formulas $ A $, provable in $ S_n $ ($ n $logical order), such as if $ k is the length of the shortest proof of $ A $ in $ S_n $ and $ l $ is the length of the shortest proof of $ A $ in $ S_ {n + 1} $then $ k> f (l) $.

I am not very familiar with computable functions, but I believe that the identity function is computable. The inequality above would therefore simplify the task of telling us that the shortest proofs become shorter as we move to higher logics.

How does this reconcile with the following quote from "A Mathematical Logic Course" by Bell and Machover:

However, most logicians agree that [second and higher order] languages ​​are, at least in principle, indispensable. Indeed, let $ mathfrak {U} $ to be a structure and let $ mathfrak {B} $ to be a structure obtained from $ mathfrak {U} $ as follows. The universe of $ mathfrak {B} $ consists of all individuals from $ mathfrak {U} $ plus all sets of individuals from $ mathfrak {U} $. The basic operations of $ mathfrak {B} $ are defined in such a way that, when they are limited to the universe of $ mathfrak {U} $ they behave exactly like the corresponding basic operations of $ mathfrak {U} $. Finally, the fundamental relations of $ mathfrak {B} $ are all basic relationships of $ mathfrak {U} $ plus two additional relationships: the property of being an individual of $ mathfrak {U} $and the relation of belonging between an individual of $ mathfrak {U} $ and a set of individuals from $ mathfrak {U} $. Then any statement about $ mathfrak {U} $ expressed in a second-order language with defined variables, can easily be "translated" into a statement on $ mathfrak {B} $ in first-rate language. A similar argument applies to other higher order languages. So we do not lose much by limiting our focus to first-rate languages.

According to their argument, they seem to lose nothing by limiting their attention to first-rate languages, but that goes against the theorems of acceleration, unless I miss something: the "translation" of a second-rate statement $ mathfrak {U} $ to a first statement of order on $ mathfrak {B} $ need more symbols? This goes against what seems to be the implicit translation, where we interpret symbols for subsets of the universe. $ mathfrak {U} $ like the symbols $ mathfrak {B} $ added to designate these subsets, which seems to give a translation of equal length.

Giorgio Mossa's answer seems to indicate that the difference lies in the standard semantics of the languages ​​in question, and not in their syntax, but it's a little fuzzy because the semantics of a language is corrected as soon as we choose a structure to interpret the language. language, which seems to have been made in the quote above. Any help is greatly appreciated.

Logic – Why does not the $ mu $ unbound operator preserve efficient computability?

Let $ f $ to be a partial function of $ mathbb {N} ^ {p + 1} $ at $ mathbb {N} $. Partial function $ (x_1, …, x_p) mapsto mu y[f(x_1,…,x_p,y)=0]$ is defined as follows:
If there is at least one integer $ z $ such as $ f (x_1, dots, x_p, z) = $ and if for each $ z <$ z, $ f (x_1, dots, x_p, z) $ is defined, then $ mu y[f(x_1,dots, x_p,y)=0]$ is at least equal $ z $. On the other hand, $ mu y[f(x_1,dots, x_p,y)=0]$ is not defined.

I do not understand why this unlimited $ mu $ The operator preserves the efficiency of calculation, in my manual and in a note that I found online, it is mentioned as a trivial fact.

I appreciate any help!

8 – What is the underlying logic for generating an icon map for a custom recorded presentation (in the Presentation Builder)?

There seems to be a lack of information on the Internet about how to generate a icon_map for newly saved layouts in Layout Builder.

I went as far as to find a patch file in the project that includes a poorly documented comment that unfortunately does not give much light on this:

/ **
* Constructs an array rendering representation of an SVG based on an icon map.
*
* @param string[][]    $ icon_map
* A two-dimensional table representing the visual output of the layout.
* For the following form:
* | ------------------------------ |
* | |
* | 100% |
* | |
* | ------- | -------------- | ------- |
* | | | |
* | | 50% | 25% |
* | | | |
* | 25% | -------------- | ------- |
* | | |
* | | 75% |
* | | |
* | ------------------------------ |
* The corresponding table would be:
* - ['top']
 * - ['first', 'second', 'second', 'third']
 * - ['first', 'bottom', 'bottom', 'bottom'].

...

It does not say Why we would use keywords like first, third, and low – or even what each term actually means for the Layout Builder module. There does not seem to be any rhyme or reason as to how this is supposed to work. Documentation is also sorely lacking.

What is the logic behind the generation of icon maps and how does it really work?